Bug 28831

Summary: OPAC XSLT Results: Allow unavailable item grouping on status only for large consortia
Product: Koha Reporter: Marcel de Rooy <m.de.rooy>
Component: OPACAssignee: Marcel de Rooy <m.de.rooy>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: david, jonathan.druart, kyle, nick
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.11.00
Bug Depends on: 26302, 29199    
Bug Blocks:    
Attachments: Bug 28831: Database revision, add new preference
Bug 28831: Add choose/when, and change indentation
Bug 28831: Add the new group by substatus-block
Bug 28831: Database revision, add new preference
Bug 28831: Add choose/when, and change indentation
Bug 28831: Add the new group by substatus-block
Bug 28831: Database revision, add new preference
Bug 28831: Add choose/when, and change indentation
Bug 28831: Add the new group by substatus-block
Bug 28831: Database revision, add new preference
Bug 28831: Add choose/when, and change indentation
Bug 28831: Add the new group by substatus-block
Bug 28831: Database revision, add new preference
Bug 28831: Add choose/when, and change indentation
Bug 28831: Add the new group by substatus-block

Description Marcel de Rooy 2021-08-09 12:11:57 UTC
See bug 26302:

> 3 - Not blocker: it would be nice to have a '-1' option for
> resultsMaxItemsUnavailable to preserve previous grouping - in large
> consortia I know they have not wanted to display individual NFL items.

This follow-up would make it possible to group by (sub)status and not on branch level first.
Comment 1 Marcel de Rooy 2021-09-09 09:51:59 UTC
Created attachment 124688 [details] [review]
Bug 28831: Database revision, add new preference

The preference OPACResultsUnavailableGroupingBy allows you to
group unavailable items by substatus, only showing item counts, on
the OPAC XSLT results.

This is meant to be useful for larger consortia.

Test plan:
Run dbrev.
Check new pref on Admin, preferences, OPAC tab.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 2 Marcel de Rooy 2021-09-09 09:52:02 UTC
Created attachment 124689 [details] [review]
Bug 28831: Add choose/when, and change indentation

As a first step:
[1] Add the new pref OPACResultsUnavailableGroupingBy in the xslt,
    and pass it via C4/XSLT.
[2] Add a choose/when construction in the third part of Availability.
[3] Add indentation (8 spaces) of the inner block handling group by branch.

Test plan:
Make sure that OPACResultsUnavailableGroupingBy eq branch.
Verify that OPAC results are still untouched.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 3 Marcel de Rooy 2021-09-09 09:52:06 UTC
Created attachment 124690 [details] [review]
Bug 28831: Add the new group by substatus-block

Test plan:
Change OPACResultsUnavailableGroupingBy to substatus.
Verify the result on opac results. (You need a few unavailable items
with different statuses on a few branches.)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 4 Marcel de Rooy 2021-09-09 09:53:10 UTC
David, Nick: This is a small follow-up on the XSLT changes on bug 26302. Could you please have a look?
Comment 5 Marcel de Rooy 2021-09-09 10:00:02 UTC
As example.
This allows you to toggle between:

Not available: Centerville: Checked out (1). Centerville: Ordered (1). Fairfield: Checked out (1). Fairfield: Withdrawn (1). 

OR

Not available: Checked out (2). Ordered (1). Withdrawn (1). 

In the first case the unavailable items = 0, groupby = branch.
In the second case only groupby = substatus is relevant.
Comment 6 David Nind 2021-09-09 12:31:50 UTC
I get this message when updating the database:

root@kohadevbox:koha(bz28831)$ updatedatabase
Bareword found where operator expected at /kohadevbox/koha/installer/data/mysql/atomicupdate/bug_28831.pl line 11, near "('OPACResultsUnavailableGroupingBy','branch','branch|substatus"
  (Might be a runaway multi-line || string starting on line 9)
	(Missing operator before substatus?)
DEV atomic update /kohadevbox/koha/installer/data/mysql/atomicupdate/bug_28831.pl  [12:29:18]
ERROR - {UNKNOWN}: Can't use an undefined value as a subroutine reference at /kohadevbox/koha/C4/Installer.pm line 735. at /kohadevbox/koha/C4/Installer.pm line 737
Comment 7 Marcel de Rooy 2021-09-09 12:51:33 UTC
Created attachment 124706 [details] [review]
Bug 28831: Database revision, add new preference

The preference OPACResultsUnavailableGroupingBy allows you to
group unavailable items by substatus, only showing item counts, on
the OPAC XSLT results.

This is meant to be useful for larger consortia.

Test plan:
Run dbrev.
Check new pref on Admin, preferences, OPAC tab.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 8 Marcel de Rooy 2021-09-09 12:51:37 UTC
Created attachment 124707 [details] [review]
Bug 28831: Add choose/when, and change indentation

As a first step:
[1] Add the new pref OPACResultsUnavailableGroupingBy in the xslt,
    and pass it via C4/XSLT.
[2] Add a choose/when construction in the third part of Availability.
[3] Add indentation (8 spaces) of the inner block handling group by branch.

Test plan:
Make sure that OPACResultsUnavailableGroupingBy eq branch.
Verify that OPAC results are still untouched.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 9 Marcel de Rooy 2021-09-09 12:51:40 UTC
Created attachment 124708 [details] [review]
Bug 28831: Add the new group by substatus-block

Test plan:
Change OPACResultsUnavailableGroupingBy to substatus.
Verify the result on opac results. (You need a few unavailable items
with different statuses on a few branches.)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 10 Marcel de Rooy 2021-09-09 13:00:28 UTC
(In reply to David Nind from comment #6)
> I get this message when updating the database:
> 
> root@kohadevbox:koha(bz28831)$ updatedatabase
> Bareword found where operator expected at
> /kohadevbox/koha/installer/data/mysql/atomicupdate/bug_28831.pl line 11,
> near "('OPACResultsUnavailableGroupingBy','branch','branch|substatus"
>   (Might be a runaway multi-line || string starting on line 9)
> 	(Missing operator before substatus?)
> DEV atomic update
> /kohadevbox/koha/installer/data/mysql/atomicupdate/bug_28831.pl  [12:29:18]
> ERROR - {UNKNOWN}: Can't use an undefined value as a subroutine reference at
> /kohadevbox/koha/C4/Installer.pm line 735. at
> /kohadevbox/koha/C4/Installer.pm line 737

Ah thanks for noting.
The pipe char ended the quote command. Had to add a backslash. And removed a comma.
Tested now, should work.
Comment 11 David Nind 2021-09-12 05:36:03 UTC
Created attachment 124804 [details] [review]
Bug 28831: Database revision, add new preference

The preference OPACResultsUnavailableGroupingBy allows you to
group unavailable items by substatus, only showing item counts, on
the OPAC XSLT results.

This is meant to be useful for larger consortia.

Test plan:
Run dbrev.
Check new pref on Admin, preferences, OPAC tab.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: David Nind <david@davidnind.com>
Comment 12 David Nind 2021-09-12 05:36:08 UTC
Created attachment 124805 [details] [review]
Bug 28831: Add choose/when, and change indentation

As a first step:
[1] Add the new pref OPACResultsUnavailableGroupingBy in the xslt,
    and pass it via C4/XSLT.
[2] Add a choose/when construction in the third part of Availability.
[3] Add indentation (8 spaces) of the inner block handling group by branch.

Test plan:
Make sure that OPACResultsUnavailableGroupingBy eq branch.
Verify that OPAC results are still untouched.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: David Nind <david@davidnind.com>
Comment 13 David Nind 2021-09-12 05:36:12 UTC
Created attachment 124806 [details] [review]
Bug 28831: Add the new group by substatus-block

Test plan:
Change OPACResultsUnavailableGroupingBy to substatus.
Verify the result on opac results. (You need a few unavailable items
with different statuses on a few branches.)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: David Nind <david@davidnind.com>
Comment 14 Marcel de Rooy 2021-09-12 14:10:05 UTC
(In reply to David Nind from comment #13)
 
> Signed-off-by: David Nind <david@davidnind.com>

Thanks David
Comment 15 Nick Clemens 2021-10-07 15:48:54 UTC
Created attachment 125894 [details] [review]
Bug 28831: Database revision, add new preference

The preference OPACResultsUnavailableGroupingBy allows you to
group unavailable items by substatus, only showing item counts, on
the OPAC XSLT results.

This is meant to be useful for larger consortia.

Test plan:
Run dbrev.
Check new pref on Admin, preferences, OPAC tab.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 16 Nick Clemens 2021-10-07 15:48:57 UTC
Created attachment 125895 [details] [review]
Bug 28831: Add choose/when, and change indentation

As a first step:
[1] Add the new pref OPACResultsUnavailableGroupingBy in the xslt,
    and pass it via C4/XSLT.
[2] Add a choose/when construction in the third part of Availability.
[3] Add indentation (8 spaces) of the inner block handling group by branch.

Test plan:
Make sure that OPACResultsUnavailableGroupingBy eq branch.
Verify that OPAC results are still untouched.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 17 Nick Clemens 2021-10-07 15:49:00 UTC
Created attachment 125896 [details] [review]
Bug 28831: Add the new group by substatus-block

Test plan:
Change OPACResultsUnavailableGroupingBy to substatus.
Verify the result on opac results. (You need a few unavailable items
with different statuses on a few branches.)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 18 Marcel de Rooy 2021-10-11 08:57:42 UTC
Needs rebase on top of 29199
Comment 19 Marcel de Rooy 2021-10-11 09:04:39 UTC
Created attachment 126031 [details] [review]
Bug 28831: Database revision, add new preference

The preference OPACResultsUnavailableGroupingBy allows you to
group unavailable items by substatus, only showing item counts, on
the OPAC XSLT results.

This is meant to be useful for larger consortia.

Test plan:
Run dbrev.
Check new pref on Admin, preferences, OPAC tab.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 20 Marcel de Rooy 2021-10-11 09:04:42 UTC
Created attachment 126032 [details] [review]
Bug 28831: Add choose/when, and change indentation

As a first step:
[1] Add the new pref OPACResultsUnavailableGroupingBy in the xslt,
    and pass it via C4/XSLT.
[2] Add a choose/when construction in the third part of Availability.
[3] Add indentation (8 spaces) of the inner block handling group by branch.

Test plan:
Make sure that OPACResultsUnavailableGroupingBy eq branch.
Verify that OPAC results are still untouched.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 21 Marcel de Rooy 2021-10-11 09:04:46 UTC
Created attachment 126033 [details] [review]
Bug 28831: Add the new group by substatus-block

Test plan:
Change OPACResultsUnavailableGroupingBy to substatus.
Verify the result on opac results. (You need a few unavailable items
with different statuses on a few branches.)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 22 Jonathan Druart 2021-10-15 09:29:22 UTC Comment hidden (obsolete)
Comment 23 Jonathan Druart 2021-10-15 09:31:28 UTC
Blocked by bug 29199.
Comment 24 Jonathan Druart 2021-10-18 09:34:15 UTC
Pushed to master for 21.11, thanks to everybody involved!