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

(-)a/admin/itemtypes.pl (+8 lines)
Lines 58-68 undef($sip_media_type) if defined($sip_media_type) and $sip_media_type =~ /^\s*$ Link Here
58
58
59
if ( $op eq 'add_form' ) {
59
if ( $op eq 'add_form' ) {
60
    my $itemtype = Koha::ItemTypes->find($itemtype_code);
60
    my $itemtype = Koha::ItemTypes->find($itemtype_code);
61
    my $parent_type = $itemtype ? $itemtype->parent_type : undef;
62
    my $parent_types = Koha::ItemTypes->search({parent_type=>undef,itemtype => {'!='=>$itemtype_code}});
61
    my $imagesets = C4::Koha::getImageSets( checked => ( $itemtype ? $itemtype->imageurl : undef ) );
63
    my $imagesets = C4::Koha::getImageSets( checked => ( $itemtype ? $itemtype->imageurl : undef ) );
62
    my $searchcategory = GetAuthorisedValues("ITEMTYPECAT");
64
    my $searchcategory = GetAuthorisedValues("ITEMTYPECAT");
63
    my $translated_languages = C4::Languages::getTranslatedLanguages( undef , C4::Context->preference('template') );
65
    my $translated_languages = C4::Languages::getTranslatedLanguages( undef , C4::Context->preference('template') );
64
    $template->param(
66
    $template->param(
65
        itemtype  => $itemtype,
67
        itemtype  => $itemtype,
68
        parent_type => $parent_type,
69
        parent_types => $parent_types,
70
        is_a_parent => $itemtype ? Koha::ItemTypes->search({parent_type=>$itemtype_code})->count : 0,
66
        imagesets => $imagesets,
71
        imagesets => $imagesets,
67
        searchcategory => $searchcategory,
72
        searchcategory => $searchcategory,
68
        can_be_translated => ( scalar(@$translated_languages) > 1 ? 1 : 0 ),
73
        can_be_translated => ( scalar(@$translated_languages) > 1 ? 1 : 0 ),
Lines 70-75 if ( $op eq 'add_form' ) { Link Here
70
} elsif ( $op eq 'add_validate' ) {
75
} elsif ( $op eq 'add_validate' ) {
71
    my $is_a_modif   = $input->param('is_a_modif');
76
    my $is_a_modif   = $input->param('is_a_modif');
72
    my $itemtype     = Koha::ItemTypes->find($itemtype_code);
77
    my $itemtype     = Koha::ItemTypes->find($itemtype_code);
78
    my $parent_type  = $input->param('parent_type');
73
    my $description  = $input->param('description');
79
    my $description  = $input->param('description');
74
    my $rentalcharge = $input->param('rentalcharge');
80
    my $rentalcharge = $input->param('rentalcharge');
75
    my $rentalcharge_daily = $input->param('rentalcharge_daily');
81
    my $rentalcharge_daily = $input->param('rentalcharge_daily');
Lines 93-98 if ( $op eq 'add_form' ) { Link Here
93
99
94
    if ( $itemtype and $is_a_modif ) {    # it's a modification
100
    if ( $itemtype and $is_a_modif ) {    # it's a modification
95
        $itemtype->description($description);
101
        $itemtype->description($description);
102
        $itemtype->parent_type($parent_type);
96
        $itemtype->rentalcharge($rentalcharge);
103
        $itemtype->rentalcharge($rentalcharge);
97
        $itemtype->rentalcharge_daily($rentalcharge_daily);
104
        $itemtype->rentalcharge_daily($rentalcharge_daily);
98
        $itemtype->rentalcharge_hourly($rentalcharge_hourly);
105
        $itemtype->rentalcharge_hourly($rentalcharge_hourly);
Lines 119-124 if ( $op eq 'add_form' ) { Link Here
119
            {
126
            {
120
                itemtype            => $itemtype_code,
127
                itemtype            => $itemtype_code,
121
                description         => $description,
128
                description         => $description,
129
                parent_type         => $parent_type,
122
                rentalcharge        => $rentalcharge,
130
                rentalcharge        => $rentalcharge,
123
                rentalcharge_daily  => $rentalcharge_daily,
131
                rentalcharge_daily  => $rentalcharge_daily,
124
                rentalcharge_hourly => $rentalcharge_hourly,
132
                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 336-341 Item types administration Link Here
336
          <thead>
356
          <thead>
337
            [% UNLESS Koha.Preference('noItemTypeImages') %]<th>Image</th>[% END %]
357
            [% UNLESS Koha.Preference('noItemTypeImages') %]<th>Image</th>[% END %]
338
            <th>Code</th>
358
            <th>Code</th>
359
            <th>Parent code</th>
339
            <th>Description</th>
360
            <th>Description</th>
340
            <th>Search category</th>
361
            <th>Search category</th>
341
            <th>Not for loan</th>
362
            <th>Not for loan</th>
Lines 362-367 Item types administration Link Here
362
              </a>
383
              </a>
363
            </td>
384
            </td>
364
            <td>
385
            <td>
386
                [% itemtype.parent_type | html %]
387
            </td>
388
            <td>
365
                [% IF itemtype.translated_descriptions.size %]
389
                [% IF itemtype.translated_descriptions.size %]
366
                    [% itemtype.description | html %] (default)<br/>
390
                    [% itemtype.description | html %] (default)<br/>
367
                    [% FOR description IN itemtype.translated_descriptions %]
391
                    [% FOR description IN itemtype.translated_descriptions %]
368
- 

Return to bug 21946