Bug 36156 - Don't duplicate selected value when a field or subfield linked to an authorized value is repeated
Summary: Don't duplicate selected value when a field or subfield linked to an authoriz...
Status: Pushed to oldstable
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Thibaud Guillot (thibaud_g)
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 36157
  Show dependency treegraph
 
Reported: 2024-02-23 12:10 UTC by Thibaud Guillot (thibaud_g)
Modified: 2024-05-26 19:20 UTC (History)
7 users (show)

See Also:
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:


Attachments
Bug 36156 : None value selected on clone field/subfield linked to AV (2.04 KB, patch)
2024-02-23 12:22 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 36156 : None value selected on clone field/subfield linked to AV (2.04 KB, patch)
2024-02-26 09:03 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 36156: None value selected on clone field/subfield linked to AV (2.10 KB, patch)
2024-02-26 11:53 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 36156: None value selected on clone field/subfield linked to AV (2.15 KB, patch)
2024-02-26 12:41 UTC, Pedro Amorim
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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