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
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.
27 use C4
::Bookseller
qw( GetBookSeller );
30 use C4
::Branch
; # GetBranches GetBranchesLoop
31 use C4
::Csv
qw( GetCsvProfiles );
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');
41 # open template first (security & userenv set here)
42 my ($template, $loggedinuser, $cookie)
43 = get_template_and_user
({template_name
=> 'serials/claims.tt',
47 flagsrequired
=> {serials
=> 'claim_serials'},
51 # supplierlist is returned in name order
52 my $supplierlist = GetSuppliersWithLateIssues
();
53 for my $s (@
{$supplierlist} ) {
54 $s->{count
} = scalar GetLateOrMissingIssues
($s->{id
});
55 if ($supplierid && $s->{id
} == $supplierid) {
60 my $branchloop = GetBranchesLoop
();
63 if($op && $op eq 'preview'){
66 my @serialnums=$input->param('serialid');
67 if (@serialnums) { # i.e. they have been flagged to generate claims
70 $err = SendAlerts
('claimissues',\
@serialnums,$input->param("letter_code"));
71 if ( not ref $err or not exists $err->{error
} ) {
72 UpdateClaimdateIssues
(\
@serialnums);
76 $template->param(error_claim
=> $@
);
77 } elsif ( ref $err and exists $err->{error
} ) {
78 if ( $err->{error
} eq "no_email" ) {
79 $template->param( error_claim
=> 'no_vendor_email' );
80 } elsif ( $err->{error
} =~ m
|Bad
or missing From address
| ) {
81 $template->param( error_claim
=> 'no_loggedin_user_email' );
84 $template->param( info_claim
=> 1 );
89 my $letters = GetLetters
({ module
=> 'claimissues' });
94 @missingissues = GetLateOrMissingIssues
($supplierid);
95 @supplierinfo=GetBookSeller
($supplierid);
99 suploop
=> $supplierlist,
100 phone
=> $supplierinfo[0]->{phone
},
101 booksellerfax
=> $supplierinfo[0]->{booksellerfax
},
102 bookselleremail
=> $supplierinfo[0]->{bookselleremail
},
104 missingissues
=> \
@missingissues,
105 supplierid
=> $supplierid,
106 claimletter
=> $claimletter,
107 supplierloop
=> \
@supplierinfo,
108 branchloop
=> $branchloop,
109 csv_profiles
=> C4
::Csv
::GetCsvProfiles
( "sql" ),
111 (uc(C4
::Context
->preference("marcflavour"))) => 1
113 output_html_with_http_headers
$input, $cookie, $template->output;