Bug 36156

Summary: Don't duplicate selected value when a field or subfield linked to an authorized value is repeated
Product: Koha Reporter: Thibaud Guillot (thibaud_g) <thibaud.guillot>
Component: CatalogingAssignee: Thibaud Guillot (thibaud_g) <thibaud.guillot>
Status: Pushed to oldstable --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: angela.berrett, fridolin.somers, gmcharlt, kyle.m.hall, lucas, m.de.rooy, pedro.amorim
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
When a field or subfield is linked to a list of authorized values and repeated in the cataloging editor, the selected value was repeated in the copied field. This makes it so the copied field will be empty.
Version(s) released in:
24.05.00,23.11.04,23.05.10
Circulation function:
Bug Depends on:    
Bug Blocks: 36157    
Attachments: Bug 36156 : None value selected on clone field/subfield linked to AV
Bug 36156 : None value selected on clone field/subfield linked to AV
Bug 36156: None value selected on clone field/subfield linked to AV
Bug 36156: None value selected on clone field/subfield linked to AV

Description Thibaud Guillot (thibaud_g) 2024-02-23 12:10:51 UTC
Hello all,

I'm surprised I haven't seen a bug about this, so I'm not 100% sure it's a bug, but I find the behavior inappropriate.

When a field or subfield is linked to a list of authorised values (and therefore a select) and is repeatable, the selected value from the select is repeated in the clone. It would be more appropriate to leave the field empty.
Comment 1 Thibaud Guillot (thibaud_g) 2024-02-23 12:22:37 UTC
Created attachment 162376 [details] [review]
Bug 36156 : None value selected on clone field/subfield linked to AV

When a field or subfield is linked to a list of authorized values and cloned, the selected value is repeated in the clone. This is linked to the default behavior of Select2Utils, so I've added a precise index (-1) to ensure that no value is selected in the clone.

Test plan:

1) Create a repeatable field and subfield and link a list of authorised values to the subfield.
2) Edit a record, clone the field and see which value is automatically selected in the clone.
3) Apply the patch
4) Repeat step 2

Sponsored by : BibLibre
Comment 2 Thibaud Guillot (thibaud_g) 2024-02-26 09:03:18 UTC
Created attachment 162421 [details] [review]
Bug 36156 : None value selected on clone field/subfield linked to AV

When a field or subfield is linked to a list of authorized values and cloned, the selected value is repeated in the clone. This is linked to the default behavior of Select2Utils, so I've added a precise index (-1) to ensure that no value is selected in the clone.

Test plan:

1) Create a repeatable field and subfield and link a list of authorised values to the subfield.
2) Edit a record, clone the field and see which value is automatically selected in the clone.
3) Apply the patch
4) Repeat step 2

Sponsored by : BibLibre
Comment 3 Kyle M Hall (khall) 2024-02-26 11:53:55 UTC
Created attachment 162430 [details] [review]
Bug 36156: None value selected on clone field/subfield linked to AV

When a field or subfield is linked to a list of authorized values and cloned, the selected value is repeated in the clone. This is linked to the default behavior of Select2Utils, so I've added a precise index (-1) to ensure that no value is selected in the clone.

Test plan:

1) Create a repeatable field and subfield and link a list of authorised values to the subfield.
2) Edit a record, clone the field and see which value is automatically selected in the clone.
3) Apply the patch
4) Repeat step 2

Sponsored by : BibLibre

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 4 Pedro Amorim 2024-02-26 12:41:13 UTC
Created attachment 162432 [details] [review]
Bug 36156: None value selected on clone field/subfield linked to AV

When a field or subfield is linked to a list of authorized values and cloned, the selected value is repeated in the clone. This is linked to the default behavior of Select2Utils, so I've added a precise index (-1) to ensure that no value is selected in the clone.

Test plan:

1) Create a repeatable field and subfield and link a list of authorised values to the subfield.
2) Edit a record, clone the field and see which value is automatically selected in the clone.
3) Apply the patch
4) Repeat step 2

Sponsored by : BibLibre

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Comment 5 Katrin Fischer 2024-03-07 14:04:42 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 6 Fridolin Somers 2024-03-11 09:15:00 UTC
Looks like a bug. I backport

Pushed to 23.11.x for 23.11.04
Comment 7 Lucas Gass (lukeg) 2024-03-19 15:06:55 UTC
Backported to 23.05.x for upcoming 23.05.10