Bugzilla – Attachment 46093 Details for
Bug 14752
Add multiple copies to a basket at once
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14752 - Add multiple copies to a basket at once
Bug-14752---Add-multiple-copies-to-a-basket-at-onc.patch (text/plain), 8.43 KB, created by
Nick Clemens (kidclamp)
on 2015-12-30 16:07:25 UTC
(
hide
)
Description:
Bug 14752 - Add multiple copies to a basket at once
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2015-12-30 16:07:25 UTC
Size:
8.43 KB
patch
obsolete
>From b7c8ac23d53ab851723cd2f0731c9e6781ff4009 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 24 Dec 2015 14:53:16 +0000 >Subject: [PATCH] Bug 14752 - Add multiple copies to a basket at once > >This patch add an 'Add multiple copies' button on the new order page in >acquisitions. While processing the multiple copies a modal is >displayed. > >To test: >1 - Add an order to an acquisitions basket >2 - Choose to add multiple items >3 - A modal shouold warn about ignoring UniqueItemFields from syspref >4 - When submitting the modal should popup until all items are processed. >5 - The modal should disappear after items are added. >6 - Items should be cloned, minus unique fields > >Sponsored by: Middletown Township Public Library (http://www.mtpl.org) >--- > .../intranet-tmpl/prog/en/includes/additem.js.inc | 3 ++ > koha-tmpl/intranet-tmpl/prog/en/js/additem.js | 54 ++++++++++++++++++++-- > .../prog/en/modules/acqui/neworderempty.tt | 24 ++++++++++ > 3 files changed, 78 insertions(+), 3 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/additem.js.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/additem.js.inc >index 28d39e4..1ecee30 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/additem.js.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/additem.js.inc >@@ -1,6 +1,9 @@ > <script type="text/javascript"> > //<![CDATA[ > var MSG_ADDITEM_JS_ADDITEM = _("Add item"); >+var MSG_ADDITEM_JS_ADDMULTI = _("Add multiple items"); >+var MSG_ADDITEM_JS_MULTIVAL = _("Number of items to add"); >+var MSG_ADDITEM_JS_SUBMITMULTI = _("Add"); > var MSG_ADDITEM_JS_UPDATEITEM = _("Update item"); > var MSG_ADDITEM_JS_EDIT = _("Edit"); > var MSG_ADDITEM_JS_DELETE = _("Delete"); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/additem.js b/koha-tmpl/intranet-tmpl/prog/en/js/additem.js >index 4a9de09..c8234a6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/js/additem.js >+++ b/koha-tmpl/intranet-tmpl/prog/en/js/additem.js >@@ -13,6 +13,8 @@ function addItem( node, unique_item_fields ) { > cloneItemBlock(index, unique_item_fields); > addItemInList(index, unique_item_fields); > $("#" + index).find("input[name='buttonPlus']").val( (window.MSG_ADDITEM_JS_UPDATEITEM || "Update item") ); >+ $("#"+ index).find("input[name='buttonPlusMulti']").remove(); >+ $("#" + index).find("input[name='multiValue").remove(); > $("#quantity").val(current_qty + 1).change(); > } else if ( current_qty >= max_qty ) { > alert(window.MSG_ADDITEM_JS_CANT_RECEIVE_MORE_ITEMS >@@ -27,6 +29,43 @@ function addItem( node, unique_item_fields ) { > $("#" + index).hide(); > } > >+function addMulti( count, node, unique_item_fields){ >+ var index = $(node).closest("div").attr('id'); >+ var countItemsBefore = $("#items_list tbody tr").length; >+ var current_qty = parseInt( $('#quantity').val(), 10 ); >+ $("#procModal").modal('show'); >+ $("#" + index).hide(); >+ for(var i=0;i<count;i++){ >+ cloneItemBlock(index, unique_item_fields, function(cloneIndex){ >+ addItemInList(cloneIndex,unique_item_fields, function(){ >+ if( ($("#items_list tbody tr").length-countItemsBefore)==(count)){ >+ $("#multiValue").val(''); >+ $('#'+index).show(); >+ $('#'+index + ' #add_multiple_copies' ).css("visibility","hidden"); >+ $("#procModal").modal('hide'); >+ } >+ }); >+ $("#" + cloneIndex).find("input[name='buttonPlus']").val( (window.MSG_ADDITEM_JS_UPDATEITEM || "Update item ") ); >+ $("#" + cloneIndex).find("input[name='buttonPlusMulti']").remove(); >+ $("#" + cloneIndex).find("input[name='multiValue").remove(); >+ $("#" + cloneIndex).hide(); >+ current_qty++; >+ $('#quantity').val( current_qty ); >+ }); >+ } >+} >+ >+ >+function checkCount(node, unique_item_fields){ >+ var count = parseInt( $("#multiValue").val(), 10 ); >+ if ( isNaN( count ) || count <=0) { >+ $("#multiCountModal").modal('show'); >+ } >+ else{ >+ addMulti( count, node, unique_item_fields); >+ } >+} >+ > function showItem(index) { > $("#outeritemblock").children("div").each(function(){ > if ( $(this).attr('id') == index ) { >@@ -75,10 +114,13 @@ function constructTrNode(index, unique_item_fields) { > return result; > } > >-function addItemInList(index, unique_item_fields) { >+function addItemInList(index, unique_item_fields, callback) { > $("#items_list").show(); > var tr = constructTrNode(index, unique_item_fields); > $("#items_list table tbody").append(tr); >+ if (typeof callback === "function"){ >+ callback(); >+ } > } > > function deleteItemBlock(node_a, index, unique_item_fields) { >@@ -105,7 +147,7 @@ function deleteItemBlock(node_a, index, unique_item_fields) { > } > } > >-function cloneItemBlock(index, unique_item_fields) { >+function cloneItemBlock(index, unique_item_fields, callback) { > var original; > if(index) { > original = $("#" + index); //original <div> >@@ -136,7 +178,9 @@ function cloneItemBlock(index, unique_item_fields) { > /* Add buttons + and Clear */ > var buttonPlus = "<fieldset class=\"action\">"; > buttonPlus += '<input type="button" class="addItemControl" name="buttonPlus" style="cursor:pointer; margin:0 1em;" onclick="addItem(this,\'' + unique_item_fields + '\')" value="' + (window.MSG_ADDITEM_JS_ADDITEM || 'Add item')+ '" />'; >- buttonPlus += '<a class="addItemControl cancel" name="buttonClear" style="cursor:pointer;" onclick="clearItemBlock(this)">' + (window.MSG_ADDITEM_JS_CLEAR || 'Clear') + '</a>'; >+ buttonPlus += '<input type="button" class="addItemControl cancel" name="buttonClear" style="cursor:pointer;" onclick="clearItemBlock(this)" value="' + (window.MSG_ADDITEM_JS_CLEAR || 'Clear')+ '" />'; >+ buttonPlus += '<input type="button" class="addItemControl" name="buttonPlusMulti" data-toggle="modal" data-target="#uniqueFieldsModal" onclick="javascript:this.nextSibling.style.visibility=\'visible\';document.f.multiValue.focus(); return false;" style="cursor:pointer; margin:0 1em;" value="' + (window.MSG_ADDITEM_JS_ADDMULTI || 'Add multiple items')+ '" />'; >+ buttonPlus +='<span id="add_multiple_copies" style="visibility:hidden"><input type="textbox" class="addItemControl" id="multiValue" name="multiValue" placeholder="'+window.MSG_ADDITEM_JS_MULTIVAL+'" /><input type="button" class="addItemControl" name=buttonAddMulti" style="cursor:pointer; margin:0 1em;" onclick="checkCount( this ,\'' + unique_item_fields + '\')" value="' + (window.MSG_ADDITEM_JS_SUBMITMULTI || 'Add') + '" /></span>'; > buttonPlus += "</fieldset>"; > $(clone).append(buttonPlus); > /* Copy values from the original block (input) */ >@@ -161,6 +205,10 @@ function cloneItemBlock(index, unique_item_fields) { > }); > > $("#outeritemblock").append(clone); >+ if (typeof callback === "function"){ >+ var cloneIndex = "itemblock"+random; >+ callback(cloneIndex); >+ } > BindPluginEvents(data); > } > }); >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 7638f02..acf3872 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >@@ -641,6 +641,30 @@ $(document).ready(function() > [% END %] > </fieldset> > </form> >+ >+<div id="procModal" data-backdrop="static" class="modal hide fade" aria-labelledby="procModal" aria-hidden="true"> >+ <div class="modal-body"> >+ <h3>Processing multiple items</h3> >+ </div> >+</div> >+ >+[% IF UniqueItemFields %] >+<div id="uniqueFieldsModal" class="modal hide fade" aria-labelledby="uniqueFieldsModal" aria-hidden="true"> >+ <div class="modal-body"> >+ <h3>The following fields are listed in the UniqueItemFields system preference and will not be copied</h3> >+ <ul id="uniqueItemFields"> >+ [% FOREACH uniqueField IN UniqueItemFields.split(" ") %] >+ <li>[% uniqueField %]</li> >+ [% END %] >+ </ul> >+ </div> >+</div> >+[% END %] >+ >+<div id="multiCountModal" class="modal hide fade" aria-labelledby="multiCountModal" aria-hidden="true"> >+ <h3>You must enter a valid number to add multiple copies</h3> >+</div> >+ > </div> > </div> > <div class="yui-b"> >-- >2.1.4
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 14752
:
46093
|
46439
|
46832
|
46833
|
47223
|
47252
|
47477
|
48254
|
51481
|
52083
|
52587
|
52588
|
52605
|
52606
|
55527
|
55528
|
56649
|
56684