X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=members%2Fprintslip.pl;h=1bb11f68beec095a1efc3d1fa54646aad1836446;hb=9d6d641d1f8b77271800f43bc027b651f9aea52b;hp=c89765b65f7fe42f3c61864177cdc41fa03505c7;hpb=fe2bbc7cd886008dbbfdb2cb847c0f4067296c3b;p=srvgit diff --git a/members/printslip.pl b/members/printslip.pl index c89765b65f..1bb11f68be 100755 --- a/members/printslip.pl +++ b/members/printslip.pl @@ -35,26 +35,14 @@ use Modern::Perl; use CGI qw ( -utf8 ); use C4::Context; -use C4::Auth qw/:DEFAULT get_session/; -use C4::Output; -use C4::Members; -use C4::Koha; -use Koha::DateUtils; - -#use Smart::Comments; -#use Data::Dumper; - -use vars qw($debug); - -BEGIN { - $debug = $ENV{DEBUG} || 0; -} +use C4::Auth qw( get_session get_template_and_user ); +use C4::Output qw( output_and_exit_if_error output_and_exit output_html_with_http_headers ); +use C4::Members qw( IssueSlip ); my $input = CGI->new; my $sessionID = $input->cookie("CGISESSID"); my $session = get_session($sessionID); -$debug or $debug = $input->param('debug') || 0; my $print = $input->param('print'); my $error = $input->param('error'); @@ -68,7 +56,6 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( query => $input, type => "intranet", flagsrequired => $flagsrequired, - debug => 1, } ); @@ -84,22 +71,11 @@ if ( $print eq 'checkinslip' ) { my $checkinslip_branch = $session->param('branch') ? $session->param('branch') : $branch; # get today's checkins - my $dtf = Koha::Database->new->schema->storage->datetime_parser; - my $today = dt_from_string; - my $today_start = $today->clone->set( hour => 0, minute => 0, second => 0 ); - my $today_end = $today->clone->set( hour => 23, minute => 59, second => 0 ); - $today_start = $dtf->format_datetime( $today_start ); - $today_end = $dtf->format_datetime( $today_end ); - my @todays_checkins = $patron->old_checkouts->search({ - returndate => { - '>=' => $today_start, - '<=' => $today_end, - }, - branchcode => $checkinslip_branch, - }); + my @itemnumbers = $patron->old_checkouts->search( { branchcode => $checkinslip_branch } ) + ->filter_by_todays_checkins->get_column('itemnumber'); my %loops = ( - old_issues => [ map { $_->itemnumber } @todays_checkins ], + old_issues => \@itemnumbers, ); my $letter = C4::Letters::GetPreparedLetter(