Bugzilla – Attachment 31863 Details for
Bug 12993
Add a default tax rate on item types
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12993: Add a default tax rate on item types
Bug-12993-Add-a-default-tax-rate-on-item-types.patch (text/plain), 6.88 KB, created by
Jonathan Druart
on 2014-09-25 09:28:36 UTC
(
hide
)
Description:
Bug 12993: Add a default tax rate on item types
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2014-09-25 09:28:36 UTC
Size:
6.88 KB
patch
obsolete
>From a9b2e52df7ea153cd44d556b913653dec6f8e235 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Thu, 25 Sep 2014 11:21:49 +0200 >Subject: [PATCH] Bug 12993: Add a default tax rate on item types > >This enhancement permits to set a default tax rate for item types. >If a default tax rate is defined for an item type, the tax rate will be >automatically selected when the librarian choose the type of the >item to order. > >Test plan: >0/ Execute the updatedb entry. >1/ Define a default tax rate for some item types. >2/ Create an order and verify the tax rate is selected after you have >chosen the item type. > >Note that the item type is only displayed if defined at the biblio >level. >--- > 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(-) > >diff --git a/admin/itemtypes.pl b/admin/itemtypes.pl >index bfaa44c..79d7cb2 100755 >--- a/admin/itemtypes.pl >+++ b/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') : >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >index 64ad028..d920540 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >+++ b/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 %] >+ > }); > //]]> > </script> >@@ -330,7 +350,7 @@ $(document).ready(function() > [% IF ( itemtypeloop ) %] > <li> > <span class="label">Item type:</span> >- <select name="itemtype" style="width:12em;"> >+ <select name="itemtype" id="itemtype" style="width:12em;"> > [% FOREACH itemtype IN itemtypeloop %] > [% IF ( itemtype.selected ) %] > <option value="[% itemtype.itemtype %]" selected="selected">[% itemtype.description %]</option> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt >index 522420b..b47f0f0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt >@@ -177,6 +177,19 @@ Item types administration > <input type="text" id="rentalcharge" name="rentalcharge" size="10" value="[% rentalcharge %]" /> > </li> > <li> >+ <label for="gstrate">Tax rate: </label> >+ <select name="gstrate" id="gstrate"> >+ <option value="">No default</option> >+ [% FOREACH gst IN gst_values %] >+ [% IF gst.option == gstrate %] >+ <option value="[% gst.option %]" selected="selected">[% gst.option * 100 | format("%.1f") %]%</option> >+ [% ELSE %] >+ <option value="[% gst.option %]">[% gst.option * 100 | format("%.1f") %]%</option> >+ [% END %] >+ [% END %] >+ </select> >+ </li> >+ <li> > <label for="checkinmsg">Checkin message: </label> > <textarea id="checkinmsg" name="checkinmsg" cols="55" rows="5">[% checkinmsg %]</textarea> > </li> >@@ -262,6 +275,7 @@ Item types administration > <th>Description</th> > <th>Not for loan</th> > <th>Charge</th> >+ <th>Tax rate</th> > <th>Checkin message</th> > <th>Actions</th> > </thead> >@@ -284,6 +298,10 @@ Item types administration > [% loo.rentalcharge %] > [% END %] > </td> >+ <td> >+ [% IF loo.gstrate.length > 0 %] >+ [% loo.gstrate * 100 | format("%.1f") %]% >+ [% END %] > <td>[% loo.checkinmsg | html_line_break %]</td> > <td> > <a href="[% loo.script_name %]?op=add_form&itemtype=[% loo.itemtype |html %]">Edit</a> >-- >2.1.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 12993
:
31863
|
32018
|
32284
|
33305
|
33306
|
33307
|
34797
|
35394
|
39566
|
39567
|
39568
|
39569
|
45538
|
45539
|
45540
|
45541
|
45542
|
45543