From 4521442c0ac6638d4d5ce7f64d95f30a015b8cbe Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Wed, 8 Jan 2025 15:11:55 +0000 Subject: [PATCH] Bug 23010: Add system preference PreventWithdrawingItemsStatus To test: 1. APPLY PATCH, updatedatabase, and restart_all 2. Search for the system preference, PreventWithDrawingItemsStatus 3. Select both in transit and checked out, then save 4. Find an item and put it in transit. 5. Now from the item detail page, go to manage items > edit item 6. Using the item that was put in transit, attempt to change the status to withdrawn. 7. You should see an error at the top of the page 'In transit item cannot be withdrawn.' Make sure the item did not get marked as withdrawn. 8. Using a different item, do a checkout 9. Now from the item detail page, go to manage items > edit item 10. Using the checked out item, attempt to change the status to withdrawn. 11. vYou should see an error at the top of the page 'Onloan item cannot be withdrawn.' Make sure the item did not get marked as withdrawn. 12. Now, using the in transit item, go to the items tab. ( catalogue/moredetail.pl?biblionumber=x ) 13. Under Statuses, attempt to withdraw the item. 14. You should see an error near the top of the page "Cannot withdraw item in transit". 15. Now, using the checked out item, go to the items tab. ( catalogue/moredetail.pl?biblionumber=144 ) 16. Under Statuses, attempt to withdraw the item. 17. You should see an error near the top of the page "Cannot withdraw checked out item.". 18. Using both the in-transit and checked out item, attempt to modify the status through batchMod. 19. Ensure that the items are not being updated to withdrawn. 20. Turn off PreventWithDrawingItemsStatus system preferece. 21. Going through each of the steps again, except this time your items should successfully withdraw. prove t/db_dependent/Koha/Item.t Signed-off-by: Roman Dolny --- ..._23010_add_PreventWithdrawingItemsStatus.pl | 18 ++++++++++++++++++ installer/data/mysql/mandatory/sysprefs.sql | 1 + .../modules/admin/preferences/circulation.pref | 7 +++++++ .../prog/js/cataloging_additem.js | 2 +- 4 files changed, 27 insertions(+), 1 deletion(-) create mode 100755 installer/data/mysql/atomicupdate/bug_23010_add_PreventWithdrawingItemsStatus.pl diff --git a/installer/data/mysql/atomicupdate/bug_23010_add_PreventWithdrawingItemsStatus.pl b/installer/data/mysql/atomicupdate/bug_23010_add_PreventWithdrawingItemsStatus.pl new file mode 100755 index 0000000000..e995466120 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_23010_add_PreventWithdrawingItemsStatus.pl @@ -0,0 +1,18 @@ +use Modern::Perl; +use Koha::Installer::Output qw(say_warning say_success say_info); + +return { + bug_number => "23010", + description => "Add new PreventWithDrawingItemsStatus system preference", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + $dbh->do(q{ + INSERT IGNORE INTO systempreferences (`variable`,`value`,`options`,`explanation`,`type`) + VALUES ('PreventWithDrawingItemsStatus',NULL,'','Prevent the withdrawing of items based on statuses','Choice') + }); + + say $out "Added new system preference 'PreventWithDrawingItemsStatus'"; + }, +}; diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index 336f05bd29..2c9901586b 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -630,6 +630,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('PreservationNotForLoanDefaultTrainIn', '', '', 'Not for loan to apply to items removed from the preservation waiting list', 'TextArea'), ('PreservationNotForLoanWaitingListIn', '', '', 'Not for loan to apply to items added to the preservation waiting list', 'TextArea'), ('PreserveSerialNotes','1','','When a new "Expected" issue is generated, should it be prefilled with last created issue notes?','YesNo'), +('PreventWithdrawingItemsStatus', '1', '', 'Prevent the withdrawing of items based on certain statuses' , 'multiple'), ('previousIssuesDefaultSortOrder','asc','asc|desc','Specify the sort order of Previous Issues on the circulation page','Choice'), ('PrintNoticesMaxLines','0','','If greater than 0, sets the maximum number of lines an overdue notice will print. If the number of items is greater than this number, the notice will end with a warning asking the borrower to check their online account for a full list of overdue items.','Integer'), ('PrivacyPolicyConsent','','Enforced|Permissive|Disabled','Data privacy policy consent in the OPAC', 'Choice'), 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 65cf0b5030..6c7e93c1c8 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 @@ -677,6 +677,13 @@ Circulation: 1: Block 0: "Don't block" - returning of items that have been withdrawn. + - + - "Prevent the ability to withdraw items with the following statuses:" + - pref: PreventWithdrawingItemsStatus + multiple: + intransit: In-transit + checkedout: Checked out + - - - pref: BlockReturnOfLostItems choices: diff --git a/koha-tmpl/intranet-tmpl/prog/js/cataloging_additem.js b/koha-tmpl/intranet-tmpl/prog/js/cataloging_additem.js index d4f28bbf84..cbaaea082d 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/cataloging_additem.js +++ b/koha-tmpl/intranet-tmpl/prog/js/cataloging_additem.js @@ -4,7 +4,7 @@ var browser = KOHA.browser(searchid, parseInt(biblionumber, 10)); browser.show(); $(document).ready(function(){ - + $('#cataloguing_additem_newitem #f[action^="/cgi-bin/koha/cataloguing/additem.pl"]') // Remove the onclick event defined in browser.js, // otherwise the deletion confirmation will not work correctly $('a[href*="biblionumber="]').off('click'); -- 2.39.5