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