Bug 30268: Check mandatory fields in addorderiso2709.pl
authorJulian Maurice <julian.maurice@biblibre.com>
Wed, 9 Mar 2022 15:42:50 +0000 (16:42 +0100)
committerTomas Cohen Arazi <tomascohen@theke.io>
Wed, 20 Jul 2022 14:49:19 +0000 (11:49 -0300)
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 <thibault.keromnes@univ-paris8.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt
koha-tmpl/intranet-tmpl/prog/js/addorderiso2709.js

index 2e4421e..9b2f5f9 100644 (file)
@@ -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' %]
 </head>
index 861c0db..a499d79 100644 (file)
@@ -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();