Bug 8255: allow local cover images to be cached
[koha_gimpoz] / acqui / acqui-home.pl
index 45a04bf..69482a8 100755 (executable)
@@ -38,6 +38,7 @@ use C4::Budgets;
 use C4::Members;
 use C4::Branch;
 use C4::Debug;
+use C4::Suggestions;
 
 my $query = CGI->new;
 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
@@ -74,9 +75,12 @@ if ( $cur_format eq 'FR' ) {
     );
 }
 
+my $status           = $query->param('status') || "ASKED";
+my $suggestions_count       = CountSuggestion($status);
+
 my $budget_arr =
   GetBudgetHierarchy( '', $user->{branchcode},
-    $template->{param_map}->{'USER_INFO'}[0]->{'borrowernumber'} );
+    $template->{VARS}->{'USER_INFO'}[0]->{'borrowernumber'} );
 
 my $total      = 0;
 my $totspent   = 0;
@@ -84,6 +88,11 @@ my $totordered = 0;
 my $totcomtd   = 0;
 my $totavail   = 0;
 
+my $total_active        = 0;
+my $totspent_active     = 0;
+my $totordered_active   = 0;
+my $totavail_active     = 0;
+
 foreach my $budget ( @{$budget_arr} ) {
 
     $budget->{budget_code_indent} =~ s/\ /\&nbsp\;/g;
@@ -117,13 +126,19 @@ foreach my $budget ( @{$budget_arr} ) {
     $totordered += $budget->{'budget_ordered'};
     $totavail   += $budget->{'budget_avail'};
 
+    if ($budget->{budget_period_active}){
+       $total_active      += $budget->{'budget_amount'};
+       $totspent_active   += $budget->{'budget_spent'};
+       $totordered_active += $budget->{'budget_ordered'};
+       $totavail_active   += $budget->{'budget_avail'};    
+    }
+
     for my $field (qw( budget_amount budget_spent budget_ordered budget_avail ) ) {
         $budget->{$field} = $num_formatter->format_price( $budget->{$field} );
     }
 }
 
 $template->param(
-
     type          => 'intranet',
     loop_budget   => $budget_arr,
     branchname    => $branchname,
@@ -132,6 +147,11 @@ $template->param(
     totordered    => $num_formatter->format_price($totordered),
     totcomtd      => $num_formatter->format_price($totcomtd),
     totavail      => $num_formatter->format_price($totavail),
+    total_active  => $num_formatter->format_price($total_active),
+    totspent_active     => $num_formatter->format_price($totspent_active),
+    totordered_active   => $num_formatter->format_price($totordered_active),
+    totavail_active     => $num_formatter->format_price($totavail_active),
+    suggestions_count   => $suggestions_count,
 );
 
 output_html_with_http_headers $query, $cookie, $template->output;