From cd91ab3b428389b7ae2ba90d8485d47bb600fe67 Mon Sep 17 00:00:00 2001 From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Date: Tue, 11 Mar 2025 12:13:21 +0100 Subject: [PATCH] Bug 39302: Fix logic flaw in the display count of checkins Checkins can disappear from the checkin list if transfer modal is triggered. There is a flaw in the logic of the checkin code: we keep 20 (default value for numReturnedItemsToShow) checkins in the table, but there can be shift in the "counter" logic when the transfer modal is triggered. This patch is removing the different hashes and use a single @checkins array to pass to the template. When a item is checked in, it is inserted at the beginning of the list (unshift). Koha::Objects are passed for patron, item and biblio to improve the readability (and maintenance cost) of the code. Test plan: Generate several checkouts (see below) Some should generate the transfer modal Check them in => Without this patch notice that at some point there will be a problem in the list, some checkins will be missing. => With this patch applied the checkin list always contain the last 20 checkins (or whatever is the value of numReturnedItemsToShow, or "8" if pref is empty, don't ask why 8!) Code to generate 50 checkouts (all overdue): ``` use C4::Circulation qw( AddIssue ); use Koha::Items; use Koha::Patrons; use t::lib::Mocks; use Koha::DateUtils qw(dt_from_string); my $patron = Koha::Patrons->find(51); t::lib::Mocks::mock_userenv({patron => $patron}); my $items = Koha::Items->search; my $patron_unblessed = $patron->unblessed; my $i; while ( my $item = $items->next ) { my $due = dt_from_string->subtract(days => 45 + rand(45))->set_hour(23)->set_minute(59)->set_second(00); AddIssue($patron, $item->barcode, $due); last if ++$i >= 50; } ``` Then retrieve the barcodes: > SELECT items.barcode FROM issues LEFT JOIN items ON items.itemnumber=issues.itemnumber; QA: 1. Do not be afraid by the length of this patch, most of the changes are variable renames. 2. return_overdue is now only calculated once per checkin (per page load, could be improved) 3. date formatting is done template-side Signed-off-by: Owen Leonard <oleonard@myacpl.org> --- circ/returns.pl | 179 ++++---------- .../prog/en/modules/circ/returns.tt | 225 ++++++++++-------- 2 files changed, 168 insertions(+), 236 deletions(-) diff --git a/circ/returns.pl b/circ/returns.pl index 11b0795ad7f..35a4ee6e8ae 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -98,46 +98,17 @@ my $overduecharges = ( C4::Context->preference('finesMode') && C4::Context->pref my $returned_counter = C4::Context->preference('numReturnedItemsToShow') || 8; # Set up the item stack .... -my %returneditems; -my %riduedate; -my %riborrowernumber; -my %rinot_returned; -my @inputloop; -foreach ( $query->param ) { - my $counter; - if (/ri-(\d*)/) { - $counter = $1; - if ( $counter > $returned_counter ) { - next; - } - } else { - next; - } - - my %input; - my $barcode = $query->param("ri-$counter"); - my $duedate = $query->param("dd-$counter"); - my $borrowernumber = $query->param("bn-$counter"); - my $not_returned = $query->param("nr-$counter"); - $counter++; - - # decode barcode ## Didn't we already decode them before passing them back last time?? - $barcode = barcodedecode($barcode) if $barcode; - - ###################### - #Are these lines still useful ? - $returneditems{$counter} = $barcode; - $riduedate{$counter} = $duedate; - $riborrowernumber{$counter} = $borrowernumber; - $rinot_returned{$counter} = $not_returned; - - ####################### - $input{counter} = $counter; - $input{barcode} = $barcode; - $input{duedate} = $duedate; - $input{borrowernumber} = $borrowernumber; - $input{not_returned} = $not_returned; - push( @inputloop, \%input ); +my @checkins; +my $i; +for my $counter ( $query->multi_param("checkin_counter") ) { + push @checkins, { + barcode => scalar $query->param("checkin_barcode_$counter"), + duedate => scalar $query->param("checkin_duedate_$counter"), + borrowernumber => scalar $query->param("checkin_borrowernumber_$counter"), + not_returned => scalar $query->param("checkin_not_returned_$counter"), + }; + + last if ++$i >= $returned_counter; } my $op = $query->param('op') // ''; @@ -384,22 +355,14 @@ if ( $barcode && ( $op eq 'cud-checkin' || $op eq 'cud-affect_reserve' ) ) { unless ( $needs_confirm || $bundle_confirm ); if ($returned) { - my $time_now = dt_from_string()->truncate( to => 'minute' ); my $date_due_dt = dt_from_string( $issue->date_due, 'sql' ); - my $duedate = $date_due_dt->strftime('%Y-%m-%d %H:%M'); - $returneditems{0} = $barcode; - $riborrowernumber{0} = $borrower->{'borrowernumber'}; - $riduedate{0} = $duedate; - $rinot_returned{0} = 0; - $input{borrowernumber} = $borrower->{'borrowernumber'}; - $input{duedate} = $duedate; - unless ($dropboxmode) { - $input{return_overdue} = 1 if ( DateTime->compare( $date_due_dt, dt_from_string() ) == -1 ); - } else { - $input{return_overdue} = 1 if ( DateTime->compare( $date_due_dt, $dropboxdate ) == -1 ); - } - push( @inputloop, \%input ); + unshift @checkins, { + barcode => $barcode, + duedate => $issue ? $issue->date_due : undef, + borrowernumber => $issue ? $issue->borrowernumber : undef, + not_returned => 0, + }; if ( C4::Context->preference("FineNotifyAtCheckin") ) { my $patron = Koha::Patrons->find( $borrower->{borrowernumber} ); @@ -431,19 +394,12 @@ if ( $barcode && ( $op eq 'cud-checkin' || $op eq 'cud-affect_reserve' ) ) { and !$needs_confirm and !$bundle_confirm ) { - my $duedate = 0; - if ($issue) { - my $date_due_dt = dt_from_string( $issue->date_due, 'sql' ); - $duedate = $date_due_dt->strftime('%Y-%m-%d %H:%M'); - $input{borrowernumber} = $issue->borrowernumber; - $riborrowernumber{0} = $borrower->{'borrowernumber'}; - } - $input{duedate} = $duedate; - $input{not_returned} = 1; - $rinot_returned{0} = 1; - $returneditems{0} = $barcode; - $riduedate{0} = $duedate; - push( @inputloop, \%input ); + unshift @checkins, { + barcode => $barcode, + duedate => $issue ? $issue->date_due : undef, + borrowernumber => $issue ? $issue->borrowernumber : undef, + not_returned => 1, + }; } $template->param( privacy => $borrower->{privacy} ); @@ -543,7 +499,7 @@ if ( $barcode && ( $op eq 'cud-checkin' || $op eq 'cud-affect_reserve' ) ) { ); } } -$template->param( inputloop => \@inputloop ); +$template->param( checkins => \@checkins ); my $found = 0; my $waiting = 0; @@ -788,81 +744,42 @@ foreach my $code ( keys %$messages ) { } $template->param( errmsgloop => \@errmsgloop ); -my $count = 0; -my @riloop; my $shelflocations = { map { $_->{authorised_value} => $_->{lib} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.location' } ) }; -foreach ( sort { $a <=> $b } keys %returneditems ) { - my %ri; - if ( $count++ < $returned_counter ) { - my $bar_code = $returneditems{$_}; - if ( $riduedate{$_} ) { - my $duedate = dt_from_string( $riduedate{$_}, 'sql' ); - $ri{year} = $duedate->year(); - $ri{month} = $duedate->month(); - $ri{day} = $duedate->day(); - $ri{hour} = $duedate->hour(); - $ri{minute} = $duedate->minute(); - $ri{duedate} = $duedate; - my $patron = Koha::Patrons->find( $riborrowernumber{$_} ); - - unless ($dropboxmode) { - $ri{return_overdue} = 1 if ( DateTime->compare( $duedate, dt_from_string() ) == -1 ); - } else { - $ri{return_overdue} = 1 if ( DateTime->compare( $duedate, $dropboxdate ) == -1 ); - } - $ri{patron} = $patron, - $ri{borissuescount} = $patron->checkouts->count; - } else { - $ri{borrowernumber} = $riborrowernumber{$_}; - } +for my $checkin (@checkins) { + my $item = Koha::Items->find( { barcode => $checkin->{barcode} } ); + next unless $item; # FIXME The item has been deleted in the meantime, + # we could handle that better displaying a message in the template - my $item = Koha::Items->find( { barcode => $bar_code } ); - next unless $item; # FIXME The item has been deleted in the meantime, - # we could handle that better displaying a message in the template + if ( $checkin->{duedate} ) { + my $duedate = dt_from_string( $checkin->{duedate}, 'sql' ); + my $patron = Koha::Patrons->find( $checkin->{borrowernumber} ); - $ri{not_returned} = $rinot_returned{$_}; - my $biblio = $item->biblio; + my $return_overdue; + unless ($dropboxmode) { + $return_overdue = 1 if ( DateTime->compare( $duedate, dt_from_string() ) == -1 ); + } else { + $return_overdue = 1 if ( DateTime->compare( $duedate, $dropboxdate ) == -1 ); + } + $checkin->{return_overdue} = $return_overdue; + $checkin->{patron} = $patron; + } - # FIXME pass $item to the template and we are done here... - $ri{itembiblionumber} = $biblio->biblionumber; - $ri{itemtitle} = $biblio->title; - $ri{subtitle} = $biblio->subtitle; - $ri{part_name} = $biblio->part_name; - $ri{part_number} = $biblio->part_number; - $ri{itemauthor} = $biblio->author; - $ri{itemcallnumber} = $item->itemcallnumber; - $ri{dateaccessioned} = $item->dateaccessioned; - $ri{recordtype} = $biblio->itemtype; - $ri{itemtype} = $item->itype; - $ri{itemnote} = $item->itemnotes; - $ri{itemnotes_nonpublic} = $item->itemnotes_nonpublic; - $ri{ccode} = $item->ccode; - $ri{enumchron} = $item->enumchron; - $ri{itemnumber} = $item->itemnumber; - $ri{barcode} = $bar_code; - $ri{homebranch} = $item->homebranch; - $ri{transferbranch} = $item->get_transfer ? $item->get_transfer->tobranch : ''; - $ri{damaged} = $item->damaged; - $ri{withdrawn} = $item->withdrawn; - $ri{transferreason} = $item->get_transfer ? $item->get_transfer->reason : ''; - - $ri{location} = $item->location; - my $shelfcode = $ri{'location'}; - $ri{'location'} = $shelflocations->{$shelfcode} - if ( defined($shelfcode) && defined($shelflocations) && exists( $shelflocations->{$shelfcode} ) ); + my $biblio = $item->biblio; + $checkin->{biblio} = $item->biblio; - } else { - last; - } - push @riloop, \%ri; + # TODO Move this logic somewhere else + $checkin->{item_location} = $item->location; + my $shelfcode = $checkin->{item_location}; + $checkin->{item_location} = $shelflocations->{$shelfcode} + if ( defined($shelfcode) && defined($shelflocations) && exists( $shelflocations->{$shelfcode} ) ); } $template->param( - riloop => \@riloop, + checkins => \@checkins, errmsgloop => \@errmsgloop, exemptfine => $exemptfine, dropboxmode => $dropboxmode, diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt index ce5205b1ced..d2b1f676784 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt @@ -447,11 +447,12 @@ <input type="hidden" name="multiple_confirm" value="1" /> <input type="hidden" name="dropboxmode" value="[% dropboxmode | html %]" /> <input type="hidden" name="exemptfine" value="[% exemptfine | html %]" /> - [% FOREACH inputloo IN inputloop %] - <input type="hidden" name="ri-[% inputloo.counter | html %]" value="[% inputloo.barcode | html %]" /> - <input type="hidden" name="dd-[% inputloo.counter | html %]" value="[% inputloo.duedate | html %]" /> - <input type="hidden" name="bn-[% inputloo.counter | html %]" value="[% inputloo.borrowernumber | html %]" /> - <input type="hidden" name="nr-[% inputloo.counter | html %]" value="[% inputloo.not_returned | html %]" /> + [% FOREACH checkin IN checkins %] + <input type="hidden" name="checkin_counter" value="[% loop.count | html %]" /> + <input type="hidden" name="checkin_barcode_[% loop.count | html %]" value="[% checkin.barcode | html %]" /> + <input type="hidden" name="checkin_duedate_[% loop.count | html %]" value="[% checkin.duedate | html %]" /> + <input type="hidden" name="checkin_borrowernumber_[% loop.count | html %]" value="[% checkin.borrowernumber | html %]" /> + <input type="hidden" name="checkin_not_returned_[% loop.count | html %]" value="[% checkin.not_returned | html %]" /> [% END %] <button type="submit" class="btn btn-default approve" accesskey="y"><i class="fa fa-check"></i> Yes, checkin (Y)</button> </form> @@ -531,11 +532,12 @@ <input type="hidden" name="barcode" value="[% item.barcode | html %]" /> <input type="hidden" name="op" value="cud-checkin" /> <input type="hidden" name="confirm_items_bundle_return" value="1" /> - [% FOREACH inputloo IN inputloop %] - <input type="hidden" name="ri-[% inputloo.counter | html %]" value="[% inputloo.barcode | html %]" /> - <input type="hidden" name="dd-[% inputloo.counter | html %]" value="[% inputloo.duedate | html %]" /> - <input type="hidden" name="bn-[% inputloo.counter | html %]" value="[% inputloo.borrowernumber | html %]" /> - <input type="hidden" name="nr-[% inputloo.counter | html %]" value="[% inputloo.not_returned | html %]" /> + [% FOREACH checkin IN checkins %] + <input type="hidden" name="checkin_counter" value="[% loop.count | html %]" /> + <input type="hidden" name="checkin_barcode_[% loop.count | html %]" value="[% checkin.barcode | html %]" /> + <input type="hidden" name="checkin_duedate_[% loop.count | html %]" value="[% checkin.duedate | html %]" /> + <input type="hidden" name="checkin_borrowernumber_[% loop.count | html %]" value="[% checkin.borrowernumber | html %]" /> + <input type="hidden" name="checkin_not_returned_[% loop.count | html %]" value="[% checkin.not_returned | html %]" /> [% END %] [% IF item.onloan %] <button type="submit" class="btn btn-default"><i class="fa fa-check"></i> Confirm checkin and mark missing items as lost</button> @@ -601,11 +603,12 @@ <input type="hidden" name="return_date_override_remember" value="[% return_date_override_remember | html %]" /> <input type="hidden" name="itemnumber" value="[% itemnumber | html %]" /> <input type="hidden" name="transit" value="[% NewTransfer | html %]" /> - [% FOREACH inputloo IN inputloop %] - <input type="hidden" name="ri-[% inputloo.counter | html %]" value="[% inputloo.barcode | html %]" /> - <input type="hidden" name="dd-[% inputloo.counter | html %]" value="[% inputloo.duedate | html %]" /> - <input type="hidden" name="bn-[% inputloo.counter | html %]" value="[% inputloo.borrowernumber | html %]" /> - <input type="hidden" name="nr-[% inputloo.counter | html %]" value="[% inputloo.not_returned | html %]" /> + [% FOREACH checkin IN checkins %] + <input type="hidden" name="checkin_counter" value="[% loop.count | html %]" /> + <input type="hidden" name="checkin_barcode_[% loop.count | html %]" value="[% checkin.barcode | html %]" /> + <input type="hidden" name="checkin_duedate_[% loop.count | html %]" value="[% checkin.duedate | html %]" /> + <input type="hidden" name="checkin_borrowernumber_[% loop.count | html %]" value="[% checkin.borrowernumber | html %]" /> + <input type="hidden" name="checkin_not_returned_[% loop.count | html %]" value="[% checkin.not_returned | html %]" /> [% END %] <div class="modal-header"> @@ -701,11 +704,12 @@ <h4><strong>Hold at</strong> [% Branches.GetName( destbranch ) | html %]</h4> [% END %] - [% FOREACH inputloo IN inputloop %] - <input type="hidden" name="ri-[% inputloo.counter | html %]" value="[% inputloo.barcode | html %]" /> - <input type="hidden" name="dd-[% inputloo.counter | html %]" value="[% inputloo.duedate | html %]" /> - <input type="hidden" name="bn-[% inputloo.counter | html %]" value="[% inputloo.borrowernumber | html %]" /> - <input type="hidden" name="nr-[% inputloo.counter | html %]" value="[% inputloo.not_returned | html %]" /> + [% FOREACH checkin IN checkins %] + <input type="hidden" name="checkin_counter" value="[% loop.count | html %]" /> + <input type="hidden" name="checkin_barcode_[% loop.count | html %]" value="[% checkin.barcode | html %]" /> + <input type="hidden" name="checkin_duedate_[% loop.count | html %]" value="[% checkin.duedate | html %]" /> + <input type="hidden" name="checkin_borrowernumber_[% loop.count | html %]" value="[% checkin.borrowernumber | html %]" /> + <input type="hidden" name="checkin_not_returned_[% loop.count | html %]" value="[% checkin.not_returned | html %]" /> [% END %] <input type="hidden" name="op" value="cud-affect_reserve" /> @@ -815,11 +819,13 @@ <input type="hidden" name="exemptfine" value="[% exemptfine | html %]" /> <input type="hidden" name="dropboxmode" value="[% dropboxmode | html %]" /> <input type="hidden" name="forgivemanualholdsexpire" value="[% forgivemanualholdsexpire | html %]" /> - [% FOREACH inputloo IN inputloop %] - <input type="hidden" name="ri-[% inputloo.counter | html %]" value="[% inputloo.barcode | html %]" /> - <input type="hidden" name="dd-[% inputloo.counter | html %]" value="[% inputloo.duedate | html %]" /> - <input type="hidden" name="bn-[% inputloo.counter | html %]" value="[% inputloo.borrowernumber | html %]" /> - <input type="hidden" name="nr-[% inputloo.counter | html %]" value="[% inputloo.not_returned | html %]" /> + + [% FOREACH checkin IN checkins %] + <input type="hidden" name="checkin_counter" value="[% loop.count | html %]" /> + <input type="hidden" name="checkin_barcode_[% loop.count | html %]" value="[% checkin.barcode | html %]" /> + <input type="hidden" name="checkin_duedate_[% loop.count | html %]" value="[% checkin.duedate | html %]" /> + <input type="hidden" name="checkin_borrowernumber_[% loop.count | html %]" value="[% checkin.borrowernumber | html %]" /> + <input type="hidden" name="checkin_not_returned_[% loop.count | html %]" value="[% checkin.not_returned | html %]" /> [% END %] </div> <!-- /.modal-footer --> @@ -919,11 +925,12 @@ <h4><strong>Hold at</strong> [% Branches.GetName( destbranch ) | html %]</h4> [% END %] - [% FOREACH inputloo IN inputloop %] - <input type="hidden" name="ri-[% inputloo.counter | html %]" value="[% inputloo.barcode | html %]" /> - <input type="hidden" name="dd-[% inputloo.counter | html %]" value="[% inputloo.duedate | html %]" /> - <input type="hidden" name="bn-[% inputloo.counter | html %]" value="[% inputloo.borrowernumber | html %]" /> - <input type="hidden" name="nr-[% inputloo.counter | html %]" value="[% inputloo.not_returned | html %]" /> + [% FOREACH checkin IN checkins %] + <input type="hidden" name="checkin_counter" value="[% loop.count | html %]" /> + <input type="hidden" name="checkin_barcode_[% loop.count | html %]" value="[% checkin.barcode | html %]" /> + <input type="hidden" name="checkin_duedate_[% loop.count | html %]" value="[% checkin.duedate | html %]" /> + <input type="hidden" name="checkin_borrowernumber_[% loop.count | html %]" value="[% checkin.borrowernumber | html %]" /> + <input type="hidden" name="checkin_not_returned_[% loop.count | html %]" value="[% checkin.not_returned | html %]" /> [% END %] <input type="hidden" name="op" value="cud-affect_reserve" /> @@ -1175,13 +1182,15 @@ <a href="#" title="Checkin settings"><i class="fa-solid fa-sliders"></i></a> </div> - <button type="submit" class="btn btn-primary">Check in</button> - [% FOREACH inputloo IN inputloop %] - <input type="hidden" name="ri-[% inputloo.counter | html %]" value="[% inputloo.barcode | html %]" /> - <input type="hidden" name="dd-[% inputloo.counter | html %]" value="[% inputloo.duedate | html %]" /> - <input type="hidden" name="bn-[% inputloo.counter | html %]" value="[% inputloo.borrowernumber | html %]" /> - <input type="hidden" name="nr-[% inputloo.counter | html %]" value="[% inputloo.not_returned | html %]" /> + [% FOREACH checkin IN checkins %] + <input type="hidden" name="checkin_counter" value="[% loop.count | html %]" /> + <input type="hidden" name="checkin_barcode_[% loop.count | html %]" value="[% checkin.barcode | html %]" /> + <input type="hidden" name="checkin_duedate_[% loop.count | html %]" value="[% checkin.duedate | html %]" /> + <input type="hidden" name="checkin_borrowernumber_[% loop.count | html %]" value="[% checkin.borrowernumber | html %]" /> + <input type="hidden" name="checkin_not_returned_[% loop.count | html %]" value="[% checkin.not_returned | html %]" /> [% END %] + + <button type="submit" class="btn btn-primary">Check in</button> </div> </div> <div class="col-sm-6"> @@ -1271,7 +1280,7 @@ </form> <!-- /#checkin-form --> - [% IF ( riloop ) %] + [% IF ( checkins.size ) %] <div class="page-section"> <h2>Checked-in items</h2> <table id="checkedintable"> @@ -1295,121 +1304,127 @@ </tr> </thead> - [% FOREACH riloo IN riloop %] + [% FOREACH checkin IN checkins %] <tr> <td class="ci-duedate"> - [% IF ( riloo.not_returned AND riloo.duedate ) %] + [% IF ( checkin.not_returned AND checkin.duedate ) %] <span class="problem not_returned">Item was not checked in</span> [% END %] - [% IF ( riloo.duedate ) %] - [% IF ( riloo.return_overdue ) %] - <span class="overdue">[% riloo.duedate | $KohaDates as_due_date => 1 %] (overdue)</span> + [% IF ( checkin.duedate ) %] + [% IF ( checkin.return_overdue ) %] + <span class="overdue">[% checkin.duedate | $KohaDates as_due_date => 1 %] (overdue)</span> [% ELSE %] - [% riloo.duedate | $KohaDates as_due_date => 1 %] + [% checkin.duedate | $KohaDates as_due_date => 1 %] [% END %] [% ELSE %] <span>Not checked out</span> [% END %] - [% IF ( riloo.damaged ) %] - <span class="dmg">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.damaged', authorised_value => riloo.damaged ) | html %]</span> + [% IF ( checkin.item.damaged ) %] + <span class="dmg">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.damaged', authorised_value => checkin.item.damaged ) | html %]</span> [% END %] - [% IF ( riloo.withdrawn ) %] - <span class="withdrawn">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => riloo.withdrawn ) | html %]</span> + [% IF ( checkin.item.withdrawn ) %] + <span class="withdrawn">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => checkin.item.withdrawn ) | html %]</span> [% END %] </td> <td class="ci-title"> - <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% riloo.itembiblionumber | uri %]"> - [% riloo.itemtitle | html %] + <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% checkin.biblio.biblionumber | uri %]"> + [% checkin.biblio.title | html %] <!-- prettier-ignore-start --> - [% FOREACH subtitle IN riloo.subtitle.split(' \\| ') %] <span class="subtitle">[% subtitle | html %]</span>[% END %] - [% FOREACH part_number IN riloo.part_number.split(' \\| ') %] <span class="part_number">[% part_number | html %]</span>[% END %] - [% FOREACH part_name IN riloo.part_name.split(' \\| ') %] <span class="part_name">[% part_name | html %]<span>[% END %] - <!-- prettier-ignore-end --> + [% FOREACH subtitle IN checkin.biblio.subtitle.split(' \\| ') %] <span class="subtitle">[% subtitle | html %]</span>[% END %] + [% FOREACH part_number IN checkin.biblio.part_number.split(' \\| ') %] <span class="part_number">[% part_number | html %]</span>[% END %] + [% FOREACH part_name IN checkin.biblio.part_name.split(' \\| ') %] <span class="part_name">[% part_name | html %]<span>[% END %] + <!-- prettier-ignore-end --> </a> - [% IF ( riloo.enumchron ) %] + [% IF ( checkin.item.enumchron ) %] <br /> - <span class="item_enumeration" style="white-space: nowrap;">[% riloo.enumchron | html %]</span> + <span class="item_enumeration" style="white-space: nowrap;">[% checkin.item.enumchron | html %]</span> [% END %] </td> - <td class="ci-author">[% riloo.itemauthor | html %]</td> + <td class="ci-author">[% checkin.biblio.author | html %]</td> <td class="ci-barcode"> - <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% riloo.itembiblionumber | uri %]&itemnumber=[% riloo.itemnumber | uri %]#item[% riloo.itemnumber | uri %]">[% riloo.barcode | html %]</a> + <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% checkin.biblio.biblionumber | uri %]&itemnumber=[% checkin.item.itemnumber | uri %]#item[% checkin.item.itemnumber | uri %]" + >[% checkin.barcode | html %]</a + > </td> - <td class="ci-homelibrary"> [% Branches.GetName( riloo.homebranch ) | html %] </td> - <td class="ci-transferlibrary"> [% Branches.GetName( riloo.transferbranch ) | html %] </td> + <td class="ci-homelibrary"> [% Branches.GetName( checkin.item.homebranch ) | html %] </td> + [% SET transfer = checkin.item.get_transfer %] + <td class="ci-transferlibrary"> [% IF transfer %][% Branches.GetName( transfer.tobranch ) | html %][% END %]</td> <td class="ci-transferreason"> - [%- SWITCH riloo.transferreason -%] - - [%- CASE 'Manual' -%] - <span>Manual</span> - [%- CASE 'StockrotationAdvance' -%] - <span>Stock rotation advance</span> - [%- CASE 'StockrotationRepatriation' -%] - <span>Stock rotation repatriation</span> - [%- CASE 'ReturnToHome' -%] - <span>Return to home library</span> - [%- CASE 'ReturnToHolding' -%] - <span>Return to holding library</span> - [%- CASE 'RotatingCollection' -%] - <span>Rotating collection</span> - [%- CASE 'Reserve' -%] - <span>Hold</span> - [%- CASE 'LostReserve' -%] - <span>Lost hold</span> - [%- CASE 'CancelReserve' -%] - <span>Cancelled hold</span> - [%- CASE 'TransferCancellation' -%] - <span>Transfer was cancelled whilst in transit</span> - [%- CASE 'Recall' -%] - <span>Recall</span> - [%- CASE 'RecallCancellation' -%] - <span>Cancelled recall</span> + [% IF transfer %] + [%- SWITCH transfer.reason -%] + + [%- CASE 'Manual' -%] + <span>Manual</span> + [%- CASE 'StockrotationAdvance' -%] + <span>Stock rotation advance</span> + [%- CASE 'StockrotationRepatriation' -%] + <span>Stock rotation repatriation</span> + [%- CASE 'ReturnToHome' -%] + <span>Return to home library</span> + [%- CASE 'ReturnToHolding' -%] + <span>Return to holding library</span> + [%- CASE 'RotatingCollection' -%] + <span>Rotating collection</span> + [%- CASE 'Reserve' -%] + <span>Hold</span> + [%- CASE 'LostReserve' -%] + <span>Lost hold</span> + [%- CASE 'CancelReserve' -%] + <span>Cancelled hold</span> + [%- CASE 'TransferCancellation' -%] + <span>Transfer was cancelled whilst in transit</span> + [%- CASE 'Recall' -%] + <span>Recall</span> + [%- CASE 'RecallCancellation' -%] + <span>Cancelled recall</span> + [%- END -%] [%- END -%] </td> <td class="ci-shelvinglocation"> - <span class="shelvingloc">[% riloo.location | html %]</span> + <span class="shelvingloc">[% checkin.item_location | html %]</span> </td> - <td class="ci-callnumber"> [% riloo.itemcallnumber | html %] </td> - <td class="ci-dateaccessioned"> [% riloo.dateaccessioned | $KohaDates %] </td> - <td class="ci-recordlevelitemtype"> [% ItemTypes.GetDescription( riloo.recordtype ) | html %] </td> - <td class="ci-itemtype"> [% ItemTypes.GetDescription( riloo.itemtype ) | html %] </td> - <td class="ci-collection"> [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => riloo.ccode) | html %] </td> + <td class="ci-callnumber"> [% checkin.item.itemcallnumber | html %] </td> + <td class="ci-dateaccessioned"> [% checkin.item.dateaccessioned | $KohaDates %] </td> + <td class="ci-recordlevelitemtype"> [% ItemTypes.GetDescription( checkin.biblio.itemtype ) | html %] </td> + <td class="ci-itemtype"> [% ItemTypes.GetDescription( checkin.item.itype ) | html %] </td> + <td class="ci-collection"> [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => checkin.item.ccode) | html %] </td> <td class="ci-patron"> - [% IF ( riloo.duedate ) %] - [% INCLUDE 'patron-title.inc' patron=riloo.patron hide_patron_infos_if_needed=1 invert_name=1 %] - [% IF riloo.borissuescount %] + [% IF ( checkin.duedate ) %] + [% INCLUDE 'patron-title.inc' patron=checkin.patron hide_patron_infos_if_needed=1 invert_name=1 %] + [% SET issues_count = checkin.patron.checkouts.count %] + [% IF issues_count %] <span class="results_summary nowrap"> <span class="label">Checkouts:</span> <span class="badge text-bg-info"> - <a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% riloo.patron.borrowernumber | uri %]">[% riloo.borissuescount | html %]</a> + <a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% checkin.patron.borrowernumber | uri %]">[% issues_count | html %]</a> </span> </span> [% END %] - [% IF riloo.patron.privacy < 2 %] + [% IF checkin.patron.privacy < 2 %] [%# 2 is the privacy rule "Never" (Delete my history immediately) %] - <a class="btn btn-default btn-xs printcheckinslip" href="#" data-borrowernumber="[% riloo.patron.borrowernumber | html %]"><i class="fa fa-print"></i> Print checkin slip</a> + <a class="btn btn-default btn-xs printcheckinslip" href="#" data-borrowernumber="[% checkin.patron.borrowernumber | html %]"><i class="fa fa-print"></i> Print checkin slip</a> [% END %] [% ELSE %] Not checked out [% END %] </td> <td class="ci-note"> - [% IF ( riloo.patron.borrowernotes ) %] - <p><span class="circ-hlt patron-note">[% riloo.patron.borrowernotes | $raw | html_line_break %]</span></p> + [% IF ( checkin.patron.borrowernotes ) %] + <p><span class="circ-hlt patron-note">[% checkin.patron.borrowernotes | $raw | html_line_break %]</span></p> [% END %] - [% IF ( riloo.itemnote ) %] - <p><span class="circ-hlt item-note-public">[% riloo.itemnote | html %]</span></p> + [% IF ( checkin.item.itemnotes ) %] + <p><span class="circ-hlt item-note-public">[% checkin.item.itemnotes | html %]</span></p> [% END %] - [% IF ( riloo.itemnotes_nonpublic ) %] - <p><span class="circ-hlt item-note-nonpublic">[% riloo.itemnotes_nonpublic | html %]</span></p> + [% IF ( checkin.item.itemnotes_nonpublic ) %] + <p><span class="circ-hlt item-note-nonpublic">[% checkin.item.itemnotes_nonpublic | html %]</span></p> [% END %] </td> </tr> - [% END # /FOREACH riloo %] + [% END # /FOREACH checkins %] </table> <!-- /#checkedintable --> </div ><!-- /.page-section --> - [% END # /IF riloop %] + [% END # /IF checkins.count %] [% END %] [% IF ( ReturnClaims ) %] -- 2.39.5