From 546a2ee692feb1e1f794fb32cb01a55d7281908a 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. Signed-off-by: Thibault Kero Signed-off-by: Martin Renvoize --- .../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 2e4421ef38..9b2f5f9043 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 @@ [% 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 %] [% INCLUDE 'calendar.inc' %] 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.20.1