|
Description
Mathieu Saby
2025-03-24 17:45:51 UTC
Created attachment 188307 [details] [review] Bug 39438: Add additional fields to agreement periods Created attachment 188778 [details] [review] Bug 39438: Add additional fields support to ERM agreement periods This patch enables additional fields functionality for agreement periods in the ERM (Electronic Resource Management) module, allowing libraries to define custom metadata fields for agreement period records. Changes include: - Update Koha::AdditionalField to support erm_agreement_periods table - Modify API definitions to include extended_attributes in responses - Add erm_agreement_periods option to additional fields admin interface - Enhance Vue components to display and manage additional field values - Update ShowElement component to handle period-specific attributes Test plan: 1. Navigate to Administration > Additional fields 2. Create new fields for "Agreement periods" 3. Edit an ERM agreement and add/edit period information 4. Verify additional fields appear and can be populated 5. Confirm values are saved and displayed correctly Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> Created attachment 188779 [details] [review] Bug 39438: Add DBIC schema relationships for agreement period additional fields This patch adds the required DBIx::Class relationship definitions to Koha::Schema::Result::ErmAgreementPeriod to support additional fields and extended attributes on agreement periods. Two has_many relationships are added: - additional_field_values: links to all additional field values - extended_attributes: alias for additional_field_values Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> Takes the same well-trodden road as the rest of these, works as expected.. Passing QA Created attachment 189021 [details] [review] Bug 39438: Add additional fields support to ERM agreement periods This patch enables additional fields functionality for agreement periods in the ERM (Electronic Resource Management) module, allowing libraries to define custom metadata fields for agreement period records. Changes include: - Update Koha::AdditionalField to support erm_agreement_periods table - Modify API definitions to include extended_attributes in responses - Add erm_agreement_periods option to additional fields admin interface - Enhance Vue components to display and manage additional field values - Update ShowElement component to handle period-specific attributes Test plan: 1. Navigate to Administration > Additional fields 2. Create new fields for "Agreement periods" 3. Edit an ERM agreement and add/edit period information 4. Verify additional fields appear and can be populated 5. Confirm values are saved and displayed correctly Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> Created attachment 189022 [details] [review] Bug 39438: Add DBIC schema relationships for agreement period additional fields This patch adds the required DBIx::Class relationship definitions to Koha::Schema::Result::ErmAgreementPeriod to support additional fields and extended attributes on agreement periods. Two has_many relationships are added: - additional_field_values: links to all additional field values - extended_attributes: alias for additional_field_values Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> Created attachment 189023 [details] [review] Bug 39438: (bug 38446 follow-up) Add agreement_period to /erm/extended_attribute_types Sponsored-by: Karlsruhe Institute of Technology (KIT) Created attachment 191895 [details] [review] Bug 39438: (bug 38446 follow-up) Add agreement_period to /erm/extended_attribute_types Sponsored-by: Karlsruhe Institute of Technology (KIT) Nice work everyone! Pushed to main for 26.05 Please add release notes failing test now:
kohadev-koha@kohadevbox:koha(main)$ prove -v /kohadevbox/koha/t/db_dependent/Koha/ERM/Agreements.t
/kohadevbox/koha/t/db_dependent/Koha/ERM/Agreements.t ..
1..3
# Subtest: periods
1..4
ok 1 - no period yet
ok 2
not ok 3
# Failed test at /kohadevbox/koha/t/db_dependent/Koha/ERM/Agreements.t line 63.
# Structures begin differing at:
# $got->[0]{agreement_id} = Does not exist
# $expected->[0]{agreement_id} = '3'
ok 4
# Looks like you failed 1 test of 4.
not ok 1 - periods
# Subtest: user_role
# Failed test 'periods'
# at /kohadevbox/koha/t/db_dependent/Koha/ERM/Agreements.t line 68.
1..4
ok 1 - no user yet
ok 2
ok 3
ok 4
ok 2 - user_role
ok 3 - no warnings
# Looks like you failed 1 test of 3.
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/3 subtests
and another:
prove -v /kohadevbox/koha/t/db_dependent/api/v1/extended_attribute_types.t
/kohadevbox/koha/t/db_dependent/api/v1/extended_attribute_types.t ..
1..3
# Subtest: list() tests
1..23
ok 1 - GET //GgljRpal44DqriBvVqcJA_aZx1RUtEVSnKw7hgGBFf0KFKBasjcxnvvFCC0A9OEEdvCpOkOn47y:thePassword123@/api/v1/extended_attribute_types
ok 2 - 200 OK
ok 3 - exact match for JSON Pointer ""
ok 4 - GET //GgljRpal44DqriBvVqcJA_aZx1RUtEVSnKw7hgGBFf0KFKBasjcxnvvFCC0A9OEEdvCpOkOn47y:thePassword123@/api/v1/extended_attribute_types
ok 5 - 200 OK
ok 6 - exact match for JSON Pointer ""
ok 7 - GET //GgljRpal44DqriBvVqcJA_aZx1RUtEVSnKw7hgGBFf0KFKBasjcxnvvFCC0A9OEEdvCpOkOn47y:thePassword123@/api/v1/extended_attribute_types
ok 8 - 200 OK
ok 9 - exact match for JSON Pointer ""
ok 10 - GET //GgljRpal44DqriBvVqcJA_aZx1RUtEVSnKw7hgGBFf0KFKBasjcxnvvFCC0A9OEEdvCpOkOn47y:thePassword123@/api/v1/extended_attribute_types
ok 11 - 200 OK
ok 12 - exact match for JSON Pointer ""
ok 13 - GET //GgljRpal44DqriBvVqcJA_aZx1RUtEVSnKw7hgGBFf0KFKBasjcxnvvFCC0A9OEEdvCpOkOn47y:thePassword123@/api/v1/extended_attribute_types?resource_type=invoice
ok 14 - 200 OK
ok 15 - exact match for JSON Pointer ""
ok 16 - GET //GgljRpal44DqriBvVqcJA_aZx1RUtEVSnKw7hgGBFf0KFKBasjcxnvvFCC0A9OEEdvCpOkOn47y:thePassword123@/api/v1/extended_attribute_types?resource_type=subscription
ok 17 - 200 OK
ok 18 - exact match for JSON Pointer ""
ok 19 - GET //GgljRpal44DqriBvVqcJA_aZx1RUtEVSnKw7hgGBFf0KFKBasjcxnvvFCC0A9OEEdvCpOkOn47y:thePassword123@/api/v1/extended_attribute_types?blah=blah
ok 20 - 400 Bad Request
ok 21 - exact match for JSON Pointer ""
ok 22 - GET //n_ekc3J_VWNHzx4HFQwcjRswVN444sJAgXpZVYJLIbFXw0RCu7LsV_ZSeNJPbtcuWZE1ZoR:thePassword123@/api/v1/extended_attribute_types
ok 23 - 403 Forbidden
ok 1 - list() tests
# Subtest: list_erm() tests
1..23
ok 1 - GET //ZHehvjvEcJFim1YS00YEfwGLS7uz_qhEhRrXDlez5N3t:thePassword123@/api/v1/erm/extended_attribute_types
ok 2 - 200 OK
ok 3 - exact match for JSON Pointer ""
ok 4 - GET //ZHehvjvEcJFim1YS00YEfwGLS7uz_qhEhRrXDlez5N3t:thePassword123@/api/v1/erm/extended_attribute_types
ok 5 - 200 OK
ok 6 - exact match for JSON Pointer ""
ok 7 - GET //ZHehvjvEcJFim1YS00YEfwGLS7uz_qhEhRrXDlez5N3t:thePassword123@/api/v1/erm/extended_attribute_types
ok 8 - 200 OK
ok 9 - exact match for JSON Pointer ""
ok 10 - GET //ZHehvjvEcJFim1YS00YEfwGLS7uz_qhEhRrXDlez5N3t:thePassword123@/api/v1/erm/extended_attribute_types?resource_type=license
ok 11 - 200 OK
ok 12 - exact match for JSON Pointer ""
ok 13 - GET //ZHehvjvEcJFim1YS00YEfwGLS7uz_qhEhRrXDlez5N3t:thePassword123@/api/v1/erm/extended_attribute_types?resource_type=order
ok 14 - 400 Bad Request
not ok 15 - exact match for JSON Pointer "/errors"
# Failed test 'exact match for JSON Pointer "/errors"'
# at /kohadevbox/koha/t/db_dependent/api/v1/extended_attribute_types.t line 215.
# Structures begin differing at:
# $got->[0]{message} = 'Not in enum list: license, agreement, agreement_period, package, title.'
# $expected->[0]{message} = 'Not in enum list: license, agreement, package, title.'
ok 16 - GET //ZHehvjvEcJFim1YS00YEfwGLS7uz_qhEhRrXDlez5N3t:thePassword123@/api/v1/erm/extended_attribute_types?blah=blah
ok 17 - 400 Bad Request
ok 18 - exact match for JSON Pointer ""
ok 19 - GET //ZHehvjvEcJFim1YS00YEfwGLS7uz_qhEhRrXDlez5N3t:thePassword123@/api/v1/erm/extended_attribute_types
ok 20 - 200 OK
ok 21 - exact match for JSON Pointer ""
ok 22 - GET //URaLdafLHOxpnKnvYefhr6PTbcU0b_gNvufoD17ZTPUZJOYauFMi32URCd6:thePassword123@/api/v1/extended_attribute_types
ok 23 - 403 Forbidden
# Looks like you failed 1 test of 23.
not ok 2 - list_erm() tests
# Failed test 'list_erm() tests'
# at /kohadevbox/koha/t/db_dependent/api/v1/extended_attribute_types.t line 235.
ok 3 - no warnings
# Looks like you failed 1 test of 3.
Created attachment 192284 [details] [review] Bug 39438: (follow-up) Remove agreement_id from periods before comparing to result The second of those tests passes fine for me but the first is now fixed follow-up pushed to main Created attachment 192653 [details] [review] Bug 39438: (RM follow-up): Fix failing test follow-up pushed to main |