Bug 15707: Add Koha::Library::Group(s) modules
[koha.git] / admin / aqbudgets.pl
index 0dce9dd..f106a86 100755 (executable)
@@ -50,9 +50,11 @@ my ($template, $borrowernumber, $cookie, $staffflags ) = get_template_and_user(
 );
 
 my $active_currency = Koha::Acquisition::Currencies->get_active;
-$template->param( symbol => $active_currency->symbol,
-                  currency => $active_currency->currency
-               );
+if ( $active_currency ) {
+    $template->param( symbol => $active_currency->symbol,
+                      currency => $active_currency->currency
+                   );
+}
 
 my $op = $input->param('op') || 'list';
 
@@ -234,7 +236,7 @@ if ( $op eq 'list' ) {
     );
 
     my @budgets = @{
-        GetBudgetHierarchy( $$period{budget_period_id}, C4::Context->userenv->{branch}, ( $show_mine ? $borrower_id : 0 ))
+        GetBudgetHierarchy( $$period{budget_period_id}, undef, ( $show_mine ? $borrower_id : 0 ))
     };
 
     my $period_total = 0;
@@ -245,6 +247,7 @@ if ( $op eq 'list' ) {
     my @budgets_to_display;
     foreach my $budget (@budgets) {
         # PERMISSIONS
+        next unless CanUserUseBudget($borrowernumber, $budget, $staffflags);
         unless(CanUserModifyBudget($borrowernumber, $budget, $staffflags)) {
             $budget->{'budget_lock'} = 1;
         }