3 # This file is part of Koha.
5 # Koha is free software; you can redistribute it and/or modify it under the
6 # terms of the GNU General Public License as published by the Free Software
7 # Foundation; either version 2 of the License, or (at your option) any later
10 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License along
15 # with Koha; if not, write to the Free Software Foundation, Inc.,
16 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
30 my $serialid = $input->param('serialid');
31 my $op = $input->param('op');
32 my $claimletter = $input->param('claimletter');
33 my $supplierid = $input->param('supplierid');
34 my $suppliername = $input->param('suppliername');
35 my $order = $input->param('order');
36 my $supplierlist = GetSuppliersWithLateIssues();
38 foreach my $s ( @{$supplierlist} ) {
39 if ($s->{id} == $supplierid ) {
46 # open template first (security & userenv set here)
47 my ($template, $loggedinuser, $cookie)
48 = get_template_and_user({template_name => 'serials/claims.tmpl',
52 flagsrequired => {serials => 'claim_serials'},
57 for ( sort {$supplierlist{$a} cmp $supplierlist{$b} } keys %supplierlist ) {
58 my ($count, @dummy) = GetLateOrMissingIssues($_, "", $order);
61 name => $supplierlist{$_},
63 selected => $_ == $supplierid,
67 my $letters = GetLetters('claimissues');
69 foreach (keys %{$letters}){
70 push @letters ,{code=>$_,name=> $letters->{$_}};
73 my $letter=((scalar(@letters)>1) || ($letters[0]->{name}||$letters[0]->{code}));
77 @missingissues = GetLateOrMissingIssues($supplierid,$serialid,$order);
78 @supplierinfo=GetBookSeller($supplierid);
82 if($op && $op eq 'preview'){
85 my @serialnums=$input->param('serialid');
86 if (@serialnums) { # i.e. they have been flagged to generate claims
87 SendAlerts('claimissues',\@serialnums,$input->param("letter_code"));
88 my $cntupdate=UpdateClaimdateIssues(\@serialnums);
89 ### $cntupdate SHOULD be equal to scalar(@$serialnums)
92 $template->param('letters'=>\@letters,'letter'=>$letter);
96 phone => $supplierinfo[0]->{phone},
97 booksellerfax => $supplierinfo[0]->{booksellerfax},
98 bookselleremail => $supplierinfo[0]->{bookselleremail},
100 missingissues => \@missingissues,
101 supplierid => $supplierid,
102 claimletter => $claimletter,
103 supplierloop => \@supplierinfo,
104 dateformat => C4::Context->preference("dateformat"),
105 DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
107 output_html_with_http_headers $input, $cookie, $template->output;