From 800b7be9b500419c7e154888374369edb851b943 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 2 Apr 2014 13:28:57 +0200 Subject: [PATCH] Bug 12019: If a fund has a restriction, a owner is mandatory The C4::Budgets::CanUserUseBudget assumes that budget_owner_id is set if a restriction (budget_permission) exists. see && $budget->{budget_owner_id} && $budget->{budget_owner_id} != $borrower->{borrowernumber} Test plan: Edit a fund and try to save it with a limitation and no owner. It should not be possible. Signed-off-by: marjorie barry-vila --- .../prog/en/modules/admin/aqbudgets.tt | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt index aba7bd6..25a85cf 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt @@ -132,6 +132,14 @@ var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") _alertString += result; } + // If a restriction is defined, an owner should be defined too. + if ( $("#budget_permission").val() > 0 ) { + var budget_owner_id = $("#budget_owner_id").val(); + if ( budget_owner_id == 0 || budget_owner_id.length <= 0 ) { + _alertString += _("- If a restriction is defined, you must define an owner for this fund.") + } + } + if (_alertString.length==0) { document.Aform.submit(); } else { -- 1.7.2.5