From 1584f469b06bfcdc20030ee14956e945ce9e31a5 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 2 Apr 2018 12:56:21 -0300 Subject: [PATCH] Bug 20426: Fix default fund value when adding orders from iso2709 file A new bug has been highlighted since: commit b830349f45007629f141a9835e05b95f90ee4b92 Bug 19453: Incorrect jQuery selector for fund drop down validation Prior to bug 19453 the check on the existence of the fund did not work as expected, no select with name='budget_code' existed and the error was never raised. Now it works but expect a fund to be selected for every record to import. This check must only be done if there is no default value selected. Test plan: - Create an order from a staged file - Do not select any funds => You must get a warning - Select a specific fund for some of the records => You must get a warning - Select a default fund in the last tab => You must not get a warning and the records must be imported and inserted with the correct fund Signed-off-by: Sonia Bouis Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart Conflicts: koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt Signed-off-by: Nick Clemens --- .../prog/en/modules/acqui/addorderiso2709.tt | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) 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 42bb4efa7e..3c29b3dbc3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt @@ -137,15 +137,18 @@ return false; } - var error = 0; - $("select[name='budget_id']").each(function() { - if (!$(this).val()) { - error++; + if (! $("#all_budget_id").val() ) { + // If there is no default fund + var error = 0; + $("select[name='budget_id']").each(function() { + if (!$(this).val()) { + error++; + } + }); + if ( error > 0 ) { + alert(_("Some budgets are not defined in item records")); + return false; } - }); - if ( error > 0 ) { - alert(_("Some budgets are not defined in item records")); - return false; } return disableUnchecked($(this)); -- 2.39.5