From 62c99195157829ce31e87f7b05eb294c297d43b5 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 --- .../prog/en/modules/acqui/addorderiso2709.tt | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 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 d679a5bd47..1e9e91815a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt @@ -551,15 +551,19 @@ 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)); @@ -588,4 +592,4 @@ [% END %] -[% INCLUDE 'intranet-bottom.inc' %] \ No newline at end of file +[% INCLUDE 'intranet-bottom.inc' %] -- 2.39.5