From 038f5a618f8a2dc5c5155f8ba239d4f6cc0711a3 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 18 Oct 2017 19:59:42 -0300 Subject: [PATCH] Bug 19287: Do not use 'yes' and 'no' for choices If the pref value is 'yes' or 'no', it will actually be '1' or '0' in DB, and the comparaison will then fail. To avoid that I think it is better to rename the value. --- circ/waitingreserves.pl | 4 ++-- installer/data/mysql/atomicupdate/bug_19287.sql | 2 +- installer/data/mysql/sysprefs.sql | 2 +- .../prog/en/modules/admin/preferences/circulation.pref | 6 +++--- koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/circ/waitingreserves.pl b/circ/waitingreserves.pl index ab28b41d40..3e2ca1a55d 100755 --- a/circ/waitingreserves.pl +++ b/circ/waitingreserves.pl @@ -79,11 +79,11 @@ if ( $op eq 'cancel_reserve' and $item) { my $reserve_id = $input->param('reserve_id'); my $hold = Koha::Holds->find( $reserve_id ); die "wrong reserve_id" unless $hold; # This is a bit rude, but we are not supposed to get a wrong reserve_id - if ( C4::Context->preference('CanMarkHoldsAwaitingPickupAsLost') =~ m|^yes| ) { + if ( C4::Context->preference('CanMarkHoldsAwaitingPickupAsLost') =~ m|^allow| ) { my $itemnumber = $hold->item->itemnumber; my $patron = $hold->borrower; C4::Circulation::LostItem( $itemnumber, 'MARK RETURNED' ); # FIXME Do we have to mark it returned? There is no pref for that? See other occurrences of 'LostItem(' - if ( $op eq 'mark_as_lost_and_notify' and C4::Context->preference('CanMarkHoldsAwaitingPickupAsLost') eq 'yes_and_notify' ) { + if ( $op eq 'mark_as_lost_and_notify' and C4::Context->preference('CanMarkHoldsAwaitingPickupAsLost') eq 'allow_and_notify' ) { my $library = $hold->branch; my $letter = C4::Letters::GetPreparedLetter( module => 'reserves', diff --git a/installer/data/mysql/atomicupdate/bug_19287.sql b/installer/data/mysql/atomicupdate/bug_19287.sql index 7ae924b792..ff754930eb 100644 --- a/installer/data/mysql/atomicupdate/bug_19287.sql +++ b/installer/data/mysql/atomicupdate/bug_19287.sql @@ -1,3 +1,3 @@ -INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES ('CanMarkHoldsAwaitingPickupAsLost','no','no|yes|yes_and_notify','Add a button on the "Holds awaiting pickup" screen to mark an item as lost and notify the patron.','Choice'); +INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES ('CanMarkHoldsAwaitingPickupAsLost','do_not_allow','do_not_allow|allow|allow_and_notify','Add a button on the "Holds awaiting pickup" screen to mark an item as lost and notify the patron.','Choice'); INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('reserves', 'CANCEL_HOLD_ON_LOST', '', 'Hold has been cancelled', 0, "Hold has been cancelled", "Dear [% borrower.firstname %] [% borrower.surname %],\n\nWe regret to inform you that the following item cannot longer be placed on hold, it has been marked as lost\n\nTitle: [% biblio.title %]\nAuthor: [% biblio.author %]\nCopy: [% item.copynumber %]\nLocation: [% branch.branchname %]", 'email', 'default'); diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 104e56a0b9..8b66853fa1 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -255,7 +255,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('MARCAuthorityControlField008','|| aca||aabn | a|a d',NULL,'Define the contents of MARC21 authority control field 008 position 06-39','Textarea'), ('MarcFieldsToOrder','',NULL,'Set the mapping values for a new order line created from a MARC record in a staged file. In a YAML format.','textarea'), ('MarcItemFieldsToOrder','',NULL,'Set the mapping values for new item records created from a MARC record in a staged file. In a YAML format.','textarea'), -('CanMarkHoldsAwaitingPickupAsLost','no','no|yes|yes_and_notify','Add a button on the "Holds awaiting pickup" screen to mark an item as lost and notify the patron.','Choice'), +('CanMarkHoldsAwaitingPickupAsLost','do_not_allow','do_not_allow|allow|allow_and_notify','Add a button on the "Holds awaiting pickup" screen to mark an item as lost and notify the patron.','Choice'), ('MARCOrgCode','OSt','','Define MARC Organization Code for MARC21 records - http://www.loc.gov/marc/organizations/orgshome.html','free'), ('MaxFine',NULL,'','Maximum fine a patron can have for all late returns at one moment. Single item caps are specified in the circulation rules matrix.','Integer'), ('MaxItemsToDisplayForBatchDel','1000',NULL,'Display up to a given number of items in a single item deletionbatch.','Integer'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref index acc56a4c46..4e5bfde238 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -693,9 +693,9 @@ Circulation: - - pref: CanMarkHoldsAwaitingPickupAsLost choices: - no: "Do not allow to mark items as lost" - yes: "Allow to mark items as lost" - yes_and_notify: "Allow to mark items as lost and notify the patron" + do_not_allow: "Do not allow to mark items as lost" + allow: "Allow to mark items as lost" + allow_and_notify: "Allow to mark items as lost and notify the patron" - "from the 'Holds awaiting pickup' screen" Fines Policy: - diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt index 397b39c6f4..b2525d6a0b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt @@ -191,16 +191,16 @@ [% END %] - [% IF Koha.Preference('CanMarkHoldsAwaitingPickupAsLost') != 'no' %] + [% IF Koha.Preference('CanMarkHoldsAwaitingPickupAsLost') != 'do_not_allow' %]
- [% IF Koha.Preference('CanMarkHoldsAwaitingPickupAsLost') == 'yes' %] + [% IF Koha.Preference('CanMarkHoldsAwaitingPickupAsLost') == 'allow' %] - [% ELSIF Koha.Preference('CanMarkHoldsAwaitingPickupAsLost') == 'yes_and_notify' %] + [% ELSIF Koha.Preference('CanMarkHoldsAwaitingPickupAsLost') == 'allow_and_notify' %] [% END %] -- 2.11.0