Bug 32445 - Status display of 'not for loan' items is broken in OPAC/staff
Summary: Status display of 'not for loan' items is broken in OPAC/staff
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P5 - low critical (vote)
Assignee: Jonathan Druart
QA Contact: Martin Renvoize
URL:
Keywords: rel_22_11_candidate
Depends on: 19532 27272
Blocks: 36281 33101
  Show dependency treegraph
 
Reported: 2022-12-11 14:14 UTC by Katrin Fischer
Modified: 2024-03-08 10:44 UTC (History)
11 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.05.00,22.11.02


Attachments
Bug 32445: Fix display of 'not for loan' items in staff (1.63 KB, patch)
2022-12-12 19:48 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 32445: Fix availability display on opac-course-details (3.45 KB, patch)
2023-01-03 11:22 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32445: Fix availability display on opac-basket (5.90 KB, patch)
2023-01-03 11:22 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32445: Fix notforloan display (4.23 KB, patch)
2023-01-03 11:22 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32445: Remove non-Koha::Item support from item-status.inc (3.41 KB, patch)
2023-01-03 11:22 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32445: include item-status-schema-org.inc (4.80 KB, patch)
2023-01-03 11:22 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32445: (follow-up) Fix availability display on opac-course-details (2.54 KB, patch)
2023-01-04 08:10 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32445: Deal with biblio course reserve (1.84 KB, patch)
2023-01-04 10:28 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32445: Fix display of 'not for loan' items in staff (1.68 KB, patch)
2023-01-04 11:57 UTC, David Nind
Details | Diff | Splinter Review
Bug 32445: Fix availability display on opac-course-details (3.50 KB, patch)
2023-01-04 11:57 UTC, David Nind
Details | Diff | Splinter Review
Bug 32445: Fix availability display on opac-basket (5.95 KB, patch)
2023-01-04 11:57 UTC, David Nind
Details | Diff | Splinter Review
Bug 32445: Fix notforloan display (4.27 KB, patch)
2023-01-04 11:57 UTC, David Nind
Details | Diff | Splinter Review
Bug 32445: Remove non-Koha::Item support from item-status.inc (3.45 KB, patch)
2023-01-04 11:57 UTC, David Nind
Details | Diff | Splinter Review
Bug 32445: include item-status-schema-org.inc (4.85 KB, patch)
2023-01-04 11:57 UTC, David Nind
Details | Diff | Splinter Review
Bug 32445: (follow-up) Fix availability display on opac-course-details (2.58 KB, patch)
2023-01-04 11:58 UTC, David Nind
Details | Diff | Splinter Review
Bug 32445: Deal with biblio course reserve (1.88 KB, patch)
2023-01-04 11:58 UTC, David Nind
Details | Diff | Splinter Review
Bug 32445: Fix display of 'not for loan' items in staff (1.75 KB, patch)
2023-01-04 12:28 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 32445: Fix availability display on opac-course-details (3.56 KB, patch)
2023-01-04 12:28 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 32445: Fix availability display on opac-basket (6.01 KB, patch)
2023-01-04 12:28 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 32445: Fix notforloan display (4.34 KB, patch)
2023-01-04 12:28 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 32445: Remove non-Koha::Item support from item-status.inc (3.52 KB, patch)
2023-01-04 12:28 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 32445: include item-status-schema-org.inc (4.92 KB, patch)
2023-01-04 12:28 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 32445: (follow-up) Fix availability display on opac-course-details (2.65 KB, patch)
2023-01-04 12:28 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 32445: Deal with biblio course reserve (1.95 KB, patch)
2023-01-04 12:28 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 32445: Fix display of 'not for loan' items in staff (1.80 KB, patch)
2023-01-04 13:44 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 32445: Fix availability display on opac-course-details (3.61 KB, patch)
2023-01-04 13:44 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 32445: Fix availability display on opac-basket (6.07 KB, patch)
2023-01-04 13:44 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 32445: Fix notforloan display (4.39 KB, patch)
2023-01-04 13:44 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 32445: Remove non-Koha::Item support from item-status.inc (3.57 KB, patch)
2023-01-04 13:44 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 32445: include item-status-schema-org.inc (4.96 KB, patch)
2023-01-04 13:44 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 32445: (follow-up) Fix availability display on opac-course-details (2.70 KB, patch)
2023-01-04 13:45 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 32445: Deal with biblio course reserve (2.00 KB, patch)
2023-01-04 13:45 UTC, Nick Clemens
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Katrin Fischer 2022-12-11 14:14:16 UTC
This is a display issue, but marking as major since it affects a basic functionality in the OPAC:

1) Edit any item, item type should be for loan, so not set to reference.
2) Set Not for loan status to "not for loan".
3) Go to the staff detail page:
4) Verify it displays as: Not for loan (Not For Loan) Available
   The available should not be there!
5) Go to the OPAC detail page:
6) Verifiy the status displays as: Available
   This should display the not for loan status!
Comment 1 Fridolin Somers 2022-12-12 19:45:19 UTC
Looks like it is caused by Bug 31321
Comment 2 Fridolin Somers 2022-12-12 19:48:17 UTC
Created attachment 144542 [details] [review]
Bug 32445: Fix display of 'not for loan' items in staff

test plan :
1) Edit any item, item type should be for loan, so not set to reference.
2) Set Not for loan status to "not for loan".
3) Go to the staff detail page:
=> Without patch it displays as: Not for loan (Not For Loan) Available
=> With patch it displays as: Not for loan (Not For Loan)
Comment 3 Katrin Fischer 2022-12-12 19:48:59 UTC
Hi Frido, did you see the bug in OPAC is worse? Not displaying at all.
Comment 4 Fridolin Somers 2022-12-12 19:55:01 UTC
For OPAC, I tried to fix :
koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc
koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status-schema-org.inc

You see there :
item.itemnotforloan and item.notforloanvalueopac

But I get lost with :
  NOT ( item.isa('Koha::Item') )
Is is still valid ?
Comment 5 Fridolin Somers 2022-12-12 19:55:30 UTC
Ah its more a dependency on Bug 27272
Comment 6 Lucas Gass 2022-12-13 16:03:46 UTC
Does Bug 29198 seem like a duplicate of this one?
Comment 7 Jonathan Druart 2022-12-14 10:25:48 UTC
(In reply to Fridolin Somers from comment #4)
> For OPAC, I tried to fix :
> koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc
> koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status-schema-org.inc
> 
> You see there :
> item.itemnotforloan and item.notforloanvalueopac
> 
> But I get lost with :
>   NOT ( item.isa('Koha::Item') )
> Is is still valid ?

Yes, it's definitely valid. We don't always send a Koha::Item

For instance in opac/opac-basket.pl
97     my $items        = $biblio->items->filter_by_visible_in_opac({ patron => $logged_in_user })->unblessed;

137     $dat->{ITEM_RESULTS}   = $items;
Comment 8 Jonathan Druart 2022-12-14 10:26:18 UTC
(In reply to Lucas Gass from comment #6)
> Does Bug 29198 seem like a duplicate of this one?

I don't think so. Here it's a regression from bug 27272.
Comment 9 Katrin Fischer 2022-12-19 11:29:09 UTC
This is a real bad bug - no chance to fix for 22.11.01?
Comment 10 David Cook 2023-01-03 02:45:20 UTC
Yikes, where are we at with this one?
Comment 11 Katrin Fischer 2023-01-03 08:25:23 UTC
(In reply to David Cook from comment #10)
> Yikes, where are we at with this one?

Needing someone to assign the bug and write patches.
Comment 12 Jonathan Druart 2023-01-03 11:22:24 UTC
Created attachment 144926 [details] [review]
Bug 32445: Fix availability display on opac-course-details
Comment 13 Jonathan Druart 2023-01-03 11:22:29 UTC
Created attachment 144927 [details] [review]
Bug 32445: Fix availability display on opac-basket

Also fix holding branch

Will display an empty span if no location, big deal?
Comment 14 Jonathan Druart 2023-01-03 11:22:34 UTC
Created attachment 144928 [details] [review]
Bug 32445: Fix notforloan display
Comment 15 Jonathan Druart 2023-01-03 11:22:39 UTC
Created attachment 144929 [details] [review]
Bug 32445: Remove non-Koha::Item support from item-status.inc
Comment 16 Jonathan Druart 2023-01-03 11:22:44 UTC
Created attachment 144930 [details] [review]
Bug 32445: include item-status-schema-org.inc

Can be discussed, but it will prevent to fetch several times the same
related objects
Comment 17 Jonathan Druart 2023-01-03 11:23:29 UTC
This patch set suggests to remove the non-Koha::Item support from item-status.inc in order to make it more reliable. We are removing some specific code from pl scripts (opac-basket.pl, opac-course-details.pl) and pass a Koha::Item to item-status.inc where it was not the case already.

It's hard to provide a full test plan. You should mostly focus on item availability  in opac-detail, opac-basket and opac-course-details.
Comment 18 David Nind 2023-01-04 00:10:57 UTC
I've tested, and this now fixes the display for:
- the record in the staff interface and OPAC
- the cart in the OPAC

For course reserves, the status is shown as:
- OPAC: Programming error, item-status.inc must be called with a Koha::Item object.
- Staff interface: Available

How I tested (using KTD):

1. Replicated the issue (as per the bug description), and in addition I added a record/item to a course reserve and the cart (for both the OPAC and staff interface).

2. Applied the patch, flush_memcached, restart_all and cleared the browser cache.

3. Refreshed the pages.

4. Results:
   - this worked fine for the record/item in the staff interface and OPAC; and the cart in the OPAC
  - Didn't work for course reserves: the status in the staff interface shows as 'Available' (I guess this is right as it is available but can't be borrowed?), and in the OPAC shows as 'Programming error, item-status.inc must be called with a Koha::Item object.'
Comment 19 Jonathan Druart 2023-01-04 08:10:26 UTC
Created attachment 144971 [details] [review]
Bug 32445: (follow-up) Fix availability display on opac-course-details

This is reverting a change made by
  commit 52b5cdf79b53eb29173e92a7dfe0f76df135e7d9
  Bug 19532: Recalls on OPAC

Is it correct? I let a comment on bug 19532 comment 928 to ask for
clarification.
Comment 20 Jonathan Druart 2023-01-04 08:13:28 UTC
The changes made to opac-course-details seem to fix the availability there, that could have been broken by bug 19532.
Comment 21 Jonathan Druart 2023-01-04 08:18:10 UTC
Hi David,
I fixed the "programming error", and the availability display at the OPAC for course reserves. But I think we need a separate bug to deal with it properly (as it exists in 22.05).
Comment 22 David Nind 2023-01-04 10:13:44 UTC
(In reply to Jonathan Druart from comment #21)
> Hi David,
> I fixed the "programming error", and the availability display at the OPAC
> for course reserves. But I think we need a separate bug to deal with it
> properly (as it exists in 22.05).

Thanks Jonathan!

An additional nuance for course reserves:

- If I add an item to course reserves using an item barcode, everything works fine and there is no error displayed.
- However, if I add it using the bibliographic number (such as 262), then I get the same error message as before.
- In addition, if I add more items to course reserves after adding one using the biblio number, they are displayed on the staff interface list, but don't display in the OPAC list (hope this makes sense).

David
Comment 23 Jonathan Druart 2023-01-04 10:28:51 UTC
Created attachment 144978 [details] [review]
Bug 32445: Deal with biblio course reserve
Comment 24 Jonathan Druart 2023-01-04 10:29:15 UTC
(In reply to David Nind from comment #22)

Should be fixed now!
Comment 25 David Nind 2023-01-04 11:57:27 UTC
Created attachment 144987 [details] [review]
Bug 32445: Fix display of 'not for loan' items in staff

test plan :
1) Edit any item, item type should be for loan, so not set to reference.
2) Set Not for loan status to "not for loan".
3) Go to the staff detail page:
=> Without patch it displays as: Not for loan (Not For Loan) Available
=> With patch it displays as: Not for loan (Not For Loan)

Signed-off-by: David Nind <david@davidnind.com>
Comment 26 David Nind 2023-01-04 11:57:32 UTC
Created attachment 144988 [details] [review]
Bug 32445: Fix availability display on opac-course-details

Signed-off-by: David Nind <david@davidnind.com>
Comment 27 David Nind 2023-01-04 11:57:38 UTC
Created attachment 144989 [details] [review]
Bug 32445: Fix availability display on opac-basket

Also fix holding branch

Will display an empty span if no location, big deal?

Signed-off-by: David Nind <david@davidnind.com>
Comment 28 David Nind 2023-01-04 11:57:43 UTC
Created attachment 144990 [details] [review]
Bug 32445: Fix notforloan display

Signed-off-by: David Nind <david@davidnind.com>
Comment 29 David Nind 2023-01-04 11:57:49 UTC
Created attachment 144991 [details] [review]
Bug 32445: Remove non-Koha::Item support from item-status.inc

Signed-off-by: David Nind <david@davidnind.com>
Comment 30 David Nind 2023-01-04 11:57:55 UTC
Created attachment 144992 [details] [review]
Bug 32445: include item-status-schema-org.inc

Can be discussed, but it will prevent to fetch several times the same
related objects

Signed-off-by: David Nind <david@davidnind.com>
Comment 31 David Nind 2023-01-04 11:58:00 UTC
Created attachment 144993 [details] [review]
Bug 32445: (follow-up) Fix availability display on opac-course-details

This is reverting a change made by
  commit 52b5cdf79b53eb29173e92a7dfe0f76df135e7d9
  Bug 19532: Recalls on OPAC

Is it correct? I let a comment on bug 19532 comment 928 to ask for
clarification.

Signed-off-by: David Nind <david@davidnind.com>
Comment 32 David Nind 2023-01-04 11:58:06 UTC
Created attachment 144994 [details] [review]
Bug 32445: Deal with biblio course reserve

Signed-off-by: David Nind <david@davidnind.com>
Comment 33 Martin Renvoize 2023-01-04 12:28:22 UTC
Created attachment 145004 [details] [review]
Bug 32445: Fix display of 'not for loan' items in staff

test plan :
1) Edit any item, item type should be for loan, so not set to reference.
2) Set Not for loan status to "not for loan".
3) Go to the staff detail page:
=> Without patch it displays as: Not for loan (Not For Loan) Available
=> With patch it displays as: Not for loan (Not For Loan)

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 34 Martin Renvoize 2023-01-04 12:28:28 UTC
Created attachment 145005 [details] [review]
Bug 32445: Fix availability display on opac-course-details

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 35 Martin Renvoize 2023-01-04 12:28:32 UTC
Created attachment 145006 [details] [review]
Bug 32445: Fix availability display on opac-basket

Also fix holding branch

Will display an empty span if no location, big deal?

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 36 Martin Renvoize 2023-01-04 12:28:37 UTC
Created attachment 145007 [details] [review]
Bug 32445: Fix notforloan display

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 37 Martin Renvoize 2023-01-04 12:28:43 UTC
Created attachment 145008 [details] [review]
Bug 32445: Remove non-Koha::Item support from item-status.inc

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 38 Martin Renvoize 2023-01-04 12:28:49 UTC
Created attachment 145009 [details] [review]
Bug 32445: include item-status-schema-org.inc

Can be discussed, but it will prevent to fetch several times the same
related objects

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 39 Martin Renvoize 2023-01-04 12:28:54 UTC
Created attachment 145010 [details] [review]
Bug 32445: (follow-up) Fix availability display on opac-course-details

This is reverting a change made by
  commit 52b5cdf79b53eb29173e92a7dfe0f76df135e7d9
  Bug 19532: Recalls on OPAC

Is it correct? I let a comment on bug 19532 comment 928 to ask for
clarification.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 40 Martin Renvoize 2023-01-04 12:28:59 UTC
Created attachment 145011 [details] [review]
Bug 32445: Deal with biblio course reserve

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 41 Martin Renvoize 2023-01-04 12:29:40 UTC
Nice cleanup here Jonathan.

All working as expected, no regressions found in testing.

QA scripts happy too..

Passing QA
Comment 42 Nick Clemens 2023-01-04 13:44:32 UTC
Created attachment 145014 [details] [review]
Bug 32445: Fix display of 'not for loan' items in staff

test plan :
1) Edit any item, item type should be for loan, so not set to reference.
2) Set Not for loan status to "not for loan".
3) Go to the staff detail page:
=> Without patch it displays as: Not for loan (Not For Loan) Available
=> With patch it displays as: Not for loan (Not For Loan)

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 43 Nick Clemens 2023-01-04 13:44:37 UTC
Created attachment 145015 [details] [review]
Bug 32445: Fix availability display on opac-course-details

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 44 Nick Clemens 2023-01-04 13:44:42 UTC
Created attachment 145016 [details] [review]
Bug 32445: Fix availability display on opac-basket

Also fix holding branch

Will display an empty span if no location, big deal?

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 45 Nick Clemens 2023-01-04 13:44:47 UTC
Created attachment 145017 [details] [review]
Bug 32445: Fix notforloan display

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 46 Nick Clemens 2023-01-04 13:44:52 UTC
Created attachment 145018 [details] [review]
Bug 32445: Remove non-Koha::Item support from item-status.inc

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 47 Nick Clemens 2023-01-04 13:44:56 UTC
Created attachment 145019 [details] [review]
Bug 32445: include item-status-schema-org.inc

Can be discussed, but it will prevent to fetch several times the same
related objects

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 48 Nick Clemens 2023-01-04 13:45:01 UTC
Created attachment 145020 [details] [review]
Bug 32445: (follow-up) Fix availability display on opac-course-details

This is reverting a change made by
  commit 52b5cdf79b53eb29173e92a7dfe0f76df135e7d9
  Bug 19532: Recalls on OPAC

Is it correct? I let a comment on bug 19532 comment 928 to ask for
clarification.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 49 Nick Clemens 2023-01-04 13:45:07 UTC
Created attachment 145021 [details] [review]
Bug 32445: Deal with biblio course reserve

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 50 Tomás Cohen Arazi 2023-01-05 12:18:51 UTC
Thanks, Jonathan. This ended up being a nice cleanup along with the fix!
Comment 51 Tomás Cohen Arazi 2023-01-05 12:26:41 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 52 Jacob O'Mara 2023-01-13 16:08:44 UTC
Nice work, thanks everyone!

Pushed to 22.11.x for the next release.
Comment 53 Lucas Gass 2023-01-24 18:15:18 UTC
Doesn't apply cleanly to 22.05.x, no backport. If needed please rebase