From 84e83c86f36f4c2d52ab0e748d521baa5c6b7307 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 --- .../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 d679a5b..1e9e918 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.7.4