Bug 34608

Summary: Add sort1 and sort2 to patron search results
Product: Koha Reporter: Owen Leonard <oleonard>
Component: PatronsAssignee: Owen Leonard <oleonard>
Status: Pushed to main --- QA Contact: Jonathan Druart <jonathan.druart>
Severity: enhancement    
Priority: P5 - low CC: david, eugenegf, gmcharlt, jonathan.druart, kyle.m.hall
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:
24.11.00
Circulation function:
Bug Depends on: 34478, 35329    
Bug Blocks: 38190    
Attachments: Bug 34608: Add sort1 and sort2 to patron search results
Bug 34608: Add sort1 and sort2 to patron search results
Bug 34608: (follow-up) Display authorized values if used
Bug 34608: Add sort1 and sort2 to patron search results
Bug 34608: (follow-up) Display authorized values if used
Bug 34608: (follow-up) Display authorized values if used
Bug 34608: Add sort1 and sort2 to patron search results
Bug 34608: (follow-up) Display authorized values if used
Bug 34608: (follow-up) Display authorized values if used
Bug 34608: Display dropdown list if linked with AV cat
Bug 34608: Display dropdown list if linked with AV cat
Bug 34608: Display dropdown list if linked with AV cat
Bug 34608: Add sort1 and sort2 to patron search results
Bug 34608: (follow-up) Display authorized values if used
Bug 34608: Display dropdown list if linked with AV cat
Bug 34608: Add sort1 and sort2 to patron search results
Bug 34608: (follow-up) Display authorized values if used
Bug 34608: Display dropdown list if linked with AV cat
Bug 34608: Deal with null values
Bug 34608: Display dropdown list if linked with AV cat
Bug 34608: Deal with null values

Description Owen Leonard 2023-08-24 11:04:45 UTC
Some libraries would like the option of showing columns for sort1 and sort2 to patron search results.
Comment 1 Owen Leonard 2023-08-24 11:22:01 UTC Comment hidden (obsolete)
Comment 2 Emily-Rose Francoeur 2023-09-07 19:16:01 UTC Comment hidden (obsolete)
Comment 3 Katrin Fischer 2023-10-07 17:55:35 UTC
I really like this, but there is a small caveat:
This works for the case where the sort fields are used with free text input, but not when you are using it with the bsort1 and bsort2 authorized values.
Comment 4 Owen Leonard 2023-11-01 16:13:00 UTC
*** Bug 34996 has been marked as a duplicate of this bug. ***
Comment 5 Owen Leonard 2023-11-01 17:47:38 UTC Comment hidden (obsolete)
Comment 6 David Nind 2023-12-04 04:25:32 UTC
The patch no longer applies 8-(... 

git bz apply 34608

Bug 34608 - Add sort1 and sort2 to patron search results

155343 - Bug 34608: Add sort1 and sort2 to patron search results
158194 - Bug 34608: (follow-up) Display authorized values if used

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 34608: Add sort1 and sort2 to patron search results
Using index info to reconstruct a base tree...
M	admin/columns_settings.yml
M	koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc
M	koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt
Falling back to patching base and 3-way merge...
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt
CONFLICT (content): Merge conflict in koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt
Auto-merging koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc
CONFLICT (content): Merge conflict in koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc
Auto-merging admin/columns_settings.yml
error: Failed to merge in the changes.
Patch failed at 0001 Bug 34608: Add sort1 and sort2 to patron search results
Comment 7 Owen Leonard 2023-12-04 16:55:25 UTC Comment hidden (obsolete)
Comment 8 Owen Leonard 2023-12-04 16:55:28 UTC Comment hidden (obsolete)
Comment 9 David Nind 2023-12-04 19:25:41 UTC Comment hidden (obsolete)
Comment 10 Jonathan Druart 2024-02-29 10:58:33 UTC
Can you rebase on top of bug 35329 please (PQA and will be pushed very soon)? I can help if needed.
Comment 11 Owen Leonard 2024-02-29 12:32:04 UTC
Created attachment 162592 [details] [review]
Bug 34608: Add sort1 and sort2 to patron search results

This patch adds the option of displaying patron "sort1" and
"sort2" statistical fields in the patron module's main search
results. The fields are hidden by default in the updated table
configuration.

To test, apply the patch and restart services.

- Go to Patrons and perform a search.
- You should not see columns for sort1 and sort2.
- Under the "Columns" button you should see options to display sort1 and
  sort2. Confirm that they work to show and hide the columns.
- Confirm that the sort1 and sort2 columns are sortable and searchable.

- Go to Administration -> Table settings.
- Under Patrons -> member, toggle the sort1 and sort1 "hidden by
  default" checkboxes and save the configuration.
- Return to patron search results to confirm that the columns are now
  shown by default.

Signed-off-by: Émily-Rose Francoeur <emily-rose.francoeur@inLibro.com>
Comment 12 Owen Leonard 2024-02-29 12:32:06 UTC
Created attachment 162593 [details] [review]
Bug 34608: (follow-up) Display authorized values if used

This patch shamelessly steals from Bug 33568 in order to allow the
correct authorized value description to be shown in the JS-generated
table of results for values of borrowers sort1 and sort2.

To test, apply the patch and go to Administration -> Authorized values.

- Add some values, if necessary, to both the 'Bsort1' and 'Bsort2'
  categories.
- Locate some patron records to edit, and set the patron's "Sort 1" and
  "Sort 2" fields.
- Perform a patron search which will return those patron records.
  - Confirm that the correct authorized value description is shown
    instead of the authorized value code.
- Delete all values from the 'Bsort1' and 'Bsort2' authorized value
  categories.
- Return to your patron search and confirm that "Sort 1" and "Sort 2"
  values are still being shown, though now it's the "raw" code.

Signed-off-by: David Nind <david@davidnind.com>
Comment 13 Owen Leonard 2024-02-29 12:32:39 UTC
Rebased on top of Bug 34478 and Bug 35329.
Comment 14 Owen Leonard 2024-04-22 10:57:30 UTC
Created attachment 165260 [details] [review]
Bug 34608: (follow-up) Display authorized values if used

This patch shamelessly steals from Bug 33568 in order to allow the
correct authorized value description to be shown in the JS-generated
table of results for values of borrowers sort1 and sort2.

To test, apply the patch and go to Administration -> Authorized values.

- Add some values, if necessary, to both the 'Bsort1' and 'Bsort2'
  categories.
- Locate some patron records to edit, and set the patron's "Sort 1" and
  "Sort 2" fields.
- Perform a patron search which will return those patron records.
  - Confirm that the correct authorized value description is shown
    instead of the authorized value code.
- Delete all values from the 'Bsort1' and 'Bsort2' authorized value
  categories.
- Return to your patron search and confirm that "Sort 1" and "Sort 2"
  values are still being shown, though now it's the "raw" code.
Comment 15 Jonathan Druart 2024-04-23 09:00:55 UTC
Shouldn't we have a dropdown in the column filter if it's linked with bsort1 category?
Otherwise we won't be able to search using the description.
Comment 16 Jonathan Druart 2024-04-23 09:20:08 UTC
Created attachment 165360 [details] [review]
Bug 34608: Display dropdown list if linked with AV cat

If at least one AV exists for bsort1 we will show a dropdown list in the
column filter for bsort1. Same for bsort2.
Comment 17 Jonathan Druart 2024-04-23 09:20:25 UTC
Owen, does this make sense for you?
Comment 18 Owen Leonard 2024-04-23 11:09:34 UTC
Created attachment 165375 [details] [review]
Bug 34608: Display dropdown list if linked with AV cat

If at least one AV exists for bsort1 we will show a dropdown list in
the column filter for bsort1. Same for bsort2.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 19 Owen Leonard 2024-06-17 16:04:15 UTC
Created attachment 167789 [details] [review]
Bug 34608: Display dropdown list if linked with AV cat

If at least one AV exists for bsort1 we will show a dropdown list in
the column filter for bsort1. Same for bsort2.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 20 Owen Leonard 2024-08-23 11:15:04 UTC
Created attachment 170624 [details] [review]
Bug 34608: Add sort1 and sort2 to patron search results

This patch adds the option of displaying patron "sort1" and
"sort2" statistical fields in the patron module's main search
results. The fields are hidden by default in the updated table
configuration.

To test, apply the patch and restart services.

- Go to Patrons and perform a search.
- You should not see columns for sort1 and sort2.
- Under the "Columns" button you should see options to display sort1 and
  sort2. Confirm that they work to show and hide the columns.
- Confirm that the sort1 and sort2 columns are sortable and searchable.

- Go to Administration -> Table settings.
- Under Patrons -> member, toggle the sort1 and sort1 "hidden by
  default" checkboxes and save the configuration.
- Return to patron search results to confirm that the columns are now
  shown by default.

Signed-off-by: Émily-Rose Francoeur <emily-rose.francoeur@inLibro.com>
Comment 21 Owen Leonard 2024-08-23 11:15:07 UTC
Created attachment 170625 [details] [review]
Bug 34608: (follow-up) Display authorized values if used

This patch shamelessly steals from Bug 33568 in order to allow the
correct authorized value description to be shown in the JS-generated
table of results for values of borrowers sort1 and sort2.

To test, apply the patch and go to Administration -> Authorized values.

- Add some values, if necessary, to both the 'Bsort1' and 'Bsort2'
  categories.
- Locate some patron records to edit, and set the patron's "Sort 1" and
  "Sort 2" fields.
- Perform a patron search which will return those patron records.
  - Confirm that the correct authorized value description is shown
    instead of the authorized value code.
- Delete all values from the 'Bsort1' and 'Bsort2' authorized value
  categories.
- Return to your patron search and confirm that "Sort 1" and "Sort 2"
  values are still being shown, though now it's the "raw" code.
Comment 22 Owen Leonard 2024-08-23 11:15:09 UTC
Created attachment 170626 [details] [review]
Bug 34608: Display dropdown list if linked with AV cat

If at least one AV exists for bsort1 we will show a dropdown list in
the column filter for bsort1. Same for bsort2.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 23 Jonathan Druart 2024-08-28 12:41:41 UTC
Created attachment 170809 [details] [review]
Bug 34608: Add sort1 and sort2 to patron search results

This patch adds the option of displaying patron "sort1" and
"sort2" statistical fields in the patron module's main search
results. The fields are hidden by default in the updated table
configuration.

To test, apply the patch and restart services.

- Go to Patrons and perform a search.
- You should not see columns for sort1 and sort2.
- Under the "Columns" button you should see options to display sort1 and
  sort2. Confirm that they work to show and hide the columns.
- Confirm that the sort1 and sort2 columns are sortable and searchable.

- Go to Administration -> Table settings.
- Under Patrons -> member, toggle the sort1 and sort1 "hidden by
  default" checkboxes and save the configuration.
- Return to patron search results to confirm that the columns are now
  shown by default.

Signed-off-by: Émily-Rose Francoeur <emily-rose.francoeur@inLibro.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 24 Jonathan Druart 2024-08-28 12:41:44 UTC
Created attachment 170810 [details] [review]
Bug 34608: (follow-up) Display authorized values if used

This patch shamelessly steals from Bug 33568 in order to allow the
correct authorized value description to be shown in the JS-generated
table of results for values of borrowers sort1 and sort2.

To test, apply the patch and go to Administration -> Authorized values.

- Add some values, if necessary, to both the 'Bsort1' and 'Bsort2'
  categories.
- Locate some patron records to edit, and set the patron's "Sort 1" and
  "Sort 2" fields.
- Perform a patron search which will return those patron records.
  - Confirm that the correct authorized value description is shown
    instead of the authorized value code.
- Delete all values from the 'Bsort1' and 'Bsort2' authorized value
  categories.
- Return to your patron search and confirm that "Sort 1" and "Sort 2"
  values are still being shown, though now it's the "raw" code.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 25 Jonathan Druart 2024-08-28 12:41:48 UTC
Created attachment 170811 [details] [review]
Bug 34608: Display dropdown list if linked with AV cat

If at least one AV exists for bsort1 we will show a dropdown list in
the column filter for bsort1. Same for bsort2.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 26 Jonathan Druart 2024-08-28 12:41:51 UTC
Created attachment 170812 [details] [review]
Bug 34608: Deal with null values

default values for sort1 and sort2 is NULL

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 27 Katrin Fischer 2024-08-30 14:17:33 UTC
When one of the bsort authorised value categories is used in combination, the filter on top changes to a drop down, which is really nice.
But the data in the column is the AV code, not the description, so there is a mismatch that is confusing for search.

The test plan claims this should work, but it didn't in my test :(

I tried a restart_all as well as a private browser window.
Comment 28 Jonathan Druart 2024-09-02 12:32:51 UTC
Created attachment 170936 [details] [review]
Bug 34608: Display dropdown list if linked with AV cat

If at least one AV exists for bsort1 we will show a dropdown list in
the column filter for bsort1. Same for bsort2.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 29 Jonathan Druart 2024-09-02 12:32:54 UTC
Created attachment 170937 [details] [review]
Bug 34608: Deal with null values

default values for sort1 and sort2 is NULL

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 30 Jonathan Druart 2024-09-02 12:33:48 UTC
(In reply to Katrin Fischer from comment #27)
> When one of the bsort authorised value categories is used in combination,
> the filter on top changes to a drop down, which is really nice.
> But the data in the column is the AV code, not the description, so there is
> a mismatch that is confusing for search.
> 
> The test plan claims this should work, but it didn't in my test :(
> 
> I tried a restart_all as well as a private browser window.

Sorry, my bad. There was a swap between bsort1 and bsort2 in "Display dropdown list if linked with AV cat". Fixed now.
Comment 31 Katrin Fischer 2024-09-16 08:45:24 UTC
This looks like it was missed in debugging?

                 [% END %]
+                console.log(waiting_holds_barcodes);

I've removed it.
Comment 32 Katrin Fischer 2024-09-16 08:53:58 UTC
Pushed for 24.11!

Well done everyone, thank you!