Bug 37577

Summary: Add additional fields support to ERM packages
Product: Koha Reporter: Michaela Sieber <michaela.sieber>
Component: ERMAssignee: Jake Deery <jake.deery>
Status: Needs documenting --- QA Contact: Nick Clemens (kidclamp) <nick>
Severity: enhancement    
Priority: P5 - low CC: andrew.auld, clemens.tubach, jonathan.druart, jonathan.field, lucas, martin.renvoize, matt.blenkinsop, pedro.amorim
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35287
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37015
Change sponsored?: Sponsored Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
This adds the option to add additional fields to ERM packages. The fields can be either free text or linked to an authorized value for a pull down list. They be set to repeatable and made searchable.
Version(s) released in:
24.11.00
Circulation function:
Bug Depends on: 37576    
Bug Blocks: 38449    
Attachments: Bug 37577: Add additional fields for ERM packages
Bug 37577: Add additional fields for ERM packages
Bug 37577: Add additional fields for ERM packages
Bug 37577: Add additional fields for ERM packages
Bug 37577: Add additional fields for ERM packages
Bug 37577: (QA follow-up) Tidy

Description Michaela Sieber 2024-08-06 12:31:29 UTC
After adding additional fields support to Licences (Bug 35287) we would love to see additional fields support for Packages.
Comment 1 Jake Deery 2024-09-12 13:58:54 UTC
Created attachment 171398 [details] [review]
Bug 37577: Add additional fields for ERM packages

This bug adds support for additional fields in the ERM module's
packages, similar to how Bug 35287 added support for additional fields
in the ERM module's licences, and Bug 37576 added support for additional
fields in the ERM module's agreements.

To test (k.t.d):
a)  APPLY PATCH
b)  Run cypress --spec t/cypress/integration/AdditionalFields_spec.ts
    1)  Note how the tests pass
c)  Add new additional fields for 'erm_packages'
    1)  Go to /cgi-bin/koha/admin/additional-fields.pl?tablename=erm_packages
    2)  Create field one called 'text non-repeatable'
    3)  Create field two called 'text repeatable', check 'repeatable'
    4)  Create field three called 'av non-repeatable', pick LANG authorised
        value
    5)  Create field four called 'av repeatable', pick LOC authorised value,
        check repeatable
d)  Create new local package
    1)  Go to /cgi-bin/koha/erm/eholdings/local/packages/add, notice the new
        additional fields section
    2)  Complete all mandatory fields for a new package
    3)  Experiment with the four different additional field types – it
        may be useful to watch the Cypress-generated test video for
        guidance
    4)  Select some AV options from the AV fields, deselect them, notice
        the repeatable one allows for multiple selection, the non-repeatable
        one does not
e)  Save the package, then view it
    1)  To view the package, click its name in the table list on
        /cgi-bin/koha/erm/eholdings/local/packages
    2)  notice the additional fields on display
    3)  also notice that the authorised values are in their human-readable
        form, and not their coded form
f)  Edit the package, then view it again
    1)  Go to /cgi-bin/koha/erm/eholdings/local/packages/edit/1
    2)  Play around again with the fields. Save.
    3)  Repeat step e, have the edits shown up?
g)  Test searchability
    1)  Go to /cgi-bin/koha/admin/additional-fields.pl?tablename=erm_packages
    2)  Edit one of the fields and make sure searchable is checked (ensure
        you choose a field that has some data in it)
    3)  Go to /cgi-bin/koha/erm/eholdings/local/packages
    4)  Notice that the searchable field(s) are now columns in the table
    5)  Notice that searchable AV fields contain a drop-down
    6)  Notice that searchable text fields have an input field
    7)  Perform a search on the additional field
    8)  Notice that the searching is working as expected
h) SIGN OFF
Comment 2 Michaela Sieber 2024-09-12 18:01:38 UTC
Hi Jake, everything is working but I think it makes no sense to place the Additional Fields section below the list of titles in the package.
We have so much white space on the screen and I think if Libraries use the additional fields they want to see them on the top of the screen with all the other relevant information about the package.
I suggest to place them in a second column on the right side next to the other fields like 'Package name','Package type', ..., 'Created on'.

Example see here: https://staff-b37577.sandboxes.biblibre.eu/cgi-bin/koha/erm/eholdings/local/packages/1

What do you think?
Comment 3 Jake Deery 2024-10-07 10:29:12 UTC
Hi Michaela,

I think this is a good point, I can see why having this information closer to the top would be helpful.

I would suggest maybe getting this bug through QA as it currently is, because to move that information we'd need to look at maybe changing the underlying engineering involved in this 'show agreement/package/licence/etc' code to be consistent across all pages. For this bug, I think it would be a step too far.

A good idea though, and something we can talk about in the near future :-)

Jake.
Comment 4 Biblibre Sandboxes 2024-10-11 13:39:09 UTC
Created attachment 172693 [details] [review]
Bug 37577: Add additional fields for ERM packages

This bug adds support for additional fields in the ERM module's
packages, similar to how Bug 35287 added support for additional fields
in the ERM module's licences, and Bug 37576 added support for additional
fields in the ERM module's agreements.

To test (k.t.d):
a)  APPLY PATCH
b)  Run cypress --spec t/cypress/integration/AdditionalFields_spec.ts
    1)  Note how the tests pass
c)  Add new additional fields for 'erm_packages'
    1)  Go to /cgi-bin/koha/admin/additional-fields.pl?tablename=erm_packages
    2)  Create field one called 'text non-repeatable'
    3)  Create field two called 'text repeatable', check 'repeatable'
    4)  Create field three called 'av non-repeatable', pick LANG authorised
        value
    5)  Create field four called 'av repeatable', pick LOC authorised value,
        check repeatable
d)  Create new local package
    1)  Go to /cgi-bin/koha/erm/eholdings/local/packages/add, notice the new
        additional fields section
    2)  Complete all mandatory fields for a new package
    3)  Experiment with the four different additional field types – it
        may be useful to watch the Cypress-generated test video for
        guidance
    4)  Select some AV options from the AV fields, deselect them, notice
        the repeatable one allows for multiple selection, the non-repeatable
        one does not
e)  Save the package, then view it
    1)  To view the package, click its name in the table list on
        /cgi-bin/koha/erm/eholdings/local/packages
    2)  notice the additional fields on display
    3)  also notice that the authorised values are in their human-readable
        form, and not their coded form
f)  Edit the package, then view it again
    1)  Go to /cgi-bin/koha/erm/eholdings/local/packages/edit/1
    2)  Play around again with the fields. Save.
    3)  Repeat step e, have the edits shown up?
g)  Test searchability
    1)  Go to /cgi-bin/koha/admin/additional-fields.pl?tablename=erm_packages
    2)  Edit one of the fields and make sure searchable is checked (ensure
        you choose a field that has some data in it)
    3)  Go to /cgi-bin/koha/erm/eholdings/local/packages
    4)  Notice that the searchable field(s) are now columns in the table
    5)  Notice that searchable AV fields contain a drop-down
    6)  Notice that searchable text fields have an input field
    7)  Perform a search on the additional field
    8)  Notice that the searching is working as expected
h) SIGN OFF

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Comment 5 Michaela Sieber 2024-10-11 14:27:13 UTC
(In reply to Jake Deery from comment #3)
> I think this is a good point, I can see why having this information closer
> to the top would be helpful.
> 
> I would suggest maybe getting this bug through QA as it currently is,
> because to move that information we'd need to look at maybe changing the
> underlying engineering involved in this 'show agreement/package/licence/etc'
> code to be consistent across all pages. For this bug, I think it would be a
> step too far.

We agree to handle this as a follow-up , as the release date is getting closer and closer.
Comment 6 Jake Deery 2024-10-31 11:47:20 UTC
Created attachment 173779 [details] [review]
Bug 37577: Add additional fields for ERM packages

This bug adds support for additional fields in the ERM module's
packages, similar to how Bug 35287 added support for additional fields
in the ERM module's licences, and Bug 37576 added support for additional
fields in the ERM module's agreements.

To test (k.t.d):
a)  APPLY PATCH
b)  Run cypress --spec t/cypress/integration/AdditionalFields_spec.ts
    1)  Note how the tests pass
c)  Add new additional fields for 'erm_packages'
    1)  Go to /cgi-bin/koha/admin/additional-fields.pl?tablename=erm_packages
    2)  Create field one called 'text non-repeatable'
    3)  Create field two called 'text repeatable', check 'repeatable'
    4)  Create field three called 'av non-repeatable', pick LANG authorised
        value
    5)  Create field four called 'av repeatable', pick LOC authorised value,
        check repeatable
d)  Create new local package
    1)  Go to /cgi-bin/koha/erm/eholdings/local/packages/add, notice the new
        additional fields section
    2)  Complete all mandatory fields for a new package
    3)  Experiment with the four different additional field types – it
        may be useful to watch the Cypress-generated test video for
        guidance
    4)  Select some AV options from the AV fields, deselect them, notice
        the repeatable one allows for multiple selection, the non-repeatable
        one does not
e)  Save the package, then view it
    1)  To view the package, click its name in the table list on
        /cgi-bin/koha/erm/eholdings/local/packages
    2)  notice the additional fields on display
    3)  also notice that the authorised values are in their human-readable
        form, and not their coded form
f)  Edit the package, then view it again
    1)  Go to /cgi-bin/koha/erm/eholdings/local/packages/edit/1
    2)  Play around again with the fields. Save.
    3)  Repeat step e, have the edits shown up?
g)  Test searchability
    1)  Go to /cgi-bin/koha/admin/additional-fields.pl?tablename=erm_packages
    2)  Edit one of the fields and make sure searchable is checked (ensure
        you choose a field that has some data in it)
    3)  Go to /cgi-bin/koha/erm/eholdings/local/packages
    4)  Notice that the searchable field(s) are now columns in the table
    5)  Notice that searchable AV fields contain a drop-down
    6)  Notice that searchable text fields have an input field
    7)  Perform a search on the additional field
    8)  Notice that the searching is working as expected
h) SIGN OFF

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Comment 7 Jake Deery 2024-10-31 11:51:21 UTC
Created attachment 173784 [details] [review]
Bug 37577: Add additional fields for ERM packages

This bug adds support for additional fields in the ERM module's
packages, similar to how Bug 35287 added support for additional fields
in the ERM module's licences, and Bug 37576 added support for additional
fields in the ERM module's agreements.

To test (k.t.d):
a)  APPLY PATCH
b)  Run cypress --spec t/cypress/integration/AdditionalFields_spec.ts
    1)  Note how the tests pass
c)  Add new additional fields for 'erm_packages'
    1)  Go to /cgi-bin/koha/admin/additional-fields.pl?tablename=erm_packages
    2)  Create field one called 'text non-repeatable'
    3)  Create field two called 'text repeatable', check 'repeatable'
    4)  Create field three called 'av non-repeatable', pick LANG authorised
        value
    5)  Create field four called 'av repeatable', pick LOC authorised value,
        check repeatable
d)  Create new local package
    1)  Go to /cgi-bin/koha/erm/eholdings/local/packages/add, notice the new
        additional fields section
    2)  Complete all mandatory fields for a new package
    3)  Experiment with the four different additional field types – it
        may be useful to watch the Cypress-generated test video for
        guidance
    4)  Select some AV options from the AV fields, deselect them, notice
        the repeatable one allows for multiple selection, the non-repeatable
        one does not
e)  Save the package, then view it
    1)  To view the package, click its name in the table list on
        /cgi-bin/koha/erm/eholdings/local/packages
    2)  notice the additional fields on display
    3)  also notice that the authorised values are in their human-readable
        form, and not their coded form
f)  Edit the package, then view it again
    1)  Go to /cgi-bin/koha/erm/eholdings/local/packages/edit/1
    2)  Play around again with the fields. Save.
    3)  Repeat step e, have the edits shown up?
g)  Test searchability
    1)  Go to /cgi-bin/koha/admin/additional-fields.pl?tablename=erm_packages
    2)  Edit one of the fields and make sure searchable is checked (ensure
        you choose a field that has some data in it)
    3)  Go to /cgi-bin/koha/erm/eholdings/local/packages
    4)  Notice that the searchable field(s) are now columns in the table
    5)  Notice that searchable AV fields contain a drop-down
    6)  Notice that searchable text fields have an input field
    7)  Perform a search on the additional field
    8)  Notice that the searching is working as expected
h) SIGN OFF

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Comment 8 Jake Deery 2024-10-31 11:54:08 UTC
After some initially weak git fu...... rebased on main :-)

Jake.
Comment 9 Nick Clemens (kidclamp) 2024-10-31 12:20:38 UTC
Created attachment 173788 [details] [review]
Bug 37577: Add additional fields for ERM packages

This bug adds support for additional fields in the ERM module's
packages, similar to how Bug 35287 added support for additional fields
in the ERM module's licences, and Bug 37576 added support for additional
fields in the ERM module's agreements.

To test (k.t.d):
a)  APPLY PATCH
b)  Run cypress --spec t/cypress/integration/AdditionalFields_spec.ts
    1)  Note how the tests pass
c)  Add new additional fields for 'erm_packages'
    1)  Go to /cgi-bin/koha/admin/additional-fields.pl?tablename=erm_packages
    2)  Create field one called 'text non-repeatable'
    3)  Create field two called 'text repeatable', check 'repeatable'
    4)  Create field three called 'av non-repeatable', pick LANG authorised
        value
    5)  Create field four called 'av repeatable', pick LOC authorised value,
        check repeatable
d)  Create new local package
    1)  Go to /cgi-bin/koha/erm/eholdings/local/packages/add, notice the new
        additional fields section
    2)  Complete all mandatory fields for a new package
    3)  Experiment with the four different additional field types – it
        may be useful to watch the Cypress-generated test video for
        guidance
    4)  Select some AV options from the AV fields, deselect them, notice
        the repeatable one allows for multiple selection, the non-repeatable
        one does not
e)  Save the package, then view it
    1)  To view the package, click its name in the table list on
        /cgi-bin/koha/erm/eholdings/local/packages
    2)  notice the additional fields on display
    3)  also notice that the authorised values are in their human-readable
        form, and not their coded form
f)  Edit the package, then view it again
    1)  Go to /cgi-bin/koha/erm/eholdings/local/packages/edit/1
    2)  Play around again with the fields. Save.
    3)  Repeat step e, have the edits shown up?
g)  Test searchability
    1)  Go to /cgi-bin/koha/admin/additional-fields.pl?tablename=erm_packages
    2)  Edit one of the fields and make sure searchable is checked (ensure
        you choose a field that has some data in it)
    3)  Go to /cgi-bin/koha/erm/eholdings/local/packages
    4)  Notice that the searchable field(s) are now columns in the table
    5)  Notice that searchable AV fields contain a drop-down
    6)  Notice that searchable text fields have an input field
    7)  Perform a search on the additional field
    8)  Notice that the searching is working as expected
h) SIGN OFF

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 10 Nick Clemens (kidclamp) 2024-10-31 12:20:40 UTC
Created attachment 173789 [details] [review]
Bug 37577: (QA follow-up) Tidy

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 11 Katrin Fischer 2024-11-08 14:30:44 UTC
Skipping Tidy patch for sha1 issues. It often seems to happen for tidy patches - do we have an idea why?

Bug 37577 - Add additional fields support to ERM packages

173788 - Bug 37577: Add additional fields for ERM packages
173789 - Bug 37577: (QA follow-up) Tidy

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 37577: Add additional fields for ERM packages
error: sha1 information is lacking or useless (koha-tmpl/intranet-tmpl/prog/en/modules/admin/additional-fields.tt).
error: could not build fake ancestor
Patch failed at 0001 Bug 37577: Add additional fields for ERM packages
hint: Use 'git am --show-current-patch=diff' to see the failed patch
When you have resolved this problem run "git bz apply --continue".
If you would prefer to skip this patch, instead run "git bz apply --skip".
To restore the original branch and stop patching run "git bz apply --abort".
Patch left in /tmp/Bug-37577-Add-additional-fields-for-ERM-packages-wzlleb6v.patch
Comment 12 Katrin Fischer 2024-11-08 14:32:25 UTC
Sorry, misread, we will not get around a rebase here (first patch doesn't apply as well)
Comment 13 Katrin Fischer 2024-11-08 14:34:52 UTC
Sorry for the noise, I found a way around it.
Comment 14 Katrin Fischer 2024-11-08 14:50:20 UTC
I feel Michaela is definitely right in that the additional fields should be above the list of linked titles on the packages summary page.

Currently we have:
Package details - package titles - additional fields

It should be:
Package details - additional fields - package titles

Otherwise the "descriptive information" that the additional fields provide will be lost below a long list of titles. 

I cannot tell how hard it is to move these elements around in the template, but if you can, please provide a follow-up. Otherwise please file a bug so we can fix this later.
Comment 15 Katrin Fischer 2024-11-08 15:10:06 UTC
Pushed for 24.11!

Well done everyone, thank you!
Comment 16 Katrin Fischer 2024-11-14 15:43:41 UTC
Moved to new bug: 
Bug 38449 - Move additional fields for ERM packages above list of titles in package
Comment 17 Lucas Gass (lukeg) 2024-11-22 21:45:34 UTC
Enhancement, no 24.05.x backport.