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