|
Lines 105-110
BEGIN {
Link Here
|
| 105 |
&GetMessagesCount |
105 |
&GetMessagesCount |
| 106 |
|
106 |
|
| 107 |
&IssueSlip |
107 |
&IssueSlip |
|
|
108 |
&CheckInSlip |
| 108 |
GetBorrowersWithEmail |
109 |
GetBorrowersWithEmail |
| 109 |
|
110 |
|
| 110 |
HasOverdues |
111 |
HasOverdues |
|
Lines 2448-2453
sub IssueSlip {
Link Here
|
| 2448 |
); |
2449 |
); |
| 2449 |
} |
2450 |
} |
| 2450 |
|
2451 |
|
|
|
2452 |
=head2 GetTodaysReturnsForBorrower |
| 2453 |
|
| 2454 |
$returns = GetTodaysReturnsForBorrower($borrowernumber, $branch); |
| 2455 |
|
| 2456 |
Return a list of items borrower has checked-in today in branch. |
| 2457 |
|
| 2458 |
=cut |
| 2459 |
|
| 2460 |
sub GetTodaysReturnsForBorrower { |
| 2461 |
my ($borrowernumber, $branch) = @_; |
| 2462 |
my $dbh = C4::Context->dbh; |
| 2463 |
my $date = POSIX::strftime("%Y-%m-%d",localtime()); |
| 2464 |
|
| 2465 |
my $query = " |
| 2466 |
SELECT itemnumber |
| 2467 |
FROM old_issues |
| 2468 |
WHERE DATE(returndate) = ? |
| 2469 |
AND borrowernumber = ? |
| 2470 |
AND branchcode = ? |
| 2471 |
"; |
| 2472 |
|
| 2473 |
my $sth = $dbh->prepare($query); |
| 2474 |
$sth->execute($date, $borrowernumber, $branch); |
| 2475 |
my @results; |
| 2476 |
|
| 2477 |
while ( my $data = $sth->fetchrow_hashref ) { |
| 2478 |
my $bibdata = GetBiblioFromItemNumber($data->{itemnumber}); |
| 2479 |
push @results, $bibdata; |
| 2480 |
} |
| 2481 |
return \@results; |
| 2482 |
} |
| 2483 |
|
| 2484 |
=head2 CheckInSlip |
| 2485 |
|
| 2486 |
$letter = CheckInSlip($borrowernumber, $branch [, $message_transport_type ] ); |
| 2487 |
|
| 2488 |
Returns the prepared letter data for items patron checked-in today in branch. |
| 2489 |
message_transport_type defaults to 'print'. |
| 2490 |
|
| 2491 |
=cut |
| 2492 |
|
| 2493 |
sub CheckInSlip { |
| 2494 |
my ($borrowernumber, $branch, $mtt) = @_; |
| 2495 |
my $issues = GetTodaysReturnsForBorrower($borrowernumber, $branch); |
| 2496 |
my %repeat = ( |
| 2497 |
'checkedin' => [ map { |
| 2498 |
'biblio' => $_, |
| 2499 |
'items' => $_, |
| 2500 |
'issues' => $_, |
| 2501 |
}, @$issues ], |
| 2502 |
); |
| 2503 |
|
| 2504 |
return C4::Letters::GetPreparedLetter ( |
| 2505 |
module => 'circulation', |
| 2506 |
letter_code => 'CHECKINSLIP', |
| 2507 |
branchcode => $branch, |
| 2508 |
tables => { |
| 2509 |
'branches' => $branch, |
| 2510 |
'borrowers' => $borrowernumber, |
| 2511 |
}, |
| 2512 |
repeat => \%repeat, |
| 2513 |
message_transport_type => $mtt || 'print', |
| 2514 |
); |
| 2515 |
} |
| 2516 |
|
| 2451 |
=head2 GetBorrowersWithEmail |
2517 |
=head2 GetBorrowersWithEmail |
| 2452 |
|
2518 |
|
| 2453 |
([$borrnum,$userid], ...) = GetBorrowersWithEmail('me@example.com'); |
2519 |
([$borrnum,$userid], ...) = GetBorrowersWithEmail('me@example.com'); |