Bug 12844: Remove the C4::Output::FormatNumber subroutine
[koha.git] / serials / claims.pl
blobbfe5a0f376acd629e227323daec9287f3b37e3a5
1 #!/usr/bin/perl
3 # Parts Copyright 2010 Biblibre
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 2 of the License, or (at your option) any later
10 # version.
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along
17 # with Koha; if not, write to the Free Software Foundation, Inc.,
18 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 use strict;
21 use warnings;
22 use CGI;
23 use C4::Auth;
24 use C4::Serials;
25 use C4::Acquisition;
26 use C4::Output;
27 use C4::Bookseller qw( GetBookSeller );
28 use C4::Context;
29 use C4::Letters;
30 use C4::Branch; # GetBranches GetBranchesLoop
31 use C4::Csv qw( GetCsvProfiles );
33 my $input = CGI->new;
35 my $serialid = $input->param('serialid');
36 my $op = $input->param('op');
37 my $claimletter = $input->param('claimletter');
38 my $supplierid = $input->param('supplierid');
39 my $suppliername = $input->param('suppliername');
40 my $order = $input->param('order');
42 # open template first (security & userenv set here)
43 my ($template, $loggedinuser, $cookie)
44 = get_template_and_user({template_name => 'serials/claims.tt',
45 query => $input,
46 type => 'intranet',
47 authnotrequired => 0,
48 flagsrequired => {serials => 'claim_serials'},
49 debug => 1,
50 });
52 # supplierlist is returned in name order
53 my $supplierlist = GetSuppliersWithLateIssues();
54 for my $s (@{$supplierlist} ) {
55 $s->{count} = scalar GetLateOrMissingIssues($s->{id}, q{}, $order);
56 if ($supplierid && $s->{id} == $supplierid) {
57 $s->{selected} = 1;
61 my $letters = GetLetters({ module => 'claimissues' });
63 my @missingissues;
64 my @supplierinfo;
65 if ($supplierid) {
66 @missingissues = GetLateOrMissingIssues($supplierid,$serialid,$order);
67 @supplierinfo=GetBookSeller($supplierid);
70 my $branchloop = GetBranchesLoop();
72 my $preview=0;
73 if($op && $op eq 'preview'){
74 $preview = 1;
75 } else {
76 my @serialnums=$input->param('serialid');
77 if (@serialnums) { # i.e. they have been flagged to generate claims
78 SendAlerts('claimissues',\@serialnums,$input->param("letter_code"));
79 my $cntupdate=UpdateClaimdateIssues(\@serialnums);
80 ### $cntupdate SHOULD be equal to scalar(@$serialnums)
84 $template->param(
85 order =>$order,
86 suploop => $supplierlist,
87 phone => $supplierinfo[0]->{phone},
88 booksellerfax => $supplierinfo[0]->{booksellerfax},
89 bookselleremail => $supplierinfo[0]->{bookselleremail},
90 preview => $preview,
91 missingissues => \@missingissues,
92 supplierid => $supplierid,
93 claimletter => $claimletter,
94 supplierloop => \@supplierinfo,
95 branchloop => $branchloop,
96 csv_profiles => C4::Csv::GetCsvProfiles( "sql" ),
97 letters => $letters,
98 (uc(C4::Context->preference("marcflavour"))) => 1
100 output_html_with_http_headers $input, $cookie, $template->output;