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 => 1},
57 my $letters = GetLetters('claimissues');
59 foreach (keys %{$letters}){
60 push @letters ,{code=>$_,name=> $letters->{$_}};
63 my $letter=((scalar(@letters)>1) || ($letters[0]->{name}||$letters[0]->{code}));
67 @missingissues = GetLateOrMissingIssues($supplierid,$serialid,$order);
68 @supplierinfo=GetBookSeller($supplierid);
72 if($op && $op eq 'preview'){
75 my @serialnums=$input->param('serialid');
76 if (@serialnums) { # i.e. they have been flagged to generate claims
77 SendAlerts('claimissues',\@serialnums,$input->param("letter_code"));
78 my $cntupdate=UpdateClaimdateIssues(\@serialnums);
79 ### $cntupdate SHOULD be equal to scalar(@$serialnums)
82 $template->param('letters'=>\@letters,'letter'=>$letter);
85 supplier_loop => $supplierlist,
86 phone => $supplierinfo[0]->{phone},
87 booksellerfax => $supplierinfo[0]->{booksellerfax},
88 bookselleremail => $supplierinfo[0]->{bookselleremail},
90 missingissues => \@missingissues,
91 supplierid => $supplierid,
92 claimletter => $claimletter,
93 supplierloop => \@supplierinfo,
94 dateformat => C4::Context->preference("dateformat"),
95 DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
97 output_html_with_http_headers $input, $cookie, $template->output;