Koha/acqui/lateorders-export.pl
Jonathan Druart 43adbda007 Bug 7298: (follow-up) various QA fixes
- use Modern::Perl;
- GPL version
- tabs

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes QA script and all tests.

Testing notes:
- CSV header row is now translatable.
  Tested by updating the German po files and checking for the line.
- Tested that claiming for late serial issues still works as
  expected, as one file has been renamed. Filed 10931 for
  untranslatable CSV contents.
- Tested that claiming late orders still works:
  * Table searching and sorting
    Works nicely, but some columns could be split up for better
    searching and sorting:
      * Order date: 20/01/2013 (245 days)
      * Total cost:     10.00x1 = 10.00 Books
        => item type should be separate
      * Basket:  10 MPL
        => Library and basket number could be separate columns
  * Filters
     * Combined various filters, search results look correct.
  * Selecting order for claiming
      * Limiting by vendor makes it possible to check/uncheck all
      * With no vendor limit, entries for other vendors will be
        locked after the first checkbox is checked for one vendor
  * Exporting as CSV
     * Exported single line > CSV appears correct.
     * Exporting multiple lines > CSV appears correct.
     PROBLEM: Translated CSV don't work correctly, as line
     breaks are lost in the translation process.
     Needs to be fixed in a follow-up.
  * Sending serial claim email
     * No regressions found - there are some problems with the
       email contents noted on bug 7298.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-31 15:51:25 +00:00

65 lines
2.1 KiB
Perl
Executable file

#!/usr/bin/perl
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# Koha is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
use Modern::Perl;
use CGI;
use C4::Auth;
use C4::Acquisition;
use C4::Output;
use C4::Context;
my $input = new CGI;
my ($template, $loggedinuser, $cookie) = get_template_and_user({
template_name => "acqui/csv/lateorders.tt",
query => $input,
type => "intranet",
authnotrequired => 0,
flagsrequired => {acquisition => 'order_receive'},
});
my @ordernumbers = $input->param('ordernumber');
my @orders;
for my $ordernumber ( @ordernumbers ) {
my $order = GetOrder $ordernumber;
push @orders, {
orderdate => $order->{orderdate},
latesince => $order->{latesince},
estimateddeliverydate => $order->{estimateddeliverydate},
supplier => $order->{supplier},
supplierid => $order->{supplierid},
title => $order->{title},
author => $order->{author},
publisher => $order->{publisher},
unitpricesupplier => $order->{unitpricesupplier},
quantity_to_receive => $order->{quantity_to_receive},
subtotal => $order->{subtotal},
budget => $order->{budget},
basketname => $order->{basketname},
basketno => $order->{basketno},
claims_count => $order->{claims_count},
claimed_date => $order->{claimed_date},
}
;
}
print $input->header(
-type => 'text/csv',
-attachment => 'lateorders.csv',
);
$template->param( orders => \@orders );
print $template->output;