View | Details | Raw Unified | Return to bug 21946
Collapse All | Expand All

(-)a/admin/itemtypes.pl (+8 lines)
Lines 71-81 if ( $op eq 'add_form' ) { Link Here
71
        };
71
        };
72
    }
72
    }
73
73
74
    my $parent_type = $itemtype ? $itemtype->parent_type : undef;
75
    my $parent_types = Koha::ItemTypes->search({parent_type=>undef,itemtype => {'!='=>$itemtype_code}});
74
    my $imagesets = C4::Koha::getImageSets( checked => ( $itemtype ? $itemtype->imageurl : undef ) );
76
    my $imagesets = C4::Koha::getImageSets( checked => ( $itemtype ? $itemtype->imageurl : undef ) );
75
    my $searchcategory = GetAuthorisedValues("ITEMTYPECAT");
77
    my $searchcategory = GetAuthorisedValues("ITEMTYPECAT");
76
    my $translated_languages = C4::Languages::getTranslatedLanguages( undef , C4::Context->preference('template') );
78
    my $translated_languages = C4::Languages::getTranslatedLanguages( undef , C4::Context->preference('template') );
77
    $template->param(
79
    $template->param(
78
        itemtype  => $itemtype,
80
        itemtype  => $itemtype,
81
        parent_type => $parent_type,
82
        parent_types => $parent_types,
83
        is_a_parent => $itemtype ? Koha::ItemTypes->search({parent_type=>$itemtype_code})->count : 0,
79
        imagesets => $imagesets,
84
        imagesets => $imagesets,
80
        searchcategory => $searchcategory,
85
        searchcategory => $searchcategory,
81
        can_be_translated => ( scalar(@$translated_languages) > 1 ? 1 : 0 ),
86
        can_be_translated => ( scalar(@$translated_languages) > 1 ? 1 : 0 ),
Lines 84-89 if ( $op eq 'add_form' ) { Link Here
84
} elsif ( $op eq 'add_validate' ) {
89
} elsif ( $op eq 'add_validate' ) {
85
    my $is_a_modif   = $input->param('is_a_modif');
90
    my $is_a_modif   = $input->param('is_a_modif');
86
    my $itemtype     = Koha::ItemTypes->find($itemtype_code);
91
    my $itemtype     = Koha::ItemTypes->find($itemtype_code);
92
    my $parent_type  = $input->param('parent_type');
87
    my $description  = $input->param('description');
93
    my $description  = $input->param('description');
88
    my $rentalcharge = $input->param('rentalcharge');
94
    my $rentalcharge = $input->param('rentalcharge');
89
    my $rentalcharge_daily = $input->param('rentalcharge_daily');
95
    my $rentalcharge_daily = $input->param('rentalcharge_daily');
Lines 108-113 if ( $op eq 'add_form' ) { Link Here
108
114
109
    if ( $itemtype and $is_a_modif ) {    # it's a modification
115
    if ( $itemtype and $is_a_modif ) {    # it's a modification
110
        $itemtype->description($description);
116
        $itemtype->description($description);
117
        $itemtype->parent_type($parent_type);
111
        $itemtype->rentalcharge($rentalcharge);
118
        $itemtype->rentalcharge($rentalcharge);
112
        $itemtype->rentalcharge_daily($rentalcharge_daily);
119
        $itemtype->rentalcharge_daily($rentalcharge_daily);
113
        $itemtype->rentalcharge_hourly($rentalcharge_hourly);
120
        $itemtype->rentalcharge_hourly($rentalcharge_hourly);
Lines 137-142 if ( $op eq 'add_form' ) { Link Here
137
            {
144
            {
138
                itemtype            => $itemtype_code,
145
                itemtype            => $itemtype_code,
139
                description         => $description,
146
                description         => $description,
147
                parent_type         => $parent_type,
140
                rentalcharge        => $rentalcharge,
148
                rentalcharge        => $rentalcharge,
141
                rentalcharge_daily  => $rentalcharge_daily,
149
                rentalcharge_daily  => $rentalcharge_daily,
142
                rentalcharge_hourly => $rentalcharge_hourly,
150
                rentalcharge_hourly => $rentalcharge_hourly,
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt (-2 / +25 lines)
Lines 96-102 Item types administration Link Here
96
    [% IF itemtype %]
96
    [% IF itemtype %]
97
        <h3>Modify item type</h3>
97
        <h3>Modify item type</h3>
98
    [% ELSE %]
98
    [% ELSE %]
99
        <h3>Add item type</h3>
99
        ]<h3>Add item type</h3>
100
    [% END %]
100
    [% END %]
101
    <form action="/cgi-bin/koha/admin/itemtypes.pl" name="Aform" method="post" id="itemtypeentry">
101
    <form action="/cgi-bin/koha/admin/itemtypes.pl" name="Aform" method="post" id="itemtypeentry">
102
        <input type="hidden" name="op" value="add_validate" />
102
        <input type="hidden" name="op" value="add_validate" />
Lines 115-120 Item types administration Link Here
115
                    </li>
115
                    </li>
116
                [% END %]
116
                [% END %]
117
                <li>
117
                <li>
118
                    <label for="parent_type">Parent item type: </label>
119
                    [% IF !is_a_parent && parent_types %]
120
                    <select name="parent_type" id="parent_type">
121
                        [% FOREACH pt IN parent_types %]
122
                            [% IF parent_type == pt.itemtype %]
123
                                <option value="[% pt.itemtype | html %]" selected="selected">[% pt.description | html %]</option>
124
                            [% ELSE %]
125
                                <option value="[% pt.itemtype | html %]">[% pt.description | html %]</option>
126
                            [% END %]
127
                        [% END %]
128
                    </select>
129
                    [% ELSIF is_a_parent %]
130
                    <input type="text" id="parent_type" value="[% parent_type | html %]" name="parent_type" size="10" maxlength="10" disabled/>
131
                    <p>Is a parent to another type, cannot have a parent</p>
132
                    [% ELSE %]
133
                    <input type="text" id="parent_type" value="[% parent_type | html %]" name="parent_type" size="10" maxlength="10" disabled/>
134
                    <p>No available parent types</p>
135
                    [% END %]
136
                </li>
137
                <li>
118
                    <label for="description" class="required">Description: </label>
138
                    <label for="description" class="required">Description: </label>
119
                    <input type="text" id="description" name="description" size="48" value="[% itemtype.description | html %]" required="required" /> <span class="required">Required</span>
139
                    <input type="text" id="description" name="description" size="48" value="[% itemtype.description | html %]" required="required" /> <span class="required">Required</span>
120
                    [% IF can_be_translated %]
140
                    [% IF can_be_translated %]
Lines 349-354 Item types administration Link Here
349
          <thead>
369
          <thead>
350
            [% UNLESS Koha.Preference('noItemTypeImages') %]<th>Image</th>[% END %]
370
            [% UNLESS Koha.Preference('noItemTypeImages') %]<th>Image</th>[% END %]
351
            <th>Code</th>
371
            <th>Code</th>
372
            <th>Parent code</th>
352
            <th>Description</th>
373
            <th>Description</th>
353
            <th>Search category</th>
374
            <th>Search category</th>
354
            <th>Not for loan</th>
375
            <th>Not for loan</th>
Lines 375-380 Item types administration Link Here
375
              </a>
396
              </a>
376
            </td>
397
            </td>
377
            <td>
398
            <td>
399
                [% itemtype.parent_type | html %]
400
            </td>
401
            <td>
378
                [% IF itemtype.translated_descriptions.size %]
402
                [% IF itemtype.translated_descriptions.size %]
379
                    [% itemtype.description | html %] (default)<br/>
403
                    [% itemtype.description | html %] (default)<br/>
380
                    [% FOR description IN itemtype.translated_descriptions %]
404
                    [% FOR description IN itemtype.translated_descriptions %]
381
- 

Return to bug 21946