Bugzilla – Attachment 154286 Details for
Bug 34109
When adding items on receive, mandatory fields are not checked
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34109: Check mandatory item fields when creating during recipt
Bug-34109-Check-mandatory-item-fields-when-creatin.patch (text/plain), 4.15 KB, created by
Sam Lau
on 2023-08-04 15:10:14 UTC
(
hide
)
Description:
Bug 34109: Check mandatory item fields when creating during recipt
Filename:
MIME Type:
Creator:
Sam Lau
Created:
2023-08-04 15:10:14 UTC
Size:
4.15 KB
patch
obsolete
>From e6cf4dd8b1839e770d08ed41f28e8198170c02e2 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 4 Aug 2023 14:13:25 +0000 >Subject: [PATCH] Bug 34109: Check mandatory item fields when creating during > recipt > >This patch adds a check of mandatory item fields before saving during order receipt. >We check both when adding the item initially, and when submitting the order, as it will use >the values from the open form. > >To test: >* Go to administration > frameworks > ACQ > MARC structure > 952 >* Set callnumber (o) or barcode (p) to mandatory >* In acquisition: >* Create a basket with "create items on order" and "is standing" > "standing" helps as you can do multiple receives testing different things, > but is optional >* Add an order line >* Receive shipment >* Verify the mandatory fields show in the item form >* Set itemtype = Music >* Save with the fields blank >* Item row is added, no warning >* Edit the item, change the item type to blank >* Click 'Confirm' for the order without closing the item edit form >* Verify the item was added with itemtype Books (on sample data) and empty mandatory field >* Apply patch >* Repeat above, however, you should not be able to submit the item or order until mandatory fields are filled > >Signed-off-by: Sam Lau <samalau@gmail.com> >--- > .../prog/en/modules/acqui/orderreceive.tt | 17 +++++++++++++++++ > koha-tmpl/intranet-tmpl/prog/js/additem.js | 16 +++++++++++++++- > 2 files changed, 32 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >index 724ae61607..2cf85d1777 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >@@ -1327,6 +1327,23 @@ > }); > > $('.modal-save').click(function() { >+ >+ //We need to validate the item forms here - if one is opened with missing subfields at >+ //confirm, it would be submitted without this >+ var _alertString= _("Form not submitted because of the following problem(s)")+"\n"; >+ _alertString +="-------------------------------------------------------------------\n\n"; >+ var empty_mandatory_fields = 0; >+ $('div[id^="itemblock"]').each(function(){ >+ var item_form = $(this); >+ var empty_item_mandatory = CheckMandatorySubfields(item_form); >+ empty_mandatory_fields += empty_item_mandatory; >+ }); >+ if (empty_mandatory_fields > 0) { >+ _alertString +="\n- " + _("%s item mandatory fields empty").format(empty_mandatory_fields); >+ alert(_alertString); >+ return false; >+ } >+ > var saved_rows = save_row(); > if(Object.keys(saved_rows).length) $('.save').prop('disabled', false); > $("#order_edit").modal('hide'); >diff --git a/koha-tmpl/intranet-tmpl/prog/js/additem.js b/koha-tmpl/intranet-tmpl/prog/js/additem.js >index 35ee4e2995..b3045c656e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/additem.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/additem.js >@@ -1,7 +1,21 @@ > /* global __ */ > /* exported addItem checkCount showItem deleteItemBlock clearItemBlock check_additem */ > function addItem( node, unique_item_fields ) { >- var index = $(node).closest("div").attr('id'); >+ var item_form = $(node).closest("div"); >+ var index = item_form.attr("id"); >+ >+ //We need to verify the item form before saving >+ var empty_item_mandatory = CheckMandatorySubfields(item_form); >+ if (empty_item_mandatory > 0) { >+ var _alertString= _("Form not submitted because of the following problem(s)")+"\n"; >+ >+ _alertString +="-------------------------------------------------------------------\n\n"; >+ _alertString += >+ "\n- " + _("%s item mandatory fields empty").format(empty_item_mandatory); >+ alert(_alertString); >+ return false; >+ } >+ > var current_qty = parseInt($("#quantity").val()); > var max_qty; > if($("#quantity_to_receive").length != 0){ >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 34109
:
154280
|
154286
|
154512