@@ -, +, @@ --- admin/itemtypes.pl | 12 +++++++++++- .../prog/en/modules/acqui/neworderempty.tt | 22 +++++++++++++++++++++- .../prog/en/modules/admin/itemtypes.tt | 18 ++++++++++++++++++ 3 files changed, 50 insertions(+), 2 deletions(-) --- a/admin/itemtypes.pl +++ a/admin/itemtypes.pl @@ -112,10 +112,17 @@ if ( $op eq 'add_form' ) { $remote_image = $data->{imageurl}; } + my @gst_values = map { + option => $_ + 0.0 + }, split( '\|', C4::Context->preference("gist") ); + + $template->param( itemtype => $itemtype, description => $data->{'description'}, rentalcharge => sprintf( "%.2f", $data->{'rentalcharge'} ), + gstrate => $data->{gstrate} ? $data->{gstrate}+0.0 : undef, + gst_values => \@gst_values, notforloan => $data->{'notforloan'}, imageurl => $data->{'imageurl'}, template => C4::Context->preference('template'), @@ -144,6 +151,7 @@ elsif ( $op eq 'add_validate' ) { UPDATE itemtypes SET description = ? , rentalcharge = ? + , gstrate = ? , notforloan = ? , imageurl = ? , summary = ? @@ -156,6 +164,7 @@ elsif ( $op eq 'add_validate' ) { $sth->execute( $input->param('description'), $input->param('rentalcharge'), + $input->param('gstrate'), ( $input->param('notforloan') ? 1 : 0 ), ( $input->param('image') eq 'removeImage' ? '' : ( @@ -174,7 +183,7 @@ elsif ( $op eq 'add_validate' ) { else { # add a new itemtype & not modif an old my $query = " INSERT INTO itemtypes - (itemtype,description,rentalcharge, notforloan, imageurl, summary, checkinmsg, checkinmsgtype, sip_media_type) + (itemtype,description,rentalcharge, gstrate, notforloan, imageurl, summary, checkinmsg, checkinmsgtype, sip_media_type) VALUES (?,?,?,?,?,?,?,?,?); "; @@ -184,6 +193,7 @@ elsif ( $op eq 'add_validate' ) { $input->param('itemtype'), $input->param('description'), $input->param('rentalcharge'), + $input->param('gstrate'), $input->param('notforloan') ? 1 : 0, $image eq 'removeImage' ? '' : $image eq 'remoteImage' ? $input->param('remoteImage') : --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt @@ -159,6 +159,26 @@ $(document).ready(function() getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2, sort2 ); }); $("#budget_id").change(); + + // Select the gstrate function of the itemtype + [% IF itemtypeloop %] + var itemtype_gstrate_map = {}; + [% FOREACH itemtype IN itemtypeloop %] + [% IF itemtype.gstrate.length > 0 %] + itemtype_gstrate_map['[%itemtype.itemtype%]'] = [% itemtype.gstrate %]; + [% END %] + [% END %] + + $("#itemtype").change(function(){ + var gstrate = itemtype_gstrate_map[$(this).val()]; + if ( gstrate != undefined ) { + $("#gstrate option[value='"+gstrate+"']").attr('selected', 'selected'); + $("#gstrate").change(); + } + }); + $("#itemtype").change(); + [% END %] + }); function UserSearchPopup(f) { @@ -387,7 +407,7 @@ $(document).ready(function() [% IF ( itemtypeloop ) %]
  • Item type: - [% FOREACH itemtype IN itemtypeloop %] [% IF ( itemtype.selected ) %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt @@ -177,6 +177,19 @@ Item types administration
  • + + +
  • +
  • @@ -262,6 +275,7 @@ Item types administration Description Not for loan Charge + Tax rate Checkin message Actions @@ -280,6 +294,10 @@ Item types administration [% loo.rentalcharge %] [% END %] + + [% IF loo.gstrate.length > 0 %] + [% loo.gstrate * 100 | format("%.1f") %]% + [% END %] [% loo.checkinmsg | html_line_break %] Edit --