From ef260f706b2ef2c3216cf478dd12658b30de7104 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 15 Aug 2013 14:53:26 -0400 Subject: [PATCH] Bug 10347 - Deactivate "Add item" button when "Add multiple copies" was activated Content-Type: text/plain; charset="utf-8" When the "Add multiple items" button is pressed the other submit buttons should be hidden in order to eliminate confusion about which button submits the form at that stage in the process. This patch alters the form so that clicking the "add multiple" button hides the other two buttons and displays form for submitting the number of copies to add. This patch also makes changes to accompanying text in order to make things (hopefully) clearer. The button text has been changed (again, see Bug 10346) to "Add multiple copies of this item." The triggered form is now labelled "Number of additional copies of this item to add" in an attempt to convey the fact that the number entered will be added to the one item represented by the item form above. i.e. if you enter "3" as the number of additional copies, you will end up with 4. Explanatory text has been added "The barcode you enter will be incremented for each additional item," because that seemed non-obvious about the process. Unrelated change: a section of obsolete JavaScript has been removed. To test, go to the add/edit items page for a new or existing record. Test adding a single item, adding & duplicating, and adding multiple. The add multiple form should be shown upon clicking 'add multiple,' and hidden when 'cancel' is clicked. --- .../prog/en/modules/cataloguing/additem.tt | 52 +++++++++++--------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt index 8cc064b..148d920 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt @@ -30,23 +30,24 @@ $(document).ready(function(){ $(this).append("Edit Item Delete Item"); } }); + var multiCopyControl = $("#add_multiple_copies_span"); + var addMultipleBlock = $("#addmultiple"); + var addSingleBlock = $("#addsingle"); + multiCopyControl.hide(); + $("#add_multiple_copies").on("click",function(e){ + e.preventDefault; + addMultipleBlock.toggle(); + addSingleBlock.toggle(); + multiCopyControl.toggle(); + }); + $("#cancel_add_multiple").on("click",function(e){ + e.preventDefault(); + addMultipleBlock.toggle(); + addSingleBlock.toggle(); + multiCopyControl.toggle(); + }); }); -function active(numlayer) -{ - for (i=10; i < 11 ; i++ ) { - ong = i+"XX"; - link = "link"+i; - if (numlayer==i) { - document.getElementById(ong).style.visibility="visible"; - document.getElementById(link).style.backgroundColor="#11AA11"; - document.getElementById(link).style.backgroundImage="url([% themelang %]/images/background-mem.gif)"; - } else { - document.getElementById(ong).style.visibility="hidden"; - document.getElementById(link).style.backgroundColor="#FFFFFF"; - document.getElementById(link).style.backgroundImage=""; - } - } -} + function Check(f) { var total_errors = CheckMandatorySubfields(f); if (total_errors > 0) { @@ -208,14 +209,19 @@ $(document).ready(function() { when pressing the enter key, while in fact it is the first submit button that is validated, in our case the "add (single) item" button. It is a bit tricky, but necessary in the sake of UI correctness. --> - - - -