From 4c46a86209a3d94713776554279898d019d4e4cb Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Wed, 9 Mar 2022 16:42:50 +0100 Subject: [PATCH] Bug 30268: Check mandatory fields in addorderiso2709.pl Test plan: 1. Make sure you have mandatory item subfields in the MARC bibliographic framework used in acquisitions ("ACQ" if it exists, the default framework otherwise). 2. Use the "Stage MARC records for import" tool to upload a file. Do not import the bibliographic records. 3. Create a new acquisition basket ("Create items when:" must be set to "placing an order") and add a new order from a staged file 4. Select the file you just uploaded 5. In the "Items information" tab, make sure at least one mandatory subfield is empty 6. Try to submit the form. If there are errors about other mandatory fields (like the fund for instance), fix those errors and resubmit. There should be an error message about mandatory item subfields. 7. Enter a value for the mandatory item subfields and resubmit the form. Verify that the order and the item have been correctly created. --- .../prog/en/modules/acqui/addorderiso2709.tt | 1 + koha-tmpl/intranet-tmpl/prog/js/addorderiso2709.js | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt index d22111bb6a..cdb386cefc 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt @@ -17,6 +17,7 @@ Batch list [% INCLUDE 'datatables.inc' %] [% Asset.js("js/acq.js") | $raw %] [% Asset.js("js/funds_sorts.js") | $raw %] +[% Asset.js("js/cataloging.js") | $raw %] [% Asset.js("js/addorderiso2709.js") | $raw %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/addorderiso2709.js b/koha-tmpl/intranet-tmpl/prog/js/addorderiso2709.js index 861c0db3a3..a499d79ba3 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/addorderiso2709.js +++ b/koha-tmpl/intranet-tmpl/prog/js/addorderiso2709.js @@ -71,6 +71,14 @@ $(document).ready(function() { return false; } + if (0 < CheckMandatorySubfields(this.form)) { + // Open the item tab + $('#tabs').tabs('option', 'active', 1); + + alert(__('Some required item subfields are not set')); + return false; + } + disableUnchecked($(this.form)); $(this.form).submit(); -- 2.30.2