Bug 32946: 'Send list' form in OPAC is misaligned
[koha-ffzg.git] / reports / orders_by_fund.pl
index 7f50e9a..c831bf2 100755 (executable)
@@ -28,23 +28,20 @@ This script displays all orders associated to a selected budget.
 use Modern::Perl;
 
 use CGI qw( -utf8 );
-use C4::Auth;
-use C4::Output;
-use C4::Budgets;
-use C4::Biblio;
-use C4::Reports;
-use C4::Acquisition; #GetBasket()
+use C4::Auth qw( get_template_and_user );
+use C4::Output qw( output_html_with_http_headers );
+use C4::Budgets qw( GetBudgetsReport GetBudgetHierarchy );
+use C4::Acquisition qw( GetBasket get_rounded_price );
+use C4::Context;
 use Koha::Biblios;
-use Koha::DateUtils;
 
-my $query = new CGI;
+my $query = CGI->new;
 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
     {
         template_name   => "reports/orders_by_budget.tt",
         query           => $query,
         type            => "intranet",
         flagsrequired   => { reports => '*' },
-        debug           => 1,
     }
 );
 
@@ -109,9 +106,7 @@ if ( $get_orders ) {
         $order->{'total_rrp'} = get_rounded_price($order->{'quantity'}) * $order->{'rrp'};
         $order->{'total_ecost'} = get_rounded_price($order->{'quantity'}) * $order->{'ecost'};
 
-        # Format the dates and currencies correctly
-        $order->{'datereceived'} = output_pref(dt_from_string($order->{'datereceived'}));
-        $order->{'entrydate'} = output_pref(dt_from_string($order->{'entrydate'}));
+        # Format the currencies correctly
         $total_quantity += $order->{'quantity'};
         $total_rrp += $order->{'total_rrp'};
         $total_ecost += $order->{'total_ecost'};
@@ -134,8 +129,7 @@ if ( $get_orders ) {
     # If we are outputting to a file, create it and exit.
     else {
         my $basename = $params->{"basename"};
-        my $sep = $params->{"sep"};
-        $sep = "\t" if ($sep eq 'tabulation');
+        my $sep = C4::Context->csv_delimiter(scalar $params->{"sep"});
 
         # TODO Use Text::CSV to generate the CSV file
         print $query->header(
@@ -209,7 +203,7 @@ else {
     $template->param(   budgetsloop   => \@{$budgetloop},
         outputFormatloop => \@outputFormats,
         delimiterloop => \@CSVdelimiters,
-        delimiterPreference => C4::Context->preference('delimiter')
+        delimiterPreference => C4::Context->preference('CSVDelimiter')
     );
 }