From 43d2c481317bf8fa3f4fa4cd5458d308960b336b Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Wed, 27 May 2020 07:22:59 -0400 Subject: [PATCH] Bug 6918: Add syspref --- C4/Reserves.pm | 4 ++-- installer/data/mysql/atomicupdate/bug_6918.perl | 10 ++++++++++ installer/data/mysql/sysprefs.sql | 1 + .../prog/en/modules/admin/preferences/circulation.pref | 6 ++++++ 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_6918.perl diff --git a/C4/Reserves.pm b/C4/Reserves.pm index e1ea0705f5..8db3a468eb 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -1290,7 +1290,7 @@ sub IsAvailableForItemLevelRequest { return !$items_any_available; } else { # on_shelf_holds == 0 "If any unavailable" (the description is rather cryptic and could still be improved) - return $item->notforloan < 0 || $item->onloan || IsItemOnHoldAndFound( $item->itemnumber ); + return ( C4::Context->preference('AllowOnOrderOnShelfHolds') ? $item->notforloan < 0 : 0 ) || $item->onloan || IsItemOnHoldAndFound( $item->itemnumber ); } } @@ -1320,7 +1320,7 @@ sub ItemsAnyAvailableForHold { $any_available = 1 unless $i->itemlost - || $i->notforloan != 0 + || C4::Context->preference('AllowOnOrderOnShelfHolds') ? $i->notforloan != 0 : $i->notforloan > 0 || $i->withdrawn || $i->onloan || IsItemOnHoldAndFound( $i->id ) diff --git a/installer/data/mysql/atomicupdate/bug_6918.perl b/installer/data/mysql/atomicupdate/bug_6918.perl new file mode 100644 index 0000000000..9eb5fa22d1 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_6918.perl @@ -0,0 +1,10 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + $dbh->do(q{ + INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES + ('AllowOnOrderOnShelfHolds', '0', NULL, 'Allow on order items to be placed on hold even if on shelf holds are not allowed', 'YesNo'); + }); + + # Always end with this (adjust the bug info) + NewVersion( $DBversion, 6918, "Can't place holds on 'on order' items with AllowOnShelfHolds off"); +} diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 4ad73ef827..adf2d538da 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -34,6 +34,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('AllowMultipleIssuesOnABiblio',1,'Allow/Don\'t allow patrons to check out multiple items from one biblio','','YesNo'), ('AllowNotForLoanOverride','0','','If ON, Koha will allow the librarian to loan a not for loan item.','YesNo'), ('AllowOfflineCirculation','0','','If on, enables HTML5 offline circulation functionality.','YesNo'), +('AllowOnOrderOnShelfHolds', '0', NULL, 'Allow on order items to be placed on hold even if on shelf holds are not allowed', 'YesNo'), ('AllowPatronToControlAutorenewal','0',NULL,'If enabled, patrons will have a field in their account to choose whether their checkouts are auto renewed or not','YesNo'), ('AllowPatronToSetCheckoutsVisibilityForGuarantor', '0', NULL, 'If enabled, the patron can set checkouts to be visible to his or her guarantor', 'YesNo'), ('AllowPatronToSetFinesVisibilityForGuarantor', '0', NULL, 'If enabled, the patron can set fines to be visible to his or her guarantor', '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 92137896dc..6cca2b4d39 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 @@ -635,6 +635,12 @@ Circulation: yes: Allow no: "Don't allow" - hold fulfillment to be limited by itemtype. + - + - pref: AllowOnOrderOnShelfHolds + choices: + yes: Allow + no: "Don't allow" + - on order items ( not for loan < 0 ) to be holdable when on-shelf holds are otherwise not allowed. - - pref: AllowRenewalIfOtherItemsAvailable choices: -- 2.24.1 (Apple Git-126)