From 988cca277ec78a6223dc5982d8ac548ce0f3b4ee Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 23 Apr 2019 23:48:35 -0400 Subject: [PATCH] Bug 22669: Fix item editing on receiving an order Since commit 1253975389975a8ff11a9bb2ef84582aeb6bd08b Bug 21091: Move add item template JavaScript to a separate file items cannot longer be edited when receiving an order. When moving the code to the JS file, the JS variable "opisadd" was always set to "true": var opisadd = '[% opisadd | html %]'; Even if the TT variable is 0, opisadd will be "0", which is evaluated to true in Javascript To clean the situation it is easier to remove this variable and use "op" instead. Test plan: - Make sure acqcreateitem is set to "when placing an order" - Create a basket with some orders - Close the basket - Go to your vendor and receive an order - On the receive page, try to edit your item => Without the patch, the pop up page will open and then close, not allowing the item to be edited. => With this patch applied you will see the item edit form. Save and confirm that the parent window is updated with the new value (actually it's refreshed) Signed-off-by: Claire Gravely --- cataloguing/additem.pl | 1 - .../intranet-tmpl/prog/en/includes/str/cataloging_additem.inc | 2 +- koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt | 4 ++-- koha-tmpl/intranet-tmpl/prog/js/cataloging_additem.js | 10 ++++------ 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index 48417aa..062d335 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -931,7 +931,6 @@ $template->param( itemtagfield => $itemtagfield, itemtagsubfield => $itemtagsubfield, op => $nextop, - opisadd => ($nextop eq "saveitem") ? 0 : 1, popup => scalar $input->param('popup') ? 1: 0, C4::Search::enabled_staff_search_views, ); diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/str/cataloging_additem.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/str/cataloging_additem.inc index 0a14c10..97cadb9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/str/cataloging_additem.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/str/cataloging_additem.inc @@ -4,7 +4,7 @@ var biblionumber = '[% biblionumber | html %]'; var frameworkcode = '[% frameworkcode | html %]'; var popup = '[% popup | html %]'; - var opisadd = '[% opisadd | html %]'; + var op = '[% op | html %]'; var LABEL_EDIT_ITEM = _("Edit item"); var LABEL_DELETE_ITEM = _("Delete item"); var MSG_FORM_NOT_SUBMITTED = _("Form not submitted because of the following problem(s)"); 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 4782d23..121ffc6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt @@ -127,7 +127,7 @@ [% END %] - [% IF ( opisadd ) %] + [% IF op != 'saveitem' %]

Add item [% IF (circborrowernumber) %](fast cataloging)[% END %]

[% ELSE %]

Edit Item #[% itemnumber | html %][% IF ( barcode ) %] / Barcode [% barcode | html %][% END %]

@@ -210,7 +210,7 @@ -
[% IF ( opisadd ) %] +
[% IF op != 'saveitem' %]