Bug 15009 - Planning dropdown button in aqbudget can have empty line

When displaying a budget, the Planning button in the admin toolbar displays

Plan by months
Plan by libraries
Plan by item types
Plan by

The last one is empty, due to C4::Budgets::GetBudgetAuthCats returning an empty field if the budget has no sort defined.
This prevents returning an array with empty element(s)

TEST:
1) Admin -> Budgets
2) Select a budget
   a) you must have '' (empty) in your aqbudgets.sort1_authcat field.
   b) edit the budget (direct DB or interface) to get that.
3) Click on Planning dropdown, see the "Plan by <nothing> " entry.
4) apply the patch, revalidate.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

No more empty option
No errors

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit b8076d8ec7)
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
This commit is contained in:
Blou 2015-10-13 16:12:49 -04:00 committed by Julian Maurice
parent 1ccf956b53
commit 76aba15a35
1 changed files with 2 additions and 2 deletions

View File

@ -411,8 +411,8 @@ sub GetBudgetAuthCats {
$sth->execute($budget_period_id);
my %authcats;
while (my ($sort1_authcat,$sort2_authcat) = $sth->fetchrow) {
$authcats{$sort1_authcat}=1;
$authcats{$sort2_authcat}=1;
$authcats{$sort1_authcat}=1 if $sort1_authcat;
$authcats{$sort2_authcat}=1 if $sort2_authcat;
}
my @auth_cats_loop;
foreach (sort keys %authcats) {