Lines 100-105
BEGIN {
Link Here
|
100 |
&GetMessagesCount |
100 |
&GetMessagesCount |
101 |
|
101 |
|
102 |
&IssueSlip |
102 |
&IssueSlip |
|
|
103 |
&FineSlip |
103 |
GetBorrowersWithEmail |
104 |
GetBorrowersWithEmail |
104 |
|
105 |
|
105 |
HasOverdues |
106 |
HasOverdues |
Lines 2394-2399
sub IssueSlip {
Link Here
|
2394 |
); |
2395 |
); |
2395 |
} |
2396 |
} |
2396 |
|
2397 |
|
|
|
2398 |
|
2399 |
sub GetBorrowerFines { |
2400 |
my ($borrowernumber) = @_; |
2401 |
my $dbh = C4::Context->dbh; |
2402 |
my $query = qq{ |
2403 |
SELECT * FROM accountlines |
2404 |
LEFT JOIN borrowers ON borrowers.borrowernumber = accountlines.borrowernumber |
2405 |
LEFT JOIN items ON accountlines.itemnumber = items.itemnumber |
2406 |
WHERE accountlines.borrowernumber = ? |
2407 |
ORDER BY accountlines.timestamp |
2408 |
}; |
2409 |
my $sth = $dbh->prepare( $query ); |
2410 |
$sth->execute( $borrowernumber ); |
2411 |
my $data = $sth->fetchall_arrayref({}); |
2412 |
return $data; |
2413 |
} |
2414 |
|
2415 |
sub FineSlip { |
2416 |
my ($borrowernumber, $branch) = @_; |
2417 |
|
2418 |
#my $now = POSIX::strftime("%Y-%m-%d", localtime); |
2419 |
|
2420 |
my $issueslist = GetBorrowerFines($borrowernumber); |
2421 |
|
2422 |
my $total = 0.0; |
2423 |
|
2424 |
foreach my $it (@$issueslist){ |
2425 |
my $dt = dt_from_string( $it->{'date'} ); |
2426 |
$it->{'date_due'} = output_pref({ dt => $dt, dateonly => 1 }); |
2427 |
$it->{'amount'} = sprintf('%.2f', $it->{'amount'}); |
2428 |
$total = $total + $it->{'amount'}; |
2429 |
$it->{'barcode'} = '-' if (!defined($it->{'barcode'})); |
2430 |
} |
2431 |
my @issues = sort { $b->{'timestamp'} <=> $a->{'timestamp'} } @$issueslist; |
2432 |
|
2433 |
my %repeat = ( |
2434 |
'fines' => [ map { |
2435 |
'fines' => $_, |
2436 |
'borrowers' => $_, |
2437 |
'items' => $_ |
2438 |
}, @issues ], |
2439 |
); |
2440 |
|
2441 |
return C4::Letters::GetPreparedLetter ( |
2442 |
module => 'circulation', |
2443 |
letter_code => 'FINESLIP', |
2444 |
branchcode => $branch, |
2445 |
tables => { |
2446 |
'branches' => $branch, |
2447 |
'borrowers' => $borrowernumber, |
2448 |
}, |
2449 |
substitute => { |
2450 |
'total.amount' => sprintf('%.2f', $total), |
2451 |
'total.fines' => scalar(@issues) |
2452 |
}, |
2453 |
repeat => \%repeat, |
2454 |
message_transport_type => 'print', |
2455 |
); |
2456 |
} |
2457 |
|
2458 |
|
2397 |
=head2 GetBorrowersWithEmail |
2459 |
=head2 GetBorrowersWithEmail |
2398 |
|
2460 |
|
2399 |
([$borrnum,$userid], ...) = GetBorrowersWithEmail('me@example.com'); |
2461 |
([$borrnum,$userid], ...) = GetBorrowersWithEmail('me@example.com'); |