From 251a3bb58430b172e240df9e1df510588260bdbb Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 23 Jun 2022 13:32:23 -0300 Subject: [PATCH] Bug 12446: (QA follow-up) Rename canbeguarantee => can_be_guarantee Signed-off-by: Tomas Cohen Arazi --- Koha/Patron.pm | 2 +- Koha/Schema/Result/Category.pm | 17 +++++++---------- admin/categories.pl | 6 +++--- installer/data/mysql/db_revs/220600004.pl | 6 +++--- .../mysql/en/optional/patron_categories.yml | 10 +++++----- installer/data/mysql/kohastructure.sql | 2 +- .../prog/en/modules/admin/categories.tt | 10 +++++----- members/memberentry.pl | 4 ++-- t/db_dependent/Patrons.t | 8 ++++---- 9 files changed, 31 insertions(+), 34 deletions(-) diff --git a/Koha/Patron.pm b/Koha/Patron.pm index b09c9a230c..ae6b7e2367 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -307,7 +307,7 @@ sub store { # Clean up guarantors on category change if required $self->guarantor_relationships->delete - unless ( $self->category->canbeguarantee ); + unless ( $self->category->can_be_guarantee ); } diff --git a/Koha/Schema/Result/Category.pm b/Koha/Schema/Result/Category.pm index fd8e78167f..ca935d98e2 100644 --- a/Koha/Schema/Result/Category.pm +++ b/Koha/Schema/Result/Category.pm @@ -162,7 +162,7 @@ Default privacy setting for this patron category produce a warning for this patron category if this item has previously been checked out to this patron if 'yes', not if 'no', defer to syspref setting if 'inherit'. -=head2 canbeguarantee +=head2 can_be_guarantee data_type: 'tinyint' default_value: 0 @@ -259,7 +259,7 @@ __PACKAGE__->add_columns( is_nullable => 0, size => 7, }, - "canbeguarantee", + "can_be_guarantee", { data_type => "tinyint", default_value => 0, is_nullable => 0 }, "reset_password", { data_type => "tinyint", is_nullable => 1 }, @@ -363,12 +363,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-06-23 15:17:56 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:5gVAZYJ4TW6H2DjdmBXkBQ - -__PACKAGE__->add_columns( - '+exclude_from_local_holds_priority' => { is_boolean => 1 }, -); +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-06-23 16:29:27 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:SKWF2QpqQtXoujwurKFQhA sub koha_object_class { 'Koha::Patron::Category'; @@ -378,8 +374,9 @@ sub koha_objects_class { } __PACKAGE__->add_columns( - '+canbeguarantee' => { is_boolean => 1 }, - '+require_strong_password' => { is_boolean => 1 } + '+can_be_guarantee' => { is_boolean => 1 }, + '+exclude_from_local_holds_priority' => { is_boolean => 1 }, + '+require_strong_password' => { is_boolean => 1 }, ); 1; diff --git a/admin/categories.pl b/admin/categories.pl index 32831bbff9..b30193deb9 100755 --- a/admin/categories.pl +++ b/admin/categories.pl @@ -80,7 +80,7 @@ elsif ( $op eq 'add_validate' ) { my $min_password_length = $input->param('min_password_length'); my $require_strong_password = $input->param('require_strong_password'); my @branches = grep { $_ ne q{} } $input->multi_param('branches'); - my $canbeguarantee = $input->param('canbeguarantee'); + my $can_be_guarantee = $input->param('can_be_guarantee'); $reset_password = undef if $reset_password eq -1; $change_password = undef if $change_password eq -1; @@ -113,7 +113,7 @@ elsif ( $op eq 'add_validate' ) { $category->hidelostitems($hidelostitems); $category->overduenoticerequired($overduenoticerequired); $category->category_type($category_type); - $category->canbeguarantee($canbeguarantee); + $category->can_be_guarantee($can_be_guarantee); $category->BlockExpiredPatronOpacActions($BlockExpiredPatronOpacActions); $category->checkprevcheckout($checkPrevCheckout); $category->default_privacy($default_privacy); @@ -146,7 +146,7 @@ elsif ( $op eq 'add_validate' ) { hidelostitems => $hidelostitems, overduenoticerequired => $overduenoticerequired, category_type => $category_type, - canbeguarantee => $canbeguarantee, + can_be_guarantee => $can_be_guarantee, BlockExpiredPatronOpacActions => $BlockExpiredPatronOpacActions, checkprevcheckout => $checkPrevCheckout, default_privacy => $default_privacy, diff --git a/installer/data/mysql/db_revs/220600004.pl b/installer/data/mysql/db_revs/220600004.pl index 1363e95d16..dafbe8c148 100755 --- a/installer/data/mysql/db_revs/220600004.pl +++ b/installer/data/mysql/db_revs/220600004.pl @@ -7,17 +7,17 @@ return { my ($args) = @_; my ($dbh) = @$args{qw(dbh)}; - unless ( column_exists( 'categories', 'canbeguarantee' ) ) { + unless ( column_exists( 'categories', 'can_be_guarantee' ) ) { $dbh->do(q{ ALTER TABLE categories - ADD COLUMN `canbeguarantee` tinyint(1) NOT NULL default 0 COMMENT 'if patrons of this category can be guarantees' + ADD COLUMN `can_be_guarantee` tinyint(1) NOT NULL default 0 COMMENT 'if patrons of this category can be guarantees' AFTER `checkprevcheckout` }); } $dbh->do(q{ UPDATE categories - SET canbeguarantee = 1 + SET can_be_guarantee = 1 WHERE category_type = 'P' OR category_type = 'C' }); }, diff --git a/installer/data/mysql/en/optional/patron_categories.yml b/installer/data/mysql/en/optional/patron_categories.yml index 3d8d72696f..c967038c64 100644 --- a/installer/data/mysql/en/optional/patron_categories.yml +++ b/installer/data/mysql/en/optional/patron_categories.yml @@ -99,7 +99,7 @@ tables: issuelimit: ~ reservefee: '0.000000' category_type: 'C' - canbeguarantee: 1 + can_be_guarantee: 1 - categorycode: 'J' description: 'Juvenile' @@ -113,7 +113,7 @@ tables: issuelimit: ~ reservefee: '0.000000' category_type: 'C' - canbeguarantee: 1 + can_be_guarantee: 1 - categorycode: 'YA' description: 'Young Adult' @@ -127,7 +127,7 @@ tables: issuelimit: ~ reservefee: '0.000000' category_type: 'C' - canbeguarantee: 1 + can_be_guarantee: 1 # Professionals - categorycode: 'T' @@ -142,7 +142,7 @@ tables: issuelimit: ~ reservefee: '0.000000' category_type: 'P' - canbeguarantee: 1 + can_be_guarantee: 1 - categorycode: 'B' description: 'Board' @@ -156,7 +156,7 @@ tables: issuelimit: ~ reservefee: '0.000000' category_type: 'P' - canbeguarantee: 1 + can_be_guarantee: 1 # Institutional - categorycode: 'IL' diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index c164cb404d..f3a73a50fa 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1664,7 +1664,7 @@ CREATE TABLE `categories` ( `BlockExpiredPatronOpacActions` tinyint(1) NOT NULL DEFAULT -1 COMMENT 'wheither or not a patron of this category can renew books or place holds once their card has expired. 0 means they can, 1 means they cannot, -1 means use syspref BlockExpiredPatronOpacActions', `default_privacy` enum('default','never','forever') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'default' COMMENT 'Default privacy setting for this patron category', `checkprevcheckout` varchar(7) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'inherit' COMMENT 'produce a warning for this patron category if this item has previously been checked out to this patron if ''yes'', not if ''no'', defer to syspref setting if ''inherit''.', - `canbeguarantee` tinyint(1) NOT NULL default 0 COMMENT 'if patrons of this category can be guarantees', + `can_be_guarantee` tinyint(1) NOT NULL default 0 COMMENT 'if patrons of this category can be guarantees', `reset_password` tinyint(1) DEFAULT NULL COMMENT 'if patrons of this category can do the password reset flow,', `change_password` tinyint(1) DEFAULT NULL COMMENT 'if patrons of this category can change their passwords in the OAPC', `min_password_length` smallint(6) DEFAULT NULL COMMENT 'set minimum password length for patrons in this category', diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt index 9204ce6673..8f9a736e5e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt @@ -220,9 +220,9 @@ Required
  • - - + [% IF category.can_be_guarantee %] [% ELSE %] @@ -490,7 +490,7 @@ [% END %] - Can be guarantee[% IF category.canbeguarantee %]Yes[% ELSE %]No[% END %] + Can be guarantee[% IF category.can_be_guarantee %]Yes[% ELSE %]No[% END %] Default privacy: @@ -669,7 +669,7 @@ [% END %] [% END %] - [% IF category.canbeguarantee %] Yes [% ELSE %] no [% END %] + [% IF category.can_be_guarantee %] Yes [% ELSE %] no [% END %] [% SWITCH category.default_privacy %] [% CASE 'default' %] diff --git a/members/memberentry.pl b/members/memberentry.pl index bc27732c37..d406817ecd 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -674,7 +674,7 @@ my $no_categories = 1; my $no_add; foreach my $category_type (qw(C A S P I X)) { my $categories_limits = { category_type => $category_type }; - $categories_limits->{canbeguarantee} = 1 if ($guarantor_id); + $categories_limits->{can_be_guarantee} = 1 if ($guarantor_id); my $patron_categories = Koha::Patron::Categories->search_with_library_limits( $categories_limits, {order_by => ['categorycode']} ); $no_categories = 0 if $patron_categories->count > 0; @@ -822,7 +822,7 @@ if (C4::Context->preference('EnhancedMessagingPreferences')) { } $template->param( borrower_data => \%data ); -$template->param( "show_guarantor" => $categorycode ? Koha::Patron::Categories->find($categorycode)->canbeguarantee : 1); # associate with step to know where you are +$template->param( "show_guarantor" => $categorycode ? Koha::Patron::Categories->find($categorycode)->can_be_guarantee : 1); # associate with step to know where you are $template->param( "step_$step" => 1) if $step; # associate with step to know where u are $template->param( step => $step ) if $step; # associate with step to know where u are diff --git a/t/db_dependent/Patrons.t b/t/db_dependent/Patrons.t index 6e34ec548f..2b9091802f 100755 --- a/t/db_dependent/Patrons.t +++ b/t/db_dependent/Patrons.t @@ -112,16 +112,16 @@ subtest "Update patron categories" => sub { category_type=>'C', upperagelimit=>17, dateofbirthrequired=>5, - canbeguarantee=>1, + can_be_guarantee=>1, } })->{categorycode}; my $c_categorycode_2 = $builder->build({ source => 'Category', value => { category_type=>'C', upperagelimit=>17, dateofbirthrequired=>5, - canbeguarantee=>1, + can_be_guarantee=>1, } })->{categorycode}; - my $a_categorycode = $builder->build({ source => 'Category', value => {category_type=>'A', canbeguarantee=>0} })->{categorycode}; - my $a_categorycode_2 = $builder->build({ source => 'Category', value => {category_type=>'A', canbeguarantee=>1} })->{categorycode}; + my $a_categorycode = $builder->build({ source => 'Category', value => {category_type=>'A', can_be_guarantee=>0} })->{categorycode}; + my $a_categorycode_2 = $builder->build({ source => 'Category', value => {category_type=>'A', can_be_guarantee=>1} })->{categorycode}; my $p_categorycode = $builder->build({ source => 'Category', value => {category_type=>'P'} })->{categorycode}; my $i_categorycode = $builder->build({ source => 'Category', value => {category_type=>'I'} })->{categorycode}; my $branchcode1 = $builder->build({ source => 'Branch' })->{branchcode}; -- 2.39.5