@@ -, +, @@ and have print message there. If not, run updatedatabase.pl the toolbar, select "Print checked-in today -slip" branches - should only print items for the current branch. in different day - should only print items for today. --- C4/Members.pm | 66 ++++++++++++++++++++++ .../data/mysql/en/mandatory/sample_notices.sql | 12 ++++ installer/data/mysql/updatedatabase.pl | 18 ++++++ .../prog/en/includes/members-toolbar.inc | 9 +++ members/printslip.pl | 7 ++- 5 files changed, 111 insertions(+), 1 deletion(-) --- a/C4/Members.pm +++ a/C4/Members.pm @@ -105,6 +105,7 @@ BEGIN { &GetMessagesCount &IssueSlip + &CheckInSlip GetBorrowersWithEmail HasOverdues @@ -2448,6 +2449,71 @@ sub IssueSlip { ); } +=head2 GetTodaysReturnsForBorrower + + $returns = GetTodaysReturnsForBorrower($borrowernumber, $branch); + +Return a list of items borrower has checked-in today in branch. + +=cut + +sub GetTodaysReturnsForBorrower { + my ($borrowernumber, $branch) = @_; + my $dbh = C4::Context->dbh; + my $date = POSIX::strftime("%Y-%m-%d",localtime()); + + my $query = " + SELECT itemnumber + FROM old_issues + WHERE DATE(returndate) = ? + AND borrowernumber = ? + AND branchcode = ? + "; + + my $sth = $dbh->prepare($query); + $sth->execute($date, $borrowernumber, $branch); + my @results; + + while ( my $data = $sth->fetchrow_hashref ) { + my $bibdata = GetBiblioFromItemNumber($data->{itemnumber}); + push @results, $bibdata; + } + return \@results; +} + +=head2 CheckInSlip + + $letter = CheckInSlip($borrowernumber, $branch [, $message_transport_type ] ); + +Returns the prepared letter data for items patron checked-in today in branch. +message_transport_type defaults to 'print'. + +=cut + +sub CheckInSlip { + my ($borrowernumber, $branch, $mtt) = @_; + my $issues = GetTodaysReturnsForBorrower($borrowernumber, $branch); + my %repeat = ( + 'checkedin' => [ map { + 'biblio' => $_, + 'items' => $_, + 'issues' => $_, + }, @$issues ], + ); + + return C4::Letters::GetPreparedLetter ( + module => 'circulation', + letter_code => 'CHECKINSLIP', + branchcode => $branch, + tables => { + 'branches' => $branch, + 'borrowers' => $borrowernumber, + }, + repeat => \%repeat, + message_transport_type => $mtt || 'print', + ); +} + =head2 GetBorrowersWithEmail ([$borrnum,$userid], ...) = GetBorrowersWithEmail('me@example.com'); --- a/installer/data/mysql/en/mandatory/sample_notices.sql +++ a/installer/data/mysql/en/mandatory/sample_notices.sql @@ -162,3 +162,15 @@ VALUES ( 'circulation', 'OVERDUES_SLIP', '', 'Overdues Slip', '0', 'OVERDUES_SLI "<>" by <>, <>, Barcode: <> Fine: <> ', 'print' ); + +INSERT INTO letter (module, code, branchcode, name, is_html, title, content, message_transport_type) +VALUES ( 'circulation', 'CHECKINSLIP', '', 'Printed check-in slip', '1', 'Items returned today', '<> <>
+<>, <>
+You returned these items today: +
    + +
  • <>: <>
    +Barcode: <>
    + +
', 'print' +); --- a/installer/data/mysql/updatedatabase.pl +++ a/installer/data/mysql/updatedatabase.pl @@ -11341,6 +11341,24 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.21.00.054"; +if ( CheckVersion($DBversion) ) { + $dbh->do(" +INSERT INTO letter (module, code, branchcode, name, is_html, title, content, message_transport_type) +VALUES ( 'circulation', 'CHECKINSLIP', '', 'Printed check-in slip', '1', 'Items returned today', '<> <>
+<>, <>
+You returned these items today: +
    + +
  • <>: <>
    +Barcode: <>
    + +
', 'print' +);"); + print "Upgrade to $DBversion done (Bug 12224 - Easy printing of patron check-in slip)\n"; + SetVersion($DBversion); +} + # DEVELOPER PROCESS, search for anything to execute in the db_update directory # SEE bug 13068 # if there is anything in the atomicupdate, read and execute it. --- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc @@ -64,6 +64,11 @@ $(document).ready(function(){ $(".btn-group").removeClass("open"); return false; }); + $("#printcheckinslip").click(function(){ + printx_window("checkinslip"); + $(".btn-group").removeClass("open"); + return false; + }); $("#searchtohold").click(function(){ searchToHold(); return false; @@ -160,9 +165,13 @@ function searchToHold(){ [% IF ( CAN_user_borrowers ) %]
  • Print summary
  • [% END %]
  • Print slip
  • Print quick slip
  • +<<<<<<< HEAD [% IF Borrowers.HasOverdues( borrowernumber ) %]
  • Print overdues
  • [% END %] +======= +
  • Print checked-in today -slip
  • +>>>>>>> Bug 12224: Allow easy printing of patron check-ins for today Search to hold --- a/members/printslip.pl +++ a/members/printslip.pl @@ -76,7 +76,12 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( my $borrowernumber = $input->param('borrowernumber'); my $branch=C4::Context->userenv->{'branch'}; my ($slip, $is_html); -if (my $letter = IssueSlip ($session->param('branch') || $branch, $borrowernumber, $print eq "qslip")) { +if ($print eq 'checkinslip') { + if (my $letter = CheckInSlip($borrowernumber, $session->param('branch') || $branch)) { + $slip = $letter->{content}; + $is_html = $letter->{is_html}; + } +} elsif (my $letter = IssueSlip ($session->param('branch') || $branch, $borrowernumber, $print eq "qslip")) { $slip = $letter->{content}; $is_html = $letter->{is_html}; } --