Koha/acqui/lateorders-export.pl
Maryse Simard e4860aeeed
Bug 12502: (follow-up) Use modal to add/edit order notes
Replace inputs to edit notes by a link opening a modal, similar
to the basket summary page. This makes it possible for the notes
to appear in the datatable exports.

Also fix exporting with the export as csv button at the bottom
of the page to export notes.

Test plan :
1) In the late orders table (acqui/lateorders.pl), a link should
appear in both the internal and vendor note column, following the
current value if it exist.
    -> This link should read "Add ..." if there is no existing note
    or "Edit ..." if there is.
2) Click on the link. A modal should appear. Confirm that saving a
note works as expected.
3) Try exporting to any format using either the button at the top
of the table or the one at the bottom of the page.
    -> The three new columns and their values should appear in the
    export.

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-20 16:37:21 +00:00

70 lines
2.3 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 qw ( -utf8 );
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->multi_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},
internalnote => $order->{order_internalnote},
vendornote => $order->{order_vendornote},
isbn => $order->{isbn},
}
;
}
print $input->header(
-type => 'text/csv',
-attachment => 'lateorders.csv',
);
$template->param( orders => \@orders );
for my $line ( split '\n', $template->output ) {
print "$line\n" unless $line =~ m|^\s*$|;
}