Bug 3969: Fix funds search
authorJonathan Druart <jonathan.druart@biblibre.com>
Tue, 24 Mar 2015 16:30:02 +0000 (17:30 +0100)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Tue, 31 Mar 2015 13:12:44 +0000 (10:12 -0300)
The funds search does not work at all.
On the budget and the budget plan page, the library dropdown list is
empty.

Test plan:
On the budget, the budget plan and the fund pages, confirm that you are
able to search a fund by code (or name) and the library dropdown list is
correctly filled.

Tested with several combinations. Works as expected.
Signed-off-by: Marc VĂ©ron <veron@veron.ch>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Tested various combinations, no problems found.
Passes tests and QA script.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
admin/aqbudgetperiods.pl
admin/aqbudgets.pl
admin/aqplan.pl

index 94f77e7..3731cf6 100755 (executable)
@@ -287,6 +287,8 @@ $url = "aqbudgetperiods.pl?tab=2";
 $url .= "&apage=$activepage" if($activepage != 1);
 my $inactive_pagination_bar = pagination_bar ($url, getnbpages( scalar(@$results), $inactivepagesize), $inactivepage, "ipage");
 
+my $branchloop = C4::Branch::GetBranchesLoop();
+
 my $tab = $input->param('tab') ? $input->param('tab') - 1 : 0;
 $template->param(
     period_active_loop      => \@period_active_loop,
@@ -294,6 +296,7 @@ $template->param(
     active_pagination_bar   => $active_pagination_bar,
     inactive_pagination_bar => $inactive_pagination_bar,
     tab                     => $tab,
+    branchloop              => $branchloop,
 );
 
 $template->param($op=>1);
index f1c2f39..0cf3c61 100755 (executable)
@@ -100,16 +100,7 @@ $template->param(
 
 my $budget;
 
-my $branches = GetBranches($show_mine);
-my @branchloop2;
-foreach my $thisbranch (keys %$branches) {
-    my %row = (
-        value      => $thisbranch,
-        branchname => $branches->{$thisbranch}->{'branchname'},
-    );
-    $row{selected} = 1 if $thisbranch eq $filter_budgetbranch;
-    push @branchloop2, \%row;
-}
+my $branchloop = C4::Branch::GetBranchesLoop($filter_budgetbranch);
 
 $template->param(auth_cats_loop => GetBudgetAuthCats( $budget_period_id ))
     if $budget_period_id;
@@ -284,6 +275,7 @@ if ( $op eq 'list' ) {
 
        #This Looks WEIRD to me : should budgets be filtered in such a way ppl who donot own it would not see the amount spent on the budget by others ?
 
+    my @budgets_to_display;
     foreach my $budget (@budgets) {
         # PERMISSIONS
         unless(CanUserModifyBudget($borrowernumber, $budget, $staffflags)) {
@@ -335,6 +327,7 @@ if ( $op eq 'list' ) {
         $budget->{budget_hierarchy} = \@budget_hierarchy;
 
         $budget->{budget_has_children} = BudgetHasChildren( $budget->{budget_id} );
+        push @budgets_to_display, $budget;
     }
 
     my $budget_period_total = $period->{budget_period_total};
@@ -343,14 +336,15 @@ if ( $op eq 'list' ) {
 
     $template->param(
         op                     => 'list',
-        budgets                => \@budgets,
+        budgets                => \@budgets_to_display,
         periods                => $periods,
         budget_period_total    => $budget_period_total,
         period_alloc_total     => $period_alloc_total,
         spent_total            => $spent_total,
         ordered_total          => $ordered_total,
         available_total        => $available_total,
-        branchloop             => \@branchloop2,
+        branchloop             => $branchloop,
+        filter_budgetname      => $filter_budgetname,
     );
 
 } #---- END list
index dda1d21..bdd5dda 100755 (executable)
@@ -400,6 +400,7 @@ if ( $output eq "file" ) {
     exit(1);
 }
 
+my $branchloop = C4::Branch::GetBranchesLoop();
 $template->param(
     authvals_row              => \@authvals_row,
     budget_lines              => \@budget_lines,
@@ -415,7 +416,8 @@ $template->param(
     CGIsepChoice              => $CGIsepChoice,
 
     authvals              => \@authvals_row,
-    hide_cols_loop              => \@hide_cols
+    hide_cols_loop              => \@hide_cols,
+    branchloop                => $branchloop,
 );
 
 output_html_with_http_headers $input, $cookie, $template->output;