Bugzilla – Attachment 183407 Details for
Bug 20644
Per itemtype setting for CheckPrevCheckout
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20644: (QA follow-up) Remove duplicate variable
Bug-20644-QA-follow-up-Remove-duplicate-variable.patch (text/plain), 8.68 KB, created by
Lisette Scheer
on 2025-06-20 20:33:35 UTC
(
hide
)
Description:
Bug 20644: (QA follow-up) Remove duplicate variable
Filename:
MIME Type:
Creator:
Lisette Scheer
Created:
2025-06-20 20:33:35 UTC
Size:
8.68 KB
patch
obsolete
>From be0738fa366fc38a6a5df741d26a9c045e33b62b Mon Sep 17 00:00:00 2001 >From: Lisette Scheer <lisette@bywatersolutions.com> >Date: Fri, 20 Jun 2025 20:19:51 +0000 >Subject: [PATCH] Bug 20644: (QA follow-up) Remove duplicate variable > >I removed a duplicate variable and tidied. >--- > Koha/Patron.pm | 2 +- > admin/itemtypes.pl | 1 - > .../prog/en/modules/admin/itemtypes.tt | 18 ++--- > t/db_dependent/Patron/Borrower_PrevCheckout.t | 71 ++++++++++--------- > 4 files changed, 48 insertions(+), 44 deletions(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 7fd2b7ab1ca..27b01a3a482 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -828,7 +828,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 >diff --git a/admin/itemtypes.pl b/admin/itemtypes.pl >index 172fe249b19..1acc49bdd5b 100755 >--- a/admin/itemtypes.pl >+++ b/admin/itemtypes.pl >@@ -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 >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt >index 585ad224ed2..f442006b24a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt >@@ -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> >diff --git a/t/db_dependent/Patron/Borrower_PrevCheckout.t b/t/db_dependent/Patron/Borrower_PrevCheckout.t >index c8d3ab0fc55..ac9b0548766 100755 >--- a/t/db_dependent/Patron/Borrower_PrevCheckout.t >+++ b/t/db_dependent/Patron/Borrower_PrevCheckout.t >@@ -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', >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 20644
:
156974
|
156977
|
163627
|
165585
|
165586
|
165661
|
165662
|
170619
|
170620
|
170621
|
170622
|
176538
|
176539
|
178093
|
178094
|
179812
|
179813
|
179814
|
179815
|
180375
|
181680
|
181681
|
182469
|
182470
|
182476
|
182477
|
182787
|
182788
|
183403
|
183404
|
183405
|
183406
| 183407 |
183408