Bug 12446: (QA follow-up) Rename canbeguarantee => can_be_guarantee

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Tomás Cohen Arazi 2022-06-23 13:32:23 -03:00
parent 9d6d1cbd18
commit 251a3bb584
9 changed files with 31 additions and 34 deletions

View file

@ -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 );
}

View file

@ -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;

View file

@ -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,

View file

@ -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'
});
},

View file

@ -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'

View file

@ -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',

View file

@ -220,9 +220,9 @@
<span class="required">Required</span>
</li>
<li>
<label for="canbeguarantee">Can be guarantee</label>
<select name="canbeguarantee" id="canbeguarantee">
[% IF category.canbeguarantee %]
<label for="can_be_guarantee">Can be guarantee</label>
<select name="can_be_guarantee" id="can_be_guarantee">
[% IF category.can_be_guarantee %]
<option value="1" selected>Yes</option>
<option value="0">No</option>
[% ELSE %]
@ -490,7 +490,7 @@
</td>
</tr>
[% END %]
<tr><th scope="row">Can be guarantee</th><td>[% IF category.canbeguarantee %]Yes[% ELSE %]No[% END %]</td></tr>
<tr><th scope="row">Can be guarantee</th><td>[% IF category.can_be_guarantee %]Yes[% ELSE %]No[% END %]</td></tr>
<tr>
<th scope="row">Default privacy: </th>
<td>
@ -669,7 +669,7 @@
[% END %]
</td>
[% END %]
<td>[% IF category.canbeguarantee %] Yes [% ELSE %] no [% END %]</td>
<td>[% IF category.can_be_guarantee %] Yes [% ELSE %] no [% END %]</td>
<td>
[% SWITCH category.default_privacy %]
[% CASE 'default' %]

View file

@ -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

View file

@ -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};