Bug 20644: (QA follow-up) Remove duplicate variable

I removed a duplicate variable and tidied.

Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Lisette Scheer 2025-06-20 20:19:51 +00:00 committed by Lucas Gass
parent 99322896b9
commit 8819f2d41c
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
5 changed files with 49 additions and 45 deletions

View File

@ -838,7 +838,7 @@ Return 1 if Koha needs to perform PrevIssue checking, else 0.
=cut
sub wants_check_for_previous_checkout {
my ($self, $item) = @_;
my ( $self, $item ) = @_;
my $syspref = C4::Context->preference("checkPrevCheckout");
# Simple cases

View File

@ -99,7 +99,6 @@ if ( $op eq 'add_form' ) {
my $rentalcharge_hourly_calendar = $input->param('rentalcharge_hourly_calendar') // 0;
my $automatic_checkin = $input->param('automatic_checkin') // 0;
my $bookable = $input->param('bookable') // 0;
my $automatic_checkin = $input->param('automatic_checkin') // 0;
my $checkprevcheckout = $input->param('checkprevcheckout');
if ( $itemtype and $is_a_modif ) { # it's a modification

View File

@ -7,7 +7,7 @@ return {
my ($args) = @_;
my ( $dbh, $out ) = @$args{qw(dbh out)};
if( !column_exists( 'itemtypes', 'checkprevcheckout' ) ) {
if ( !column_exists( 'itemtypes', 'checkprevcheckout' ) ) {
$dbh->do(
q{
ALTER TABLE itemtypes

View File

@ -362,17 +362,17 @@
<label for="checkprevcheckout">Check for previous checkouts: </label>
<select name="checkprevcheckout" id="checkprevcheckout">
[% IF itemtype.checkprevcheckout == 'yes' %]
<option value="yes" selected="selected">Yes and override system preferences</option>
<option value="no">No and override system preferences</option>
<option value="inherit">Inherit from system preferences</option>
<option value="yes" selected="selected">Yes and override system preferences</option>
<option value="no">No and override system preferences</option>
<option value="inherit">Inherit from system preferences</option>
[% ELSIF itemtype.checkprevcheckout == 'no' %]
<option value="yes">Yes and override system preferences</option>
<option value="no" selected="selected">No and override system preferences</option>
<option value="inherit">Inherit from system preferences</option>
<option value="yes">Yes and override system preferences</option>
<option value="no" selected="selected">No and override system preferences</option>
<option value="inherit">Inherit from system preferences</option>
[% ELSE %]
<option value="yes">Yes and override system preferences</option>
<option value="no">No and override system preferences</option>
<option value="inherit" selected="selected">Inherit from system preferences</option>
<option value="yes">Yes and override system preferences</option>
<option value="no">No and override system preferences</option>
<option value="inherit" selected="selected">Inherit from system preferences</option>
[% END %]
</select>
</li>

View File

@ -49,26 +49,32 @@ my $inheritCatCode = $builder->build(
}
);
my $yesItypeCode = $builder->build_object({
class => 'Koha::ItemTypes',
value => {
checkprevcheckout => 'yes',
my $yesItypeCode = $builder->build_object(
{
class => 'Koha::ItemTypes',
value => {
checkprevcheckout => 'yes',
}
}
});
);
my $noItypeCode = $builder->build_object({
class => 'Koha::ItemTypes',
value => {
checkprevcheckout => 'no',
my $noItypeCode = $builder->build_object(
{
class => 'Koha::ItemTypes',
value => {
checkprevcheckout => 'no',
}
}
});
);
my $inheritItypeCode = $builder->build_object({
class => 'Koha::ItemTypes',
value => {
checkprevcheckout => 'inherit',
my $inheritItypeCode = $builder->build_object(
{
class => 'Koha::ItemTypes',
value => {
checkprevcheckout => 'inherit',
}
}
});
);
# Create context for some tests late on in the file.
my $library = $builder->build( { source => 'Branch' } );
@ -235,7 +241,6 @@ map {
} @{ $_->{categories} };
} @{$mappings};
# wants_check_for_previous_checkout
# We want to test the subroutine by passing the $item parameter
@ -288,29 +293,29 @@ map {
# | Expected Result | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
my $itypeCode = {
'yes' => $yesItypeCode->itemtype,
'no' => $noItypeCode->itemtype,
'yes' => $yesItypeCode->itemtype,
'no' => $noItypeCode->itemtype,
'inherit' => $inheritItypeCode->itemtype,
};
foreach my $syspref ('hardyes','softyes','softno','hardno'){
foreach my $syspref ( 'hardyes', 'softyes', 'softno', 'hardno' ) {
t::lib::Mocks::mock_preference( 'checkprevcheckout', $syspref );
foreach my $itemtype_setting ('yes','no','inherit'){ #itemtype Setting
my $item = $builder->build_sample_item( { itype => $itypeCode->{$itemtype_setting} } );
foreach my $categorie_settings('yes','no','inherit'){
foreach my $itemtype_setting ( 'yes', 'no', 'inherit' ) { #itemtype Setting
my $item = $builder->build_sample_item( { itype => $itypeCode->{$itemtype_setting} } );
foreach my $categorie_settings ( 'yes', 'no', 'inherit' ) {
my $catCode = $categorie_settings . 'Cat';
foreach my $patron_setting('yes','no','inherit'){
foreach my $patron_setting ( 'yes', 'no', 'inherit' ) {
my $result = undef;
$result = 1 if($syspref eq 'hardyes');
$result = 0 if($syspref eq 'hardno');
$result = 1 if(!defined $result && $itemtype_setting eq 'yes');
$result = 0 if(!defined $result && $itemtype_setting eq 'no');
$result = 1 if(!defined $result && $patron_setting eq 'yes');
$result = 0 if(!defined $result && $patron_setting eq 'no');
$result = 1 if(!defined $result && $categorie_settings eq 'yes');
$result = 0 if(!defined $result && $categorie_settings eq 'no');
$result = 1 if(!defined $result && $syspref eq 'softyes');
$result = 0 if(!defined $result && $syspref eq 'softno');
$result = 1 if ( $syspref eq 'hardyes' );
$result = 0 if ( $syspref eq 'hardno' );
$result = 1 if ( !defined $result && $itemtype_setting eq 'yes' );
$result = 0 if ( !defined $result && $itemtype_setting eq 'no' );
$result = 1 if ( !defined $result && $patron_setting eq 'yes' );
$result = 0 if ( !defined $result && $patron_setting eq 'no' );
$result = 1 if ( !defined $result && $categorie_settings eq 'yes' );
$result = 0 if ( !defined $result && $categorie_settings eq 'no' );
$result = 1 if ( !defined $result && $syspref eq 'softyes' );
$result = 0 if ( !defined $result && $syspref eq 'softno' );
my $kpatron = $builder->build(
{
source => 'Borrower',