|
Lines 50-55
BEGIN {
Link Here
|
| 50 |
GetBorrowersToExpunge |
50 |
GetBorrowersToExpunge |
| 51 |
|
51 |
|
| 52 |
IssueSlip |
52 |
IssueSlip |
|
|
53 |
&FineSlip |
| 53 |
|
54 |
|
| 54 |
checkuserpassword |
55 |
checkuserpassword |
| 55 |
get_cardnumber_length |
56 |
get_cardnumber_length |
|
Lines 684-689
WHERE borrowernumber = 0 AND DATEDIFF( NOW(), timestamp ) > ?|;
Link Here
|
| 684 |
return $cnt eq '0E0'? 0: $cnt; |
685 |
return $cnt eq '0E0'? 0: $cnt; |
| 685 |
} |
686 |
} |
| 686 |
|
687 |
|
|
|
688 |
sub GetBorrowerFines { |
| 689 |
my ($borrowernumber) = @_; |
| 690 |
my $dbh = C4::Context->dbh; |
| 691 |
my $query = qq{ |
| 692 |
SELECT * FROM accountlines |
| 693 |
LEFT JOIN borrowers ON borrowers.borrowernumber = accountlines.borrowernumber |
| 694 |
LEFT JOIN items ON accountlines.itemnumber = items.itemnumber |
| 695 |
WHERE accountlines.borrowernumber = ? |
| 696 |
ORDER BY accountlines.timestamp |
| 697 |
}; |
| 698 |
my $sth = $dbh->prepare( $query ); |
| 699 |
$sth->execute( $borrowernumber ); |
| 700 |
my $data = $sth->fetchall_arrayref({}); |
| 701 |
return $data; |
| 702 |
} |
| 703 |
|
| 704 |
sub FineSlip { |
| 705 |
my ($borrowernumber, $branch) = @_; |
| 706 |
|
| 707 |
#my $now = POSIX::strftime("%Y-%m-%d", localtime); |
| 708 |
|
| 709 |
my $issueslist = GetBorrowerFines($borrowernumber); |
| 710 |
|
| 711 |
my $total = 0.0; |
| 712 |
|
| 713 |
foreach my $it (@$issueslist){ |
| 714 |
my $dt = dt_from_string( $it->{'date'} ); |
| 715 |
$it->{'date_due'} = output_pref({ dt => $dt, dateonly => 1 }); |
| 716 |
$it->{'amount'} = sprintf('%.2f', $it->{'amount'}); |
| 717 |
$total = $total + $it->{'amount'}; |
| 718 |
$it->{'barcode'} = '-' if (!defined($it->{'barcode'})); |
| 719 |
} |
| 720 |
my @issues = sort { $b->{'timestamp'} <=> $a->{'timestamp'} } @$issueslist; |
| 721 |
|
| 722 |
my %repeat = ( |
| 723 |
'fines' => [ map { |
| 724 |
'fines' => $_, |
| 725 |
'borrowers' => $_, |
| 726 |
'items' => $_ |
| 727 |
}, @issues ], |
| 728 |
); |
| 729 |
|
| 730 |
return C4::Letters::GetPreparedLetter ( |
| 731 |
module => 'circulation', |
| 732 |
letter_code => 'FINESLIP', |
| 733 |
branchcode => $branch, |
| 734 |
tables => { |
| 735 |
'branches' => $branch, |
| 736 |
'borrowers' => $borrowernumber, |
| 737 |
}, |
| 738 |
substitute => { |
| 739 |
'total.amount' => sprintf('%.2f', $total), |
| 740 |
'total.fines' => scalar(@issues) |
| 741 |
}, |
| 742 |
repeat => \%repeat, |
| 743 |
message_transport_type => 'print', |
| 744 |
); |
| 745 |
} |
| 746 |
|
| 687 |
END { } # module clean-up code here (global destructor) |
747 |
END { } # module clean-up code here (global destructor) |
| 688 |
|
748 |
|
| 689 |
1; |
749 |
1; |