cc37c04bf3
Test Case: Check the following files have been updated from use strict; use warnings; to use Modern::Perl; acqui-home.pl addorder.pl basketgroup.pl basketheader.pl booksellers.pl check_budget_total.pl check_duplicate_barcode_ajax.pl edi_ean.pl edifactmsgs.pl edimsg.pl finishreceive.pl histsearch.pl invoice.pl invoices.pl neworderbiblio.pl neworderempty.pl newordersuggestion.pl ordered.pl orderreceive.pl parcel.pl parcels.pl pdfformat/layout2pages.pm pdfformat/layout2pagesde.pm pdfformat/layout3pages.pm pdfformat/layout3pagesfr.pm spent.pl supplier.pl uncertainprice.pl updatesupplier.pl z3950_search.pl Signed-off-by: Owen Leonard <oleonard@myacpl.org> Corrected a single semicolon in edimsg.pl during signoff. Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
136 lines
4.6 KiB
Perl
Executable file
136 lines
4.6 KiB
Perl
Executable file
#!/usr/bin/perl
|
|
|
|
# Copyright 2011 BibLibre SARL
|
|
# 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>.
|
|
|
|
=head1 NAME
|
|
|
|
invoices.pl
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
Search for invoices
|
|
|
|
=cut
|
|
|
|
use Modern::Perl;
|
|
|
|
use CGI qw ( -utf8 );
|
|
use C4::Auth;
|
|
use C4::Output;
|
|
|
|
use C4::Acquisition qw/GetInvoices/;
|
|
use C4::Budgets;
|
|
use Koha::DateUtils;
|
|
use Koha::Acquisition::Booksellers;
|
|
|
|
my $input = CGI->new;
|
|
my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user(
|
|
{
|
|
template_name => 'acqui/invoices.tt',
|
|
query => $input,
|
|
type => 'intranet',
|
|
authnotrequired => 0,
|
|
flagsrequired => { 'acquisition' => '*' },
|
|
debug => 1,
|
|
}
|
|
);
|
|
|
|
my $invoicenumber = $input->param('invoicenumber');
|
|
my $supplierid = $input->param('supplierid');
|
|
my $shipmentdatefrom = $input->param('shipmentdatefrom');
|
|
my $shipmentdateto = $input->param('shipmentdateto');
|
|
my $billingdatefrom = $input->param('billingdatefrom');
|
|
my $billingdateto = $input->param('billingdateto');
|
|
my $isbneanissn = $input->param('isbneanissn');
|
|
my $title = $input->param('title');
|
|
my $author = $input->param('author');
|
|
my $publisher = $input->param('publisher');
|
|
my $publicationyear = $input->param('publicationyear');
|
|
my $branch = $input->param('branch');
|
|
my $message_id = $input->param('message_id');
|
|
my $op = $input->param('op');
|
|
|
|
$shipmentdatefrom and $shipmentdatefrom = eval { dt_from_string( $shipmentdatefrom ) };
|
|
$shipmentdateto and $shipmentdateto = eval { dt_from_string( $shipmentdateto ) };
|
|
$billingdatefrom and $billingdatefrom = eval { dt_from_string( $billingdatefrom ) };
|
|
$billingdateto and $billingdateto = eval { dt_from_string( $billingdateto ) };
|
|
|
|
my $invoices = [];
|
|
if ( $op and $op eq 'do_search' ) {
|
|
@{$invoices} = GetInvoices(
|
|
invoicenumber => $invoicenumber,
|
|
supplierid => $supplierid,
|
|
shipmentdatefrom => $shipmentdatefrom ? output_pref( { str => $shipmentdatefrom, dateformat => 'iso' } ) : undef,
|
|
shipmentdateto => $shipmentdateto ? output_pref( { str => $shipmentdateto, dateformat => 'iso' } ) : undef,
|
|
billingdatefrom => $billingdatefrom ? output_pref( { str => $billingdatefrom, dateformat => 'iso' } ) : undef,
|
|
billingdateto => $billingdateto ? output_pref( { str => $billingdateto, dateformat => 'iso' } ) : undef,
|
|
isbneanissn => $isbneanissn,
|
|
title => $title,
|
|
author => $author,
|
|
publisher => $publisher,
|
|
publicationyear => $publicationyear,
|
|
branchcode => $branch,
|
|
message_id => $message_id,
|
|
);
|
|
}
|
|
|
|
# Build suppliers list
|
|
my @suppliers = Koha::Acquisition::Booksellers->search( undef, { order_by => { -asc => 'name' } } );
|
|
my $suppliers_loop = [];
|
|
my $suppliername;
|
|
foreach (@suppliers) {
|
|
my $selected = 0;
|
|
if ($supplierid && $supplierid == $_->id ) {
|
|
$selected = 1;
|
|
$suppliername = $_->name;
|
|
}
|
|
push @{$suppliers_loop},
|
|
{
|
|
suppliername => $_->name,
|
|
booksellerid => $_->id,
|
|
selected => $selected,
|
|
};
|
|
}
|
|
|
|
my $budgets = GetBudgets();
|
|
my @budgets_loop;
|
|
foreach my $budget (@$budgets) {
|
|
push @budgets_loop, $budget if CanUserUseBudget( $loggedinuser, $budget, $flags );
|
|
}
|
|
|
|
$template->{'VARS'}->{'budgets_loop'} = \@budgets_loop;
|
|
|
|
$template->param(
|
|
do_search => ( $op and $op eq 'do_search' ) ? 1 : 0,
|
|
invoices => $invoices,
|
|
invoicenumber => $invoicenumber,
|
|
booksellerid => $supplierid,
|
|
suppliername => $suppliername,
|
|
shipmentdatefrom => $shipmentdatefrom,
|
|
shipmentdateto => $shipmentdateto,
|
|
billingdatefrom => $billingdatefrom,
|
|
billingdateto => $billingdateto,
|
|
isbneanissn => $isbneanissn,
|
|
title => $title,
|
|
author => $author,
|
|
publisher => $publisher,
|
|
publicationyear => $publicationyear,
|
|
branch => $branch,
|
|
suppliers_loop => $suppliers_loop,
|
|
);
|
|
|
|
output_html_with_http_headers $input, $cookie, $template->output;
|