From 22aea1d61b6ed8ce1c3cd0b8e980b08c7572e939 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 28 Jun 2019 14:07:39 -0400 Subject: [PATCH] Bug 23233: AllowItemsOnHoldCheckout is misnamed and does not indicate it is for SIP-based checkouts only MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The system preference AllowItemsOnHoldCheckout only affects SIP based checkouts. I believe we should rename it AllowItemsOnHoldCheckoutSIP so it matches AllowItemsOnHoldCheckoutSCO. We should also update the description as well. As far as I know AllowItemsOnHoldCheckout has never affected anything except SIP traffic. That does not preclude the addition of another AllowItemsOnHoldCheckout syspref that would affect the staff interface, but that would be an enhancement and is outside the scope of this bug report. Test Plan: 1) Test AllowItemsOnHoldCheckout via SIP 2) Apply this patch 3) Test AllowItemsOnHoldCheckoutSIP via SIP 4) Note there is no difference! 5) Note the syspref description has been update to mention SIP Signed-off-by: Joonas Kylmälä Signed-off-by: Jonathan Druart --- C4/Items.pm | 4 ++-- C4/SIP/ILS/Transaction/Checkout.pm | 2 +- C4/UsageStats.pm | 2 +- Koha/Item.pm | 2 +- installer/data/mysql/atomicupdate/bug_23233.perl | 12 ++++++++++++ installer/data/mysql/sysprefs.sql | 2 +- .../prog/en/modules/admin/preferences/circulation.pref | 6 ++++-- 7 files changed, 22 insertions(+), 8 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_23233.perl diff --git a/C4/Items.pm b/C4/Items.pm index b81fb0aa17..c5d248a72f 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -950,7 +950,7 @@ sub GetItemsInfo { holding.opac_info as holding_branch_opac_info, home.opac_info as home_branch_opac_info "; - $query .= ",IF(tmp_holdsqueue.itemnumber,1,0) AS has_pending_hold" if !C4::Context->preference('AllowItemsOnHoldCheckout'); + $query .= ",IF(tmp_holdsqueue.itemnumber,1,0) AS has_pending_hold" if !C4::Context->preference('AllowItemsOnHoldCheckoutSIP'); $query .= " FROM items LEFT JOIN branches AS holding ON items.holdingbranch = holding.branchcode @@ -964,7 +964,7 @@ sub GetItemsInfo { LEFT JOIN itemtypes ON itemtypes.itemtype = " . (C4::Context->preference('item-level_itypes') ? 'items.itype' : 'biblioitems.itemtype'); $query .= " - LEFT JOIN tmp_holdsqueue USING (itemnumber)" if !C4::Context->preference('AllowItemsOnHoldCheckout'); + LEFT JOIN tmp_holdsqueue USING (itemnumber)" if !C4::Context->preference('AllowItemsOnHoldCheckoutSIP'); $query .= q| LEFT JOIN localization ON itemtypes.itemtype = localization.code AND localization.entity = 'itemtypes' diff --git a/C4/SIP/ILS/Transaction/Checkout.pm b/C4/SIP/ILS/Transaction/Checkout.pm index 91a22be192..e7439742dc 100644 --- a/C4/SIP/ILS/Transaction/Checkout.pm +++ b/C4/SIP/ILS/Transaction/Checkout.pm @@ -57,7 +57,7 @@ sub do_checkout { my $borrower = $patron->unblessed; $debug and warn "do_checkout borrower: . " . Dumper $borrower; my ($issuingimpossible, $needsconfirmation) = _can_we_issue($patron, $barcode, - C4::Context->preference("AllowItemsOnHoldCheckout") + C4::Context->preference("AllowItemsOnHoldCheckoutSIP") ); my $noerror=1; # If set to zero we block the issue diff --git a/C4/UsageStats.pm b/C4/UsageStats.pm index 20ab194fc8..0d864af01c 100644 --- a/C4/UsageStats.pm +++ b/C4/UsageStats.pm @@ -134,7 +134,7 @@ sub BuildReport { AgeRestrictionOverride AllFinesNeedOverride AllowFineOverride - AllowItemsOnHoldCheckout + AllowItemsOnHoldCheckoutSIP AllowItemsOnHoldCheckoutSCO AllowNotForLoanOverride AllowRenewalLimitOverride diff --git a/Koha/Item.pm b/Koha/Item.pm index a9cca3f727..cfdef805be 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -382,7 +382,7 @@ This method checks the tmp_holdsqueue to see if this item has been selected for sub has_pending_hold { my ( $self ) = @_; my $pending_hold = $self->_result->tmp_holdsqueues; - return !C4::Context->preference('AllowItemsOnHoldCheckout') && $pending_hold->count ? 1: 0; + return !C4::Context->preference('AllowItemsOnHoldCheckoutSIP') && $pending_hold->count ? 1: 0; } =head3 as_marc_field diff --git a/installer/data/mysql/atomicupdate/bug_23233.perl b/installer/data/mysql/atomicupdate/bug_23233.perl new file mode 100644 index 0000000000..409b219692 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_23233.perl @@ -0,0 +1,12 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + $dbh->do(q{ + UPDATE systempreferences SET + variable = 'AllowItemsOnHoldCheckoutSIP', + explanation = 'Do not generate RESERVE_WAITING and RESERVED warning when checking out items reserved to someone else via SIP. This allows self checkouts for those items.' + WHERE variable = 'AllowItemsOnHoldCheckout' + }); + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug XXXXX - description)\n"; +} diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 9fc3d5821e..6a68769eda 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -27,7 +27,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('AllowHoldsOnDamagedItems','1','','Allow hold requests to be placed on damaged items','YesNo'), ('AllowHoldsOnPatronsPossessions','1',NULL,'Allow holds on records that patron have items of it','YesNo'), ('AllowCheckoutNotes', '0', NULL, 'Allow patrons to submit notes about checked out items.','YesNo'), -('AllowItemsOnHoldCheckout','0','','Do not generate RESERVE_WAITING and RESERVED warning when checking out items reserved to someone else. This allows self checkouts for those items.','YesNo'), +('AllowItemsOnHoldCheckoutSIP','0','','Do not generate RESERVE_WAITING and RESERVED warning when checking out items reserved to someone else via SIP. This allows self checkouts for those items.','YesNo'), ('AllowItemsOnHoldCheckoutSCO','0','','Do not generate RESERVE_WAITING and RESERVED warning in the SCO module when checking out items reserved to someone else. This allows self checkouts for those items.','YesNo'), ('AllowMultipleCovers','0','1','Allow multiple cover images to be attached to each bibliographic record.','YesNo'), ('AllowMultipleIssuesOnABiblio',1,'Allow/Don\'t allow patrons to check out multiple items from one biblio','','YesNo'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref index e949eac982..54a8ef11fe 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -202,11 +202,13 @@ Circulation: no: "Don't allow" - staff to renew items that are on hold by manually specifying a due date. - - - pref: AllowItemsOnHoldCheckout + - pref: AllowItemsOnHoldCheckoutSIP choices: yes: Allow no: "Don't allow" - - checkouts of items reserved to someone else. If allowed do not generate RESERVE_WAITING and RESERVED warning. This allows self checkouts for those items. If using the holds queue items with pending holds will be marked as "unavailable" if this set to "Don't Allow". + - checkouts of items reserved to someone else via SIP checkout messages. + - If allowed do not generate RESERVE_WAITING and RESERVED warning. + - This allows self checkouts for those items. If using the holds queue items with pending holds will be marked as "unavailable" if this set to "Don't Allow". - - pref: AllowItemsOnHoldCheckoutSCO choices: -- 2.11.0