From e3c6c4beedaa7b1fafc9d7ad93d85b6b0284336a Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 28 Feb 2020 17:30:07 +0000 Subject: [PATCH] Bug 24476: Rename autorenewal to autorenew_checkouts Signed-off-by: Andrew Fuerste-Henry Signed-off-by: Katrin Fischer Signed-off-by: Martin Renvoize --- C4/Circulation.pm | 6 ++--- Koha/Patron.pm | 2 +- api/v1/swagger/definitions/patron.json | 2 +- api/v1/swagger/paths/patrons.json | 4 ++-- .../bug_24476_opt_out_of_auto_renewal.perl | 16 +++++++------- installer/data/mysql/kohastructure.sql | 6 ++--- .../prog/en/modules/circ/circulation.tt | 6 ++--- .../prog/en/modules/members/memberentrygen.tt | 22 +++++++++---------- .../prog/en/modules/members/members-update.tt | 2 +- .../en/modules/members/moremember-brief.tt | 2 +- .../prog/en/modules/members/moremember.tt | 4 ++-- .../bootstrap/en/modules/opac-memberentry.tt | 22 +++++++++---------- misc/cronjobs/automatic_renewals.pl | 2 +- t/db_dependent/Circulation.t | 16 +++++++------- 14 files changed, 56 insertions(+), 56 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 30311b0124..c6f3cf9d75 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2751,7 +2751,7 @@ sub CanBookBeRenewed { return ( 0, 'overdue'); } - if ( $issue->auto_renew && $patron->autorenewal ) { + if ( $issue->auto_renew && $patron->autorenew_checkouts ) { if ( $patron->category->effective_BlockExpiredPatronOpacActions and $patron->is_expired ) { return ( 0, 'auto_account_expired' ); @@ -2807,10 +2807,10 @@ sub CanBookBeRenewed { if ( $soonestrenewal > DateTime->now( time_zone => C4::Context->tz() ) ) { - return ( 0, "auto_too_soon" ) if $issue->auto_renew && $patron->autorenewal; + return ( 0, "auto_too_soon" ) if $issue->auto_renew && $patron->autorenew_checkouts; return ( 0, "too_soon" ); } - elsif ( $issue->auto_renew && $patron->autorenewal ) { + elsif ( $issue->auto_renew && $patron->autorenew_checkouts ) { $auto_renew = 1; } } diff --git a/Koha/Patron.pm b/Koha/Patron.pm index 331d7b9408..b8792861df 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -1671,7 +1671,7 @@ sub to_api_mapping { smsalertnumber => 'sms_number', sort1 => 'statistics_1', sort2 => 'statistics_2', - autorenewal => 'autorenewal', + autorenew_checkouts => 'autorenew_checkouts', streetnumber => 'street_number', streettype => 'street_type', zipcode => 'postal_code', diff --git a/api/v1/swagger/definitions/patron.json b/api/v1/swagger/definitions/patron.json index cf5eedf52d..a4f998c04d 100644 --- a/api/v1/swagger/definitions/patron.json +++ b/api/v1/swagger/definitions/patron.json @@ -191,7 +191,7 @@ "type": ["string", "null"], "description": "a field that can be used for any information unique to the library" }, - "autorenewal": { + "autorenew_checkouts": { "type": "boolean", "description": "indicate whether auto-renewal is allowed for patron" }, diff --git a/api/v1/swagger/paths/patrons.json b/api/v1/swagger/paths/patrons.json index bb4efd3caf..c8798f28d5 100644 --- a/api/v1/swagger/paths/patrons.json +++ b/api/v1/swagger/paths/patrons.json @@ -296,9 +296,9 @@ "required": false, "type": "string" }, { - "name": "autorenewal", + "name": "autorenew_checkouts", "in": "query", - "description": "Search on autorenewal", + "description": "Search on autorenew_checkouts", "required": false, "type": "boolean" }, { diff --git a/installer/data/mysql/atomicupdate/bug_24476_opt_out_of_auto_renewal.perl b/installer/data/mysql/atomicupdate/bug_24476_opt_out_of_auto_renewal.perl index 9bc691bd9b..50edba9cc6 100644 --- a/installer/data/mysql/atomicupdate/bug_24476_opt_out_of_auto_renewal.perl +++ b/installer/data/mysql/atomicupdate/bug_24476_opt_out_of_auto_renewal.perl @@ -1,20 +1,20 @@ $DBversion = 'XXX'; if( CheckVersion( $DBversion ) ) { - unless( column_exists('borrowers','autorenewal') ){ - $dbh->do( "ALTER TABLE borrowers ADD COLUMN autorenewal TINYINT(1) NOT NULL DEFAULT 1" ); + unless( column_exists('borrowers','autorenew_checkouts') ){ + $dbh->do( "ALTER TABLE borrowers ADD COLUMN autorenew_checkouts TINYINT(1) NOT NULL DEFAULT 1" ); } - unless( column_exists('deletedborrowers','autorenewal') ){ - $dbh->do( "ALTER TABLE deletedborrowers ADD COLUMN autorenewal TINYINT(1) NOT NULL DEFAULT 1" ); + unless( column_exists('deletedborrowers','autorenew_checkouts') ){ + $dbh->do( "ALTER TABLE deletedborrowers ADD COLUMN autorenew_checkouts TINYINT(1) NOT NULL DEFAULT 1" ); } - unless( column_exists('borrower_modifications','autorenewal') ){ - $dbh->do( "ALTER TABLE borrower_modifications ADD COLUMN autorenewal TINYINT(1) NOT NULL DEFAULT 1" ); + unless( column_exists('borrower_modifications','autorenew_checkouts') ){ + $dbh->do( "ALTER TABLE borrower_modifications ADD COLUMN autorenew_checkouts TINYINT(1) NOT NULL DEFAULT 1" ); } $dbh->do(q{ UPDATE systempreferences - SET value = CONCAT(value,'|autorenewal') + SET value = CONCAT(value,'|autorenew_checkouts') WHERE variable IN ('PatronSelfModificationBorrowerUnwantedField','PatronSelfRegistrationBorrowerUnwantedField') - AND value NOT LIKE '%autorenewal%' + AND value NOT LIKE '%autorenew_checkouts%' }); SetVersion( $DBversion ); print "Upgrade to $DBversion done (Bug 24476 - Allow patrons to opt-out of autorenewal)\n"; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 9c361dd9f1..e80c64c19f 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -589,7 +589,7 @@ CREATE TABLE `deletedborrowers` ( -- stores data related to the patrons/borrower `login_attempts` int(4) default 0, -- number of failed login attemps `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token `anonymized` TINYINT(1) NOT NULL DEFAULT 0, -- flag for data anonymization - `autorenewal` TINYINT(1) NOT NULL DEFAULT 1, -- flag for allowing auto-renewal + `autorenew_checkouts` TINYINT(1) NOT NULL DEFAULT 1, -- flag for allowing auto-renewal KEY borrowernumber (borrowernumber), KEY `cardnumber` (`cardnumber`), KEY `sms_provider_id` (`sms_provider_id`) @@ -1533,7 +1533,7 @@ CREATE TABLE `borrowers` ( -- this table includes information about your patrons `login_attempts` int(4) default 0, -- number of failed login attemps `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token `anonymized` TINYINT(1) NOT NULL DEFAULT 0, -- flag for data anonymization - `autorenewal` TINYINT(1) NOT NULL DEFAULT 1, -- flag for allowing auto-renewal + `autorenew_checkouts` TINYINT(1) NOT NULL DEFAULT 1, -- flag for allowing auto-renewal UNIQUE KEY `cardnumber` (`cardnumber`), PRIMARY KEY `borrowernumber` (`borrowernumber`), KEY `categorycode` (`categorycode`), @@ -3441,7 +3441,7 @@ CREATE TABLE IF NOT EXISTS `borrower_modifications` ( `privacy` int(11) DEFAULT NULL, `extended_attributes` MEDIUMTEXT DEFAULT NULL, `gdpr_proc_consent` datetime, -- data processing consent - `autorenewal` TINYINT(1) NOT NULL DEFAULT 1, -- flag for allowing auto-renewal + `autorenew_checkouts` TINYINT(1) NOT NULL DEFAULT 1, -- flag for allowing auto-renewal PRIMARY KEY (`verification_token` (191),`borrowernumber`), KEY `verification_token` (`verification_token` (191)), KEY `borrowernumber` (`borrowernumber`) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index feb3c3a5e6..167a20355b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -568,7 +568,7 @@
[% IF NEEDSCONFIRMATION %] [% IF auto_renew %] - [% IF patron.autorenewal %] + [% IF patron.autorenew_checkouts %] [% ELSE %] @@ -578,9 +578,9 @@ [% END %] [% ELSE %] - [% IF ( auto_renew && patron.autorenewal ) %] + [% IF ( auto_renew && patron.autorenew_checkouts ) %] - [% ELSIF patron.autorenewal %] + [% ELSIF patron.autorenew_checkouts %] [% ELSE %] [% END # /UNLESS nosort2 %] - [% UNLESS noautorenewal %] + [% UNLESS noautorenew_checkouts %]
  • -
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/members-update.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/members-update.tt index c16e432530..e250b9e7e4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/members-update.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/members-update.tt @@ -52,7 +52,7 @@ [% CASE 'contacttitle' %]Contact: Title [% CASE 'relationship' %]Contact: Relationship [% CASE 'sex' %]Gender -[% CASE 'autorenewal' %]Auto-renewal +[% CASE 'autorenew_checkouts' %]Auto-renewal [% CASE 'altcontactfirstname' %]Alternate contact: First name [% CASE 'altcontactsurname' %]Alternate contact: Surname [% CASE 'altcontactaddress1' %]Alternate contact: Address diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt index ecac3b7f28..2eded98efb 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt @@ -84,7 +84,7 @@
  • Library: [% patron.library.branchname | html %]
  • [% IF ( patron.sort1 ) %]
  • Sort field 1:[% AuthorisedValues.GetByCode('Bsort1', patron.sort1) | html %]
  • [% END %] [% IF ( patron.sort2 ) %]
  • Sort field 2:[% AuthorisedValues.GetByCode('Bsort2', patron.sort2) | html %]
  • [% END %] - [% UNLESS ( patron.autorenewal ) %]
  • Auto renewal: Patron has opted out
  • [% END %] + [% UNLESS ( patron.autorenew_checkouts ) %]
  • Auto renewal: Patron has opted out
  • [% END %]
    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt index 488515b8ef..15ea33c9f0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -516,8 +516,8 @@ [% AuthorisedValues.GetByCode('Bsort2', patron.sort2) | html %] [% END %] - [% UNLESS ( patron.autorenewal ) %] -
  • + [% UNLESS ( patron.autorenew_checkouts ) %] +
  • Auto renewal: Patron has opted out
  • diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt index a2bcde4516..b5c5e3401f 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt @@ -258,29 +258,29 @@ [% END %] [% END %] - [% UNLESS hidden.defined('autorenewal') %] + [% UNLESS hidden.defined('autorenew_checkouts') %]
  • -
  • diff --git a/misc/cronjobs/automatic_renewals.pl b/misc/cronjobs/automatic_renewals.pl index a3bded3aea..a76f7dfb35 100755 --- a/misc/cronjobs/automatic_renewals.pl +++ b/misc/cronjobs/automatic_renewals.pl @@ -80,7 +80,7 @@ GetOptions( pod2usage(0) if $help; cronlogaction(); -my $auto_renews = Koha::Checkouts->search({ auto_renew => 1, 'borrower.autorenewal' => 1 },{ join => 'borrower'}); +my $auto_renews = Koha::Checkouts->search({ auto_renew => 1, 'borrower.autorenew_checkouts' => 1 },{ join => 'borrower'}); my %report; $verbose = 1 unless $verbose or $confirm; diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t index 72dd1d2948..6d7e4b4c92 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -657,10 +657,10 @@ subtest "CanBookBeRenewed tests" => sub { - $renewing_borrower_obj->autorenewal(0)->store; + $renewing_borrower_obj->autorenew_checkouts(0)->store; ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrowernumber, $item_4->itemnumber ); is( $renewokay, 1, 'No renewal before is undef, but patron opted out of auto_renewal' ); - $renewing_borrower_obj->autorenewal(1)->store; + $renewing_borrower_obj->autorenew_checkouts(1)->store; # Bug 7413 @@ -706,11 +706,11 @@ subtest "CanBookBeRenewed tests" => sub { 'Bug 14101: Cannot renew, renewal is automatic and premature (returned code is auto_too_soon)' ); - $renewing_borrower_obj->autorenewal(0)->store; + $renewing_borrower_obj->autorenew_checkouts(0)->store; ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrowernumber, $item_4->itemnumber ); is( $renewokay, 0, 'No renewal before is 7, patron opted out of auto_renewal still cannot renew early' ); is( $error, 'too_soon', 'Error is too_soon, no auto' ); - $renewing_borrower_obj->autorenewal(1)->store; + $renewing_borrower_obj->autorenew_checkouts(1)->store; # Change policy so that loans can only be renewed exactly on due date (0 days prior to due date) # and test automatic renewal again @@ -722,11 +722,11 @@ subtest "CanBookBeRenewed tests" => sub { 'Bug 14101: Cannot renew, renewal is automatic and premature, "No renewal before" = 0 (returned code is auto_too_soon)' ); - $renewing_borrower_obj->autorenewal(0)->store; + $renewing_borrower_obj->autorenew_checkouts(0)->store; ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrowernumber, $item_4->itemnumber ); is( $renewokay, 0, 'No renewal before is 0, patron opted out of auto_renewal still cannot renew early' ); is( $error, 'too_soon', 'Error is too_soon, no auto' ); - $renewing_borrower_obj->autorenewal(1)->store; + $renewing_borrower_obj->autorenew_checkouts(1)->store; # Change policy so that loans can be renewed 99 days prior to the due date # and test automatic renewal again @@ -738,10 +738,10 @@ subtest "CanBookBeRenewed tests" => sub { 'Bug 14101: Cannot renew, renewal is automatic (returned code is auto_renew)' ); - $renewing_borrower_obj->autorenewal(0)->store; + $renewing_borrower_obj->autorenew_checkouts(0)->store; ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrowernumber, $item_4->itemnumber ); is( $renewokay, 1, 'No renewal before is 99, patron opted out of auto_renewal so can renew' ); - $renewing_borrower_obj->autorenewal(1)->store; + $renewing_borrower_obj->autorenew_checkouts(1)->store; subtest "too_late_renewal / no_auto_renewal_after" => sub { plan tests => 14; -- 2.39.5