From ab159c35b81e5ee543dd47624039b723e313d1fb Mon Sep 17 00:00:00 2001 From: Janusz Kaczmarek Date: Wed, 22 Feb 2023 12:59:11 +0100 Subject: [PATCH] Bug 33037: Koha does not display difference between enumchron and serialseq in record detail view (OPAC and intranet) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Patch 32555 tries to resolve the issue caused by bug 31313. But the way it is fixed seems to be at least problematic. With patch 32555 we will never see the difference between `serial`.`serialseq` and `items`.`enumchron` which is still intended in opac-detail.tt (line ~ 1332) and [intranet] catalogue/detail.tt (line ~ 446). This is because ITEM_RESULT.serialitem (in opac-detail.tt) and item.itemserial.serial (in catalogue/detail.tt) refer to non-existing things. (and therefor the problem described in 32555 no longer emerge). The original problem is caused by mixing up serialitem with serial in [opac-]detail.pl and passing serialitem instead of serial to both templates. To test: 1. Create a serial subscription 1.1. Go to Serials 1.2. Click on New subscription 1.3. Fill out the first form - Vendor: leave empty - Record: enter a record number - Create an item record when receiving this serial - When there is an irregular issue: Keep issue number - Manual history: leave unchecked - Call number: leave empty - Library: Centerville - Public/nonpublic note: leave empty - Patron notification: None - Location: None - Collection: None - Item type: Continuing resources - Grace period: leave empty - Number of issues to display: leave both empty 1.4. Click Next (and confirm you are not using a vendor) 1.5. Fill out the second form - First issue publication date: 2023-01-01 - Frequency: 1/month - Subscription length: issues 12 - Subscription start date: 2023-01-01 - Subscription end date: 2024-01-01 - Numbering pattern: Number - Locale: leave empty - Begins with: 42 - Inner counter: leave empty 1.6. Click Test prediction pattern 1.7. Click Save subscription 2. Click OPAC view: Open in new window. 3. Back in the staff interface tab, receive an issue 3.1. Click Receive 3.2. In Status, choose Arrived for No. 42 3.3. IN ITEM DETAILS BELOW CHANGE h - Serial enumeration / chronology from No. 42 to some different string 3.3. Click Save 4. Check the items in OPAC and Intranet – you will see only the value from the item $h subfield (enumchron) instead of desired "enumchron -- serialseq" in case of a difference between `serial`.`serialseq` and `items`.`enumchron`. 5. Apply this patch 6. Repeat 4 7. Check the items in OPAC and Intranet – you should now see the desired "enumchron -- serialseq" string. 8. Sign off Signed-off-by: Lucas Gass Signed-off-by: Nick Signed-off-by: Tomas Cohen Arazi (cherry picked from commit c8012d41041969c0ec69afb962ae6795ffa1926b) Signed-off-by: Matt Blenkinsop --- catalogue/detail.pl | 3 ++- koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt | 4 ++-- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt | 2 +- opac/opac-detail.pl | 3 ++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/catalogue/detail.pl b/catalogue/detail.pl index c7908bc969..f8b6d04237 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -386,7 +386,8 @@ foreach my $item (@items) { # FIXME The following must be Koha::Item->serial my $serial_item = Koha::Serial::Items->find($item->itemnumber); if ( $serial_item ) { - $item_info->{serial} = $serial_item; + my $serial = Koha::Serials->find($serial_item->serialid); + $item_info->{serial} = $serial if $serial; $itemfields{publisheddate} = 1; } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index d31438980c..dc3e4e435a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -423,7 +423,7 @@ Note that permanent location is a code, and location may be an authval. [% IF Koha.Preference('EnableItemGroups') %][% item.object.item_group.description | html %][% END %] [% IF ( item.itemcallnumber ) %] [% item.itemcallnumber | html %][% END %] [% IF ( volinfo ) %] - [% SET serial = item.itemserial.serial %] + [% SET serial = item.serial %] [% IF itemdata_publisheddate #If there is at least one published date, use it for sorting %] [% ELSE %] @@ -432,7 +432,7 @@ Note that permanent location is a code, and location may be an authval. [% IF ( itemdata_enumchron ) %] [% IF item.enumchron && serial.serialseq %] [% item.enumchron | html %] - [% IF ( item.serialseq && item.enumchron != serial.serialseq ) %] + [% IF ( serial.serialseq && item.enumchron != serial.serialseq ) %] -- [% serial.serialseq | html %] [% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt index 6ba1010c48..12829a0c8c 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -1325,7 +1325,7 @@ [% END %] [% IF ( itemdata_enumchron ) %] - [% SET serial = ITEM_RESULT.serialitem %] + [% SET serial = ITEM_RESULT.serial %] [% IF ITEM_RESULT.enumchron && serial.serialseq %] [% ITEM_RESULT.enumchron | html %] diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 3c2b8df6ec..116694e267 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -720,7 +720,8 @@ else { # FIXME The following must be Koha::Item->serial my $serial_item = Koha::Serial::Items->find($item->itemnumber); if ( $serial_item ) { - $item_info->{serial} = $serial_item; + my $serial = Koha::Serials->find($serial_item->serialid); + $item_info->{serial} = $serial if $serial; } $item_info->{checkout} = $item->checkout; -- 2.39.5