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 97-103 Item types administration Link Here
97
    [% IF itemtype %]
97
    [% IF itemtype %]
98
        <h3>Modify item type</h3>
98
        <h3>Modify item type</h3>
99
    [% ELSE %]
99
    [% ELSE %]
100
        <h3>Add item type</h3>
100
        ]<h3>Add item type</h3>
101
    [% END %]
101
    [% END %]
102
    <form action="/cgi-bin/koha/admin/itemtypes.pl" name="Aform" method="post" id="itemtypeentry">
102
    <form action="/cgi-bin/koha/admin/itemtypes.pl" name="Aform" method="post" id="itemtypeentry">
103
        <input type="hidden" name="op" value="add_validate" />
103
        <input type="hidden" name="op" value="add_validate" />
Lines 116-121 Item types administration Link Here
116
                    </li>
116
                    </li>
117
                [% END %]
117
                [% END %]
118
                <li>
118
                <li>
119
                    <label for="parent_type">Parent item type: </label>
120
                    [% IF !is_a_parent && parent_types %]
121
                    <select name="parent_type" id="parent_type">
122
                        [% FOREACH pt IN parent_types %]
123
                            [% IF parent_type == pt.itemtype %]
124
                                <option value="[% pt.itemtype | html %]" selected="selected">[% pt.description | html %]</option>
125
                            [% ELSE %]
126
                                <option value="[% pt.itemtype | html %]">[% pt.description | html %]</option>
127
                            [% END %]
128
                        [% END %]
129
                    </select>
130
                    [% ELSIF is_a_parent %]
131
                    <input type="text" id="parent_type" value="[% parent_type | html %]" name="parent_type" size="10" maxlength="10" disabled/>
132
                    <p>Is a parent to another type, cannot have a parent</p>
133
                    [% ELSE %]
134
                    <input type="text" id="parent_type" value="[% parent_type | html %]" name="parent_type" size="10" maxlength="10" disabled/>
135
                    <p>No available parent types</p>
136
                    [% END %]
137
                </li>
138
                <li>
119
                    <label for="description" class="required">Description: </label>
139
                    <label for="description" class="required">Description: </label>
120
                    <input type="text" id="description" name="description" size="48" value="[% itemtype.description | html %]" required="required" /> <span class="required">Required</span>
140
                    <input type="text" id="description" name="description" size="48" value="[% itemtype.description | html %]" required="required" /> <span class="required">Required</span>
121
                    [% IF can_be_translated %]
141
                    [% IF can_be_translated %]
Lines 352-357 Item types administration Link Here
352
          <thead>
372
          <thead>
353
            [% UNLESS Koha.Preference('noItemTypeImages') %]<th class="noExport">Image</th>[% END %]
373
            [% UNLESS Koha.Preference('noItemTypeImages') %]<th class="noExport">Image</th>[% END %]
354
            <th>Code</th>
374
            <th>Code</th>
375
            <th>Parent code</th>
355
            <th>Description</th>
376
            <th>Description</th>
356
            <th>Search category</th>
377
            <th>Search category</th>
357
            <th>Not for loan</th>
378
            <th>Not for loan</th>
Lines 379-384 Item types administration Link Here
379
              </a>
400
              </a>
380
            </td>
401
            </td>
381
            <td>
402
            <td>
403
                [% itemtype.parent_type | html %]
404
            </td>
405
            <td>
382
                [% IF itemtype.translated_descriptions.size %]
406
                [% IF itemtype.translated_descriptions.size %]
383
                    [% itemtype.description | html %] (default)<br/>
407
                    [% itemtype.description | html %] (default)<br/>
384
                    [% FOR description IN itemtype.translated_descriptions %]
408
                    [% FOR description IN itemtype.translated_descriptions %]
385
- 

Return to bug 21946