Bugzilla – Attachment 18588 Details for
Bug 10209
The ability to order multiple copies of the same item from different funds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
The ability to order multiple copies of the same item, from different fund classes, on the same order number
0001-Bug-10209-The-ability-to-order-multiple-copies-of-th.patch (text/plain), 8.62 KB, created by
Amit Gupta
on 2013-06-02 07:48:30 UTC
(
hide
)
Description:
The ability to order multiple copies of the same item, from different fund classes, on the same order number
Filename:
MIME Type:
Creator:
Amit Gupta
Created:
2013-06-02 07:48:30 UTC
Size:
8.62 KB
patch
obsolete
>From c1557a66f98d25a7bc1d9d093bfcecb4960d4a50 Mon Sep 17 00:00:00 2001 >From: Amit Gupta <amitddng135@gmail.com> >Date: Sun, 2 Jun 2013 13:14:00 +0530 >Subject: [PATCH] Bug 10209 - The ability to order multiple copies of the same > item, from different fund classes, on the same order number > >To Test: >1) Create 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. > >Atleast one quantity and fund will be there if you >try to delete it will show one error message. >--- > acqui/addorder.pl | 11 +- > .../prog/en/modules/acqui/neworderempty.tt | 116 +++++++++++++++----- > 2 files changed, 97 insertions(+), 30 deletions(-) > >diff --git a/acqui/addorder.pl b/acqui/addorder.pl >index 077adaf..82ff9d7 100755 >--- a/acqui/addorder.pl >+++ b/acqui/addorder.pl >@@ -156,6 +156,8 @@ $orderinfo->{'uncertainprice'} ||= 0; > $orderinfo->{subscriptionid} ||= undef; > > my $user = $input->remote_user; >+my @budget_id = $input->param("budget_id"); >+my @quantity = $input->param("quantity"); > > # create, modify or delete biblio > # create if $quantity>=0 and $existing='no' >@@ -205,7 +207,14 @@ if ( $orderinfo->{quantity} ne '0' ) { > ModOrder( $orderinfo); > } > else { # else, it's a new line >- @$orderinfo{qw(basketno ordernumber )} = NewOrder($orderinfo); >+ my $i = 0; >+ foreach my $budget_id (@budget_id) { >+ $$orderinfo{budget_id} = $budget_id; >+ my $quantity = @quantity[$i]; >+ $$orderinfo{quantity} = $quantity; >+ @$orderinfo{qw(basketno ordernumber )} = NewOrder($orderinfo); >+ $i++; >+ } > } > > # now, add items if applicable >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..f6d7760 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,61 @@ $(document).ready(function() > }); > //]]> > </script> >+<script language="javascript"> >+ function addRow(tableID) { >+ var table = document.getElementById(tableID); >+ var rowCount = table.rows.length; >+ var row = table.insertRow(rowCount); >+ var cell1 = row.insertCell(0); >+ var element1 = document.createElement("input"); >+ element1.type = "checkbox"; >+ element1.name="chkbox[]"; >+ cell1.appendChild(element1); >+ >+ var cell2 = row.insertCell(1); >+ var createSelect = "<select name='budget_id' id='budget_id'>"; >+ var createOption = ""; >+ var object1 = document.getElementById('budget_id'); >+ >+ for (i = 1; i < object1.options.length; i++) { >+ createOption = createOption + "<option value ='" + object1.options[i].value+"'>"+object1.options[i].text + "</option>"; >+ >+ } >+ >+ createSelect = createSelect + createOption + "</select>"; >+ cell2.innerHTML = createSelect; >+ var cell3 = row.insertCell(2); >+ var element2 = document.createElement("input"); >+ element2.type = "text"; >+ element2.name = "quantity"; >+ element2.id="quantity"; >+ element2.value = 1; >+ cell3.appendChild(element2); >+ } >+ >+ function deleteRow(tableID) { >+ try { >+ var table = document.getElementById(tableID); >+ var rowCount = table.rows.length; >+ if (rowCount == 2) { >+ alert ("Cannot delete, all the funds and quantity, at least one should be there"); >+ return; >+ } >+ >+ for(var i=0; i<rowCount; i++) { >+ var row = table.rows[i]; >+ var chkbox = row.cells[0].childNodes[0]; >+ if(null != chkbox && true == chkbox.checked) { >+ table.deleteRow(i); >+ rowCount--; >+ i--; >+ } >+ } >+ } catch(e) { >+ alert(e); >+ } >+ } >+</script> > </head> > <body id="acq_neworderempty" class="acq"> > >@@ -391,13 +446,36 @@ $(document).ready(function() > [% END %][%# IF (AcqCreateItemOrdering) %] > <fieldset class="rows"> > <legend>Accounting Details</legend> >- <ol> >- <li> >- [% IF ( close ) %] >- <span class="label required">Quantity: </span> >+ <ol>[% IF ( biblionumber ) %] [% ELSE %] >+ <input type="button" value="Add fund and quantity" onclick="addRow('dataTable')" /> >+ <input type="button" value="Delete fund and quantity" onclick="deleteRow('dataTable')" /> >+ [% END %] >+ <table id="dataTable" width="350px" border="1"> >+ <tr> >+ <td></td> >+ <td><label class="required" for="budget_id">Fund: </label></td> >+ <td><label class="required" for="quantity">Quantity: </label></td> >+ </tr> >+ <tr> >+ <td><input type="checkbox" name="chk"/></td> >+ <td> [% IF ( close ) %] >+ <input type="hidden" size="20" name="budget_id" id="budget_id" value="[% budget_id %]" />[% Budget_name %] >+ [% ELSE %] >+ <select id="budget_id" onchange="fetchSortDropbox(this.form)" size="1" name="budget_id"> >+ <option value="">Select a budget</option> >+ [% FOREACH budget_loo IN budget_loop %] >+ [% IF ( budget_loo.b_sel ) %] >+ <option value="[% budget_loo.b_id %]" selected="selected">[% budget_loo.b_txt %]</option> >+ [% ELSE %] >+ [% IF ( budget_loo.b_active ) %]<option value="[% budget_loo.b_id %]">[% budget_loo.b_txt %]</option> >+ [% ELSE %]<option value="[% budget_loo.b_id %]" class="b_inactive">[% budget_loo.b_txt %]</option> >+ [% END %] >+ [% END %] >+ [% END %] >+ </select> [% END %]</td> >+ <td> [% IF ( close ) %] > <input type="hidden" size="20" name="quantity" value="[% quantity %]" />[% quantity %] >- [% ELSE %] >- <label class="required" for="quantity">Quantity: </label> >+ [% ELSE %] > [% IF (AcqCreateItemOrdering) %] > [% IF subscriptionid %] > <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="1" /> >@@ -413,29 +491,9 @@ $(document).ready(function() > [% END %] > [% END %] > <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, usefull when receiveing an order --> >- <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="1" /> >- </li> >- <li> >- [% IF ( close ) %] >- <span class="label required">Fund: </span> >- <input type="hidden" size="20" name="budget_id" id="budget_id" value="[% budget_id %]" />[% Budget_name %] >- [% ELSE %] >- <label class="required" for="budget_id">Fund: </label> >- <select id="budget_id" onchange="fetchSortDropbox(this.form)" size="1" name="budget_id"> >- <option value="">Select a budget</option> >- [% FOREACH budget_loo IN budget_loop %] >- [% IF ( budget_loo.b_sel ) %] >- <option value="[% budget_loo.b_id %]" selected="selected">[% budget_loo.b_txt %]</option> >- [% ELSE %] >- [% IF ( budget_loo.b_active ) %]<option value="[% budget_loo.b_id %]">[% budget_loo.b_txt %]</option> >- [% ELSE %]<option value="[% budget_loo.b_id %]" class="b_inactive">[% budget_loo.b_txt %]</option> >- [% END %] >- [% END %] >- [% END %] >- </select> >- <label for="showallbudgets" style="float:none;width:auto;"> Show all:</label> >- <input type="checkbox" id="showallbudgets" /> >- [% END %] >+ <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="1" /></td> >+ </tr> >+ </table> > </li> > <li> > [% IF ( close ) %] >-- >1.7.9.5 >
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 10209
:
18515
|
18588
|
18792
|
18834
|
18854