Bug 32911: Remove ILL partner_code config from koha-conf.xml and turn it into a system preference

Preparation:
1) apply patch
2) run reset_all
3) enable ILLModule sys preference
4) install a backend (e.g. FreeForm)
5) go into system preferences and confirm that ILLPartnerCode exists and is the default inter-library loan (IL)

Test plan:
1) create an ILL request
2) ensure the patron of category 'IL' has a primary e-mail configured
3) click on "place request with partners"
4) verify that the patron(s) of said category are on the partners list

Upgrade test:
1) Remove the system preference from the database, run query:
delete from systempreferences where variable="ILLPartnerCode";
2) Check or edit the value or partner_code in koha-conf.xml and run atomicupdate:
installer/data/mysql/updatedatabase.pl
3) Confirm the value in koha-conf.xml has been successfully migrated into the system preference, run query:
select * from systempreferences where variable="ILLPartnerCode";

Optional tests:
- Set a patron category in the sys pref and then delete said patron category (needs to not have patrons in it)
- Check the about page -> System information and confirm the warning message is correct

- Set the sys pref to the empty option
- Check the about page -> System information and confirm the warning message is correct

- Set the sys pref to a category that has no patrons of its type (ktd examples: Board, or Library)
- Check the about page -> System information and confirm the warning message is correct

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Pedro Amorim 2023-02-08 16:57:14 +00:00 committed by Tomas Cohen Arazi
parent b33b45d771
commit f0f9bd0f75
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
5 changed files with 24 additions and 7 deletions

View file

@ -319,7 +319,7 @@ sub _load_configuration {
if ( $reply_date && 'hide' eq $reply_date );
# ILL Partners
$configuration->{partner_code} = $xml_config->{partner_code} || 'IL';
$configuration->{partner_code} = C4::Context->preference('ILLPartnerCode') || 'IL';
return $configuration;
}

View file

@ -306,13 +306,16 @@ if ( C4::Context->preference('ILLModule') ) {
$warnILLConfiguration = 1;
}
# Check partner_code
if ( !Koha::Patron::Categories->find($ill_config->partner_code) ) {
$template->param( ill_partner_code_doesnt_exist => $ill_config->partner_code );
# Check ILLPartnerCode sys pref
if ( !Koha::Patron::Categories->find( C4::Context->preference('ILLPartnerCode') ) ) {
$template->param( ill_partner_code_doesnt_exist => C4::Context->preference('ILLPartnerCode') );
$warnILLConfiguration = 1;
} elsif ( !Koha::Patrons->search( { categorycode => C4::Context->preference('ILLPartnerCode') } )->count ) {
$template->param( ill_partner_code_no_patrons => C4::Context->preference('ILLPartnerCode') );
$warnILLConfiguration = 1;
}
if ( !$ill_config_from_file->{partner_code} ) {
if ( !C4::Context->preference('ILLPartnerCode') ) {
# partner code not defined
$template->param( ill_partner_code_not_defined => 1 );
$warnILLConfiguration = 1;

View file

@ -293,6 +293,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('ILLModuleCopyrightClearance','','70|10','Enter text to enable the copyright clearance stage of request creation. Text will be displayed','Textarea'),
('ILLModuleUnmediated','0','','If enabled, try to immediately progress newly placed ILL requests.','YesNo'),
('ILLOpacbackends',NULL,NULL,'ILL backends to enabled for OPAC initiated requests','multiple'),
('ILLPartnerCode','IL','','Patrons from this patron category will be used as partners to place ILL requests with','free'),
('ILLSendStaffNotices', NULL, NULL, 'Send these ILL notices to staff', 'multiple'),
('ILS-DI','0','','Enables ILS-DI services at OPAC.','YesNo'),
('ILS-DI:AuthorizedIPs','','Restricts usage of ILS-DI to some IPs','.','Free'),

View file

@ -515,7 +515,15 @@
<tr>
<th scope="row"><strong>Warning</strong> </th>
<td>
The ILL module is enabled, but no 'partner_code' defined in koha-conf.xml. Falling back to the hardcoded 'IL'.
The ILL module is enabled, but ILLPartnerCode system preference is empty. Falling back to the hardcoded 'IL'.
</td>
</tr>
[% END %]
[% IF ill_partner_code_no_patrons %]
<tr>
<th scope="row"><strong>Warning</strong> </th>
<td>
The ILL module is enabled and ILLPartnerCode system preference configured, but there are no patrons in [% ill_partner_code_no_patrons | html %] category.
</td>
</tr>
[% END %]
@ -531,7 +539,7 @@
<tr>
<th scope="row"><strong>Warning</strong> </th>
<td>
The ILL module is enabled, but the configured 'partner_code' ([% ill_partner_code_doesnt_exist | html %]) is not defined on the system.
The ILL module is enabled, but the configured ILLPartnerCode ([% ill_partner_code_doesnt_exist | html %]) is not defined on the system.
</td>
</tr>
[% END %]

View file

@ -44,6 +44,11 @@ Interlibrary loans:
- pref: ILLSendStaffNotices
class: multi
- "(separated with |). e.g. ILL_REQUEST_CANCEL|ILL_REQUEST_MODIFIED If left empty, no staff ILL notices will be sent."
-
- "Use patrons from category"
- pref: ILLPartnerCode
choices: patron-categories
- "as partners to place ILL requests with."
-
- "Fallback email address for staff ILL notices to be sent to in the absence of a library address:"
- pref: ILLDefaultStaffEmail