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 $order = $input->param('order');
20 my %supplierlist = GetSuppliersWithLateIssues
;
23 # open template first (security & userenv set here)
24 my ($template, $loggedinuser, $cookie)
25 = get_template_and_user
({template_name
=> "serials/claims.tmpl",
29 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
40 my $letters = GetLetters
("claimissues");
42 foreach (keys %$letters){
43 push @letters ,{code
=>$_,name
=> $letters->{$_}};
46 my $letter=((scalar(@letters)>1) || ($letters[0]->{name
}||$letters[0]->{code
}));
47 my ($count2, @missingissues) = GetLateOrMissingIssues
($supplierid,$serialid,$order) if $supplierid;
49 my $CGIsupplier=CGI
::scrolling_list
( -name
=> 'supplierid',
51 -values => \
@select_supplier,
52 -default => $supplierid,
53 -labels
=> \
%supplierlist,
57 my ($singlesupplier,@supplierinfo);
59 (@supplierinfo)=GetBookSeller
($supplierid);
60 } else { # set up supplierid for the claim links out of main table if all suppliers is chosen
61 for(my $i=0; $i<@missingissues;$i++){
62 $missingissues[$i]->{'supplierid'} = getsupplierbyserialid
($missingissues[$i]->{'serialid'});
71 if ($op eq "send_alert"){
72 my @serialnums=$input->param("serialid");
73 SendAlerts
('claimissues',\
@serialnums,$input->param("letter_code"));
74 my $cntupdate=UpdateClaimdateIssues
(\
@serialnums);
75 ### $cntupdate SHOULD be equal to scalar(@$serialnums)
78 $template->param('letters'=>\
@letters,'letter'=>$letter);
81 CGIsupplier
=> $CGIsupplier,
82 phone
=> $supplierinfo[0]->{phone
},
83 booksellerfax
=> $supplierinfo[0]->{booksellerfax
},
84 bookselleremail
=> $supplierinfo[0]->{bookselleremail
},
86 missingissues
=> \
@missingissues,
87 supplierid
=> $supplierid,
88 claimletter
=> $claimletter,
89 singlesupplier
=> $singlesupplier,
90 supplierloop
=> \
@supplierinfo,
91 dateformat
=> C4
::Context
->preference("dateformat"),
93 output_html_with_http_headers
$input, $cookie, $template->output;