|
Lines 101-106
BEGIN {
Link Here
|
| 101 |
&GetMessagesCount |
101 |
&GetMessagesCount |
| 102 |
|
102 |
|
| 103 |
&IssueSlip |
103 |
&IssueSlip |
|
|
104 |
&CheckInSlip |
| 104 |
GetBorrowersWithEmail |
105 |
GetBorrowersWithEmail |
| 105 |
|
106 |
|
| 106 |
HasOverdues |
107 |
HasOverdues |
|
Lines 2405-2410
sub IssueSlip {
Link Here
|
| 2405 |
); |
2406 |
); |
| 2406 |
} |
2407 |
} |
| 2407 |
|
2408 |
|
|
|
2409 |
=head2 GetTodaysReturnsForBorrower |
| 2410 |
|
| 2411 |
$returns = GetTodaysReturnsForBorrower($borrowernumber, $branch); |
| 2412 |
|
| 2413 |
Return a list of items borrower has checked-in today in branch. |
| 2414 |
|
| 2415 |
=cut |
| 2416 |
|
| 2417 |
sub GetTodaysReturnsForBorrower { |
| 2418 |
my ($borrowernumber, $branch) = @_; |
| 2419 |
my $dbh = C4::Context->dbh; |
| 2420 |
my $date = POSIX::strftime("%Y-%m-%d",localtime()); |
| 2421 |
|
| 2422 |
my $query = " |
| 2423 |
SELECT itemnumber |
| 2424 |
FROM old_issues |
| 2425 |
WHERE DATE(returndate) = ? |
| 2426 |
AND borrowernumber = ? |
| 2427 |
AND branchcode = ? |
| 2428 |
"; |
| 2429 |
|
| 2430 |
my $sth = $dbh->prepare($query); |
| 2431 |
$sth->execute($date, $borrowernumber, $branch); |
| 2432 |
my @results; |
| 2433 |
|
| 2434 |
while ( my $data = $sth->fetchrow_hashref ) { |
| 2435 |
my $bibdata = GetBiblioFromItemNumber($data->{itemnumber}); |
| 2436 |
push @results, $bibdata; |
| 2437 |
} |
| 2438 |
return \@results; |
| 2439 |
} |
| 2440 |
|
| 2441 |
=head2 CheckInSlip |
| 2442 |
|
| 2443 |
$letter = CheckInSlip($borrowernumber, $branch [, $message_transport_type ] ); |
| 2444 |
|
| 2445 |
Returns the prepared letter data for items patron checked-in today in branch. |
| 2446 |
message_transport_type defaults to 'print'. |
| 2447 |
|
| 2448 |
=cut |
| 2449 |
|
| 2450 |
sub CheckInSlip { |
| 2451 |
my ($borrowernumber, $branch, $mtt) = @_; |
| 2452 |
my $issues = GetTodaysReturnsForBorrower($borrowernumber, $branch); |
| 2453 |
my %repeat = ( |
| 2454 |
'checkedin' => [ map { |
| 2455 |
'biblio' => $_, |
| 2456 |
'items' => $_, |
| 2457 |
'issues' => $_, |
| 2458 |
}, @$issues ], |
| 2459 |
); |
| 2460 |
|
| 2461 |
return C4::Letters::GetPreparedLetter ( |
| 2462 |
module => 'circulation', |
| 2463 |
letter_code => 'CHECKINSLIP', |
| 2464 |
branchcode => $branch, |
| 2465 |
tables => { |
| 2466 |
'branches' => $branch, |
| 2467 |
'borrowers' => $borrowernumber, |
| 2468 |
}, |
| 2469 |
repeat => \%repeat, |
| 2470 |
message_transport_type => $mtt || 'print', |
| 2471 |
); |
| 2472 |
} |
| 2473 |
|
| 2408 |
=head2 GetBorrowersWithEmail |
2474 |
=head2 GetBorrowersWithEmail |
| 2409 |
|
2475 |
|
| 2410 |
([$borrnum,$userid], ...) = GetBorrowersWithEmail('me@example.com'); |
2476 |
([$borrnum,$userid], ...) = GetBorrowersWithEmail('me@example.com'); |