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

(-)a/admin/itemtypes.pl (-3 / +12 lines)
Lines 122-131 if ( $op eq 'add_form' ) { Link Here
122
122
123
    my $searchcategory = GetAuthorisedValues("ITEMTYPECAT", $data->{'searchcategory'});
123
    my $searchcategory = GetAuthorisedValues("ITEMTYPECAT", $data->{'searchcategory'});
124
124
125
    my @gst_values = map {
126
        option => $_ + 0.0
127
    }, split( '\|', C4::Context->preference("gist") );
128
125
    $template->param(
129
    $template->param(
126
        itemtype        => $itemtype,
130
        itemtype        => $itemtype,
127
        description     => $data->{'description'},
131
        description     => $data->{'description'},
128
        rentalcharge    => sprintf( "%.2f", $data->{'rentalcharge'} ),
132
        rentalcharge    => sprintf( "%.2f", $data->{'rentalcharge'} ),
133
        gstrate         => $data->{gstrate} ? $data->{gstrate}+0.0 : undef,
134
        gst_values      => \@gst_values,
129
        notforloan      => $data->{'notforloan'},
135
        notforloan      => $data->{'notforloan'},
130
        imageurl        => $data->{'imageurl'},
136
        imageurl        => $data->{'imageurl'},
131
        template        => C4::Context->preference('template'),
137
        template        => C4::Context->preference('template'),
Lines 155-160 elsif ( $op eq 'add_validate' ) { Link Here
155
            UPDATE itemtypes
161
            UPDATE itemtypes
156
            SET    description = ?
162
            SET    description = ?
157
                 , rentalcharge = ?
163
                 , rentalcharge = ?
164
                 , gstrate = ?
158
                 , notforloan = ?
165
                 , notforloan = ?
159
                 , imageurl = ?
166
                 , imageurl = ?
160
                 , summary = ?
167
                 , summary = ?
Lines 169-174 elsif ( $op eq 'add_validate' ) { Link Here
169
        $sth->execute(
176
        $sth->execute(
170
            $input->param('description'),
177
            $input->param('description'),
171
            $input->param('rentalcharge'),
178
            $input->param('rentalcharge'),
179
            $input->param('gstrate'),
172
            ( $input->param('notforloan') ? 1 : 0 ),
180
            ( $input->param('notforloan') ? 1 : 0 ),
173
            (
181
            (
174
                $input->param('image') eq 'removeImage' ? '' : (
182
                $input->param('image') eq 'removeImage' ? '' : (
Lines 189-204 elsif ( $op eq 'add_validate' ) { Link Here
189
    elsif ( not $already_exists and not $is_a_modif ) {
197
    elsif ( not $already_exists and not $is_a_modif ) {
190
        my $query = "
198
        my $query = "
191
            INSERT INTO itemtypes
199
            INSERT INTO itemtypes
192
                (itemtype,description,rentalcharge, notforloan, imageurl, summary, checkinmsg, checkinmsgtype, sip_media_type, hideinopac, searchcategory)
200
                (itemtype,description,rentalcharge, gstrate, notforloan, imageurl, summary, checkinmsg, checkinmsgtype, sip_media_type, hideinopac, searchcategory)
193
            VALUES
201
            VALUES
194
                (?,?,?,?,?,?,?,?,?,?,?);
202
                (?,?,?,?,?,?,?,?,?,?,?,?);
195
            ";
203
            ";
196
        my $sth = $dbh->prepare($query);
204
        my $sth = $dbh->prepare($query);
197
		my $image = $input->param('image');
205
        my $image = $input->param('image');
198
        $sth->execute(
206
        $sth->execute(
199
            $input->param('itemtype'),
207
            $input->param('itemtype'),
200
            $input->param('description'),
208
            $input->param('description'),
201
            $input->param('rentalcharge'),
209
            $input->param('rentalcharge'),
210
            $input->param('gstrate'),
202
            $input->param('notforloan') ? 1 : 0,
211
            $input->param('notforloan') ? 1 : 0,
203
            $image eq 'removeImage' ?           ''                 :
212
            $image eq 'removeImage' ?           ''                 :
204
            $image eq 'remoteImage' ? $input->param('remoteImage') :
213
            $image eq 'remoteImage' ? $input->param('remoteImage') :
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt (-1 / +21 lines)
Lines 159-164 $(document).ready(function() Link Here
159
            getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2, sort2 );
159
            getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2, sort2 );
160
        });
160
        });
161
        $("#budget_id").change();
161
        $("#budget_id").change();
162
163
        // Select the gstrate function of the itemtype
164
        [% IF itemtypeloop %]
165
            var itemtype_gstrate_map = {};
166
            [% FOREACH itemtype IN itemtypeloop %]
167
                [% IF itemtype.gstrate.length > 0 %]
168
                    itemtype_gstrate_map['[%itemtype.itemtype%]'] = [% itemtype.gstrate %];
169
                [% END %]
170
            [% END %]
171
172
            $("#itemtype").change(function(){
173
                var gstrate = itemtype_gstrate_map[$(this).val()];
174
                if ( gstrate != undefined ) {
175
                    $("#gstrate option[value='"+gstrate+"']").attr('selected', 'selected');
176
                    $("#gstrate").change();
177
                }
178
            });
179
            $("#itemtype").change();
180
        [% END %]
181
162
    });
182
    });
163
183
164
    function UserSearchPopup(f) {
184
    function UserSearchPopup(f) {
Lines 386-392 $(document).ready(function() Link Here
386
            [% IF ( itemtypeloop ) %]
406
            [% IF ( itemtypeloop ) %]
387
            <li>
407
            <li>
388
                <span class="label">Item type:</span>
408
                <span class="label">Item type:</span>
389
                <select name="itemtype" style="width:12em;">
409
                <select name="itemtype" id="itemtype" style="width:12em;">
390
                [% FOREACH itemtype IN itemtypeloop %]
410
                [% FOREACH itemtype IN itemtypeloop %]
391
                    [% IF ( itemtype.selected ) %]
411
                    [% IF ( itemtype.selected ) %]
392
                        <option value="[% itemtype.itemtype %]" selected="selected">[% itemtype.description %]</option>
412
                        <option value="[% itemtype.itemtype %]" selected="selected">[% itemtype.description %]</option>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt (-1 / +18 lines)
Lines 223-228 Item types administration Link Here
223
		  <input type="text" id="rentalcharge" name="rentalcharge" size="10" value="[% rentalcharge %]" />
223
		  <input type="text" id="rentalcharge" name="rentalcharge" size="10" value="[% rentalcharge %]" />
224
         </li>
224
         </li>
225
      <li>
225
      <li>
226
          <label for="gstrate">Tax rate: </label>
227
          <select name="gstrate" id="gstrate">
228
              <option value="">No default</option>
229
              [% FOREACH gst IN gst_values %]
230
                  [% IF gst.option == gstrate %]
231
                      <option value="[% gst.option %]" selected="selected">[% gst.option * 100 | format("%.1f") %]%</option>
232
                  [% ELSE %]
233
                      <option value="[% gst.option %]">[% gst.option * 100 | format("%.1f") %]%</option>
234
                  [% END %]
235
              [% END %]
236
          </select>
237
     </li>
238
      <li>
226
          <label for="checkinmsg">Checkin message: </label>
239
          <label for="checkinmsg">Checkin message: </label>
227
          <textarea id="checkinmsg" name="checkinmsg" cols="55" rows="5">[% checkinmsg %]</textarea>
240
          <textarea id="checkinmsg" name="checkinmsg" cols="55" rows="5">[% checkinmsg %]</textarea>
228
      </li>
241
      </li>
Lines 310-315 Item types administration Link Here
310
    <th>Not for loan</th>
323
    <th>Not for loan</th>
311
    <th>Hide in OPAC</th>
324
    <th>Hide in OPAC</th>
312
    <th>Charge</th>
325
    <th>Charge</th>
326
    <th>Tax rate</th>
313
    <th>Checkin message</th>
327
    <th>Checkin message</th>
314
    <th>Actions</th>
328
    <th>Actions</th>
315
  </thead>
329
  </thead>
Lines 344-349 Item types administration Link Here
344
      [% loo.rentalcharge %]
358
      [% loo.rentalcharge %]
345
    [% END %]
359
    [% END %]
346
    </td>
360
    </td>
361
    <td>
362
        [% IF loo.gstrate.length > 0 %]
363
            [% loo.gstrate * 100 | format("%.1f") %]%
364
        [% END %]
347
    <td>[% loo.checkinmsg | html_line_break %]</td>
365
    <td>[% loo.checkinmsg | html_line_break %]</td>
348
    <td>
366
    <td>
349
      <a href="[% loo.script_name %]?op=add_form&amp;itemtype=[% loo.itemtype |html %]">Edit</a>
367
      <a href="[% loo.script_name %]?op=add_form&amp;itemtype=[% loo.itemtype |html %]">Edit</a>
350
- 

Return to bug 12993