Bug 35044 - Additional fields: Allow for repeatable fields
Summary: Additional fields: Allow for repeatable fields
Status: Needs documenting
Alias: None
Product: Koha
Classification: Unclassified
Component: System Administration (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Pedro Amorim
QA Contact: Julian Maurice
URL:
Keywords:
Depends on: 37262
Blocks: 32751 35287 35451 35625 38528 38738
  Show dependency treegraph
 
Reported: 2023-10-12 11:36 UTC by Pedro Amorim
Modified: 2024-12-18 11:09 UTC (History)
12 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Medium patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This enhancement adds the "repeatable" option for additional fields. For repeatable text fields there is now: - an "Add new" button for adding a new text field - a "Remove" button for the removal of a repeatable text field. For repeatable fields using authorized values, the options are now shown as checkboxes instead of a dropdown list, and allows multiple selections.
Version(s) released in:
24.11.00
Circulation function:


Attachments
Bug 35044: [DONT PUSH] dbic specific (2.52 KB, patch)
2023-10-18 14:48 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: DB changes + atomicupdate file (3.89 KB, patch)
2023-10-18 14:48 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Admin: New additional fields 'repeatable' field (4.68 KB, patch)
2023-10-18 14:48 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Preparation: (19.13 KB, patch)
2023-10-18 14:48 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Update: Order baskets (4.12 KB, patch)
2023-10-18 14:48 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Update: Acquisition orders (4.80 KB, patch)
2023-10-18 14:48 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Update: Invoices (5.68 KB, patch)
2023-10-18 14:48 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Update: Serial subscriptions (11.58 KB, patch)
2023-10-18 14:48 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Update: Serial subscriptions batch edit (10.90 KB, patch)
2023-10-18 14:48 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Update: Manual invoices, manual credits and accountlines (10.97 KB, patch)
2023-10-18 14:48 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Add tests (4.34 KB, patch)
2023-10-18 14:48 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Add repetable to REST API spec (829 bytes, patch)
2023-10-31 12:01 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: [DONT PUSH] dbic specific (2.08 KB, patch)
2023-11-06 10:57 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: DB changes + atomicupdate file (3.89 KB, patch)
2023-11-06 10:57 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Admin: New additional fields 'repeatable' field (5.03 KB, patch)
2023-11-06 10:57 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Preparation: (19.13 KB, patch)
2023-11-06 10:57 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Update: Order baskets (4.12 KB, patch)
2023-11-06 10:57 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Update: Acquisition orders (4.80 KB, patch)
2023-11-06 10:57 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Update: Invoices (5.68 KB, patch)
2023-11-06 10:57 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Update: Serial subscriptions (11.64 KB, patch)
2023-11-06 10:58 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Update: Serial subscriptions batch edit (10.90 KB, patch)
2023-11-06 10:58 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Update: Manual invoices, manual credits and accountlines (10.06 KB, patch)
2023-11-06 10:58 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Add tests (4.34 KB, patch)
2023-11-06 10:58 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: [DONT PUSH] dbic specific (2.08 KB, patch)
2023-11-13 10:10 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: DB changes + atomicupdate file (3.89 KB, patch)
2023-11-13 10:10 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Admin: New additional fields 'repeatable' field (5.03 KB, patch)
2023-11-13 10:10 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Preparation: (19.13 KB, patch)
2023-11-13 10:10 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Update: Order baskets (4.12 KB, patch)
2023-11-13 10:10 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Update: Acquisition orders (4.84 KB, patch)
2023-11-13 10:10 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Update: Invoices (5.68 KB, patch)
2023-11-13 10:10 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Update: Serial subscriptions (11.64 KB, patch)
2023-11-13 10:10 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Update: Serial subscriptions batch edit (10.90 KB, patch)
2023-11-13 10:10 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Update: Manual invoices, manual credits and accountlines (10.06 KB, patch)
2023-11-13 10:10 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Add repetable to REST API spec (829 bytes, patch)
2023-11-13 10:10 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Add tests (4.34 KB, patch)
2023-11-13 10:10 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: (QA Follow-up) Fix atomicupdate (1.60 KB, patch)
2023-11-27 12:23 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: [DONT PUSH] dbic specific (2.15 KB, patch)
2023-12-21 10:28 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35044: DB changes + atomicupdate file (3.95 KB, patch)
2023-12-21 10:28 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35044: Admin: New additional fields 'repeatable' field (5.10 KB, patch)
2023-12-21 10:28 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35044: Preparation: (19.20 KB, patch)
2023-12-21 10:28 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35044: Update: Order baskets (4.19 KB, patch)
2023-12-21 10:28 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35044: Update: Acquisition orders (4.91 KB, patch)
2023-12-21 10:28 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35044: Update: Invoices (5.75 KB, patch)
2023-12-21 10:28 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35044: Update: Serial subscriptions (11.72 KB, patch)
2023-12-21 10:28 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35044: Update: Serial subscriptions batch edit (10.97 KB, patch)
2023-12-21 10:28 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35044: Update: Manual invoices, manual credits and accountlines (10.14 KB, patch)
2023-12-21 10:28 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35044: Add repetable to REST API spec (896 bytes, patch)
2023-12-21 10:28 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35044: Add tests (4.41 KB, patch)
2023-12-21 10:28 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35044: (QA Follow-up) Fix atomicupdate (1.67 KB, patch)
2023-12-21 10:28 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35044: [DONT PUSH] dbic specific (2.15 KB, patch)
2024-04-01 09:14 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: DB changes + atomicupdate file (3.95 KB, patch)
2024-04-01 09:14 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Admin: New additional fields 'repeatable' field (5.11 KB, patch)
2024-04-01 09:14 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Preparation: (19.20 KB, patch)
2024-04-01 09:14 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Update: Order baskets (4.19 KB, patch)
2024-04-01 09:14 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Update: Acquisition orders (6.27 KB, patch)
2024-04-01 09:14 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Update: Invoices (5.76 KB, patch)
2024-04-01 09:14 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Update: Serial subscriptions (11.72 KB, patch)
2024-04-01 09:14 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Update: Serial subscriptions batch edit (11.02 KB, patch)
2024-04-01 09:15 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Update: Manual invoices, manual credits and accountlines (10.17 KB, patch)
2024-04-01 09:15 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Add repetable to REST API spec (896 bytes, patch)
2024-04-01 09:15 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Add tests (4.41 KB, patch)
2024-04-01 09:15 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: (QA Follow-up) Fix atomicupdate (1.67 KB, patch)
2024-04-01 09:15 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: 00-testcritic.t fix (1.02 KB, patch)
2024-06-13 15:49 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: [DONT PUSH] dbic specific (2.14 KB, patch)
2024-07-05 13:11 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: DB changes + atomicupdate file (3.90 KB, patch)
2024-07-05 13:11 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Admin: New additional fields 'repeatable' field (5.11 KB, patch)
2024-07-05 13:11 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Preparation: (19.19 KB, patch)
2024-07-05 13:11 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Update: Order baskets (4.19 KB, patch)
2024-07-05 13:11 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Update: Acquisition orders (6.26 KB, patch)
2024-07-05 13:11 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Update: Invoices (5.75 KB, patch)
2024-07-05 13:11 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Update: Serial subscriptions (11.54 KB, patch)
2024-07-05 13:11 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Update: Serial subscriptions batch edit (11.10 KB, patch)
2024-07-05 13:11 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Update: Manual invoices, manual credits and accountlines (10.15 KB, patch)
2024-07-05 13:11 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Add repetable to REST API spec (943 bytes, patch)
2024-07-05 13:11 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: Add tests (4.41 KB, patch)
2024-07-05 13:11 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: (QA follow-up): DRY code before set_additional_fields (14.54 KB, patch)
2024-07-25 08:51 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: (QA follow-up): Allow for value '0' in additional fields (1.92 KB, patch)
2024-07-25 08:51 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: (QA follow-up): Remove FIXME and redundant code (1.09 KB, patch)
2024-07-25 08:51 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: (QA follow-up): Allow for '0' in serials batch edit (2.09 KB, patch)
2024-07-25 17:16 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: (QA follow-up): Remove useless code (1.40 KB, patch)
2024-07-25 17:16 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: (QA follow-up): Avoid polluting the global scope with function using immediately invoked function expression (2.59 KB, patch)
2024-07-25 17:16 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: (QA follow-up): Fix QA script Error on boolean TINYINT (939 bytes, patch)
2024-07-25 17:16 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: (QA follow-up): Add removal of empty value entries in additional_field_values to atomicupdate (1.61 KB, patch)
2024-07-25 17:16 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: [DONT PUSH] dbic specific (2.26 KB, patch)
2024-07-26 07:49 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: DB changes + atomicupdate file (4.01 KB, patch)
2024-07-26 07:49 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: Admin: New additional fields 'repeatable' field (5.22 KB, patch)
2024-07-26 07:49 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: Preparation: (19.30 KB, patch)
2024-07-26 07:49 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: Update: Order baskets (4.30 KB, patch)
2024-07-26 07:49 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: Update: Acquisition orders (6.39 KB, patch)
2024-07-26 07:49 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: Update: Invoices (5.87 KB, patch)
2024-07-26 07:49 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: Update: Serial subscriptions (11.67 KB, patch)
2024-07-26 07:49 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: Update: Serial subscriptions batch edit (11.23 KB, patch)
2024-07-26 07:49 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: Update: Manual invoices, manual credits and accountlines (10.28 KB, patch)
2024-07-26 07:49 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: Add repetable to REST API spec (1.03 KB, patch)
2024-07-26 07:49 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: Add tests (4.52 KB, patch)
2024-07-26 07:49 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: (QA follow-up): DRY code before set_additional_fields (14.65 KB, patch)
2024-07-26 07:49 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: (QA follow-up): Allow for value '0' in additional fields (2.03 KB, patch)
2024-07-26 07:49 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: (QA follow-up): Remove FIXME and redundant code (1.20 KB, patch)
2024-07-26 07:49 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: (QA follow-up): Allow for '0' in serials batch edit (2.21 KB, patch)
2024-07-26 07:49 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: (QA follow-up): Remove useless code (1.51 KB, patch)
2024-07-26 07:50 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: (QA follow-up): Avoid polluting global scope with functions (2.70 KB, patch)
2024-07-26 07:50 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: (QA follow-up): Fix QA script Error on boolean TINYINT (1.03 KB, patch)
2024-07-26 07:50 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: (QA follow-up): Remove empty additional_field_values entries (1.70 KB, patch)
2024-07-26 07:50 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: (QA follow-up) Delete empty values with a single query (1.57 KB, patch)
2024-07-26 07:50 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: [DONT PUSH] dbic specific (2.20 KB, patch)
2024-07-26 07:52 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: DB changes + atomicupdate file (3.96 KB, patch)
2024-07-26 07:52 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: Admin: New additional fields 'repeatable' field (5.17 KB, patch)
2024-07-26 07:52 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: Preparation: (19.25 KB, patch)
2024-07-26 07:52 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: Update: Order baskets (4.25 KB, patch)
2024-07-26 07:53 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: Update: Acquisition orders (6.33 KB, patch)
2024-07-26 07:53 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: Update: Invoices (5.81 KB, patch)
2024-07-26 07:53 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: Update: Serial subscriptions (11.62 KB, patch)
2024-07-26 07:53 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: Update: Serial subscriptions batch edit (11.17 KB, patch)
2024-07-26 07:53 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: Update: Manual invoices, manual credits and accountlines (10.23 KB, patch)
2024-07-26 07:53 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: Add repetable to REST API spec (1003 bytes, patch)
2024-07-26 07:53 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: Add tests (4.47 KB, patch)
2024-07-26 07:53 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: (QA follow-up): DRY code before set_additional_fields (14.60 KB, patch)
2024-07-26 07:53 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: (QA follow-up): Allow for value '0' in additional fields (1.98 KB, patch)
2024-07-26 07:53 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: (QA follow-up): Remove FIXME and redundant code (1.15 KB, patch)
2024-07-26 07:53 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: (QA follow-up): Allow for '0' in serials batch edit (2.15 KB, patch)
2024-07-26 07:53 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: (QA follow-up): Remove useless code (1.46 KB, patch)
2024-07-26 07:53 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: (QA follow-up): Avoid polluting global scope with functions (2.65 KB, patch)
2024-07-26 07:53 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: (QA follow-up): Fix QA script Error on boolean TINYINT (999 bytes, patch)
2024-07-26 07:53 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: (QA follow-up): Remove empty additional_field_values entries (1.65 KB, patch)
2024-07-26 07:53 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: (QA follow-up) Delete empty values with a single query (1.51 KB, patch)
2024-07-26 07:53 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 35044: (QA follow-up): Fix flaky tests (1.36 KB, patch)
2024-07-26 13:09 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35044: (QA follow-up): Add color to atomic update (1.97 KB, patch)
2024-08-20 14:30 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 Pedro Amorim 2023-10-12 11:36:27 UTC
If the field is an AV field, there should be an option to allow for multiple selection.
Comment 1 Pedro Amorim 2023-10-18 14:48:31 UTC Comment hidden (obsolete)
Comment 2 Pedro Amorim 2023-10-18 14:48:34 UTC Comment hidden (obsolete)
Comment 3 Pedro Amorim 2023-10-18 14:48:37 UTC Comment hidden (obsolete)
Comment 4 Pedro Amorim 2023-10-18 14:48:39 UTC Comment hidden (obsolete)
Comment 5 Pedro Amorim 2023-10-18 14:48:42 UTC Comment hidden (obsolete)
Comment 6 Pedro Amorim 2023-10-18 14:48:45 UTC Comment hidden (obsolete)
Comment 7 Pedro Amorim 2023-10-18 14:48:47 UTC Comment hidden (obsolete)
Comment 8 Pedro Amorim 2023-10-18 14:48:50 UTC Comment hidden (obsolete)
Comment 9 Pedro Amorim 2023-10-18 14:48:53 UTC Comment hidden (obsolete)
Comment 10 Pedro Amorim 2023-10-18 14:48:56 UTC Comment hidden (obsolete)
Comment 11 Pedro Amorim 2023-10-18 14:48:59 UTC Comment hidden (obsolete)
Comment 12 Pedro Amorim 2023-10-31 12:01:48 UTC Comment hidden (obsolete)
Comment 13 Pedro Amorim 2023-11-06 10:57:42 UTC Comment hidden (obsolete)
Comment 14 Pedro Amorim 2023-11-06 10:57:45 UTC Comment hidden (obsolete)
Comment 15 Pedro Amorim 2023-11-06 10:57:47 UTC Comment hidden (obsolete)
Comment 16 Pedro Amorim 2023-11-06 10:57:50 UTC Comment hidden (obsolete)
Comment 17 Pedro Amorim 2023-11-06 10:57:53 UTC Comment hidden (obsolete)
Comment 18 Pedro Amorim 2023-11-06 10:57:56 UTC Comment hidden (obsolete)
Comment 19 Pedro Amorim 2023-11-06 10:57:59 UTC Comment hidden (obsolete)
Comment 20 Pedro Amorim 2023-11-06 10:58:02 UTC Comment hidden (obsolete)
Comment 21 Pedro Amorim 2023-11-06 10:58:06 UTC Comment hidden (obsolete)
Comment 22 Pedro Amorim 2023-11-06 10:58:09 UTC Comment hidden (obsolete)
Comment 23 Pedro Amorim 2023-11-06 10:58:11 UTC Comment hidden (obsolete)
Comment 24 Pedro Amorim 2023-11-06 10:59:06 UTC
Rebased on top of bug 35190
Comment 25 Pedro Amorim 2023-11-13 10:10:04 UTC
Created attachment 158857 [details] [review]
Bug 35044: [DONT PUSH] dbic specific
Comment 26 Pedro Amorim 2023-11-13 10:10:07 UTC
Created attachment 158858 [details] [review]
Bug 35044: DB changes + atomicupdate file

Add the 'repeatable' column to additional_fields
Remove the unique key from additional_field_values
as we will now be allowing for repeated instances of the same
field_id + record_id
Comment 27 Pedro Amorim 2023-11-13 10:10:10 UTC
Created attachment 158859 [details] [review]
Bug 35044: Admin: New additional fields 'repeatable' field

There is now a new 'repeatable' checkbox when configuring
(adding or editing) an additional field for a specific table.
It is also displayed in a column in the additional fields panel
for a given tablename.

MARC fields are not allowed to be repeatable.
Comment 28 Pedro Amorim 2023-11-13 10:10:13 UTC
Created attachment 158860 [details] [review]
Bug 35044: Preparation:

get_additional_field_values_for_template method

New method to be utilized for retrieval of additional fields of any
class that implements it.
This is to be used when additional_fields are needed to be sent to
.tt files for renderering. Both for form entries and read-only 'show' pages.

Template files:

Updated additional-fields-entry.inc:
Now considers entry of repeatable fields.
Repeatable text fields will have a "+New" link to allow for adding of a new instance of a repeatable field.
Repeatable AV fields will be shown as checkboxes instead of a dropdown

Update additional-fields-display.inc
When displaying non-editable additional-fields, multiple instances for each field are now considered.
Label now only shows if field has a non-null value in it.
Option to show value_only
Option to set if its to be displayed on a table cell

Update histsearch.tt and filter-orders.inc
Now calls additional-fields-entry.inc with search_form=1 to prevent
repetable "+New" controls from showing on search inputs.

additional-fields-entry.js
New JS asset to be called by template files who require
additional-fields-entry.inc for repeatable fields controls.
This also handles the need for having the marcfield of type
'get' submitted if it is a disabled dropdown (AV marc field)
Comment 29 Pedro Amorim 2023-11-13 10:10:16 UTC
Created attachment 158861 [details] [review]
Bug 35044: Update: Order baskets

Test plan, k-t-d:

Preparation: Create additional fields for table 'aqbasket':
2 text fields, one repeatable, one not-repeatable
2 AV fields, one repeatable, one not-repeatable

1) Add a new basket, visit:
/cgi-bin/koha/acqui/basketheader.pl?booksellerid=1&op=add_form
2) Fill in name and all additional fields, click the '+New' and 'Clear' links,  hit 'Save'
3) Notice the basket screen shows repeated fields separated by comma.
4) Notice that only non-null additional fields labels are shown.
5) Edit the basket. Notice all fields are shown as expected.

Additional testing:

Having a repeatable field with multiple instances, go back to the additional fields configuration and make the additional field non-repeatable again. Edit the basket again. Notice the multiple text instances are still shown, but the '+New' link no longer shows.
You're able to remove existing multiple instances, but unable to add new ones, this is because the field is no longer repeatable.
Comment 30 Pedro Amorim 2023-11-13 10:10:19 UTC
Created attachment 158862 [details] [review]
Bug 35044: Update: Acquisition orders

Test plan, k-t-d:

Preparation: Create additional fields for table 'aqorders':
2 text fields, one repeatable, one not-repeatable
2 AV fields, one repeatable, one not-repeatable
2 MARC fields, one 'get' and one 'set', both non-repeatable, MARC field 942$c
Attempt to create a repeatable MARC field (get or set). Notice you're unable to.

1) Add a new order for an existing basket, with an existing record, visit:
/cgi-bin/koha/acqui/neworderempty.pl?booksellerid=1&basketno=1&biblionumber=76
2) Set the mandatory "Koha item type" for the item. Click the 'Add item' button below.
3) Notice the accounting details now have quantity:1
4) Set the mandatory "Fund" input in accounting details.
5) At the bottom, fill in all additional fields, click the '+New' and 'Clear' links,  hit 'Save'
6) In the orders table shown, click "Modify". Notice all the fields are presented correctly in the edit form.
Comment 31 Pedro Amorim 2023-11-13 10:10:22 UTC
Created attachment 158863 [details] [review]
Bug 35044: Update: Invoices

Added fixme comment to invoices.tt, the search works so nothing to do here, but the code is not DRY

Test plan, k-t-d:

Preparation: Create additional fields for table 'aqinvoices':
2 text fields, one repeatable, one not-repeatable
2 AV fields, one repeatable, one not-repeatable

1) Add a new invoice for an existing vendor, visit:
/cgi-bin/koha/acqui/parcels.pl?booksellerid=1
2) Input something in the mandatory "Vendor invoice" field.
3) Fill in all additional fields, click the '+New' and 'Clear' links,  hit 'Save'
4) Search for invoices, visit:
http://localhost:8081/cgi-bin/koha/acqui/invoices.pl
5) Click "Search" on the left column of the page
6) Click the invoice we just created. Verify all the fields show correctly.
7) Go back to the additional fields configuration, set all additional fields as "searchable"
8) Return to http://localhost:8081/cgi-bin/koha/acqui/invoices.pl
9) Perform some searches using the additional fields values.
Comment 32 Pedro Amorim 2023-11-13 10:10:25 UTC
Created attachment 158864 [details] [review]
Bug 35044: Update: Serial subscriptions

Test plan, k-t-d:

Preparation: Create additional fields for table 'subscription', visit:
/cgi-bin/koha/admin/additional-fields.pl?tablename=subscription

2 text fields, one repeatable, one not-repeatable
2 AV fields, one repeatable, one not-repeatable
2 MARC fields, one 'get' and one 'set', both non-repeatable, MARC field 942$c
Attempt to create a repeatable MARC field (get or set). Notice you're unable to.

1) Add a new serial subscription, visit:
/cgi-bin/koha/serials/subscription-add.pl
2) Set the mandatory "Record" input (e.g. '112'). Click the 'Next' and press 'Ok' on the alert box.
3) Fill in all required fields and press "Test prediction pattern"
4) At the bottom, fill in all additional fields, click the '+New' and 'Clear' links,  hit 'Save'
5) Notice the fields are shown, repeated fields are comma separated
6) Click Edit -> Edit Subscription, repeat steps 4 and 5
7) Go back to subscription additional fields, set all fields as searchable
8) Visit serials-home:
/cgi-bin/koha/serials/serials-home.pl
9) Click 'Search'
10) Notice the searchable fields now show in their columns, repeated fields separated by comma
11) Perform a search using a repeatable field, verify it all works as expected.

-- Subscription Claims --

Preparation:
1) Define a new claim notice, visit:
/cgi-bin/koha/tools/letter.pl?op=add_form&module=claimissues
2) Input code, name, click "Email" set a "Message subject" and put something in the message body. Hit 'Save'.
3) Set a serial as late, visit our original subscription:
/cgi-bin/koha/serials/serials-collection.pl?subscriptionid=1
4) Click "Edit serials" and status -> "Late". Hit "Save".
5) Link the original subscription to the existing vendor, visit:
/cgi-bin/koha/serials/subscription-add.pl?op=modify&subscriptionid=1
6) Click "Search for a vendor". Hit "Ok". Hit "Choose". Save the subscription.

Claims:
7) Visit claims:
/cgi-bin/koha/serials/claims.pl
8) Click "Ok"
9) Verify that searchable additional fields all have their respective column. Repeated fields are shown comma separated.
Comment 33 Pedro Amorim 2023-11-13 10:10:28 UTC
Created attachment 158865 [details] [review]
Bug 35044: Update: Serial subscriptions batch edit

Test plan, k-t-d:

Preparation: Create additional fields for table 'subscription', visit:
/cgi-bin/koha/admin/additional-fields.pl?tablename=subscription

2 text fields, one repeatable, one not-repeatable
2 AV fields, one repeatable, one not-repeatable
2 MARC fields, one 'get' and one 'set', both non-repeatable, MARC field 942$c
Attempt to create a repeatable MARC field (get or set). Notice you're unable to.

1) Add a new serial subscription, visit:
/cgi-bin/koha/serials/subscription-add.pl
2) Set the mandatory "Record" input (e.g. '112'). Click the 'Next' and press 'Ok' on the alert box.
3) Fill in all required fields and press "Test prediction pattern"
4) At the bottom, fill in all additional fields, click the '+New' and 'Clear' links,  hit 'Save'
5) Notice the fields are shown, repeated fields are comma separated
6) Repeat steps 1-4 to create a second subscription
7) Visit serials home and hit "Search":
/cgi-bin/koha/serials/serials-home.pl
8) Check the checkboxes next to the 2 subscriptions and click "Edit selected serials"
9) Input some values in the additional fields section, click the '+New' and 'Clear' links,  hit 'Save'
10) Verify that both subscriptions now have the new values form the batch edit.
Comment 34 Pedro Amorim 2023-11-13 10:10:31 UTC
Created attachment 158866 [details] [review]
Bug 35044: Update: Manual invoices, manual credits and accountlines

Test plan, k-t-d:

Preparation: Create additional fields for table 'accountlines:credit', visit:
/cgi-bin/koha/admin/additional-fields.pl?tablename=accountlines%3Acredit

2 text fields, one repeatable, one not-repeatable
2 AV fields, one repeatable, one not-repeatable

1) Add a new manual credit for admin borrower:
/cgi-bin/koha/members/mancredit.pl?borrowernumber=51
2) Set the mandatory "Amount" input (e.g. '5'). Click the 'Next' and press 'Ok' on the alert box.
3) Fill in all additional fields, click the '+New' and 'Clear' links,  hit 'Save'
4) On the table, click "Details" for the for account line we just created.
5) Notice the additional fields are there, repeated fields are comma separated.
6) Repeat the above test plan, but for accountlines:debit instead, visit:
/cgi-bin/koha/admin/additional-fields.pl?tablename=accountlines%3Adebit
7) To add a manual invoice, visit:
/cgi-bin/koha/members/maninvoice.pl?borrowernumber=51
Comment 35 Pedro Amorim 2023-11-13 10:10:35 UTC
Created attachment 158867 [details] [review]
Bug 35044: Add repetable to REST API spec
Comment 36 Pedro Amorim 2023-11-13 10:10:38 UTC
Created attachment 158868 [details] [review]
Bug 35044: Add tests

Test plan:
prove t/db_dependent/Koha/Object/Mixin/AdditionalFields.t
Comment 37 Pedro Amorim 2023-11-13 10:11:56 UTC
Rebased on bug 34708
Comment 38 Pedro Amorim 2023-11-27 12:23:59 UTC
Created attachment 159268 [details] [review]
Bug 35044: (QA Follow-up) Fix atomicupdate

Was missing bug number and correct filename
Was checking for the wrong unique key name, existing unique key name is 'field_record',
not 'afv_fk'
Comment 39 Martin Renvoize (ashimema) 2023-12-21 10:28:18 UTC
Created attachment 160177 [details] [review]
Bug 35044: [DONT PUSH] dbic specific

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 40 Martin Renvoize (ashimema) 2023-12-21 10:28:21 UTC
Created attachment 160178 [details] [review]
Bug 35044: DB changes + atomicupdate file

Add the 'repeatable' column to additional_fields
Remove the unique key from additional_field_values
as we will now be allowing for repeated instances of the same
field_id + record_id

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 41 Martin Renvoize (ashimema) 2023-12-21 10:28:24 UTC
Created attachment 160179 [details] [review]
Bug 35044: Admin: New additional fields 'repeatable' field

There is now a new 'repeatable' checkbox when configuring
(adding or editing) an additional field for a specific table.
It is also displayed in a column in the additional fields panel
for a given tablename.

MARC fields are not allowed to be repeatable.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 42 Martin Renvoize (ashimema) 2023-12-21 10:28:27 UTC
Created attachment 160180 [details] [review]
Bug 35044: Preparation:

get_additional_field_values_for_template method

New method to be utilized for retrieval of additional fields of any
class that implements it.
This is to be used when additional_fields are needed to be sent to
.tt files for renderering. Both for form entries and read-only 'show' pages.

Template files:

Updated additional-fields-entry.inc:
Now considers entry of repeatable fields.
Repeatable text fields will have a "+New" link to allow for adding of a new instance of a repeatable field.
Repeatable AV fields will be shown as checkboxes instead of a dropdown

Update additional-fields-display.inc
When displaying non-editable additional-fields, multiple instances for each field are now considered.
Label now only shows if field has a non-null value in it.
Option to show value_only
Option to set if its to be displayed on a table cell

Update histsearch.tt and filter-orders.inc
Now calls additional-fields-entry.inc with search_form=1 to prevent
repetable "+New" controls from showing on search inputs.

additional-fields-entry.js
New JS asset to be called by template files who require
additional-fields-entry.inc for repeatable fields controls.
This also handles the need for having the marcfield of type
'get' submitted if it is a disabled dropdown (AV marc field)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 43 Martin Renvoize (ashimema) 2023-12-21 10:28:31 UTC
Created attachment 160181 [details] [review]
Bug 35044: Update: Order baskets

Test plan, k-t-d:

Preparation: Create additional fields for table 'aqbasket':
2 text fields, one repeatable, one not-repeatable
2 AV fields, one repeatable, one not-repeatable

1) Add a new basket, visit:
/cgi-bin/koha/acqui/basketheader.pl?booksellerid=1&op=add_form
2) Fill in name and all additional fields, click the '+New' and 'Clear' links,  hit 'Save'
3) Notice the basket screen shows repeated fields separated by comma.
4) Notice that only non-null additional fields labels are shown.
5) Edit the basket. Notice all fields are shown as expected.

Additional testing:

Having a repeatable field with multiple instances, go back to the additional fields configuration and make the additional field non-repeatable again. Edit the basket again. Notice the multiple text instances are still shown, but the '+New' link no longer shows.
You're able to remove existing multiple instances, but unable to add new ones, this is because the field is no longer repeatable.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 44 Martin Renvoize (ashimema) 2023-12-21 10:28:34 UTC
Created attachment 160182 [details] [review]
Bug 35044: Update: Acquisition orders

Test plan, k-t-d:

Preparation: Create additional fields for table 'aqorders':
2 text fields, one repeatable, one not-repeatable
2 AV fields, one repeatable, one not-repeatable
2 MARC fields, one 'get' and one 'set', both non-repeatable, MARC field 942$c
Attempt to create a repeatable MARC field (get or set). Notice you're unable to.

1) Add a new order for an existing basket, with an existing record, visit:
/cgi-bin/koha/acqui/neworderempty.pl?booksellerid=1&basketno=1&biblionumber=76
2) Set the mandatory "Koha item type" for the item. Click the 'Add item' button below.
3) Notice the accounting details now have quantity:1
4) Set the mandatory "Fund" input in accounting details.
5) At the bottom, fill in all additional fields, click the '+New' and 'Clear' links,  hit 'Save'
6) In the orders table shown, click "Modify". Notice all the fields are presented correctly in the edit form.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 45 Martin Renvoize (ashimema) 2023-12-21 10:28:37 UTC
Created attachment 160183 [details] [review]
Bug 35044: Update: Invoices

Added fixme comment to invoices.tt, the search works so nothing to do here, but the code is not DRY

Test plan, k-t-d:

Preparation: Create additional fields for table 'aqinvoices':
2 text fields, one repeatable, one not-repeatable
2 AV fields, one repeatable, one not-repeatable

1) Add a new invoice for an existing vendor, visit:
/cgi-bin/koha/acqui/parcels.pl?booksellerid=1
2) Input something in the mandatory "Vendor invoice" field.
3) Fill in all additional fields, click the '+New' and 'Clear' links,  hit 'Save'
4) Search for invoices, visit:
http://localhost:8081/cgi-bin/koha/acqui/invoices.pl
5) Click "Search" on the left column of the page
6) Click the invoice we just created. Verify all the fields show correctly.
7) Go back to the additional fields configuration, set all additional fields as "searchable"
8) Return to http://localhost:8081/cgi-bin/koha/acqui/invoices.pl
9) Perform some searches using the additional fields values.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 46 Martin Renvoize (ashimema) 2023-12-21 10:28:40 UTC
Created attachment 160184 [details] [review]
Bug 35044: Update: Serial subscriptions

Test plan, k-t-d:

Preparation: Create additional fields for table 'subscription', visit:
/cgi-bin/koha/admin/additional-fields.pl?tablename=subscription

2 text fields, one repeatable, one not-repeatable
2 AV fields, one repeatable, one not-repeatable
2 MARC fields, one 'get' and one 'set', both non-repeatable, MARC field 942$c
Attempt to create a repeatable MARC field (get or set). Notice you're unable to.

1) Add a new serial subscription, visit:
/cgi-bin/koha/serials/subscription-add.pl
2) Set the mandatory "Record" input (e.g. '112'). Click the 'Next' and press 'Ok' on the alert box.
3) Fill in all required fields and press "Test prediction pattern"
4) At the bottom, fill in all additional fields, click the '+New' and 'Clear' links,  hit 'Save'
5) Notice the fields are shown, repeated fields are comma separated
6) Click Edit -> Edit Subscription, repeat steps 4 and 5
7) Go back to subscription additional fields, set all fields as searchable
8) Visit serials-home:
/cgi-bin/koha/serials/serials-home.pl
9) Click 'Search'
10) Notice the searchable fields now show in their columns, repeated fields separated by comma
11) Perform a search using a repeatable field, verify it all works as expected.

-- Subscription Claims --

Preparation:
1) Define a new claim notice, visit:
/cgi-bin/koha/tools/letter.pl?op=add_form&module=claimissues
2) Input code, name, click "Email" set a "Message subject" and put something in the message body. Hit 'Save'.
3) Set a serial as late, visit our original subscription:
/cgi-bin/koha/serials/serials-collection.pl?subscriptionid=1
4) Click "Edit serials" and status -> "Late". Hit "Save".
5) Link the original subscription to the existing vendor, visit:
/cgi-bin/koha/serials/subscription-add.pl?op=modify&subscriptionid=1
6) Click "Search for a vendor". Hit "Ok". Hit "Choose". Save the subscription.

Claims:
7) Visit claims:
/cgi-bin/koha/serials/claims.pl
8) Click "Ok"
9) Verify that searchable additional fields all have their respective column. Repeated fields are shown comma separated.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 47 Martin Renvoize (ashimema) 2023-12-21 10:28:43 UTC
Created attachment 160185 [details] [review]
Bug 35044: Update: Serial subscriptions batch edit

Test plan, k-t-d:

Preparation: Create additional fields for table 'subscription', visit:
/cgi-bin/koha/admin/additional-fields.pl?tablename=subscription

2 text fields, one repeatable, one not-repeatable
2 AV fields, one repeatable, one not-repeatable
2 MARC fields, one 'get' and one 'set', both non-repeatable, MARC field 942$c
Attempt to create a repeatable MARC field (get or set). Notice you're unable to.

1) Add a new serial subscription, visit:
/cgi-bin/koha/serials/subscription-add.pl
2) Set the mandatory "Record" input (e.g. '112'). Click the 'Next' and press 'Ok' on the alert box.
3) Fill in all required fields and press "Test prediction pattern"
4) At the bottom, fill in all additional fields, click the '+New' and 'Clear' links,  hit 'Save'
5) Notice the fields are shown, repeated fields are comma separated
6) Repeat steps 1-4 to create a second subscription
7) Visit serials home and hit "Search":
/cgi-bin/koha/serials/serials-home.pl
8) Check the checkboxes next to the 2 subscriptions and click "Edit selected serials"
9) Input some values in the additional fields section, click the '+New' and 'Clear' links,  hit 'Save'
10) Verify that both subscriptions now have the new values form the batch edit.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 48 Martin Renvoize (ashimema) 2023-12-21 10:28:47 UTC
Created attachment 160186 [details] [review]
Bug 35044: Update: Manual invoices, manual credits and accountlines

Test plan, k-t-d:

Preparation: Create additional fields for table 'accountlines:credit', visit:
/cgi-bin/koha/admin/additional-fields.pl?tablename=accountlines%3Acredit

2 text fields, one repeatable, one not-repeatable
2 AV fields, one repeatable, one not-repeatable

1) Add a new manual credit for admin borrower:
/cgi-bin/koha/members/mancredit.pl?borrowernumber=51
2) Set the mandatory "Amount" input (e.g. '5'). Click the 'Next' and press 'Ok' on the alert box.
3) Fill in all additional fields, click the '+New' and 'Clear' links,  hit 'Save'
4) On the table, click "Details" for the for account line we just created.
5) Notice the additional fields are there, repeated fields are comma separated.
6) Repeat the above test plan, but for accountlines:debit instead, visit:
/cgi-bin/koha/admin/additional-fields.pl?tablename=accountlines%3Adebit
7) To add a manual invoice, visit:
/cgi-bin/koha/members/maninvoice.pl?borrowernumber=51

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 49 Martin Renvoize (ashimema) 2023-12-21 10:28:50 UTC
Created attachment 160187 [details] [review]
Bug 35044: Add repetable to REST API spec

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 50 Martin Renvoize (ashimema) 2023-12-21 10:28:53 UTC
Created attachment 160188 [details] [review]
Bug 35044: Add tests

Test plan:
prove t/db_dependent/Koha/Object/Mixin/AdditionalFields.t

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 51 Martin Renvoize (ashimema) 2023-12-21 10:28:56 UTC
Created attachment 160189 [details] [review]
Bug 35044: (QA Follow-up) Fix atomicupdate

Was missing bug number and correct filename
Was checking for the wrong unique key name, existing unique key name is 'field_record',
not 'afv_fk'

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 52 Martin Renvoize (ashimema) 2023-12-21 10:33:16 UTC
Tested thoroughly and I'm really happy with the results here.

There's one caveat, which I've already discussed with Pedro and we came to the conclusion it was a feature rather than a bug.  The repeatable implementation is all UI level, there's no check on store to prevent a non-repeatable field being repeated.. this means if you're so inclined you could carefully craft a request to add an additional field value for a field marked non-repeatable.

However, given that you can flick between repeatable/non-repeatable in the UI easily (and that doesn't cleanup existing repeated value's as we felt it least destructive to keep the data around) and you can remove existing repeated value's, but not add new ones to a newly marked non-repeatable field this covers the use cases nicely.

Signing off.
Comment 53 David Nind 2024-03-23 07:29:29 UTC
Patches no longer apply 8-(....

git bz apply 35044

Bug 35044 Depends on bug 35197 (Signed Off)
Follow? [(y)es, (n)o] y

Bug 35197 - Expose additional_field definitions through REST API

159648 - Bug 35197: Add additional_fields REST API endpoint
159649 - Bug 35197: Add tests
159650 - Bug 35197: Field name consistency

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 35197: Add additional_fields REST API endpoint
Applying: Bug 35197: Add tests
Applying: Bug 35197: Field name consistency

Bug 35044 - Additional fields: Allow for repeatable fields

160177 - Bug 35044: [DONT PUSH] dbic specific
160178 - Bug 35044: DB changes + atomicupdate file
160179 - Bug 35044: Admin: New additional fields 'repeatable' field
160180 - Bug 35044: Preparation:
160181 - Bug 35044: Update: Order baskets
160182 - Bug 35044: Update: Acquisition orders
160183 - Bug 35044: Update: Invoices
160184 - Bug 35044: Update: Serial subscriptions
160185 - Bug 35044: Update: Serial subscriptions batch edit
160186 - Bug 35044: Update: Manual invoices, manual credits and accountlines
160187 - Bug 35044: Add repetable to REST API spec
160188 - Bug 35044: Add tests
160189 - Bug 35044: (QA Follow-up) Fix atomicupdate

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 35044: [DONT PUSH] dbic specific
Applying: Bug 35044: DB changes + atomicupdate file
Applying: Bug 35044: Admin: New additional fields 'repeatable' field
Applying: Bug 35044: Preparation:
Applying: Bug 35044: Update: Order baskets
Applying: Bug 35044: Update: Acquisition orders
Using index info to reconstruct a base tree...
M	acqui/addorder.pl
M	acqui/neworderempty.pl
M	koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt
Falling back to patching base and 3-way merge...
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt
Auto-merging acqui/neworderempty.pl
Auto-merging acqui/addorder.pl
CONFLICT (content): Merge conflict in acqui/addorder.pl
error: Failed to merge in the changes.
Patch failed at 0001 Bug 35044: Update: Acquisition orders
Comment 54 Pedro Amorim 2024-04-01 09:14:33 UTC
Created attachment 164162 [details] [review]
Bug 35044: [DONT PUSH] dbic specific

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 55 Pedro Amorim 2024-04-01 09:14:37 UTC
Created attachment 164163 [details] [review]
Bug 35044: DB changes + atomicupdate file

Add the 'repeatable' column to additional_fields
Remove the unique key from additional_field_values
as we will now be allowing for repeated instances of the same
field_id + record_id

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 56 Pedro Amorim 2024-04-01 09:14:40 UTC
Created attachment 164164 [details] [review]
Bug 35044: Admin: New additional fields 'repeatable' field

There is now a new 'repeatable' checkbox when configuring
(adding or editing) an additional field for a specific table.
It is also displayed in a column in the additional fields panel
for a given tablename.

MARC fields are not allowed to be repeatable.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 57 Pedro Amorim 2024-04-01 09:14:43 UTC
Created attachment 164165 [details] [review]
Bug 35044: Preparation:

get_additional_field_values_for_template method

New method to be utilized for retrieval of additional fields of any
class that implements it.
This is to be used when additional_fields are needed to be sent to
.tt files for renderering. Both for form entries and read-only 'show' pages.

Template files:

Updated additional-fields-entry.inc:
Now considers entry of repeatable fields.
Repeatable text fields will have a "+New" link to allow for adding of a new instance of a repeatable field.
Repeatable AV fields will be shown as checkboxes instead of a dropdown

Update additional-fields-display.inc
When displaying non-editable additional-fields, multiple instances for each field are now considered.
Label now only shows if field has a non-null value in it.
Option to show value_only
Option to set if its to be displayed on a table cell

Update histsearch.tt and filter-orders.inc
Now calls additional-fields-entry.inc with search_form=1 to prevent
repetable "+New" controls from showing on search inputs.

additional-fields-entry.js
New JS asset to be called by template files who require
additional-fields-entry.inc for repeatable fields controls.
This also handles the need for having the marcfield of type
'get' submitted if it is a disabled dropdown (AV marc field)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 58 Pedro Amorim 2024-04-01 09:14:46 UTC
Created attachment 164166 [details] [review]
Bug 35044: Update: Order baskets

Test plan, k-t-d:

Preparation: Create additional fields for table 'aqbasket':
2 text fields, one repeatable, one not-repeatable
2 AV fields, one repeatable, one not-repeatable

1) Add a new basket, visit:
/cgi-bin/koha/acqui/basketheader.pl?booksellerid=1&op=add_form
2) Fill in name and all additional fields, click the '+New' and 'Clear' links,  hit 'Save'
3) Notice the basket screen shows repeated fields separated by comma.
4) Notice that only non-null additional fields labels are shown.
5) Edit the basket. Notice all fields are shown as expected.

Additional testing:

Having a repeatable field with multiple instances, go back to the additional fields configuration and make the additional field non-repeatable again. Edit the basket again. Notice the multiple text instances are still shown, but the '+New' link no longer shows.
You're able to remove existing multiple instances, but unable to add new ones, this is because the field is no longer repeatable.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 59 Pedro Amorim 2024-04-01 09:14:50 UTC
Created attachment 164167 [details] [review]
Bug 35044: Update: Acquisition orders

Test plan, k-t-d:

Preparation: Create additional fields for table 'aqorders':
2 text fields, one repeatable, one not-repeatable
2 AV fields, one repeatable, one not-repeatable
2 MARC fields, one 'get' and one 'set', both non-repeatable, MARC field 942$c
Attempt to create a repeatable MARC field (get or set). Notice you're unable to.

1) Add a new order for an existing basket, with an existing record, visit:
/cgi-bin/koha/acqui/neworderempty.pl?booksellerid=1&basketno=1&biblionumber=76
2) Set the mandatory "Koha item type" for the item. Click the 'Add item' button below.
3) Notice the accounting details now have quantity:1
4) Set the mandatory "Fund" input in accounting details.
5) At the bottom, fill in all additional fields, click the '+New' and 'Clear' links,  hit 'Save'
6) In the orders table shown, click "Modify". Notice all the fields are presented correctly in the edit form.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 60 Pedro Amorim 2024-04-01 09:14:54 UTC
Created attachment 164168 [details] [review]
Bug 35044: Update: Invoices

Added fixme comment to invoices.tt, the search works so nothing to do here, but the code is not DRY

Test plan, k-t-d:

Preparation: Create additional fields for table 'aqinvoices':
2 text fields, one repeatable, one not-repeatable
2 AV fields, one repeatable, one not-repeatable

1) Add a new invoice for an existing vendor, visit:
/cgi-bin/koha/acqui/parcels.pl?booksellerid=1
2) Input something in the mandatory "Vendor invoice" field.
3) Fill in all additional fields, click the '+New' and 'Clear' links,  hit 'Save'
4) Search for invoices, visit:
http://localhost:8081/cgi-bin/koha/acqui/invoices.pl
5) Click "Search" on the left column of the page
6) Click the invoice we just created. Verify all the fields show correctly.
7) Go back to the additional fields configuration, set all additional fields as "searchable"
8) Return to http://localhost:8081/cgi-bin/koha/acqui/invoices.pl
9) Perform some searches using the additional fields values.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 61 Pedro Amorim 2024-04-01 09:14:57 UTC
Created attachment 164169 [details] [review]
Bug 35044: Update: Serial subscriptions

Test plan, k-t-d:

Preparation: Create additional fields for table 'subscription', visit:
/cgi-bin/koha/admin/additional-fields.pl?tablename=subscription

2 text fields, one repeatable, one not-repeatable
2 AV fields, one repeatable, one not-repeatable
2 MARC fields, one 'get' and one 'set', both non-repeatable, MARC field 942$c
Attempt to create a repeatable MARC field (get or set). Notice you're unable to.

1) Add a new serial subscription, visit:
/cgi-bin/koha/serials/subscription-add.pl
2) Set the mandatory "Record" input (e.g. '112'). Click the 'Next' and press 'Ok' on the alert box.
3) Fill in all required fields and press "Test prediction pattern"
4) At the bottom, fill in all additional fields, click the '+New' and 'Clear' links,  hit 'Save'
5) Notice the fields are shown, repeated fields are comma separated
6) Click Edit -> Edit Subscription, repeat steps 4 and 5
7) Go back to subscription additional fields, set all fields as searchable
8) Visit serials-home:
/cgi-bin/koha/serials/serials-home.pl
9) Click 'Search'
10) Notice the searchable fields now show in their columns, repeated fields separated by comma
11) Perform a search using a repeatable field, verify it all works as expected.

-- Subscription Claims --

Preparation:
1) Define a new claim notice, visit:
/cgi-bin/koha/tools/letter.pl?op=add_form&module=claimissues
2) Input code, name, click "Email" set a "Message subject" and put something in the message body. Hit 'Save'.
3) Set a serial as late, visit our original subscription:
/cgi-bin/koha/serials/serials-collection.pl?subscriptionid=1
4) Click "Edit serials" and status -> "Late". Hit "Save".
5) Link the original subscription to the existing vendor, visit:
/cgi-bin/koha/serials/subscription-add.pl?op=modify&subscriptionid=1
6) Click "Search for a vendor". Hit "Ok". Hit "Choose". Save the subscription.

Claims:
7) Visit claims:
/cgi-bin/koha/serials/claims.pl
8) Click "Ok"
9) Verify that searchable additional fields all have their respective column. Repeated fields are shown comma separated.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 62 Pedro Amorim 2024-04-01 09:15:01 UTC
Created attachment 164170 [details] [review]
Bug 35044: Update: Serial subscriptions batch edit

Test plan, k-t-d:

Preparation: Create additional fields for table 'subscription', visit:
/cgi-bin/koha/admin/additional-fields.pl?tablename=subscription

2 text fields, one repeatable, one not-repeatable
2 AV fields, one repeatable, one not-repeatable
2 MARC fields, one 'get' and one 'set', both non-repeatable, MARC field 942$c
Attempt to create a repeatable MARC field (get or set). Notice you're unable to.

1) Add a new serial subscription, visit:
/cgi-bin/koha/serials/subscription-add.pl
2) Set the mandatory "Record" input (e.g. '112'). Click the 'Next' and press 'Ok' on the alert box.
3) Fill in all required fields and press "Test prediction pattern"
4) At the bottom, fill in all additional fields, click the '+New' and 'Clear' links,  hit 'Save'
5) Notice the fields are shown, repeated fields are comma separated
6) Repeat steps 1-4 to create a second subscription
7) Visit serials home and hit "Search":
/cgi-bin/koha/serials/serials-home.pl
8) Check the checkboxes next to the 2 subscriptions and click "Edit selected serials"
9) Input some values in the additional fields section, click the '+New' and 'Clear' links,  hit 'Save'
10) Verify that both subscriptions now have the new values form the batch edit.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 63 Pedro Amorim 2024-04-01 09:15:04 UTC
Created attachment 164171 [details] [review]
Bug 35044: Update: Manual invoices, manual credits and accountlines

Test plan, k-t-d:

Preparation: Create additional fields for table 'accountlines:credit', visit:
/cgi-bin/koha/admin/additional-fields.pl?tablename=accountlines%3Acredit

2 text fields, one repeatable, one not-repeatable
2 AV fields, one repeatable, one not-repeatable

1) Add a new manual credit for admin borrower:
/cgi-bin/koha/members/mancredit.pl?borrowernumber=51
2) Set the mandatory "Amount" input (e.g. '5'). Click the 'Next' and press 'Ok' on the alert box.
3) Fill in all additional fields, click the '+New' and 'Clear' links,  hit 'Save'
4) On the table, click "Details" for the for account line we just created.
5) Notice the additional fields are there, repeated fields are comma separated.
6) Repeat the above test plan, but for accountlines:debit instead, visit:
/cgi-bin/koha/admin/additional-fields.pl?tablename=accountlines%3Adebit
7) To add a manual invoice, visit:
/cgi-bin/koha/members/maninvoice.pl?borrowernumber=51

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 64 Pedro Amorim 2024-04-01 09:15:08 UTC
Created attachment 164172 [details] [review]
Bug 35044: Add repetable to REST API spec

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 65 Pedro Amorim 2024-04-01 09:15:13 UTC
Created attachment 164173 [details] [review]
Bug 35044: Add tests

Test plan:
prove t/db_dependent/Koha/Object/Mixin/AdditionalFields.t

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 66 Pedro Amorim 2024-04-01 09:15:18 UTC
Created attachment 164174 [details] [review]
Bug 35044: (QA Follow-up) Fix atomicupdate

Was missing bug number and correct filename
Was checking for the wrong unique key name, existing unique key name is 'field_record',
not 'afv_fk'

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 67 Pedro Amorim 2024-05-17 12:30:48 UTC
There's a trivial conflict in the "Update: Serial subscriptions" commit but after that there's another conflict(s) caused by the API follow-up changes added to the depending bug (bug 35197). For this reason I'm setting this to blocked.
Comment 68 Pedro Amorim 2024-06-13 15:49:16 UTC
Created attachment 167690 [details] [review]
Bug 35044: 00-testcritic.t fix

Squash to 'Update: Serial subscriptions'
Comment 69 Pedro Amorim 2024-07-05 13:11:06 UTC
Created attachment 168537 [details] [review]
Bug 35044: [DONT PUSH] dbic specific

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 70 Pedro Amorim 2024-07-05 13:11:10 UTC
Created attachment 168538 [details] [review]
Bug 35044: DB changes + atomicupdate file

Add the 'repeatable' column to additional_fields
Remove the unique key from additional_field_values
as we will now be allowing for repeated instances of the same
field_id + record_id

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 71 Pedro Amorim 2024-07-05 13:11:13 UTC
Created attachment 168539 [details] [review]
Bug 35044: Admin: New additional fields 'repeatable' field

There is now a new 'repeatable' checkbox when configuring
(adding or editing) an additional field for a specific table.
It is also displayed in a column in the additional fields panel
for a given tablename.

MARC fields are not allowed to be repeatable.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 72 Pedro Amorim 2024-07-05 13:11:17 UTC
Created attachment 168540 [details] [review]
Bug 35044: Preparation:

get_additional_field_values_for_template method

New method to be utilized for retrieval of additional fields of any
class that implements it.
This is to be used when additional_fields are needed to be sent to
.tt files for renderering. Both for form entries and read-only 'show' pages.

Template files:

Updated additional-fields-entry.inc:
Now considers entry of repeatable fields.
Repeatable text fields will have a "+New" link to allow for adding of a new instance of a repeatable field.
Repeatable AV fields will be shown as checkboxes instead of a dropdown

Update additional-fields-display.inc
When displaying non-editable additional-fields, multiple instances for each field are now considered.
Label now only shows if field has a non-null value in it.
Option to show value_only
Option to set if its to be displayed on a table cell

Update histsearch.tt and filter-orders.inc
Now calls additional-fields-entry.inc with search_form=1 to prevent
repetable "+New" controls from showing on search inputs.

additional-fields-entry.js
New JS asset to be called by template files who require
additional-fields-entry.inc for repeatable fields controls.
This also handles the need for having the marcfield of type
'get' submitted if it is a disabled dropdown (AV marc field)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 73 Pedro Amorim 2024-07-05 13:11:21 UTC
Created attachment 168541 [details] [review]
Bug 35044: Update: Order baskets

Test plan, k-t-d:

Preparation: Create additional fields for table 'aqbasket':
2 text fields, one repeatable, one not-repeatable
2 AV fields, one repeatable, one not-repeatable

1) Add a new basket, visit:
/cgi-bin/koha/acqui/basketheader.pl?booksellerid=1&op=add_form
2) Fill in name and all additional fields, click the '+New' and 'Clear' links,  hit 'Save'
3) Notice the basket screen shows repeated fields separated by comma.
4) Notice that only non-null additional fields labels are shown.
5) Edit the basket. Notice all fields are shown as expected.

Additional testing:

Having a repeatable field with multiple instances, go back to the additional fields configuration and make the additional field non-repeatable again. Edit the basket again. Notice the multiple text instances are still shown, but the '+New' link no longer shows.
You're able to remove existing multiple instances, but unable to add new ones, this is because the field is no longer repeatable.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 74 Pedro Amorim 2024-07-05 13:11:24 UTC
Created attachment 168542 [details] [review]
Bug 35044: Update: Acquisition orders

Test plan, k-t-d:

Preparation: Create additional fields for table 'aqorders':
2 text fields, one repeatable, one not-repeatable
2 AV fields, one repeatable, one not-repeatable
2 MARC fields, one 'get' and one 'set', both non-repeatable, MARC field 942$c
Attempt to create a repeatable MARC field (get or set). Notice you're unable to.

1) Add a new order for an existing basket, with an existing record, visit:
/cgi-bin/koha/acqui/neworderempty.pl?booksellerid=1&basketno=1&biblionumber=76
2) Set the mandatory "Koha item type" for the item. Click the 'Add item' button below.
3) Notice the accounting details now have quantity:1
4) Set the mandatory "Fund" input in accounting details.
5) At the bottom, fill in all additional fields, click the '+New' and 'Clear' links,  hit 'Save'
6) In the orders table shown, click "Modify". Notice all the fields are presented correctly in the edit form.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 75 Pedro Amorim 2024-07-05 13:11:28 UTC
Created attachment 168543 [details] [review]
Bug 35044: Update: Invoices

Added fixme comment to invoices.tt, the search works so nothing to do here, but the code is not DRY

Test plan, k-t-d:

Preparation: Create additional fields for table 'aqinvoices':
2 text fields, one repeatable, one not-repeatable
2 AV fields, one repeatable, one not-repeatable

1) Add a new invoice for an existing vendor, visit:
/cgi-bin/koha/acqui/parcels.pl?booksellerid=1
2) Input something in the mandatory "Vendor invoice" field.
3) Fill in all additional fields, click the '+New' and 'Clear' links,  hit 'Save'
4) Search for invoices, visit:
http://localhost:8081/cgi-bin/koha/acqui/invoices.pl
5) Click "Search" on the left column of the page
6) Click the invoice we just created. Verify all the fields show correctly.
7) Go back to the additional fields configuration, set all additional fields as "searchable"
8) Return to http://localhost:8081/cgi-bin/koha/acqui/invoices.pl
9) Perform some searches using the additional fields values.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 76 Pedro Amorim 2024-07-05 13:11:31 UTC
Created attachment 168544 [details] [review]
Bug 35044: Update: Serial subscriptions

Test plan, k-t-d:

Preparation: Create additional fields for table 'subscription', visit:
/cgi-bin/koha/admin/additional-fields.pl?tablename=subscription

2 text fields, one repeatable, one not-repeatable
2 AV fields, one repeatable, one not-repeatable
2 MARC fields, one 'get' and one 'set', both non-repeatable, MARC field 942$c
Attempt to create a repeatable MARC field (get or set). Notice you're unable to.

1) Add a new serial subscription, visit:
/cgi-bin/koha/serials/subscription-add.pl
2) Set the mandatory "Record" input (e.g. '112'). Click the 'Next' and press 'Ok' on the alert box.
3) Fill in all required fields and press "Test prediction pattern"
4) At the bottom, fill in all additional fields, click the '+New' and 'Clear' links,  hit 'Save'
5) Notice the fields are shown, repeated fields are comma separated
6) Click Edit -> Edit Subscription, repeat steps 4 and 5
7) Go back to subscription additional fields, set all fields as searchable
8) Visit serials-home:
/cgi-bin/koha/serials/serials-home.pl
9) Click 'Search'
10) Notice the searchable fields now show in their columns, repeated fields separated by comma
11) Perform a search using a repeatable field, verify it all works as expected.

-- Subscription Claims --

Preparation:
1) Define a new claim notice, visit:
/cgi-bin/koha/tools/letter.pl?op=add_form&module=claimissues
2) Input code, name, click "Email" set a "Message subject" and put something in the message body. Hit 'Save'.
3) Set a serial as late, visit our original subscription:
/cgi-bin/koha/serials/serials-collection.pl?subscriptionid=1
4) Click "Edit serials" and status -> "Late". Hit "Save".
5) Link the original subscription to the existing vendor, visit:
/cgi-bin/koha/serials/subscription-add.pl?op=modify&subscriptionid=1
6) Click "Search for a vendor". Hit "Ok". Hit "Choose". Save the subscription.

Claims:
7) Visit claims:
/cgi-bin/koha/serials/claims.pl
8) Click "Ok"
9) Verify that searchable additional fields all have their respective column. Repeated fields are shown comma separated.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 77 Pedro Amorim 2024-07-05 13:11:35 UTC
Created attachment 168545 [details] [review]
Bug 35044: Update: Serial subscriptions batch edit

Test plan, k-t-d:

Preparation: Create additional fields for table 'subscription', visit:
/cgi-bin/koha/admin/additional-fields.pl?tablename=subscription

2 text fields, one repeatable, one not-repeatable
2 AV fields, one repeatable, one not-repeatable
2 MARC fields, one 'get' and one 'set', both non-repeatable, MARC field 942$c
Attempt to create a repeatable MARC field (get or set). Notice you're unable to.

1) Add a new serial subscription, visit:
/cgi-bin/koha/serials/subscription-add.pl
2) Set the mandatory "Record" input (e.g. '112'). Click the 'Next' and press 'Ok' on the alert box.
3) Fill in all required fields and press "Test prediction pattern"
4) At the bottom, fill in all additional fields, click the '+New' and 'Clear' links,  hit 'Save'
5) Notice the fields are shown, repeated fields are comma separated
6) Repeat steps 1-4 to create a second subscription
7) Visit serials home and hit "Search":
/cgi-bin/koha/serials/serials-home.pl
8) Check the checkboxes next to the 2 subscriptions and click "Edit selected serials"
9) Input some values in the additional fields section, click the '+New' and 'Clear' links,  hit 'Save'
10) Verify that both subscriptions now have the new values form the batch edit.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 78 Pedro Amorim 2024-07-05 13:11:38 UTC
Created attachment 168546 [details] [review]
Bug 35044: Update: Manual invoices, manual credits and accountlines

Test plan, k-t-d:

Preparation: Create additional fields for table 'accountlines:credit', visit:
/cgi-bin/koha/admin/additional-fields.pl?tablename=accountlines%3Acredit

2 text fields, one repeatable, one not-repeatable
2 AV fields, one repeatable, one not-repeatable

1) Add a new manual credit for admin borrower:
/cgi-bin/koha/members/mancredit.pl?borrowernumber=51
2) Set the mandatory "Amount" input (e.g. '5'). Click the 'Next' and press 'Ok' on the alert box.
3) Fill in all additional fields, click the '+New' and 'Clear' links,  hit 'Save'
4) On the table, click "Details" for the for account line we just created.
5) Notice the additional fields are there, repeated fields are comma separated.
6) Repeat the above test plan, but for accountlines:debit instead, visit:
/cgi-bin/koha/admin/additional-fields.pl?tablename=accountlines%3Adebit
7) To add a manual invoice, visit:
/cgi-bin/koha/members/maninvoice.pl?borrowernumber=51

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 79 Pedro Amorim 2024-07-05 13:11:42 UTC
Created attachment 168547 [details] [review]
Bug 35044: Add repetable to REST API spec

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 80 Pedro Amorim 2024-07-05 13:11:45 UTC
Created attachment 168548 [details] [review]
Bug 35044: Add tests

Test plan:
prove t/db_dependent/Koha/Object/Mixin/AdditionalFields.t

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 81 Pedro Amorim 2024-07-05 13:13:40 UTC
This is now rebased on bug 35197 state pushed to main.
This is now depending on bug 37262 as that is a follow-up required to fix some issues introduced by last changes in bug 35197.
Comment 82 Julian Maurice 2024-07-23 10:35:10 UTC
1) In the patches:
> #FIXME: The above $subscription->{additional_fields} may be redundant. Remove if so.
Can it be checked/fixed now ?

2) With the patches it is no longer possible to save a "falsy" value like '' or '0'. That's a regression and it would be nice to add a test for that.

3) I was a bit surprised when I realized that repeatable AV fields are not actually repeatable. There is no "+ New" button like with other repeatable fields.
It makes sense in this case to have a list of checkboxes instead of a repeatable dropdown list, but I didn't expect that. So maybe the issue is with the term "repeatable". I think that "multivalued" would fit better.
Is it feasible to change that term without too much work ?
Can anyone else from QA team or release team give their opinion on this ?

Failing QA for 1 and 2
Comment 83 Julian Maurice 2024-07-23 12:34:37 UTC
(In reply to Julian Maurice from comment #82)
> Is it feasible to change that term without too much work ?
Just in case: it can be done by using format-patch then applying some regexps on the .patch files and re-applying the patches. I can attach the modified patches if needed
Comment 84 Pedro Amorim 2024-07-25 08:51:40 UTC
Created attachment 169545 [details] [review]
Bug 35044: (QA follow-up): DRY code before set_additional_fields
Comment 85 Pedro Amorim 2024-07-25 08:51:44 UTC
Created attachment 169546 [details] [review]
Bug 35044: (QA follow-up): Allow for value '0' in additional fields

This now allows for value '0' for an additional field (repeatable or not).
This still does not allow for an empty '' field in additional fields.
This is consistent with borrower patron attributes, i.e. if you submit an empty borrower patron attribute entry, it does not store it as empty.
Additionally, if you have a value in a borrower patron attribute but then submit the form with that field as empty, it gets deleted from the database.

I agree not being able to save the value '0' is a blocker, but not the empty.
For consistency sake I'm keeping this as is, I don't see a use-case where a row with an empty field value is preferred over it not existing.

If we allow for '' values of additional fields, the 'clear' button for repeatable fields would have to remove the input instead of clearing the value (or else how would the user remove repeatable fields entries?).
If this is done, it's inconsistent with the repeatable fields from patron attribute types, as in that instance the 'clear' button only removes the input contents, not the input element itself.

prove t/db_dependent/Koha/Object/Mixin/AdditionalFields.t
Comment 86 Pedro Amorim 2024-07-25 08:51:47 UTC
Created attachment 169547 [details] [review]
Bug 35044: (QA follow-up): Remove FIXME and redundant code

prove t/db_dependent/Koha/Acquisition/Booksellers.t
prove t/db_dependent/Serials.t
Comment 87 Pedro Amorim 2024-07-25 08:57:07 UTC
(In reply to Julian Maurice from comment #82)
> 1) In the patches:
> > #FIXME: The above $subscription->{additional_fields} may be redundant. Remove if so.
> Can it be checked/fixed now ?
> 
> 2) With the patches it is no longer possible to save a "falsy" value like ''
> or '0'. That's a regression and it would be nice to add a test for that.
> 
> 3) I was a bit surprised when I realized that repeatable AV fields are not
> actually repeatable. There is no "+ New" button like with other repeatable
> fields.
> It makes sense in this case to have a list of checkboxes instead of a
> repeatable dropdown list, but I didn't expect that. So maybe the issue is
> with the term "repeatable". I think that "multivalued" would fit better.
> Is it feasible to change that term without too much work ?
> Can anyone else from QA team or release team give their opinion on this ?
> 
> Failing QA for 1 and 2

Thank you very much for your time here, Julian.
I believe my 3 latest QA follow-up patches address 1) and 2). Please let me know if you disagree.

As for 3) I agree with you, but don't feel strongly either way. I adopted the 'repeatable' naming to be consistent with patron attribute types, even though the 'repeatable' in patron attribute types only works for text fields, not AV fields, with that not being clear from the UI.

My long term goal for additional fields + borrower patron attributes is to eventually merge these 2 features (they're essentially the same thing, written twice). But I'm happy to follow-up with the renaming if required.
Comment 88 Julian Maurice 2024-07-25 09:10:30 UTC
> I adopted the 'repeatable' naming to be consistent with patron attribute types
Ok, so it's probably better to keep "repeatable" for consistency.
Thanks for the followup patches. I'll try to review them later today.
Comment 89 Julian Maurice 2024-07-25 13:49:41 UTC
About the '' value, I agree that it doesn't make much sense to keep them. But it's a change in behavior, and maybe someone out there uses these empty values in some way.
If we decide to not keep the empty value we should at least advertise it in the release notes (and in the commit messages, but you already did that)
And I think that the updatedatabase should remove these empty values

Other things to fix:

1) add_additional_fields does not allow '0' as a value, so it's not possible to add this value in subscriptions batch edit (the only place where add_additional_fields is used)

2) There is a piece of code that does nothing in koha-tmpl/intranet-tmpl/prog/en/modules/admin/additional-fields.tt:
$("#repeatable").prop('checked') == true
It's not an "if" condition and it appears on the same line as the end of a block so I assume this must be a copy/paste mistake

3) In koha-tmpl/intranet-tmpl/prog/js/additional-fields-entry.js functions clone_entry and clear_entry are added to the global scope. To avoid that you should wrap the whole script inside a block like this:

(function () {
    // code goes here
})();

4) QA script failure:

 FAIL   installer/data/mysql/kohastructure.sql
   FAIL   tinyint_has_boolean_flag
                The new column additional_fields.repeatable is using TINYINT(1) as type but is not defined as boolean in the schema file (Koha/Schema/Result/AdditionalField.pm), see the SQL12 coding guideline
Comment 90 Pedro Amorim 2024-07-25 17:16:18 UTC
Created attachment 169603 [details] [review]
Bug 35044: (QA follow-up): Allow for '0' in serials batch edit

This commit also ensures any existing '0' value additional fields are kept if batch editing and submitting the input empty
Comment 91 Pedro Amorim 2024-07-25 17:16:22 UTC
Created attachment 169604 [details] [review]
Bug 35044: (QA follow-up): Remove useless code

Most definitely a copy paste error. I've tested and retested this particular JS piece of code, works as intended before and after removing this badly copy pasted code. I'm surprised this wasn't causing a console error.
Comment 92 Pedro Amorim 2024-07-25 17:16:26 UTC
Created attachment 169605 [details] [review]
Bug 35044: (QA follow-up): Avoid polluting the global scope with function using immediately invoked function expression
Comment 93 Pedro Amorim 2024-07-25 17:16:30 UTC
Created attachment 169606 [details] [review]
Bug 35044: (QA follow-up): Fix QA script Error on boolean TINYINT
Comment 94 Pedro Amorim 2024-07-25 17:16:34 UTC
Created attachment 169607 [details] [review]
Bug 35044: (QA follow-up): Add removal of empty value entries in additional_field_values to atomicupdate

To test:
1) Follow any of the above test plans to add some additional_field_values entries
2) Run the following SQL:
  update additional_field_values set value = '';
3) Run updatedatabase twice. Notice the first time it tells you how many entries were removed. The 2nd time it does nothing.
Comment 95 Julian Maurice 2024-07-26 07:49:07 UTC
Created attachment 169643 [details] [review]
Bug 35044: [DONT PUSH] dbic specific

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

https://bugs.koha-community.org/show_bug.cgi?id=25044
Comment 96 Julian Maurice 2024-07-26 07:49:11 UTC
Created attachment 169644 [details] [review]
Bug 35044: DB changes + atomicupdate file

Add the 'repeatable' column to additional_fields
Remove the unique key from additional_field_values
as we will now be allowing for repeated instances of the same
field_id + record_id

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

https://bugs.koha-community.org/show_bug.cgi?id=25044
Comment 97 Julian Maurice 2024-07-26 07:49:14 UTC
Created attachment 169645 [details] [review]
Bug 35044: Admin: New additional fields 'repeatable' field

There is now a new 'repeatable' checkbox when configuring
(adding or editing) an additional field for a specific table.
It is also displayed in a column in the additional fields panel
for a given tablename.

MARC fields are not allowed to be repeatable.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

https://bugs.koha-community.org/show_bug.cgi?id=25044
Comment 98 Julian Maurice 2024-07-26 07:49:18 UTC
Created attachment 169646 [details] [review]
Bug 35044: Preparation:

get_additional_field_values_for_template method

New method to be utilized for retrieval of additional fields of any
class that implements it.
This is to be used when additional_fields are needed to be sent to .tt
files for renderering. Both for form entries and read-only 'show' pages.

Template files:

Updated additional-fields-entry.inc:
Now considers entry of repeatable fields.
Repeatable text fields will have a "+New" link to allow for adding of a
new instance of a repeatable field.
Repeatable AV fields will be shown as checkboxes instead of a dropdown

Update additional-fields-display.inc
When displaying non-editable additional-fields, multiple instances for
each field are now considered.
Label now only shows if field has a non-null value in it.
Option to show value_only
Option to set if its to be displayed on a table cell

Update histsearch.tt and filter-orders.inc
Now calls additional-fields-entry.inc with search_form=1 to prevent
repetable "+New" controls from showing on search inputs.

additional-fields-entry.js
New JS asset to be called by template files who require
additional-fields-entry.inc for repeatable fields controls.
This also handles the need for having the marcfield of type
'get' submitted if it is a disabled dropdown (AV marc field)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

https://bugs.koha-community.org/show_bug.cgi?id=25044
Comment 99 Julian Maurice 2024-07-26 07:49:21 UTC
Created attachment 169647 [details] [review]
Bug 35044: Update: Order baskets

Test plan, k-t-d:

Preparation: Create additional fields for table 'aqbasket':
2 text fields, one repeatable, one not-repeatable
2 AV fields, one repeatable, one not-repeatable

1) Add a new basket, visit:
/cgi-bin/koha/acqui/basketheader.pl?booksellerid=1&op=add_form
2) Fill in name and all additional fields, click the '+New' and 'Clear'
   links,  hit 'Save'
3) Notice the basket screen shows repeated fields separated by comma.
4) Notice that only non-null additional fields labels are shown.
5) Edit the basket. Notice all fields are shown as expected.

Additional testing:

Having a repeatable field with multiple instances, go back to the
additional fields configuration and make the additional field
non-repeatable again. Edit the basket again. Notice the multiple text
instances are still shown, but the '+New' link no longer shows.
You're able to remove existing multiple instances, but unable to add new
ones, this is because the field is no longer repeatable.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

https://bugs.koha-community.org/show_bug.cgi?id=25044
Comment 100 Julian Maurice 2024-07-26 07:49:24 UTC
Created attachment 169648 [details] [review]
Bug 35044: Update: Acquisition orders

Test plan, k-t-d:

Preparation: Create additional fields for table 'aqorders':
2 text fields, one repeatable, one not-repeatable
2 AV fields, one repeatable, one not-repeatable
2 MARC fields, one 'get' and one 'set', both non-repeatable, MARC field
942$c
Attempt to create a repeatable MARC field (get or set). Notice you're
unable to.

1) Add a new order for an existing basket, with an existing record,
   visit:
/cgi-bin/koha/acqui/neworderempty.pl?booksellerid=1&basketno=1&biblionumber=76
2) Set the mandatory "Koha item type" for the item. Click the 'Add item'
   button below.
3) Notice the accounting details now have quantity:1
4) Set the mandatory "Fund" input in accounting details.
5) At the bottom, fill in all additional fields, click the '+New' and
   'Clear' links,  hit 'Save'
6) In the orders table shown, click "Modify". Notice all the fields are
   presented correctly in the edit form.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

https://bugs.koha-community.org/show_bug.cgi?id=25044
Comment 101 Julian Maurice 2024-07-26 07:49:28 UTC
Created attachment 169649 [details] [review]
Bug 35044: Update: Invoices

Added fixme comment to invoices.tt, the search works so nothing to do
here, but the code is not DRY

Test plan, k-t-d:

Preparation: Create additional fields for table 'aqinvoices':
2 text fields, one repeatable, one not-repeatable
2 AV fields, one repeatable, one not-repeatable

1) Add a new invoice for an existing vendor, visit:
/cgi-bin/koha/acqui/parcels.pl?booksellerid=1
2) Input something in the mandatory "Vendor invoice" field.
3) Fill in all additional fields, click the '+New' and 'Clear' links,
   hit 'Save'
4) Search for invoices, visit:
http://localhost:8081/cgi-bin/koha/acqui/invoices.pl
5) Click "Search" on the left column of the page
6) Click the invoice we just created. Verify all the fields show
   correctly.
7) Go back to the additional fields configuration, set all additional
   fields as "searchable"
8) Return to http://localhost:8081/cgi-bin/koha/acqui/invoices.pl
9) Perform some searches using the additional fields values.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

https://bugs.koha-community.org/show_bug.cgi?id=25044
Comment 102 Julian Maurice 2024-07-26 07:49:31 UTC
Created attachment 169650 [details] [review]
Bug 35044: Update: Serial subscriptions

Test plan, k-t-d:

Preparation: Create additional fields for table 'subscription', visit:
/cgi-bin/koha/admin/additional-fields.pl?tablename=subscription

2 text fields, one repeatable, one not-repeatable
2 AV fields, one repeatable, one not-repeatable
2 MARC fields, one 'get' and one 'set', both non-repeatable, MARC field
942$c
Attempt to create a repeatable MARC field (get or set). Notice you're
unable to.

1) Add a new serial subscription, visit:
/cgi-bin/koha/serials/subscription-add.pl
2) Set the mandatory "Record" input (e.g. '112'). Click the 'Next' and
   press 'Ok' on the alert box.
3) Fill in all required fields and press "Test prediction pattern"
4) At the bottom, fill in all additional fields, click the '+New' and
   'Clear' links,  hit 'Save'
5) Notice the fields are shown, repeated fields are comma separated
6) Click Edit -> Edit Subscription, repeat steps 4 and 5
7) Go back to subscription additional fields, set all fields as
   searchable
8) Visit serials-home: /cgi-bin/koha/serials/serials-home.pl
9) Click 'Search'
10) Notice the searchable fields now show in their columns, repeated
    fields separated by comma
11) Perform a search using a repeatable field, verify it all works as
    expected.

-- Subscription Claims --

Preparation:
1) Define a new claim notice, visit:
/cgi-bin/koha/tools/letter.pl?op=add_form&module=claimissues
2) Input code, name, click "Email" set a "Message subject" and put
   something in the message body. Hit 'Save'.
3) Set a serial as late, visit our original subscription:
/cgi-bin/koha/serials/serials-collection.pl?subscriptionid=1
4) Click "Edit serials" and status -> "Late". Hit "Save".
5) Link the original subscription to the existing vendor, visit:
/cgi-bin/koha/serials/subscription-add.pl?op=modify&subscriptionid=1
6) Click "Search for a vendor". Hit "Ok". Hit "Choose". Save the
   subscription.

Claims:
7) Visit claims:
/cgi-bin/koha/serials/claims.pl
8) Click "Ok"
9) Verify that searchable additional fields all have their respective
   column. Repeated fields are shown comma separated.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

https://bugs.koha-community.org/show_bug.cgi?id=25044
Comment 103 Julian Maurice 2024-07-26 07:49:35 UTC
Created attachment 169651 [details] [review]
Bug 35044: Update: Serial subscriptions batch edit

Test plan, k-t-d:

Preparation: Create additional fields for table 'subscription', visit:
/cgi-bin/koha/admin/additional-fields.pl?tablename=subscription

2 text fields, one repeatable, one not-repeatable
2 AV fields, one repeatable, one not-repeatable
2 MARC fields, one 'get' and one 'set', both non-repeatable, MARC field
942$c
Attempt to create a repeatable MARC field (get or set). Notice you're
unable to.

1) Add a new serial subscription, visit:
/cgi-bin/koha/serials/subscription-add.pl
2) Set the mandatory "Record" input (e.g. '112'). Click the 'Next' and
   press 'Ok' on the alert box.
3) Fill in all required fields and press "Test prediction pattern"
4) At the bottom, fill in all additional fields, click the '+New' and
   'Clear' links,  hit 'Save'
5) Notice the fields are shown, repeated fields are comma separated
6) Repeat steps 1-4 to create a second subscription
7) Visit serials home and hit "Search":
/cgi-bin/koha/serials/serials-home.pl
8) Check the checkboxes next to the 2 subscriptions and click "Edit
   selected serials"
9) Input some values in the additional fields section, click the '+New'
   and 'Clear' links,  hit 'Save'
10) Verify that both subscriptions now have the new values form the
    batch edit.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

https://bugs.koha-community.org/show_bug.cgi?id=25044
Comment 104 Julian Maurice 2024-07-26 07:49:38 UTC
Created attachment 169652 [details] [review]
Bug 35044: Update: Manual invoices, manual credits and accountlines

Test plan, k-t-d:

Preparation: Create additional fields for table 'accountlines:credit',
visit:
/cgi-bin/koha/admin/additional-fields.pl?tablename=accountlines%3Acredit

2 text fields, one repeatable, one not-repeatable
2 AV fields, one repeatable, one not-repeatable

1) Add a new manual credit for admin borrower:
/cgi-bin/koha/members/mancredit.pl?borrowernumber=51
2) Set the mandatory "Amount" input (e.g. '5'). Click the 'Next' and
   press 'Ok' on the alert box.
3) Fill in all additional fields, click the '+New' and 'Clear' links,
   hit 'Save'
4) On the table, click "Details" for the for account line we just
   created.
5) Notice the additional fields are there, repeated fields are comma
   separated.
6) Repeat the above test plan, but for accountlines:debit instead,
   visit:
/cgi-bin/koha/admin/additional-fields.pl?tablename=accountlines%3Adebit
7) To add a manual invoice, visit:
   /cgi-bin/koha/members/maninvoice.pl?borrowernumber=51

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

https://bugs.koha-community.org/show_bug.cgi?id=25044
Comment 105 Julian Maurice 2024-07-26 07:49:42 UTC
Created attachment 169653 [details] [review]
Bug 35044: Add repetable to REST API spec

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

https://bugs.koha-community.org/show_bug.cgi?id=25044
Comment 106 Julian Maurice 2024-07-26 07:49:45 UTC
Created attachment 169654 [details] [review]
Bug 35044: Add tests

Test plan:
prove t/db_dependent/Koha/Object/Mixin/AdditionalFields.t

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

https://bugs.koha-community.org/show_bug.cgi?id=25044
Comment 107 Julian Maurice 2024-07-26 07:49:49 UTC
Created attachment 169655 [details] [review]
Bug 35044: (QA follow-up): DRY code before set_additional_fields

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

https://bugs.koha-community.org/show_bug.cgi?id=25044
Comment 108 Julian Maurice 2024-07-26 07:49:52 UTC
Created attachment 169656 [details] [review]
Bug 35044: (QA follow-up): Allow for value '0' in additional fields

This now allows for value '0' for an additional field (repeatable or
not).
This still does not allow for an empty '' field in additional fields.
This is consistent with borrower patron attributes, i.e. if you submit
an empty borrower patron attribute entry, it does not store it as empty.
Additionally, if you have a value in a borrower patron attribute but
then submit the form with that field as empty, it gets deleted from the
database.

I agree not being able to save the value '0' is a blocker, but not the
empty.
For consistency sake I'm keeping this as is, I don't see a use-case
where a row with an empty field value is preferred over it not existing.

If we allow for '' values of additional fields, the 'clear' button for
repeatable fields would have to remove the input instead of clearing the
value (or else how would the user remove repeatable fields entries?).
If this is done, it's inconsistent with the repeatable fields from
patron attribute types, as in that instance the 'clear' button only
removes the input contents, not the input element itself.

prove t/db_dependent/Koha/Object/Mixin/AdditionalFields.t

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

https://bugs.koha-community.org/show_bug.cgi?id=25044
Comment 109 Julian Maurice 2024-07-26 07:49:55 UTC
Created attachment 169657 [details] [review]
Bug 35044: (QA follow-up): Remove FIXME and redundant code

prove t/db_dependent/Koha/Acquisition/Booksellers.t
prove t/db_dependent/Serials.t

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

https://bugs.koha-community.org/show_bug.cgi?id=25044
Comment 110 Julian Maurice 2024-07-26 07:49:59 UTC
Created attachment 169658 [details] [review]
Bug 35044: (QA follow-up): Allow for '0' in serials batch edit

This commit also ensures any existing '0' value additional fields are
kept if batch editing and submitting the input empty

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

https://bugs.koha-community.org/show_bug.cgi?id=25044
Comment 111 Julian Maurice 2024-07-26 07:50:03 UTC
Created attachment 169659 [details] [review]
Bug 35044: (QA follow-up): Remove useless code

Most definitely a copy paste error. I've tested and retested this
particular JS piece of code, works as intended before and after removing
this badly copy pasted code. I'm surprised this wasn't causing a console
error.

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

https://bugs.koha-community.org/show_bug.cgi?id=25044
Comment 112 Julian Maurice 2024-07-26 07:50:06 UTC
Created attachment 169660 [details] [review]
Bug 35044: (QA follow-up): Avoid polluting global scope with functions

using immediately invoked function expression

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

https://bugs.koha-community.org/show_bug.cgi?id=25044
Comment 113 Julian Maurice 2024-07-26 07:50:10 UTC
Created attachment 169661 [details] [review]
Bug 35044: (QA follow-up): Fix QA script Error on boolean TINYINT

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

https://bugs.koha-community.org/show_bug.cgi?id=25044
Comment 114 Julian Maurice 2024-07-26 07:50:13 UTC
Created attachment 169662 [details] [review]
Bug 35044: (QA follow-up): Remove empty additional_field_values entries

To test:
1) Follow any of the above test plans to add some
   additional_field_values entries
2) Run the following SQL:
  update additional_field_values set value = '';
3) Run updatedatabase twice. Notice the first time it tells you how many
   entries were removed. The 2nd time it does nothing.

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

https://bugs.koha-community.org/show_bug.cgi?id=25044
Comment 115 Julian Maurice 2024-07-26 07:50:17 UTC
Created attachment 169663 [details] [review]
Bug 35044: (QA follow-up) Delete empty values with a single query

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

https://bugs.koha-community.org/show_bug.cgi?id=25044
Comment 116 Julian Maurice 2024-07-26 07:52:49 UTC
Created attachment 169664 [details] [review]
Bug 35044: [DONT PUSH] dbic specific

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 117 Julian Maurice 2024-07-26 07:52:52 UTC
Created attachment 169665 [details] [review]
Bug 35044: DB changes + atomicupdate file

Add the 'repeatable' column to additional_fields
Remove the unique key from additional_field_values
as we will now be allowing for repeated instances of the same
field_id + record_id

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 118 Julian Maurice 2024-07-26 07:52:55 UTC
Created attachment 169666 [details] [review]
Bug 35044: Admin: New additional fields 'repeatable' field

There is now a new 'repeatable' checkbox when configuring
(adding or editing) an additional field for a specific table.
It is also displayed in a column in the additional fields panel
for a given tablename.

MARC fields are not allowed to be repeatable.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 119 Julian Maurice 2024-07-26 07:52:59 UTC
Created attachment 169667 [details] [review]
Bug 35044: Preparation:

get_additional_field_values_for_template method

New method to be utilized for retrieval of additional fields of any
class that implements it.
This is to be used when additional_fields are needed to be sent to .tt
files for renderering. Both for form entries and read-only 'show' pages.

Template files:

Updated additional-fields-entry.inc:
Now considers entry of repeatable fields.
Repeatable text fields will have a "+New" link to allow for adding of a
new instance of a repeatable field.
Repeatable AV fields will be shown as checkboxes instead of a dropdown

Update additional-fields-display.inc
When displaying non-editable additional-fields, multiple instances for
each field are now considered.
Label now only shows if field has a non-null value in it.
Option to show value_only
Option to set if its to be displayed on a table cell

Update histsearch.tt and filter-orders.inc
Now calls additional-fields-entry.inc with search_form=1 to prevent
repetable "+New" controls from showing on search inputs.

additional-fields-entry.js
New JS asset to be called by template files who require
additional-fields-entry.inc for repeatable fields controls.
This also handles the need for having the marcfield of type
'get' submitted if it is a disabled dropdown (AV marc field)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 120 Julian Maurice 2024-07-26 07:53:02 UTC
Created attachment 169668 [details] [review]
Bug 35044: Update: Order baskets

Test plan, k-t-d:

Preparation: Create additional fields for table 'aqbasket':
2 text fields, one repeatable, one not-repeatable
2 AV fields, one repeatable, one not-repeatable

1) Add a new basket, visit:
/cgi-bin/koha/acqui/basketheader.pl?booksellerid=1&op=add_form
2) Fill in name and all additional fields, click the '+New' and 'Clear'
   links,  hit 'Save'
3) Notice the basket screen shows repeated fields separated by comma.
4) Notice that only non-null additional fields labels are shown.
5) Edit the basket. Notice all fields are shown as expected.

Additional testing:

Having a repeatable field with multiple instances, go back to the
additional fields configuration and make the additional field
non-repeatable again. Edit the basket again. Notice the multiple text
instances are still shown, but the '+New' link no longer shows.
You're able to remove existing multiple instances, but unable to add new
ones, this is because the field is no longer repeatable.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 121 Julian Maurice 2024-07-26 07:53:06 UTC
Created attachment 169669 [details] [review]
Bug 35044: Update: Acquisition orders

Test plan, k-t-d:

Preparation: Create additional fields for table 'aqorders':
2 text fields, one repeatable, one not-repeatable
2 AV fields, one repeatable, one not-repeatable
2 MARC fields, one 'get' and one 'set', both non-repeatable, MARC field
942$c
Attempt to create a repeatable MARC field (get or set). Notice you're
unable to.

1) Add a new order for an existing basket, with an existing record,
   visit:
/cgi-bin/koha/acqui/neworderempty.pl?booksellerid=1&basketno=1&biblionumber=76
2) Set the mandatory "Koha item type" for the item. Click the 'Add item'
   button below.
3) Notice the accounting details now have quantity:1
4) Set the mandatory "Fund" input in accounting details.
5) At the bottom, fill in all additional fields, click the '+New' and
   'Clear' links,  hit 'Save'
6) In the orders table shown, click "Modify". Notice all the fields are
   presented correctly in the edit form.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 122 Julian Maurice 2024-07-26 07:53:09 UTC
Created attachment 169670 [details] [review]
Bug 35044: Update: Invoices

Added fixme comment to invoices.tt, the search works so nothing to do
here, but the code is not DRY

Test plan, k-t-d:

Preparation: Create additional fields for table 'aqinvoices':
2 text fields, one repeatable, one not-repeatable
2 AV fields, one repeatable, one not-repeatable

1) Add a new invoice for an existing vendor, visit:
/cgi-bin/koha/acqui/parcels.pl?booksellerid=1
2) Input something in the mandatory "Vendor invoice" field.
3) Fill in all additional fields, click the '+New' and 'Clear' links,
   hit 'Save'
4) Search for invoices, visit:
http://localhost:8081/cgi-bin/koha/acqui/invoices.pl
5) Click "Search" on the left column of the page
6) Click the invoice we just created. Verify all the fields show
   correctly.
7) Go back to the additional fields configuration, set all additional
   fields as "searchable"
8) Return to http://localhost:8081/cgi-bin/koha/acqui/invoices.pl
9) Perform some searches using the additional fields values.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 123 Julian Maurice 2024-07-26 07:53:13 UTC
Created attachment 169671 [details] [review]
Bug 35044: Update: Serial subscriptions

Test plan, k-t-d:

Preparation: Create additional fields for table 'subscription', visit:
/cgi-bin/koha/admin/additional-fields.pl?tablename=subscription

2 text fields, one repeatable, one not-repeatable
2 AV fields, one repeatable, one not-repeatable
2 MARC fields, one 'get' and one 'set', both non-repeatable, MARC field
942$c
Attempt to create a repeatable MARC field (get or set). Notice you're
unable to.

1) Add a new serial subscription, visit:
/cgi-bin/koha/serials/subscription-add.pl
2) Set the mandatory "Record" input (e.g. '112'). Click the 'Next' and
   press 'Ok' on the alert box.
3) Fill in all required fields and press "Test prediction pattern"
4) At the bottom, fill in all additional fields, click the '+New' and
   'Clear' links,  hit 'Save'
5) Notice the fields are shown, repeated fields are comma separated
6) Click Edit -> Edit Subscription, repeat steps 4 and 5
7) Go back to subscription additional fields, set all fields as
   searchable
8) Visit serials-home: /cgi-bin/koha/serials/serials-home.pl
9) Click 'Search'
10) Notice the searchable fields now show in their columns, repeated
    fields separated by comma
11) Perform a search using a repeatable field, verify it all works as
    expected.

-- Subscription Claims --

Preparation:
1) Define a new claim notice, visit:
/cgi-bin/koha/tools/letter.pl?op=add_form&module=claimissues
2) Input code, name, click "Email" set a "Message subject" and put
   something in the message body. Hit 'Save'.
3) Set a serial as late, visit our original subscription:
/cgi-bin/koha/serials/serials-collection.pl?subscriptionid=1
4) Click "Edit serials" and status -> "Late". Hit "Save".
5) Link the original subscription to the existing vendor, visit:
/cgi-bin/koha/serials/subscription-add.pl?op=modify&subscriptionid=1
6) Click "Search for a vendor". Hit "Ok". Hit "Choose". Save the
   subscription.

Claims:
7) Visit claims:
/cgi-bin/koha/serials/claims.pl
8) Click "Ok"
9) Verify that searchable additional fields all have their respective
   column. Repeated fields are shown comma separated.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 124 Julian Maurice 2024-07-26 07:53:17 UTC
Created attachment 169672 [details] [review]
Bug 35044: Update: Serial subscriptions batch edit

Test plan, k-t-d:

Preparation: Create additional fields for table 'subscription', visit:
/cgi-bin/koha/admin/additional-fields.pl?tablename=subscription

2 text fields, one repeatable, one not-repeatable
2 AV fields, one repeatable, one not-repeatable
2 MARC fields, one 'get' and one 'set', both non-repeatable, MARC field
942$c
Attempt to create a repeatable MARC field (get or set). Notice you're
unable to.

1) Add a new serial subscription, visit:
/cgi-bin/koha/serials/subscription-add.pl
2) Set the mandatory "Record" input (e.g. '112'). Click the 'Next' and
   press 'Ok' on the alert box.
3) Fill in all required fields and press "Test prediction pattern"
4) At the bottom, fill in all additional fields, click the '+New' and
   'Clear' links,  hit 'Save'
5) Notice the fields are shown, repeated fields are comma separated
6) Repeat steps 1-4 to create a second subscription
7) Visit serials home and hit "Search":
/cgi-bin/koha/serials/serials-home.pl
8) Check the checkboxes next to the 2 subscriptions and click "Edit
   selected serials"
9) Input some values in the additional fields section, click the '+New'
   and 'Clear' links,  hit 'Save'
10) Verify that both subscriptions now have the new values form the
    batch edit.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 125 Julian Maurice 2024-07-26 07:53:20 UTC
Created attachment 169673 [details] [review]
Bug 35044: Update: Manual invoices, manual credits and accountlines

Test plan, k-t-d:

Preparation: Create additional fields for table 'accountlines:credit',
visit:
/cgi-bin/koha/admin/additional-fields.pl?tablename=accountlines%3Acredit

2 text fields, one repeatable, one not-repeatable
2 AV fields, one repeatable, one not-repeatable

1) Add a new manual credit for admin borrower:
/cgi-bin/koha/members/mancredit.pl?borrowernumber=51
2) Set the mandatory "Amount" input (e.g. '5'). Click the 'Next' and
   press 'Ok' on the alert box.
3) Fill in all additional fields, click the '+New' and 'Clear' links,
   hit 'Save'
4) On the table, click "Details" for the for account line we just
   created.
5) Notice the additional fields are there, repeated fields are comma
   separated.
6) Repeat the above test plan, but for accountlines:debit instead,
   visit:
/cgi-bin/koha/admin/additional-fields.pl?tablename=accountlines%3Adebit
7) To add a manual invoice, visit:
   /cgi-bin/koha/members/maninvoice.pl?borrowernumber=51

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 126 Julian Maurice 2024-07-26 07:53:24 UTC
Created attachment 169674 [details] [review]
Bug 35044: Add repetable to REST API spec

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 127 Julian Maurice 2024-07-26 07:53:27 UTC
Created attachment 169675 [details] [review]
Bug 35044: Add tests

Test plan:
prove t/db_dependent/Koha/Object/Mixin/AdditionalFields.t

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 128 Julian Maurice 2024-07-26 07:53:31 UTC
Created attachment 169676 [details] [review]
Bug 35044: (QA follow-up): DRY code before set_additional_fields

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 129 Julian Maurice 2024-07-26 07:53:34 UTC
Created attachment 169677 [details] [review]
Bug 35044: (QA follow-up): Allow for value '0' in additional fields

This now allows for value '0' for an additional field (repeatable or
not).
This still does not allow for an empty '' field in additional fields.
This is consistent with borrower patron attributes, i.e. if you submit
an empty borrower patron attribute entry, it does not store it as empty.
Additionally, if you have a value in a borrower patron attribute but
then submit the form with that field as empty, it gets deleted from the
database.

I agree not being able to save the value '0' is a blocker, but not the
empty.
For consistency sake I'm keeping this as is, I don't see a use-case
where a row with an empty field value is preferred over it not existing.

If we allow for '' values of additional fields, the 'clear' button for
repeatable fields would have to remove the input instead of clearing the
value (or else how would the user remove repeatable fields entries?).
If this is done, it's inconsistent with the repeatable fields from
patron attribute types, as in that instance the 'clear' button only
removes the input contents, not the input element itself.

prove t/db_dependent/Koha/Object/Mixin/AdditionalFields.t

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 130 Julian Maurice 2024-07-26 07:53:38 UTC
Created attachment 169678 [details] [review]
Bug 35044: (QA follow-up): Remove FIXME and redundant code

prove t/db_dependent/Koha/Acquisition/Booksellers.t
prove t/db_dependent/Serials.t

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 131 Julian Maurice 2024-07-26 07:53:41 UTC
Created attachment 169679 [details] [review]
Bug 35044: (QA follow-up): Allow for '0' in serials batch edit

This commit also ensures any existing '0' value additional fields are
kept if batch editing and submitting the input empty

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 132 Julian Maurice 2024-07-26 07:53:45 UTC
Created attachment 169680 [details] [review]
Bug 35044: (QA follow-up): Remove useless code

Most definitely a copy paste error. I've tested and retested this
particular JS piece of code, works as intended before and after removing
this badly copy pasted code. I'm surprised this wasn't causing a console
error.

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 133 Julian Maurice 2024-07-26 07:53:48 UTC
Created attachment 169681 [details] [review]
Bug 35044: (QA follow-up): Avoid polluting global scope with functions

using immediately invoked function expression

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 134 Julian Maurice 2024-07-26 07:53:51 UTC
Created attachment 169682 [details] [review]
Bug 35044: (QA follow-up): Fix QA script Error on boolean TINYINT

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 135 Julian Maurice 2024-07-26 07:53:55 UTC
Created attachment 169683 [details] [review]
Bug 35044: (QA follow-up): Remove empty additional_field_values entries

To test:
1) Follow any of the above test plans to add some
   additional_field_values entries
2) Run the following SQL:
  update additional_field_values set value = '';
3) Run updatedatabase twice. Notice the first time it tells you how many
   entries were removed. The 2nd time it does nothing.

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 136 Julian Maurice 2024-07-26 07:53:58 UTC
Created attachment 169684 [details] [review]
Bug 35044: (QA follow-up) Delete empty values with a single query

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 137 Julian Maurice 2024-07-26 07:59:41 UTC
I added the last patch and edited some of the commit messages to make them fit into the 72-column width limit.

Everything works fine, code looks good and QA script is happy => PQA
Comment 138 Pedro Amorim 2024-07-26 13:09:07 UTC
Created attachment 169697 [details] [review]
Bug 35044: (QA follow-up): Fix flaky tests

To test, run the following test file a couple times until it fails:
prove t/db_dependent/Koha/Object/Mixin/AdditionalFields.t

My testing this failed around 50% of the time so it should not take
long to reproduce. I believe this is because the order of the array
elements may differ.

Apply this patch and run the test file again many times. It should
never fail.
Comment 139 Katrin Fischer 2024-08-20 13:10:39 UTC
There appears to be some mistake in the database update, but I fail to spot it:

{UNKNOWN}: DBIx::Class::ResultSource::column_info(): No such column repeatable at /kohadevbox/koha/Koha/Schema/Result/AdditionalField.pm line 159
Compilation failed in require at /usr/share/perl5/Class/C3/Componentised.pm line 146. at /usr/share/perl5/Class/C3/Componentised.pm line 151
Compilation failed in require at /kohadevbox/koha/C4/Installer.pm line 30.
BEGIN failed--compilation aborted at /kohadevbox/koha/C4/Installer.pm line 30.
Compilation failed in require at /kohadevbox/koha/installer/data/mysql/updatedatabase.pl line 40.
BEGIN failed--compilation aborted at /kohadevbox/koha/installer/data/mysql/updatedatabase.pl line 40.

Applied all patches, removed the "DO NOT PUSH" patch. 

Please add use of say_success to database update when working on the follow-up.
Comment 140 Pedro Amorim 2024-08-20 14:30:07 UTC
Created attachment 170501 [details] [review]
Bug 35044: (QA follow-up): Add color to atomic update
Comment 141 Pedro Amorim 2024-08-20 14:30:58 UTC
(In reply to Katrin Fischer from comment #139)
> Applied all patches, removed the "DO NOT PUSH" patch. 
Did you run dbic? You need the patch or run dbic since those are the schema files.
IF that's not it, where/when does the error show up?
Comment 142 Katrin Fischer 2024-08-20 17:52:56 UTC
(In reply to Pedro Amorim from comment #141)
> (In reply to Katrin Fischer from comment #139)
> > Applied all patches, removed the "DO NOT PUSH" patch. 
> Did you run dbic? You need the patch or run dbic since those are the schema
> files.
> IF that's not it, where/when does the error show up?

I wanted to run dbic after updating the database - otherwise it can't show me the new field.
Comment 143 Katrin Fischer 2024-08-20 18:10:10 UTC
(In reply to Katrin Fischer from comment #139)
> There appears to be some mistake in the database update, but I fail to spot
> it:
> 
> {UNKNOWN}: DBIx::Class::ResultSource::column_info(): No such column
> repeatable at /kohadevbox/koha/Koha/Schema/Result/AdditionalField.pm line 159
> Compilation failed in require at /usr/share/perl5/Class/C3/Componentised.pm
> line 146. at /usr/share/perl5/Class/C3/Componentised.pm line 151
> Compilation failed in require at /kohadevbox/koha/C4/Installer.pm line 30.
> BEGIN failed--compilation aborted at /kohadevbox/koha/C4/Installer.pm line
> 30.
> Compilation failed in require at
> /kohadevbox/koha/installer/data/mysql/updatedatabase.pl line 40.
> BEGIN failed--compilation aborted at
> /kohadevbox/koha/installer/data/mysql/updatedatabase.pl line 40.
> 
> Applied all patches, removed the "DO NOT PUSH" patch. 
> 
> Please add use of say_success to database update when working on the
> follow-up.

The error appears when running updatedatabase.
Comment 144 Pedro Amorim 2024-08-21 08:25:48 UTC
You need to also not apply the patch:
Bug 35044: (QA follow-up): Fix QA script Error on boolean TINYINT

Because that is fixing the TINYIT boolean database thing for 'repeatable', but if you don't run dbic or apply the schema patch, then the 'repeatable' field does not exist on the schema class.
Comment 145 Katrin Fischer 2024-08-21 13:17:49 UTC
(In reply to Pedro Amorim from comment #144)
> You need to also not apply the patch:
> Bug 35044: (QA follow-up): Fix QA script Error on boolean TINYINT
> 
> Because that is fixing the TINYIT boolean database thing for 'repeatable',
> but if you don't run dbic or apply the schema patch, then the 'repeatable'
> field does not exist on the schema class.

Huh. I guess on update for others this would work well because the dbic files will already be installed? 

So what I'll do:

* Apply all patches
* Run database update
* Remove dbic patch
* Re-run dbic and commit it
Comment 146 Pedro Amorim 2024-08-23 15:19:08 UTC
Please let me know if something else is a blocker here.
Comment 147 Katrin Fischer 2024-08-23 15:50:16 UTC
Hm, some untidiness added by this patch set... I tidied the database update, but leaving the others for now.
Comment 148 Katrin Fischer 2024-08-23 16:22:16 UTC
Pushed for 24.11!

Well done everyone, thank you!
Comment 149 Lucas Gass (lukeg) 2024-09-12 22:39:19 UTC
No backport for 24.05.x
Comment 150 Jonathan Druart 2024-12-17 15:29:59 UTC
There is a logic error in additional-fields-entry.inc 

 15                 [% IF field.marcfield && field.marcfield_mode == 'get' %]
 16                     <select name="additional_field_[% field.id | html %]" id="additional_field_[% field.id | html %]" class="marcfieldget" disabled>
 17                 [% ELSE %]
 18                     [% IF !field.repeatable %]
 19                         <select name="additional_field_[% field.id | html %]" id="additional_field_[% field.id | html %]">
 20                     [% END %]
 21                 [% END %]

Then later we unconditionally close
79                 </select>

Can you have a look please?
Comment 151 Pedro Amorim 2024-12-18 11:09:34 UTC
(In reply to Jonathan Druart from comment #150)
> There is a logic error in additional-fields-entry.inc 
> 
>  15                 [% IF field.marcfield && field.marcfield_mode == 'get' %]
>  16                     <select name="additional_field_[% field.id | html
> %]" id="additional_field_[% field.id | html %]" class="marcfieldget"
> disabled>
>  17                 [% ELSE %]
>  18                     [% IF !field.repeatable %]
>  19                         <select name="additional_field_[% field.id |
> html %]" id="additional_field_[% field.id | html %]">
>  20                     [% END %]
>  21                 [% END %]
> 
> Then later we unconditionally close
> 79                 </select>
> 
> Can you have a look please?

Opened bug 38738