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

(-)a/admin/itemtypes.pl (-1 / +11 lines)
Lines 112-121 if ( $op eq 'add_form' ) { Link Here
112
        $remote_image = $data->{imageurl};
112
        $remote_image = $data->{imageurl};
113
    }
113
    }
114
114
115
    my @gst_values = map {
116
        option => $_ + 0.0
117
    }, split( '\|', C4::Context->preference("gist") );
118
119
115
    $template->param(
120
    $template->param(
116
        itemtype        => $itemtype,
121
        itemtype        => $itemtype,
117
        description     => $data->{'description'},
122
        description     => $data->{'description'},
118
        rentalcharge    => sprintf( "%.2f", $data->{'rentalcharge'} ),
123
        rentalcharge    => sprintf( "%.2f", $data->{'rentalcharge'} ),
124
        gstrate         => $data->{gstrate} ? $data->{gstrate}+0.0 : undef,
125
        gst_values      => \@gst_values,
119
        notforloan      => $data->{'notforloan'},
126
        notforloan      => $data->{'notforloan'},
120
        imageurl        => $data->{'imageurl'},
127
        imageurl        => $data->{'imageurl'},
121
        template        => C4::Context->preference('template'),
128
        template        => C4::Context->preference('template'),
Lines 144-149 elsif ( $op eq 'add_validate' ) { Link Here
144
            UPDATE itemtypes
151
            UPDATE itemtypes
145
            SET    description = ?
152
            SET    description = ?
146
                 , rentalcharge = ?
153
                 , rentalcharge = ?
154
                 , gstrate = ?
147
                 , notforloan = ?
155
                 , notforloan = ?
148
                 , imageurl = ?
156
                 , imageurl = ?
149
                 , summary = ?
157
                 , summary = ?
Lines 156-161 elsif ( $op eq 'add_validate' ) { Link Here
156
        $sth->execute(
164
        $sth->execute(
157
            $input->param('description'),
165
            $input->param('description'),
158
            $input->param('rentalcharge'),
166
            $input->param('rentalcharge'),
167
            $input->param('gstrate'),
159
            ( $input->param('notforloan') ? 1 : 0 ),
168
            ( $input->param('notforloan') ? 1 : 0 ),
160
            (
169
            (
161
                $input->param('image') eq 'removeImage' ? '' : (
170
                $input->param('image') eq 'removeImage' ? '' : (
Lines 174-180 elsif ( $op eq 'add_validate' ) { Link Here
174
    else {    # add a new itemtype & not modif an old
183
    else {    # add a new itemtype & not modif an old
175
        my $query = "
184
        my $query = "
176
            INSERT INTO itemtypes
185
            INSERT INTO itemtypes
177
                (itemtype,description,rentalcharge, notforloan, imageurl, summary, checkinmsg, checkinmsgtype, sip_media_type)
186
                (itemtype,description,rentalcharge, gstrate, notforloan, imageurl, summary, checkinmsg, checkinmsgtype, sip_media_type)
178
            VALUES
187
            VALUES
179
                (?,?,?,?,?,?,?,?,?);
188
                (?,?,?,?,?,?,?,?,?);
180
            ";
189
            ";
Lines 184-189 elsif ( $op eq 'add_validate' ) { Link Here
184
            $input->param('itemtype'),
193
            $input->param('itemtype'),
185
            $input->param('description'),
194
            $input->param('description'),
186
            $input->param('rentalcharge'),
195
            $input->param('rentalcharge'),
196
            $input->param('gstrate'),
187
            $input->param('notforloan') ? 1 : 0,
197
            $input->param('notforloan') ? 1 : 0,
188
            $image eq 'removeImage' ?           ''                 :
198
            $image eq 'removeImage' ?           ''                 :
189
            $image eq 'remoteImage' ? $input->param('remoteImage') :
199
            $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
</script>
184
</script>
Lines 331-337 $(document).ready(function() Link Here
331
            [% IF ( itemtypeloop ) %]
351
            [% IF ( itemtypeloop ) %]
332
            <li>
352
            <li>
333
                <span class="label">Item type:</span>
353
                <span class="label">Item type:</span>
334
                <select name="itemtype" style="width:12em;">
354
                <select name="itemtype" id="itemtype" style="width:12em;">
335
                [% FOREACH itemtype IN itemtypeloop %]
355
                [% FOREACH itemtype IN itemtypeloop %]
336
                    [% IF ( itemtype.selected ) %]
356
                    [% IF ( itemtype.selected ) %]
337
                        <option value="[% itemtype.itemtype %]" selected="selected">[% itemtype.description %]</option>
357
                        <option value="[% itemtype.itemtype %]" selected="selected">[% itemtype.description %]</option>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt (-1 / +18 lines)
Lines 177-182 Item types administration Link Here
177
		  <input type="text" id="rentalcharge" name="rentalcharge" size="10" value="[% rentalcharge %]" />
177
		  <input type="text" id="rentalcharge" name="rentalcharge" size="10" value="[% rentalcharge %]" />
178
         </li>
178
         </li>
179
      <li>
179
      <li>
180
          <label for="gstrate">Tax rate: </label>
181
          <select name="gstrate" id="gstrate">
182
              <option value="">No default</option>
183
              [% FOREACH gst IN gst_values %]
184
                  [% IF gst.option == gstrate %]
185
                      <option value="[% gst.option %]" selected="selected">[% gst.option * 100 | format("%.1f") %]%</option>
186
                  [% ELSE %]
187
                      <option value="[% gst.option %]">[% gst.option * 100 | format("%.1f") %]%</option>
188
                  [% END %]
189
              [% END %]
190
          </select>
191
     </li>
192
      <li>
180
          <label for="checkinmsg">Checkin message: </label>
193
          <label for="checkinmsg">Checkin message: </label>
181
          <textarea id="checkinmsg" name="checkinmsg" cols="55" rows="5">[% checkinmsg %]</textarea>
194
          <textarea id="checkinmsg" name="checkinmsg" cols="55" rows="5">[% checkinmsg %]</textarea>
182
      </li>
195
      </li>
Lines 262-267 Item types administration Link Here
262
    <th>Description</th>
275
    <th>Description</th>
263
    <th>Not for loan</th>
276
    <th>Not for loan</th>
264
    <th>Charge</th>
277
    <th>Charge</th>
278
    <th>Tax rate</th>
265
    <th>Checkin message</th>
279
    <th>Checkin message</th>
266
    <th>Actions</th>
280
    <th>Actions</th>
267
  </thead>
281
  </thead>
Lines 280-285 Item types administration Link Here
280
      [% loo.rentalcharge %]
294
      [% loo.rentalcharge %]
281
    [% END %]
295
    [% END %]
282
    </td>
296
    </td>
297
    <td>
298
        [% IF loo.gstrate.length > 0 %]
299
            [% loo.gstrate * 100 | format("%.1f") %]%
300
        [% END %]
283
    <td>[% loo.checkinmsg | html_line_break %]</td>
301
    <td>[% loo.checkinmsg | html_line_break %]</td>
284
    <td>
302
    <td>
285
      <a href="[% loo.script_name %]?op=add_form&amp;itemtype=[% loo.itemtype |html %]">Edit</a>
303
      <a href="[% loo.script_name %]?op=add_form&amp;itemtype=[% loo.itemtype |html %]">Edit</a>
286
- 

Return to bug 12993