Bug 29662

Summary: PrefillItem should apply to all subfields when SubfieldsToUseWhenPrefill is null
Product: Koha Reporter: Andrew Fuerste-Henry <andrewfh>
Component: CatalogingAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Katrin Fischer <katrin.fischer>
Severity: normal    
Priority: P5 - low CC: dcook, e.betemps, fridolin.somers, hayleypelham, jonathan.druart, m.de.rooy, thibault.keromnes
Version: MainKeywords: regression, release-notes-needed
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29661
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.11.00
Bug Depends on: 27526    
Bug Blocks: 29663    
Attachments: Bug 29662: (bug 27526 follow-up) Prefill all subfields if SubfieldsToUseWhenPrefill is empty
Bug 29662: (bug 27526 follow-up) Prefill all subfields if SubfieldsToUseWhenPrefill is empty
Bug 29662: (bug 27526 follow-up) Prefill all subfields if SubfieldsToUseWhenPrefill is empty
Bug 29662: (QA folow-up) Add explanation for empty to system preference description

Description Andrew Fuerste-Henry 2021-12-08 16:55:27 UTC
To recreate:
- turn on PrefillItem
- confirm SubfieldsToUseWhenPrefill is empty
- create an item, confirm no values are prefilled for next item
- set at least one subfield in SubfieldsToUseWhenPrefill
- create an item, confirm specified subfield(s) get prefilled for next item

In previous versions, leaving SubfieldsToUseWhenPrefill blank meant all subfields were prefilled.
Comment 1 Jonathan Druart 2021-12-13 10:52:15 UTC
Do you know when the regression happened?

On bug 27526 I have explicitly taken this use case into account so I guess I compared with current master (21.06).
Comment 2 Jonathan Druart 2021-12-13 10:53:34 UTC
Created attachment 128436 [details] [review]
Bug 29662: (bug 27526 follow-up) Prefill all subfields if SubfieldsToUseWhenPrefill is empty
Comment 3 Jonathan Druart 2021-12-13 10:54:21 UTC
This patch removes the code that dealt with that specific case, but it would be good to know when this regression occurred.
Comment 4 Hayley Pelham 2021-12-22 21:21:24 UTC
Hello,

Can someone please give a test plan for this patch?

Cheers,
Hayley
Comment 5 Katrin Fischer 2022-01-09 11:30:39 UTC
Hi Hayley, 

I think you can do the following:

Before applying the patch:
- turn on PrefillItem system preference
- confirm SubfieldsToUseWhenPrefill system preference is empty
- create an item, confirm no values are prefilled for next item
- set at least one subfield in SubfieldsToUseWhenPrefill
- create an item, confirm specified subfield(s) get prefilled for next item

Apply patch:
- create an item, confirm it behaves the same as before with your defined subfield getting prefilled
- Empty SubfieldsToUseWhenPrefill system preferene
- create an item, confirm that now all item subfields are prefilled
Comment 6 Jonathan Druart 2022-03-22 14:01:50 UTC
Andrew, does this patch fix the problem you reported?
Comment 7 Biblibre Sandboxes 2022-09-08 15:49:03 UTC
Created attachment 140344 [details] [review]
Bug 29662: (bug 27526 follow-up) Prefill all subfields if SubfieldsToUseWhenPrefill is empty

Signed-off-by: Thibault Keromnès <thibault.keromnes@univ-paris8.fr>
Comment 8 Katrin Fischer 2022-10-03 22:21:21 UTC
Leaving a note for myself or another QA person: I could not see what broke the feature yet, but I can confirm that leaving it empty was meant to copy all the fields:

From bug 7412 that implemented the feature:
By default, all subfields are prefilled when the PrefillItem syspref is on, unless you specify which fields
you want to prefill in the SubfieldsToUseWhenPrefill syspref.
With a value of "f u v", only the $f, $u and $v will be prefilled, for example.
Comment 9 Katrin Fischer 2022-10-18 20:31:52 UTC
Created attachment 142097 [details] [review]
Bug 29662: (bug 27526 follow-up) Prefill all subfields if SubfieldsToUseWhenPrefill is empty

Signed-off-by: Thibault Keromnès <thibault.keromnes@univ-paris8.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 10 Katrin Fischer 2022-10-18 20:31:58 UTC
Created attachment 142098 [details] [review]
Bug 29662: (QA folow-up) Add explanation for empty to system preference description

This amends the system preference description for PrefillItem
to explain what happens when the pref is left empty.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 11 Katrin Fischer 2022-10-18 22:11:07 UTC
*** Bug 29663 has been marked as a duplicate of this bug. ***
Comment 12 Tomás Cohen Arazi 2022-10-21 14:46:33 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!