Bug 32176 - Correctly display patrons when selected after autocomplete (was js/patron-autocomplete.js need another option)
Summary: Correctly display patrons when selected after autocomplete (was js/patron-aut...
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on: 40958
Blocks: 40995
  Show dependency treegraph
 
Reported: 2022-11-11 11:32 UTC by Jonathan Druart
Modified: 2025-10-13 14:02 UTC (History)
1 user (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 32176: Remove duplicated code to select patron from autocomplete (16.24 KB, patch)
2025-10-06 14:17 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32176: Use patron_to_html (1.17 KB, patch)
2025-10-06 14:17 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32176: Fix list transfer (2.64 KB, patch)
2025-10-06 14:17 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32176: Remove duplicated code to select patron from autocomplete (16.31 KB, patch)
2025-10-10 12:42 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 32176: Use patron_to_html (1.23 KB, patch)
2025-10-10 12:42 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 32176: Fix list transfer (2.70 KB, patch)
2025-10-10 12:42 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 32176: Fix punctuation in patron search (2.60 KB, patch)
2025-10-13 13:58 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 32176: Add Cypress tests (2.40 KB, patch)
2025-10-13 13:59 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2022-11-11 11:32:06 UTC
See commit message from "Bug 31782: Remove js/autocomplete/patrons.js"

We need another option in this function, and remove code duplicate from patron_lists/list.tt, acqui/histsearch.tt and acqui/duplicate_orders.tt
Comment 1 Jonathan Druart 2025-10-06 14:17:54 UTC
Created attachment 187477 [details] [review]
Bug 32176: Remove duplicated code to select patron from autocomplete

On bug 31782 we centralized the code to autocomplete when searching for patron
There were several occurrences in the code where some code were
duplicated (when selecting patrons and allowing to remove them from a
list).

This patch centralizes this code by adding another parameter to
patron_autocomplete: on-select-add-to

Test plan:
When duplicating an order, searching for orders, editing a course (and
adding instructors) and adding patrons to a patron list, you should now
see the correct patron details displayed: with preferred name, without
"null" in case of missing surname, correct spacing, etc. Like (almost)
everywhere else in Koha.
Comment 2 Jonathan Druart 2025-10-06 14:17:56 UTC
Created attachment 187478 [details] [review]
Bug 32176: Use patron_to_html

Thanks to bug 40958.
Comment 3 Jonathan Druart 2025-10-06 14:17:59 UTC
Created attachment 187479 [details] [review]
Bug 32176: Fix list transfer
Comment 4 Andrew Fuerste-Henry 2025-10-07 15:35:01 UTC
I get the following error when attempting to create a course with these patches applied: 
Template process failed: file error - js-patron-format.inc: not found at /kohadevbox/koha/C4/Templates.pm line 146
Comment 5 Jonathan Druart 2025-10-07 17:02:12 UTC
(In reply to Andrew Fuerste-Henry from comment #4)
> I get the following error when attempting to create a course with these
> patches applied: 
> Template process failed: file error - js-patron-format.inc: not found at
> /kohadevbox/koha/C4/Templates.pm line 146

Do you have bug 40958 applied?
Comment 6 Andrew Fuerste-Henry 2025-10-07 17:14:49 UTC
(In reply to Jonathan Druart from comment #5)

> Do you have bug 40958 applied?

Yes
Comment 7 Jonathan Druart 2025-10-09 09:09:26 UTC
(In reply to Andrew Fuerste-Henry from comment #6)
> (In reply to Jonathan Druart from comment #5)
> 
> > Do you have bug 40958 applied?
> 
> Yes

Indeed, sorry! There was a problem in the dependency tree. I have added a patch to bug 40958 to remove the occurrence added by bug 40699.
Comment 8 Andrew Fuerste-Henry 2025-10-10 12:42:33 UTC
Created attachment 187728 [details] [review]
Bug 32176: Remove duplicated code to select patron from autocomplete

On bug 31782 we centralized the code to autocomplete when searching for patron
There were several occurrences in the code where some code were
duplicated (when selecting patrons and allowing to remove them from a
list).

This patch centralizes this code by adding another parameter to
patron_autocomplete: on-select-add-to

Test plan:
When duplicating an order, searching for orders, editing a course (and
adding instructors) and adding patrons to a patron list, you should now
see the correct patron details displayed: with preferred name, without
"null" in case of missing surname, correct spacing, etc. Like (almost)
everywhere else in Koha.

Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Comment 9 Andrew Fuerste-Henry 2025-10-10 12:42:35 UTC
Created attachment 187729 [details] [review]
Bug 32176: Use patron_to_html

Thanks to bug 40958.

Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Comment 10 Andrew Fuerste-Henry 2025-10-10 12:42:38 UTC
Created attachment 187730 [details] [review]
Bug 32176: Fix list transfer

Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Comment 11 Andrew Fuerste-Henry 2025-10-10 12:48:35 UTC
(In reply to Andrew Fuerste-Henry from comment #8)
> without "null" in case of missing surname, correct spacing, etc. Like (almost)
> everywhere else in Koha.

Oop, signed off too soon. When I removed Henry's surname I get ", Henry" in autocompletes.
Comment 12 Andrew Fuerste-Henry 2025-10-10 14:04:13 UTC
Back to signed off. The issue I ran into with ", Henry" is existing problematic behavior for which I'll file a new bug.
Comment 13 Jonathan Druart 2025-10-13 13:58:43 UTC
Created attachment 187841 [details] [review]
Bug 32176: Fix punctuation in patron search
Comment 14 Jonathan Druart 2025-10-13 13:59:05 UTC
Created attachment 187842 [details] [review]
Bug 32176: Add Cypress tests
Comment 15 Jonathan Druart 2025-10-13 14:02:05 UTC
(In reply to Andrew Fuerste-Henry from comment #12)
> Back to signed off. The issue I ran into with ", Henry" is existing
> problematic behavior for which I'll file a new bug.

The last 2 patches fix the punctuation problem on the patron searches. On bug 40995 we will deal with the autocomplete.

And we now have Cypress tests \o/