15 my $serialid = $input->param('serialid');
16 my $op = $input->param('op');
17 my $claimletter = $input->param('claimletter');
18 my $supplierid = $input->param('supplierid');
19 my $suppliername = $input->param('suppliername');
20 my $order = $input->param('order');
21 my %supplierlist = GetSuppliersWithLateIssues
;
24 # open template first (security & userenv set here)
25 my ($template, $loggedinuser, $cookie)
26 = get_template_and_user
({template_name
=> "serials/claims.tmpl",
30 flagsrequired
=> {serials
=> 1},
33 foreach my $supplierid (sort {$supplierlist{$a} cmp $supplierlist{$b} } keys %supplierlist){
34 my ($count, @dummy) = GetLateOrMissingIssues
($supplierid,"",$order);
35 my $counting = $count;
36 $supplierlist{$supplierid} = $supplierlist{$supplierid}." ($counting)";
37 push @select_supplier, $supplierid
39 my $letters = GetLetters
("claimissues");
41 foreach (keys %$letters){
42 push @letters ,{code
=>$_,name
=> $letters->{$_}};
45 my $letter=((scalar(@letters)>1) || ($letters[0]->{name
}||$letters[0]->{code
}));
46 my ($count2, @missingissues);
48 ($count2, @missingissues) = GetLateOrMissingIssues
($supplierid,$serialid,$order);
51 my $CGIsupplier=CGI
::scrolling_list
( -name
=> 'supplierid',
53 -values => \
@select_supplier,
54 -default => $supplierid,
55 -labels
=> \
%supplierlist,
59 my ($singlesupplier,@supplierinfo);
61 (@supplierinfo)=GetBookSeller
($supplierid);
62 } else { # set up supplierid for the claim links out of main table if all suppliers is chosen
63 for my $mi (@missingissues){
64 $mi->{supplierid
} = getsupplierbyserialid
($mi->{serialid
});
69 if($op && $op eq 'preview'){
72 if ($op eq "send_alert"){
73 my @serialnums=$input->param("serialid");
74 SendAlerts
('claimissues',\
@serialnums,$input->param("letter_code"));
75 my $cntupdate=UpdateClaimdateIssues
(\
@serialnums);
76 ### $cntupdate SHOULD be equal to scalar(@$serialnums)
77 $template->param('SHOWCONFIRMATION' => 1);
78 $template->param('suppliername' => $suppliername);
81 $template->param('letters'=>\
@letters,'letter'=>$letter);
84 CGIsupplier
=> $CGIsupplier,
85 phone
=> $supplierinfo[0]->{phone
},
86 booksellerfax
=> $supplierinfo[0]->{booksellerfax
},
87 bookselleremail
=> $supplierinfo[0]->{bookselleremail
},
89 missingissues
=> \
@missingissues,
90 supplierid
=> $supplierid,
91 claimletter
=> $claimletter,
92 singlesupplier
=> $singlesupplier,
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;