From da66f7c0ce2bed2580b7d94c21900e9f29a9c784 Mon Sep 17 00:00:00 2001 From: charles Date: Tue, 1 Dec 2015 16:13:22 -0500 Subject: [PATCH] Bug 14668 - Show serial enumeration in the checkin page and the patron's opac checkout summary The enumchron is now displayed alongside the author name in the "Title" section of the item summary. TEST PLAN ========= 1) INTRANET 1) Edit an item and add something in the "h" subfield, ie: "volume #42" 2) Check out the item to a patron 3) In the patron page, both at the bottom of the page or in the "Check out" tab, you should see the enumchron concatenated with the title 2) OPAC 1) Search for the same patron you used earlier 2) In the "your summary" tab, you should see the enumchron in the Title 3) INTRANET 1) Check in the item you just borrowed 2) At check in, the enumchron should also appear in the Title. --- C4/Reserves.pm | 1 + circ/circulation.pl | 33 +++++++++++++++++++--- circ/returns.pl | 1 + koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js | 12 ++++++-- .../prog/en/modules/circ/circulation.tt | 30 +++++++++++--------- .../intranet-tmpl/prog/en/modules/circ/returns.tt | 2 +- .../opac-tmpl/bootstrap/en/modules/opac-user.tt | 4 ++- opac/opac-user.pl | 1 + svc/checkouts | 3 +- 9 files changed, 64 insertions(+), 23 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index 6ed1543..4e60a7a 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -358,6 +358,7 @@ sub GetReservesFromItemnumber { $r->get_column('branchcode'), $r->reserve_id(), $r->waitingdate(), + $r->get_column('expirationdate'), ); } diff --git a/circ/circulation.pl b/circ/circulation.pl index f16475e..177d4f1 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -458,11 +458,36 @@ if ($borrowernumber) { if ($borrowernumber) { my $holds = Koha::Holds->search( { borrowernumber => $borrowernumber } ); $template->param( - holds_count => $holds->count(), - WaitingHolds => scalar $holds->waiting(), + holds_count => Koha::Database->new()->schema() + ->resultset('Reserve') + ->count( { borrowernumber => $borrowernumber } ), ); - - $template->param( adultborrower => 1 ) if ( $borrower->{category_type} eq 'A' || $borrower->{category_type} eq 'I' ); + my @borrowerreserv = GetReservesFromBorrowernumber($borrowernumber); + + my @WaitingReserveLoop; + foreach my $num_res (@borrowerreserv) { + if ( $num_res->{'found'} && $num_res->{'found'} eq 'W' ) { + my $getiteminfo = GetBiblioFromItemNumber( $num_res->{'itemnumber'} ); + my $itemholdinfo = GetReservesFromItemNumber( $num_res->{'itemnumber'} ); + my $itemtypeinfo = getitemtypeinfo( (C4::Context->preference('item-level_itypes')) ? $getiteminfo->{'itype'} : $getiteminfo->{'itemtype'} ); + my %getWaitingReserveInfo; + $getWaitingReserveInfo{title} = $getiteminfo->{'title'}; + $getWaitingReserveInfo{biblionumber} = $getiteminfo->{'biblionumber'}; + $getWaitingReserveInfo{author} = $getiteminfo->{'author'}; + $getWaitingReserveInfo{itemcallnumber} = $getiteminfo->{'itemcallnumber'}; + $getWaitingReserveInfo{enumchron} = $getiteminfo->{'enumchron'}; + $getWaitingReserveInfo{reservedate} = format_date( $num_res->{'reservedate'} ); + $getWaitingReserveInfo{waitingat} = GetBranchName( $num_res->{'branchcode'} ); + $getWaitingReserveInfo{itemtype} = $itemtypeinfo->{'description'}; + $getWaitingReserveInfo{expirationdate} = $itemholdinfo->{'expirationdate'}; + $getWaitingReserveInfo{waitinghere} = 1 + if $num_res->{'branchcode'} eq $branch; + push( @WaitingReserveLoop, \%getWaitingReserveInfo ); + } + } + $template->param( WaitingReserveLoop => \@WaitingReserveLoop ); + $template->param( adultborrower => 1 ) + if ( $borrower->{category_type} eq 'A' || $borrower->{category_type} eq 'I' ); } #title diff --git a/circ/returns.pl b/circ/returns.pl index 4039c75..bab6216 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -581,6 +581,7 @@ foreach ( sort { $a <=> $b } keys %returneditems ) { $ri{itemtitle} = $biblio->{'title'}; $ri{itemauthor} = $biblio->{'author'}; $ri{itemcallnumber} = $biblio->{'itemcallnumber'}; + $ri{enumchron} = $item->{'enumchron'}; $ri{itemtype} = $biblio->{'itemtype'}; $ri{itemnote} = $biblio->{'itemnotes'}; $ri{ccode} = $biblio->{'ccode'}; diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js index b4b676b..20520ec 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js @@ -227,7 +227,11 @@ $(document).ready(function() { title += " " + value.subfield; }); - title += ""; + if ( oObj.enumchron ) { + title += "" + " " + oObj.enumchron + ""; + }else{ + title += ""; + } if ( oObj.author ) { title += " " + BY.replace( "_AUTHOR_", " " + oObj.author ); @@ -489,7 +493,11 @@ $(document).ready(function() { title += " " + value.subfield; }); - title += ""; + if ( oObj.enumchron ) { + title += "" + " " + oObj.enumchron + ""; + }else{ + title += ""; + } if ( oObj.author ) { title += " " + BY.replace( "_AUTHOR_", " " + oObj.author ); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index 19ba9fa..bcd9441 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -797,28 +797,30 @@ No patron matched [% message %] - [% IF ( WaitingHolds ) %] + [% IF ( WaitingReserveLoop ) %]

Holds waiting:

- [% FOREACH w IN WaitingHolds %] + [% FOREACH WaitingReserveLoo IN WaitingReserveLoop %] [% END %]
- [% END %] + [% END %] [% IF ( notes ) %]
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 ca23a94..f61b801 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt @@ -580,7 +580,7 @@ $(document).ready(function () { [% END %] - [% riloo.itemtitle |html %] + [% riloo.itemtitle |html %][% IF ( riloo.enumchron ) %]
[% riloo.enumchron %][% END %] [% riloo.itemauthor %] [% riloo.barcode %] [% riloo.homebranch %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt index 4bb2632..d37cad0 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ -193,6 +193,7 @@ [% ISSUE.title |html %] [% FOREACH subtitl IN ISSUE.subtitle %] [% subtitl.subfield %][% END %] + [% IF ( ISSUE.enumchron ) %] [% ISSUE.enumchron %][% END %] [% ISSUE.author %] [% IF ( ISSUE.overdue ) %] @@ -353,7 +354,7 @@ [% WAITIN.itemtype %] - [% WAITIN.waiting_title %] [% FOREACH subtitl IN WAITIN.subtitle %] [% subtitl.subfield %][% END %] + [% WAITIN.waiting_title %] [% IF ( WAITIN.enumchron ) %][% WAITIN.enumchron %] [% END %][% FOREACH subtitl IN WAITIN.subtitle %] [% subtitl.subfield %][% END %] [% WAITIN.author %] @@ -540,6 +541,7 @@ [% RESERVE.reserves_title %] + [% IF ( WAITIN.enumchron ) %] [% WAITIN.enumchron %][% END %] [% FOREACH subtitl IN RESERVE.subtitle %] [% subtitl.subfield %] [% END %] diff --git a/opac/opac-user.pl b/opac/opac-user.pl index 54c9295..04b2673 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -312,6 +312,7 @@ my $wcount = 0; foreach my $res (@reserves) { if ( $res->{'itemnumber'} ) { my $item = GetItem( $res->{'itemnumber'}); + $res->{enumchron} = $item->{enumchron}; $res->{'holdingbranch'} = $branches->{ $item->{'holdingbranch'} }->{'branchname'}; $res->{'branch'} = $branches->{ $res->{'branchcode'} }->{'branchname'}; diff --git a/svc/checkouts b/svc/checkouts index 6ecfd09..62f4290 100755 --- a/svc/checkouts +++ b/svc/checkouts @@ -93,7 +93,7 @@ my $sql = ' itemlost, damaged, location, - + items.enumchron, DATEDIFF( issuedate, CURRENT_DATE() ) AS not_issued_today FROM issues LEFT JOIN items USING ( itemnumber ) @@ -168,6 +168,7 @@ while ( my $c = $sth->fetchrow_hashref() ) { date_due_overdue => $c->{date_due_overdue} ? JSON::true : JSON::false, timestamp => $c->{timestamp}, onsite_checkout => $c->{onsite_checkout}, + enumchron => $c->{enumchron}, renewals_count => $renewals_count, renewals_allowed => $renewals_allowed, renewals_remaining => $renewals_remaining, -- 1.9.1