@@ -, +, @@ recipt "standing" helps as you can do multiple receives testing different things, but is optional --- .../prog/en/modules/acqui/orderreceive.tt | 17 +++++++++++++++++ koha-tmpl/intranet-tmpl/prog/js/additem.js | 16 +++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt @@ -1328,6 +1328,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'); --- a/koha-tmpl/intranet-tmpl/prog/js/additem.js +++ a/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){ --