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 <claire.gravely@bsz-bw.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
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,
);
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)");
<input type="hidden" name="popup" value="1" />
[% END %]
<input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
- [% IF ( opisadd ) %]
+ [% IF op != 'saveitem' %]
<h2 id="additema">Add item [% IF (circborrowernumber) %]<em>(fast cataloging)</em>[% END %]</h2>
[% ELSE %]
<h2 id="edititem">Edit Item #[% itemnumber | html %][% IF ( barcode ) %] / Barcode [% barcode | html %][% END %]</h2>
<input type="hidden" name="indicator" value=" " />
<input type="hidden" name="itemnumber" value="[% itemnumber | html %]" />
-<fieldset class="action"> [% IF ( opisadd ) %]
+<fieldset class="action"> [% IF op != 'saveitem' %]
<input type="submit" name="phony_submit" value="phony_submit" id="phony_submit" style="display:none;" onclick="return false;" />
<!-- Note : We use here a false submit button because we have several submit buttons and we don't want the user to believe they validated the adding of multiple items
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.
-/* global KOHA searchid biblionumber frameworkcode popup opisadd LABEL_EDIT_ITEM LABEL_DELETE_ITEM MSG_FORM_NOT_SUBMITTED MSG_MANDATORY_FIELDS_EMPTY MSG_ADD_MULTIPLE_ITEMS MSG_ENTER_NUM_ITEMS MSG_CONFIRM_DELETE_ITEM MSG_CONFIRM_ADD_ITEM columns_settings CheckMandatorySubfields CheckMultipleAdd */
+/* global KOHA searchid biblionumber frameworkcode popup op LABEL_EDIT_ITEM LABEL_DELETE_ITEM MSG_FORM_NOT_SUBMITTED MSG_MANDATORY_FIELDS_EMPTY MSG_ADD_MULTIPLE_ITEMS MSG_ENTER_NUM_ITEMS MSG_CONFIRM_DELETE_ITEM MSG_CONFIRM_ADD_ITEM columns_settings CheckMandatorySubfields CheckMultipleAdd */
var browser = KOHA.browser(searchid, parseInt(biblionumber, 10));
browser.show();
// otherwise the deletion confirmation will not work correctly
$('a[href*="biblionumber="]').off('click');
- if( popup ){
- if( opisadd ){
- window.close();
- }
+ if( popup && op != 'saveitem' ){
+ window.close();
}
$("fieldset.rows input, fieldset.rows select").addClass("noEnterSubmit");
function confirm_deletion() {
return confirm( MSG_CONFIRM_DELETE_ITEM );
-}
\ No newline at end of file
+}