From 1eb50789fba00ae084ced39c0a3b1b5e0ffe438c Mon Sep 17 00:00:00 2001 From: Amit Gupta Date: Tue, 11 Jun 2013 23:34:06 +0530 Subject: [PATCH] Bug 10209 - The ability to order multiple copies of the same item, from different fund classes, on the same order number Test Plan: 1) Create a basket. 2) Click on new order empty record. 3) Give title, quantity and select fund. 4) Order multiple copies of the same item click on Add fund and quantity button it will add one more fund and quantity by default quantity will be 1. 5) For delete fund and quantity simply click on Delete fund and quantity. --- acqui/addorder.pl | 18 ++- koha-tmpl/intranet-tmpl/prog/en/js/additem.js | 1 + .../prog/en/modules/acqui/neworderempty.tt | 126 +++++++++++++++----- 3 files changed, 115 insertions(+), 30 deletions(-) diff --git a/acqui/addorder.pl b/acqui/addorder.pl index 077adaf..ba82e25 100755 --- a/acqui/addorder.pl +++ b/acqui/addorder.pl @@ -156,6 +156,9 @@ $orderinfo->{'uncertainprice'} ||= 0; $orderinfo->{subscriptionid} ||= undef; my $user = $input->remote_user; +my $budget_id = $input->param('budget_id'); +my $quantity = $input->param('quantity'); +my $max_budget = $input->param('max_budget'); # create, modify or delete biblio # create if $quantity>=0 and $existing='no' @@ -204,8 +207,21 @@ if ( $orderinfo->{quantity} ne '0' ) { if ($$orderinfo{ordernumber}) { ModOrder( $orderinfo); } - else { # else, it's a new line + else { # else, it's a new line + $orderinfo->{budget_id} = $budget_id; + $orderinfo->{quantity} = $quantity; @$orderinfo{qw(basketno ordernumber )} = NewOrder($orderinfo); + + for (my $j = 2; $j <= $max_budget; $j++) { + my $b = $input->param("b"."$j"); + my $q = $input->param("q"."$j"); + if (defined $b) { + $orderinfo->{budget_id} = $b; + $orderinfo->{quantity} = $q; + @$orderinfo{qw(basketno ordernumber )} = NewOrder($orderinfo); + } + } + } # now, add items if applicable diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/additem.js b/koha-tmpl/intranet-tmpl/prog/en/js/additem.js index 2c15b04..1962685 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/additem.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/additem.js @@ -14,6 +14,7 @@ function addItem( node, unique_item_fields ) { addItemInList(index, unique_item_fields); $("#" + index).find("a[name='buttonPlus']").text("Update"); $("#quantity").val(current_qty + 1).change(); + document.getElementById("quantity").readOnly = false; } else if ( current_qty >= max_qty ) { alert(window.MSG_ADDITEM_JS_CANT_RECEIVE_MORE_ITEMS || "You can't receive any more items."); 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 87cfa8a..5c81add 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt @@ -149,6 +149,70 @@ $(document).ready(function() }); //]]> + @@ -391,13 +455,37 @@ $(document).ready(function() [% END %][%# IF (AcqCreateItemOrdering) %]
Accounting Details -
    -
  1. - [% IF ( close ) %] - Quantity: +
      [% IF ( biblionumber ) %] [% ELSE %] + + + + [% END %] + + + + + + + + + + + +
          [% IF ( close ) %] + [% Budget_name %] + [% ELSE %] + [% END %] [% IF ( close ) %] [% quantity %] - [% ELSE %] - + [% ELSE %] [% IF (AcqCreateItemOrdering) %] [% IF subscriptionid %] @@ -413,29 +501,9 @@ $(document).ready(function() [% END %] [% END %] - - -
    1. - [% IF ( close ) %] - Fund: - [% Budget_name %] - [% ELSE %] - - - - - [% END %] +
    2. [% IF ( close ) %] -- 1.7.9.5