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