From 76264638ccd16600fa063fe19475e73177763916 Mon Sep 17 00:00:00 2001 From: "f.demians at tamil.fr" <(frederic@tamil.fr)> Date: Fri, 26 Nov 2010 08:22:45 +0100 Subject: [PATCH] Bug 5446 Item creation in Acquisition module doesn't control mandatory field Add some JS validing form, so saving an order is blocked if any item mandatory field is empty. Signed-off-by: Koustubha Kale --- .../prog/en/modules/acqui/neworderempty.tmpl | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tmpl index e53c7daa26..85ccb6feb7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tmpl @@ -36,7 +36,20 @@ function Check(ff) { if (totalExceedsBudget(ff.budget_id.value, ff.total.value ) ) { ok=1; - _alertString += "\n- " + "Order total (" + ff.total.value + ") exceeds budget available ("+actTotal+")"; + _alertString += "\n- " + _("Order total (") + ff.total.value + + _(") exceeds budget available (") + actTotal+")"; + } + + var empty_item_mandatory = 0; + for (i = 0; i < ff.field_value.length; i++) { + if (ff.field_value[i].value.length == 0 && ff.mandatory[i].value == 1) { + empty_item_mandatory++; + } + } + if (empty_item_mandatory > 0) { + ok = 1; + _alertString += + "\n- " + empty_item_mandatory + _(" item mandatory fields empty"); } if (ok) { -- 2.39.5