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