-if (my $letter = IssueSlip ($session->param('branch') || $branch, $borrowernumber, $print eq "qslip")) {
+if ( $print eq 'checkinslip' ) {
+ my $checkinslip_branch = $session->param('branch') ? $session->param('branch') : $branch;
+
+ # get today's checkins
+ my @issue_ids = $patron->old_checkouts->search( { branchcode => $checkinslip_branch } )
+ ->filter_by_todays_checkins->get_column('issue_id');
+
+ my %loops = (
+ old_issues => \@issue_ids,
+ );
+
+ my $letter = C4::Letters::GetPreparedLetter(
+ module => 'circulation',
+ letter_code => 'CHECKINSLIP',
+ branchcode => $checkinslip_branch,
+ lang => $patron->lang,
+ tables => {
+ branches => $checkinslip_branch,
+ borrowers => $borrowernumber,
+ },
+ loops => \%loops,
+ message_transport_type => 'print'
+ );
+
+ $slip = $letter->{content};
+ $is_html = $letter->{is_html};
+
+} elsif (my $letter = IssueSlip ($session->param('branch') || $branch, $borrowernumber, $print eq "qslip")) {