Bug 37576

Summary: Add additional fields support to ERM agreements
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, katrin.fischer, 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
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 agreements. 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: 35287    
Bug Blocks: 37577    
Attachments: Bug 37576: Add additional fields for ERM agreements
Bug 37576: Add additional fields for ERM agreements
Bug 37576: Add additional fields for ERM agreements
Bug 37576: (follow-up) fix missed cypress change
Bug 37576: Add additional fields for ERM agreements
Bug 37576: (follow-up) fix missed cypress change
Bug 37576: (QA follow-up) Tidy
Bug 37576: (follow-up) fix broken cypress tests
Bug 37576: (follow-up) fix broken cypress tests
Bug 37576: (follow-up) Fix for UserRoles test

Description Michaela Sieber 2024-08-06 12:29:15 UTC
After adding additional fields support to Licences (Bug 35287) we would love to see additional fields support for Agreements
Comment 1 Jake Deery 2024-09-09 10:13:06 UTC
Created attachment 171181 [details] [review]
Bug 37576: Add additional fields for ERM agreements

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

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_agreements'
    1)  Go to /cgi-bin/koha/admin/additional-fields.pl?tablename=erm_agreements
    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 agreement
    1)  Go to /cgi-bin/koha/erm/agreements/add, notice the new additional
        fields section
    2)  Complete all mandatory fields for a new licence
    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 agreement, then view it
    1)  To view the licence, click its name in the table list on
        /cgi-bin/koha/erm/agreements
    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 agreement, then view it again
    1)  Go to /cgi-bin/koha/erm/agreements/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_agreements
    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/agreements
    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-09 11:16:33 UTC
When trying to edit the existing additional fields they are not displayed, see here:https://staff-b37576.sandboxes.biblibre.eu/cgi-bin/koha/erm/agreements/1
Comment 3 Jake Deery 2024-09-10 16:25:59 UTC
Created attachment 171268 [details] [review]
Bug 37576: Add additional fields for ERM agreements

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

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_agreements'
    1)  Go to /cgi-bin/koha/admin/additional-fields.pl?tablename=erm_agreements
    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 agreement
    1)  Go to /cgi-bin/koha/erm/agreements/add, notice the new additional
        fields section
    2)  Complete all mandatory fields for a new licence
    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 agreement, then view it
    1)  To view the licence, click its name in the table list on
        /cgi-bin/koha/erm/agreements
    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 agreement, then view it again
    1)  Go to /cgi-bin/koha/erm/agreements/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_agreements
    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/agreements
    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 4 Jake Deery 2024-09-10 16:27:26 UTC
Hi Michaela,

Well spotted, it was a challenge to identify this issue, but in the end it was one single missing character!! Argh!!

I've attached a new patch. Could you try this out on one of the sandbox servers and let me know how testing goes?

Ta,
Jake.
Comment 5 Biblibre Sandboxes 2024-09-12 10:52:55 UTC
Created attachment 171379 [details] [review]
Bug 37576: Add additional fields for ERM agreements

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

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_agreements'
    1)  Go to /cgi-bin/koha/admin/additional-fields.pl?tablename=erm_agreements
    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 agreement
    1)  Go to /cgi-bin/koha/erm/agreements/add, notice the new additional
        fields section
    2)  Complete all mandatory fields for a new licence
    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 agreement, then view it
    1)  To view the licence, click its name in the table list on
        /cgi-bin/koha/erm/agreements
    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 agreement, then view it again
    1)  Go to /cgi-bin/koha/erm/agreements/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_agreements
    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/agreements
    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 6 Michaela Sieber 2024-09-12 10:54:58 UTC
Thanks Jake, signed off :-)
Comment 7 Jake Deery 2024-09-12 13:58:25 UTC
Created attachment 171397 [details] [review]
Bug 37576: (follow-up) fix missed cypress change

This patch fixes a single line in our cypress tests which didn't cause
the test to fail, but nonetheless should be addressed.
Comment 8 Jake Deery 2024-09-12 13:59:51 UTC
Thanks for the sign-off, Michaela. :-)

Jake.
Comment 9 Nick Clemens (kidclamp) 2024-10-31 11:34:33 UTC
Created attachment 173774 [details] [review]
Bug 37576: Add additional fields for ERM agreements

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

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_agreements'
    1)  Go to /cgi-bin/koha/admin/additional-fields.pl?tablename=erm_agreements
    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 agreement
    1)  Go to /cgi-bin/koha/erm/agreements/add, notice the new additional
        fields section
    2)  Complete all mandatory fields for a new licence
    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 agreement, then view it
    1)  To view the licence, click its name in the table list on
        /cgi-bin/koha/erm/agreements
    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 agreement, then view it again
    1)  Go to /cgi-bin/koha/erm/agreements/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_agreements
    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/agreements
    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 11:34:36 UTC
Created attachment 173775 [details] [review]
Bug 37576: (follow-up) fix missed cypress change

This patch fixes a single line in our cypress tests which didn't cause
the test to fail, but nonetheless should be addressed.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 11 Nick Clemens (kidclamp) 2024-10-31 11:34:38 UTC
Created attachment 173776 [details] [review]
Bug 37576: (QA follow-up) Tidy

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 12 Katrin Fischer 2024-11-08 15:10:02 UTC
Pushed for 24.11!

Well done everyone, thank you!
Comment 13 Katrin Fischer 2024-11-14 12:23:43 UTC
It looks like we have failing Cypress tests, that probably didn't show up before while we fixed other tests. 

Can you please have provide a follow-up?

 Show agreement.Agreement CRUD operations Show agreement	0 ms	1
 Delete agreement.Agreement CRUD operations Delete agreement	0 ms	1
 Show package.Package CRUD operations Show package	0 ms	1
 Delete package.Package CRUD operations Delete package	0 ms	1
 Add agreement.Add/search user Add agreement
Comment 14 Jake Deery 2024-11-14 14:36:32 UTC
Created attachment 174530 [details] [review]
Bug 37576: (follow-up) fix broken cypress tests

This patch is intended to fix failing Cypress tests
by including the correct payload in get_agreement()
found in e2e.js
Comment 15 Jake Deery 2024-11-14 14:46:25 UTC
Just looking at packages. That also appears to be broken.
Comment 16 Jake Deery 2024-11-14 15:01:47 UTC
Created attachment 174531 [details] [review]
Bug 37576: (follow-up) fix broken cypress tests

This patch is intended to fix failing Cypress tests
by including the correct payload in get_agreement()
found in e2e.js, and by moving get_package to the
e2e.js with corrected payload also
Comment 17 Jake Deery 2024-11-14 15:02:28 UTC
Rebased and expanded follow-up to also fix packages. That appears to be all Cypress tests passing now :-)

Jake.
Comment 18 Katrin Fischer 2024-11-14 15:41:50 UTC
Text fix patch picked for main.
Comment 19 Jake Deery 2024-11-14 16:55:40 UTC
Created attachment 174532 [details] [review]
Bug 37576: (follow-up) Fix for UserRoles test

This patch, although not directly caused by Bug 37576,
fixes issues with the UserRoles cypress test due
to a change in the data structure brought on by recent
ERM bugs.
Comment 20 Katrin Fischer 2024-11-15 08:13:14 UTC
Picked follow-up "Fix for UserRoles test" for main.
Comment 21 Lucas Gass (lukeg) 2024-11-22 21:45:29 UTC
Enhancement, no 24.05.x backport.