Bug 32918

Summary: ERM authorized values should be in installer/data/mysql/en/mandatory/auth_values.yml
Product: Koha Reporter: Caroline Cyr La Rose <caroline.cyr-la-rose>
Component: Installation and upgrade (web-based installer)Assignee: Caroline Cyr La Rose <caroline.cyr-la-rose>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: gmcharlt, jonathan.druart, lucas
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.05.00,22.11.04
Circulation function:
Bug Depends on: 32030    
Bug Blocks:    
Attachments: Bug 32918: ERM authorized values should be in installer/data/mysql/en/mandatory/auth_values.yml
Bug 32918: ERM authorized values should be in installer/data/mysql/en/mandatory/auth_values.yml
Bug 32918: ERM authorized values should be in installer/data/mysql/en/mandatory/auth_values.yml
Bug 32918: (follow-up) Add new lines for formatting consistency
Bug 32918: ERM authorized values should be in installer/data/mysql/en/mandatory/auth_values.yml
Bug 32918: (follow-up) Add new lines for formatting consistency

Description Caroline Cyr La Rose 2023-02-08 21:14:45 UTC
Currently, the authorized values for the ERM categories are in 

installer/data/mysql/mandatory/auth_val_cat.sql

which is the file for authorized value categories, and not translatable.

These should be moved to 

installer/data/mysql/en/mandatory/auth_values.yml

so that each language can translate them.
Comment 1 Caroline Cyr La Rose 2023-02-08 22:22:15 UTC
Created attachment 146413 [details] [review]
Bug 32918: ERM authorized values should be in installer/data/mysql/en/mandatory/auth_values.yml

This patch moves the authorized value insertions for ERM categories into
the language-specific auth_values.yml file.

To test:
1. Count the number of authorized values in the mandatory categories

select count(*) from authorised_values where category in ('YES_NO', 'PAYMENT_TYPE', 'HSBND_FREQ', 'ERM_AGREEMENT_STATUS', 'ERM_AGREEMENT_CLOSURE_REASON', 'ERM_AGREEMENT_RENEWAL_PRIORITY', 'ERM_USER_ROLES', 'ERM_LICENSE_TYPE', 'ERM_LICENSE_STATUS', 'ERM_AGREEMENT_LICENSE_STATUS', 'ERM_AGREEMENT_LICENSE_LOCATION', 'ERM_PACKAGE_TYPE', 'ERM_PACKAGE_CONTENT_TYPE', 'ERM_TITLE_PUBLICATION_TYPE', 'COUNTRY', 'LANG', 'qualif');

--> There should be 929

2. Delete the authorized values from these categories

delete from authorised_values where category in ('YES_NO', 'PAYMENT_TYPE', 'HSBND_FREQ', 'ERM_AGREEMENT_STATUS', 'ERM_AGREEMENT_CLOSURE_REASON', 'ERM_AGREEMENT_RENEWAL_PRIORITY', 'ERM_USER_ROLES', 'ERM_LICENSE_TYPE', 'ERM_LICENSE_STATUS', 'ERM_AGREEMENT_LICENSE_STATUS', 'ERM_AGREEMENT_LICENSE_LOCATION', 'ERM_PACKAGE_TYPE', 'ERM_PACKAGE_CONTENT_TYPE', 'ERM_TITLE_PUBLICATION_TYPE', 'COUNTRY', 'LANG', 'qualif');

3. Apply patch
4. Load the mandatory authorized values

./misc/load_yaml.pl --file installer/data/mysql/en/mandatory/auth_values.yml --load

5. Redo step 1
   --> There should be the same number (929)
6. Update translations

cd misc/translator
./translate update xx-XX

7. Search the po/xx-XX-installer.po file for any of the loaded
   authorized values

   For example,

   grep AbstractAndIndex po/xx-XX-installer.po
   grep "Abstract and index" po/xx-XX-installer.po

   --> authorized values and descriptions should be translatable
Comment 2 Caroline Cyr La Rose 2023-02-09 16:13:59 UTC
Created attachment 146438 [details] [review]
Bug 32918: ERM authorized values should be in installer/data/mysql/en/mandatory/auth_values.yml

This patch moves the authorized value insertions for ERM categories into
the language-specific auth_values.yml file.

To test:
1. Count the number of authorized values in the mandatory categories

select count(*) from authorised_values where category in ('YES_NO', 'PAYMENT_TYPE', 'HSBND_FREQ', 'ERM_AGREEMENT_STATUS', 'ERM_AGREEMENT_CLOSURE_REASON', 'ERM_AGREEMENT_RENEWAL_PRIORITY', 'ERM_USER_ROLES', 'ERM_LICENSE_TYPE', 'ERM_LICENSE_STATUS', 'ERM_AGREEMENT_LICENSE_STATUS', 'ERM_AGREEMENT_LICENSE_LOCATION', 'ERM_PACKAGE_TYPE', 'ERM_PACKAGE_CONTENT_TYPE', 'ERM_TITLE_PUBLICATION_TYPE', 'COUNTRY', 'LANG', 'qualif');

--> There should be 929

2. Delete the authorized values from these categories

delete from authorised_values where category in ('YES_NO', 'PAYMENT_TYPE', 'HSBND_FREQ', 'ERM_AGREEMENT_STATUS', 'ERM_AGREEMENT_CLOSURE_REASON', 'ERM_AGREEMENT_RENEWAL_PRIORITY', 'ERM_USER_ROLES', 'ERM_LICENSE_TYPE', 'ERM_LICENSE_STATUS', 'ERM_AGREEMENT_LICENSE_STATUS', 'ERM_AGREEMENT_LICENSE_LOCATION', 'ERM_PACKAGE_TYPE', 'ERM_PACKAGE_CONTENT_TYPE', 'ERM_TITLE_PUBLICATION_TYPE', 'COUNTRY', 'LANG', 'qualif');

3. Apply patch
4. Load the mandatory authorized values

./misc/load_yaml.pl --file installer/data/mysql/en/mandatory/auth_values.yml --load

5. Redo step 1
   --> There should be the same number (929)
6. Update translations

cd misc/translator
./translate update xx-XX

7. Search the po/xx-XX-installer.po file for any of the loaded
   authorized values

   For example,

   grep "Abstract and index" po/xx-XX-installer.po

   --> descriptions should be translatable
Comment 3 Caroline Cyr La Rose 2023-02-09 16:17:19 UTC
I had originally made the authorized values themselves translatable since they are English words, and for historical and legal reasons, that doesn't always fly here. 

Unfortunately, some of them trigger actions (like the 'closed' ERM_AGREEMENT_STATUS makes the 'Closure reason' drop down active in agreements), so we can't translate them... at least not all of them. Since I'm not sure which ones trigger actions, I removed all of them from the translations. Now, only the descriptions are translatable.
Comment 4 Katrin Fischer 2023-02-20 22:55:25 UTC
(In reply to Caroline Cyr La Rose from comment #3)
> I had originally made the authorized values themselves translatable since
> they are English words, and for historical and legal reasons, that doesn't
> always fly here. 
> 
> Unfortunately, some of them trigger actions (like the 'closed'
> ERM_AGREEMENT_STATUS makes the 'Closure reason' drop down active in
> agreements), so we can't translate them... at least not all of them. Since
> I'm not sure which ones trigger actions, I removed all of them from the
> translations. Now, only the descriptions are translatable.

Looking at the values I wish they'd follow a bit more closely recommendations for authorised values, not using _ (we do recommend against these for locations and collections for search reasons) and using capital letters. It would also make it easier to see that these are CODES and not words.

But... as Caroline said, we cannot change this easily and it's an oversight that is hard to fix now (and certainly should not be fixed here.
Comment 5 Katrin Fischer 2023-02-20 23:01:06 UTC
Created attachment 146983 [details] [review]
Bug 32918: ERM authorized values should be in installer/data/mysql/en/mandatory/auth_values.yml

This patch moves the authorized value insertions for ERM categories into
the language-specific auth_values.yml file.

To test:
1. Count the number of authorized values in the mandatory categories

select count(*) from authorised_values where category in ('YES_NO', 'PAYMENT_TYPE', 'HSBND_FREQ', 'ERM_AGREEMENT_STATUS', 'ERM_AGREEMENT_CLOSURE_REASON', 'ERM_AGREEMENT_RENEWAL_PRIORITY', 'ERM_USER_ROLES', 'ERM_LICENSE_TYPE', 'ERM_LICENSE_STATUS', 'ERM_AGREEMENT_LICENSE_STATUS', 'ERM_AGREEMENT_LICENSE_LOCATION', 'ERM_PACKAGE_TYPE', 'ERM_PACKAGE_CONTENT_TYPE', 'ERM_TITLE_PUBLICATION_TYPE', 'COUNTRY', 'LANG', 'qualif');

--> There should be 929

2. Delete the authorized values from these categories

delete from authorised_values where category in ('YES_NO', 'PAYMENT_TYPE', 'HSBND_FREQ', 'ERM_AGREEMENT_STATUS', 'ERM_AGREEMENT_CLOSURE_REASON', 'ERM_AGREEMENT_RENEWAL_PRIORITY', 'ERM_USER_ROLES', 'ERM_LICENSE_TYPE', 'ERM_LICENSE_STATUS', 'ERM_AGREEMENT_LICENSE_STATUS', 'ERM_AGREEMENT_LICENSE_LOCATION', 'ERM_PACKAGE_TYPE', 'ERM_PACKAGE_CONTENT_TYPE', 'ERM_TITLE_PUBLICATION_TYPE', 'COUNTRY', 'LANG', 'qualif');

3. Apply patch
4. Load the mandatory authorized values

./misc/load_yaml.pl --file installer/data/mysql/en/mandatory/auth_values.yml --load

5. Redo step 1
   --> There should be the same number (929)
6. Update translations

cd misc/translator
./translate update xx-XX

7. Search the po/xx-XX-installer.po file for any of the loaded
   authorized values

   For example,

   grep "Abstract and index" po/xx-XX-installer.po

   --> descriptions should be translatable

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 6 Katrin Fischer 2023-02-20 23:01:08 UTC
Created attachment 146984 [details] [review]
Bug 32918: (follow-up) Add new lines for formatting consistency

This adds new lines between each authorised value for better
readability and to match the formatting of the rest of the file.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 7 Jonathan Druart 2023-02-22 12:38:41 UTC
Created attachment 147132 [details] [review]
Bug 32918: ERM authorized values should be in installer/data/mysql/en/mandatory/auth_values.yml

This patch moves the authorized value insertions for ERM categories into
the language-specific auth_values.yml file.

To test:
1. Count the number of authorized values in the mandatory categories

select count(*) from authorised_values where category in ('YES_NO', 'PAYMENT_TYPE', 'HSBND_FREQ', 'ERM_AGREEMENT_STATUS', 'ERM_AGREEMENT_CLOSURE_REASON', 'ERM_AGREEMENT_RENEWAL_PRIORITY', 'ERM_USER_ROLES', 'ERM_LICENSE_TYPE', 'ERM_LICENSE_STATUS', 'ERM_AGREEMENT_LICENSE_STATUS', 'ERM_AGREEMENT_LICENSE_LOCATION', 'ERM_PACKAGE_TYPE', 'ERM_PACKAGE_CONTENT_TYPE', 'ERM_TITLE_PUBLICATION_TYPE', 'COUNTRY', 'LANG', 'qualif');

--> There should be 929

2. Delete the authorized values from these categories

delete from authorised_values where category in ('YES_NO', 'PAYMENT_TYPE', 'HSBND_FREQ', 'ERM_AGREEMENT_STATUS', 'ERM_AGREEMENT_CLOSURE_REASON', 'ERM_AGREEMENT_RENEWAL_PRIORITY', 'ERM_USER_ROLES', 'ERM_LICENSE_TYPE', 'ERM_LICENSE_STATUS', 'ERM_AGREEMENT_LICENSE_STATUS', 'ERM_AGREEMENT_LICENSE_LOCATION', 'ERM_PACKAGE_TYPE', 'ERM_PACKAGE_CONTENT_TYPE', 'ERM_TITLE_PUBLICATION_TYPE', 'COUNTRY', 'LANG', 'qualif');

3. Apply patch
4. Load the mandatory authorized values

./misc/load_yaml.pl --file installer/data/mysql/en/mandatory/auth_values.yml --load

5. Redo step 1
   --> There should be the same number (929)
6. Update translations

cd misc/translator
./translate update xx-XX

7. Search the po/xx-XX-installer.po file for any of the loaded
   authorized values

   For example,

   grep "Abstract and index" po/xx-XX-installer.po

   --> descriptions should be translatable

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 8 Jonathan Druart 2023-02-22 12:38:44 UTC
Created attachment 147133 [details] [review]
Bug 32918: (follow-up) Add new lines for formatting consistency

This adds new lines between each authorised value for better
readability and to match the formatting of the rest of the file.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 9 Tomás Cohen Arazi (tcohen) 2023-02-22 13:11:23 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 10 Martin Renvoize (ashimema) 2023-02-27 13:38:44 UTC
Many hands makes light work, thankyou everyone!

Pushed to 22.11.x for the next release
Comment 11 Lucas Gass (lukeg) 2023-03-08 13:12:46 UTC
Not needed for 22.05.x, no backport.