From c312d6e061189ea0ee55cfd794cd2b3a3c4df99a Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Thu, 7 Nov 2024 13:33:02 +0100 Subject: [PATCH] Bug 38387: Remove remaining references to deleted system preferences Namely, UpdateItemLocationOnCheckin and UpdateItemLocationOnCheckout --- C4/Circulation.pm | 2 +- installer/data/mysql/mandatory/sysprefs.sql | 2 - .../admin/preferences/circulation.pref | 35 ---- .../prog/js/pages/preferences.js | 27 --- t/db_dependent/Circulation/issue.t | 194 +----------------- 5 files changed, 2 insertions(+), 258 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index ee678b8824..03ad49d0f9 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1738,7 +1738,7 @@ sub AddIssue { $patron->update_lastseen('check_out'); if ( $item_object->location && $item_object->location eq 'CART' && ( !$item_object->permanent_location || $item_object->permanent_location ne 'CART' ) ) { - ## Item was moved to cart via UpdateItemLocationOnCheckin, anything issued should be taken off the cart. + ## Item was moved to cart via automatic item modification on checkin, anything issued should be taken off the cart. CartToShelf( $item_object->itemnumber ); } diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index 34ada9d837..b94f0d3f5a 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -818,8 +818,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('UniqueItemFields','barcode','','Pipe-separated list of fields that should be unique (used in acquisition module for item creation). Fields must be valid SQL column names of items table','Free'), ('UnseenRenewals','0','','Allow renewals to be recorded as "unseen" by the library, and count against the patrons unseen renewals limit.','YesNo'), ('UnsubscribeReflectionDelay','',NULL,'Delay for locking unsubscribers', 'Integer'), -('UpdateItemLocationOnCheckin', '', 'NULL', 'This is a list of value pairs.\n Examples:\n\nPROC: FIC - causes an item in the Processing Center location to be updated into the Fiction location on check in.\nFIC: GEN - causes an item in the Fiction location to be updated into the General stacks location on check in.\n_BLANK_:FIC - causes an item that has no location to be updated into the Fiction location on check in.\nFIC: _BLANK_ - causes an item in location FIC to be updated to a blank location on check in.\n_ALL_:FIC - causes all items to be updated into the Fiction location on check in.\nPROC: _PERM_ - causes an item that is in the Processing Center to be updated to it''s permanent location.\n\nGeneral rule: if the location value on the left matches the item''s current location, it will be updated to match the location value on the right.\nNote: PROC and CART are special values, for these locations only can location and permanent_location differ, in all other cases an update will affect both. Items in the CART location will be returned to their permanent location on checkout.\n\nThe special term _BLANK_ may be used on either side of a value pair to update or remove the location from items with no location assigned.\nThe special term _ALL_ is used on the left side of the colon (:) to affect all items.\nThe special term _PERM_ is used on the right side of the colon (:) to return items to their permanent location.', 'Free'), -('UpdateItemLocationOnCheckout', '', 'NULL', 'This is a list of value pairs.\n Examples:\n\nPROC: FIC - causes an item in the Processing Center location to be updated into the Fiction location on check out.\nFIC: GEN - causes an item in the Fiction location to be updated into the General stacks location on check out.\n_BLANK_:FIC - causes an item that has no location to be updated into the Fiction location on check out.\nFIC: _BLANK_ - causes an item in location FIC to be updated to a blank location on check out.\n_ALL_:FIC - causes all items to be updated into the Fiction location on check out.\nPROC: _PERM_ - causes an item that is in the Processing Center to be updated to it''s permanent location.\n\nGeneral rule: if the location value on the left matches the item''s current location, it will be updated to match the location value on the right.\nNote: PROC and CART are special values, for these locations only can location and permanent_location differ, in all other cases an update will affect both. Items in the CART location will be returned to their permanent location on checkout.\n\nThe special term _BLANK_ may be used on either side of a value pair to update or remove the location from items with no location assigned.\nThe special term _ALL_ is used on the left side of the colon (:) to affect all items.\nThe special term _PERM_ is used on the right side of the colon (:) to return items to their permanent location.', 'Free'), ('UpdateItemLostStatusWhenPaid', '0', NULL, 'Allows the status of lost items to be automatically changed to lost and paid for when paid for', 'Integer'), ('UpdateItemLostStatusWhenWriteoff', '0', NULL, 'Allows the status of lost items to be automatically changed to lost and paid for when written off', 'Integer'), ('UpdateItemWhenLostFromHoldList','',NULL,'This is a list of values to update an item when it is marked as lost from the holds to pull screen','Free'), 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 d8497227a8..e6a09f4d5b 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 @@ -524,23 +524,6 @@ Circulation: - "
itype: [NEWBK,\"\"]" - "
NOTE: The word 'NULL' can be used to block renewal on undefined fields, while an empty string \"\" will block on an empty (but defined) field." - "
Configuration: Collections (CCODE) | Item types" - - - - pref: UpdateItemLocationOnCheckout - type: textarea - syntax: text/x-yaml - class: code - - "This is a list of value pairs. The first value is followed immediately by colon space then the second value.

" - - "Examples:
" - - "PROC: FIC - causes an item in the Processing Center location to be updated into the Fiction location on check out.
" - - "FIC: GEN - causes an item in the Fiction location to be updated into the General stacks location on check out.
" - - "_BLANK_: FIC - causes an item that has no location to be updated into the Fiction location on check out.
" - - "FIC: _BLANK_ - causes an item in location FIC to be updated to a blank location on check out.
" - - "_ALL_: FIC - causes all items to be updated into the Fiction location on check out.
" - - "PROC: _PERM_ - causes an item that is in the Processing Center to be updated to it's permanent location.

" - - "General rule: if the location value on the left of the colon (:) matches the item's current location, it will be updated to match the location value on the right of the colon (:).
" - - "Note: PROC and CART are special values, for these locations the location and permanent_location can differ, in all other cases an update will affect both. Items in the CART location will be returned to their permanent location on checkout.
" - - "The special term _BLANK_ may be used on either side of a value pair to update or remove the location from items with no location assigned.
" - - "The special term _ALL_ is used on the left side of the colon (:) to affect all items, and overrides all other rules." - - pref: UpdateNotForLoanStatusOnCheckout type: textarea @@ -692,24 +675,6 @@ Circulation: 1: Do 0: "Don't" - calculate and update overdue charges when an item is returned with a backdated return date. - - - - pref: UpdateItemLocationOnCheckin - type: textarea - syntax: text/x-yaml - class: code - - "This is a list of value pairs. The first value is followed immediately by colon space then the second value." - - "Valid values are LOC authorised values, _BLANK_, _PERM_, and _ALL_.

" - - "Examples:
" - - "PROC: FIC - causes an item in the Processing center location to be updated into the Fiction location on check in.
" - - "FIC: GEN - causes an item in the Fiction location to be updated into the General stacks location on check in.
" - - "_BLANK_: FIC - causes an item that has no location to be updated into the Fiction location on check in.
" - - "FIC: _BLANK_ - causes an item in location FIC to be updated to a blank location on check in.
" - - "_ALL_: FIC - causes all items to be updated into the Fiction location on check in.
" - - "PROC: _PERM_ - causes an item that is in the Processing center to be updated to it's permanent location.

" - - "General rule: if the location value on the left of the colon (:) matches the item's current location, it will be updated to match the location value on the right of the colon (:).
" - - "Note: PROC and CART are special values, for these locations the location and permanent_location can differ, in all other cases an update will affect both. Items in the CART location will be returned to their permanent location on checkout.
" - - "The special term _BLANK_ may be used on either side of a value pair to update or remove the location from items with no location assigned.
" - - "The special term _ALL_ is used on the left side of the colon (:) to affect all items, and overrides all other rules." - - pref: UpdateNotForLoanStatusOnCheckin type: textarea diff --git a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js b/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js index 58eae20d35..a3be5b2a34 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js +++ b/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js @@ -319,33 +319,6 @@ if (search_jumped) { document.location.hash = "jumped"; } -$( - "#pref_UpdateItemLocationOnCheckin, #pref_UpdateItemLocationOnCheckout" -).change(function () { - var the_text = $(this).val(); - var alert_text = ""; - if (the_text.indexOf("_ALL_:") != -1) - alert_text = - __("Note: _ALL_ value will override all other values") + "\n"; - var split_text = the_text.split("\n"); - var alert_issues = ""; - var issue_count = 0; - var reg_check = /.*:\s.*/; - for (var i = 0; i < split_text.length; i++) { - if (!split_text[i].match(reg_check) && split_text[i].length) { - alert_issues += split_text[i] + "\n"; - issue_count++; - } - } - if (issue_count) - alert_text += - "\n" + - __("The following values are not formatted correctly:") + - "\n" + - alert_issues; - if (alert_text.length) alert(alert_text); -}); - $(".prefs-tab form").each(function () { $(this).validate({ rules: {}, diff --git a/t/db_dependent/Circulation/issue.t b/t/db_dependent/Circulation/issue.t index 8b91a27a88..961ffc4d13 100755 --- a/t/db_dependent/Circulation/issue.t +++ b/t/db_dependent/Circulation/issue.t @@ -17,7 +17,7 @@ use Modern::Perl; -use Test::More tests => 67; +use Test::More tests => 39; use DateTime::Duration; use t::lib::Mocks; @@ -490,89 +490,6 @@ is( q{UpdateNotForLoanStatusOnCheckin does not update notforloan value for specific itemtype from 1 with setting "1: ONLYMESSAGE"} ); -my $itemnumber2 = Koha::Item->new( - { - biblionumber => $biblionumber, - barcode => 'barcode_4', - itemcallnumber => 'callnumber4', - homebranch => $branchcode_1, - holdingbranch => $branchcode_1, - location => 'FIC', - itype => $itemtype - } -)->store->itemnumber; - -t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckout', q{} ); -t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', q{} ); - -AddReturn( 'barcode_4', $branchcode_1 ); -my $item2 = Koha::Items->find( $itemnumber2 ); -ok( $item2->location eq 'FIC', 'UpdateItemLocationOnCheckin does not modify value when not enabled' ); - -t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', 'FIC: GEN' ); -$log_count_before = $schema->resultset('ActionLog')->search({module => 'CATALOGUING'})->count(); -AddReturn( 'barcode_4', $branchcode_1 ); -$item2 = Koha::Items->find( $itemnumber2 ); -is( $item2->location, 'GEN', q{UpdateItemLocationOnCheckin updates location value from 'FIC' to 'GEN' with setting "FIC: GEN"} ); -is( $item2->permanent_location, 'GEN', q{UpdateItemLocationOnCheckin updates permanent_location value from 'FIC' to 'GEN' with setting "FIC: GEN"} ); -$log_count_after = $schema->resultset('ActionLog')->search({module => 'CATALOGUING'})->count(); -is($log_count_before, $log_count_after, "Change from UpdateNotForLoanStatusOnCheckin is not logged"); -AddReturn( 'barcode_4', $branchcode_1 ); -$item2 = Koha::Items->find( $itemnumber2 ); -ok( $item2->location eq 'GEN', q{UpdateItemLocationOnCheckin does not update location value from 'GEN' with setting "FIC: GEN"} ); - -t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', '_ALL_: CART' ); -AddReturn( 'barcode_4', $branchcode_1 ); -$item2 = Koha::Items->find( $itemnumber2 ); -ok( $item2->location eq 'CART', q{UpdateItemLocationOnCheckin updates location value from 'GEN' with setting "_ALL_: CART"} ); -Koha::Item::Transfer->new({ - itemnumber => $itemnumber2, - frombranch => $branchcode_2, - tobranch => $branchcode_1, - datesent => '2020-01-01' -})->store; -AddReturn( 'barcode_4', $branchcode_1 ); -$item2 = Koha::Items->find( $itemnumber2 ); -ok( $item2->location eq 'CART', q{UpdateItemLocationOnCheckin updates location value from 'GEN' with setting "_ALL_: CART" when transfer filled} ); - -ok( $item2->permanent_location eq 'GEN', q{UpdateItemLocationOnCheckin does not update permanent_location value from 'GEN' with setting "_ALL_: CART"} ); -AddIssue( $patron_1, 'barcode_4', $daysago10,0, $today, '' ); -$item2 = Koha::Items->find( $itemnumber2 ); -ok( $item2->location eq 'GEN', q{Location updates from 'CART' to permanent location on issue} ); - -t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', "GEN: _BLANK_\n_BLANK_: PROC\nPROC: _PERM_" ); -AddReturn( 'barcode_4', $branchcode_1 ); -$item2 = Koha::Items->find( $itemnumber2 ); -ok( $item2->location eq '', q{UpdateItemLocationOnCheckin updates location value from 'GEN' to '' with setting "GEN: _BLANK_"} ); -AddReturn( 'barcode_4', $branchcode_1 ); -$item2 = Koha::Items->find( $itemnumber2 ); -ok( $item2->location eq 'PROC' , q{UpdateItemLocationOnCheckin updates location value from '' to 'PROC' with setting "_BLANK_: PROC"} ); -ok( $item2->permanent_location eq '' , q{UpdateItemLocationOnCheckin does not update permanent_location value from '' to 'PROC' with setting "_BLANK_: PROC"} ); -AddReturn( 'barcode_4', $branchcode_1 ); -$item2 = Koha::Items->find( $itemnumber2 ); -ok( $item2->location eq '' , q{UpdateItemLocationOnCheckin updates location value from 'PROC' to '' with setting "PROC: _PERM_" } ); -ok( $item2->permanent_location eq '' , q{UpdateItemLocationOnCheckin does not update permanent_location from '' with setting "PROC: _PERM_" } ); - -# Bug 28472 -my $itemnumber3 = Koha::Item->new( - { - biblionumber => $biblionumber, - barcode => 'barcode_5', - itemcallnumber => 'callnumber5', - homebranch => $branchcode_1, - holdingbranch => $branchcode_1, - location => undef, - itype => $itemtype - } -)->store->itemnumber; - -t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', '_ALL_: CART' ); -AddReturn( 'barcode_5', $branchcode_1 ); -my $item3 = Koha::Items->find( $itemnumber3 ); -is( $item3->location, 'CART', q{UpdateItemLocationOnCheckin updates location value from NULL (i.e. the item has no shelving location set) to 'CART' with setting "_ALL_: CART"} ); - - - # Bug 14640 - Cancel the hold on checking out if asked Koha::Items->find({ barcode => $barcode_1 })->notforloan('0')->store; my $reserve_id = AddReserve( @@ -665,114 +582,5 @@ AddReturn( 'barcode_6', $branchcode_1 ); $item = Koha::Items->find( $itemnumber4 ); ok( $item->notforloan eq 0, q{UpdateNotForLoanStatusOnCheckout does not update notforloan value from 0 with setting "-1: 0"} ); -# Bug 21159 - Update item shelving location on checkout -my $itemnumber5 = Koha::Item->new( - { - biblionumber => $biblionumber, - barcode => 'barcode_7', - itemcallnumber => 'callnumber3', - homebranch => $branchcode_1, - holdingbranch => $branchcode_1, - location => 'FIC', - itype => $itemtype - }, -)->store->itemnumber; - -t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckout', q{} ); -t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', q{} ); -AddIssue( $patron_1, 'barcode_7' ); -my $item5 = Koha::Items->find($itemnumber5); -ok( $item5->location eq 'FIC', 'UpdateItemLocationOnCheckout does not modify value when not enabled' ); - -#--- -AddReturn( 'barcode_7', $branchcode_1 ); -t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckout', 'FIC: GEN' ); -$log_count_before = $schema->resultset('ActionLog')->search( { module => 'CATALOGUING' } )->count(); -AddIssue( $patron_1, 'barcode_7' ); -$item5 = Koha::Items->find($itemnumber5); -is( - $item5->location, 'GEN', - q{UpdateItemLocationOnCheckout updates location value from 'FIC' to 'GEN' with setting "FIC: GEN"} -); -is( - $item5->permanent_location, 'GEN', - q{UpdateItemLocationOnCheckout updates permanent_location value from 'FIC' to 'GEN' with setting "FIC: GEN"} -); -$log_count_after = $schema->resultset('ActionLog')->search( { module => 'CATALOGUING' } )->count(); -is( $log_count_before, $log_count_after, "Change from UpdateNotForLoanStatusOnCheckout is not logged" ); -AddReturn( 'barcode_7', $branchcode_1 ); -AddIssue( $patron_1, 'barcode_7' ); -$item5 = Koha::Items->find($itemnumber5); -ok( - $item5->location eq 'GEN', - q{UpdateItemLocationOnCheckout does not update location value from 'GEN' with setting "FIC: GEN"} -); - -t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckout', '_ALL_: CART' ); -AddReturn( 'barcode_7', $branchcode_1 ); -AddIssue( $patron_1, 'barcode_7' ); -$item5 = Koha::Items->find($itemnumber5); -ok( - $item5->location eq 'CART', - q{UpdateItemLocationOnCheckout updates location value from 'GEN' with setting "_ALL_: CART"} -); -ok( - $item5->permanent_location eq 'GEN', - q{UpdateItemLocationOnCheckout does not update permanent_location value from 'GEN' with setting "_ALL_: CART"} -); - -$item5->location('GEN')->store; -t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckout', "GEN: _BLANK_\n_BLANK_: PROC\nPROC: _PERM_" ); -AddReturn( 'barcode_7', $branchcode_1 ); -AddIssue( $patron_1, 'barcode_7' ); -$item5 = Koha::Items->find($itemnumber5); -ok( - $item5->location eq '', - q{UpdateItemLocationOnCheckout updates location value from 'GEN' to '' with setting "GEN: _BLANK_"} -); -AddReturn( 'barcode_7', $branchcode_1 ); -AddIssue( $patron_1, 'barcode_7' ); -$item5 = Koha::Items->find($itemnumber5); -ok( - $item5->location eq 'PROC', - q{UpdateItemLocationOnCheckout updates location value from '' to 'PROC' with setting "_BLANK_: PROC"} -); -ok( - $item5->permanent_location eq '', - q{UpdateItemLocationOnCheckout does not update permanent_location value from '' to 'PROC' with setting "_BLANK_: PROC"} -); -AddReturn( 'barcode_7', $branchcode_1 ); -AddIssue( $patron_1, 'barcode_7' ); -$item5 = Koha::Items->find($itemnumber5); -ok( - $item5->location eq '', - q{UpdateItemLocationOnCheckout updates location value from 'PROC' to '' with setting "PROC: _PERM_" } -); -ok( - $item5->permanent_location eq '', - q{UpdateItemLocationOnCheckout does not update permanent_location from '' with setting "PROC: _PERM_" } -); - -# Bug 28472 -my $itemnumber6 = Koha::Item->new( - { - biblionumber => $biblionumber, - barcode => 'barcode_8', - itemcallnumber => 'callnumber5', - homebranch => $branchcode_1, - holdingbranch => $branchcode_1, - location => undef, - itype => $itemtype - } -)->store->itemnumber; - -t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckout', '_ALL_: CART' ); -AddIssue( $patron_1, 'barcode_8' ); -my $item6 = Koha::Items->find($itemnumber6); -is( - $item6->location, 'CART', - q{UpdateItemLocationOnCheckout updates location value from NULL (i.e. the item has no shelving location set) to 'CART' with setting "_ALL_: CART"} -); - #End transaction $schema->storage->txn_rollback; -- 2.39.2