Bugzilla – Attachment 146556 Details for
Bug 25560
Define itemtype specific rules in the UpdateNotForLoanStatusOnCheckin system preference
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25560: Database changes
Bug-25560-Database-changes.patch (text/plain), 6.26 KB, created by
Alex Buckley
on 2023-02-12 22:56:29 UTC
(
hide
)
Description:
Bug 25560: Database changes
Filename:
MIME Type:
Creator:
Alex Buckley
Created:
2023-02-12 22:56:29 UTC
Size:
6.26 KB
patch
obsolete
>From f1c95165aa347385ff91b32293b803b09fc1363b Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >Date: Tue, 2 Aug 2022 15:05:33 +1200 >Subject: [PATCH] Bug 25560: Database changes > >Sponsored-by: Waikato Institute of Technology, New Zealand >--- > ...UpdateNotForLoanStatusOnCheckin_syspref.pl | 37 +++++++++++++++++++ > installer/data/mysql/mandatory/sysprefs.sql | 2 +- > 2 files changed, 38 insertions(+), 1 deletion(-) > create mode 100755 installer/data/mysql/atomicupdate/bug_25560-amend_UpdateNotForLoanStatusOnCheckin_syspref.pl > >diff --git a/installer/data/mysql/atomicupdate/bug_25560-amend_UpdateNotForLoanStatusOnCheckin_syspref.pl b/installer/data/mysql/atomicupdate/bug_25560-amend_UpdateNotForLoanStatusOnCheckin_syspref.pl >new file mode 100755 >index 0000000000..a9c3ad1f69 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_25560-amend_UpdateNotForLoanStatusOnCheckin_syspref.pl >@@ -0,0 +1,37 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "25560", >+ description => >+ "Migrating existing UpdateNotForLoanStatusOnCheckin rules to new format", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ my ($UpdateNotForLoanStatusOnCheckin) = $dbh->selectrow_array( >+ q| >+ SELECT value FROM systempreferences WHERE variable='UpdateNotForLoanStatusOnCheckin' >+ | >+ ); >+ >+ my ( $new_rules, $updated_rules ); >+ if ( $UpdateNotForLoanStatusOnCheckin && $UpdateNotForLoanStatusOnCheckin !~ /[0-9a-zA-Z_]:\r/ ) { >+ >+ # Split and re-format the existing rules under a single _ALL_ special term to affect all itemtypes >+ my @rules = split /\r/, $UpdateNotForLoanStatusOnCheckin; >+ foreach my $rule (@rules) { >+ $rule =~ s/^\s+|\s+$|\r|\n//g; >+ $new_rules .= ' ' . $rule . "\r"; >+ } >+ $updated_rules .= "_ALL_:\r$new_rules\r"; >+ $dbh->do( >+ qq{ >+ UPDATE systempreferences >+ SET value = '$updated_rules', explanation = "This is a list of item types and value pairs.\nExamples:\n_ALL_:\n -1: 0\n\nCR:\n 1: 0\n\nWhen an item is checked in, if its item type matches CR then when the value on the left (1) matches the items' not for loan value it will be updated to the value on the right.\n\nThe special term _ALL_ is used on the left side of the colon (:) to affect all item types. This does not override all other rules\n\nEach item type needs to be defined on a separate line on the left side of the colon (:).\nEach pair of not for loan values, for that item type, should be listed on separate lines below the item type, each indented by a leading space." >+ WHERE variable = 'UpdateNotForLoanStatusOnCheckin' >+ } >+ ); >+ } >+ }, >+}; >+ >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index beebd27a6f..6803fdf9fa 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -747,7 +747,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('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'), >-('UpdateNotForLoanStatusOnCheckin', '', 'NULL', "This is a list of value pairs. When an item is checked in, if the not for loan value on the left matches the items not for loan value it will be updated to the right-hand value. E.g. '-1: 0' will cause an item that was set to 'Ordered' to now be available for loan. Can be used for showing only the not for loan description. E.g. '-1: ONLYMESSAGE'. Each pair of values should be on a separate line.", 'Free'), >+('UpdateNotForLoanStatusOnCheckin', '', 'NULL', 'This is a list of item types and value pairs.\nExamples:\n_ALL_:\n -1: 0\n\nCR:\n 1: 0\n\nWhen an item is checked in, if its item type matches CR then when the value on the left (1) matches the items not for loan value it will be updated to the value on the right.\n\nThe special term _ALL_ is used on the left side of the colon (:) to affect all item types. This does not override all other rules\n\nEach item type needs to be defined on a separate line on the left side of the colon (:).\nEach pair of not for loan values, for that item type, should be listed on separate lines below the item type, each indented by a leading space.', 'Free'), > ('UpdateTotalIssuesOnCirc','0',NULL,'Whether to update the totalissues field in the biblio on each circ.','YesNo'), > ('UploadPurgeTemporaryFilesDays','',NULL,'If not empty, number of days used when automatically deleting temporary uploads','integer'), > ('uppercasesurnames','0',NULL,'If ON, surnames are converted to upper case in patron entry form','YesNo'), >-- >2.20.1
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 25560
:
105236
|
105237
|
105238
|
105239
|
105240
|
105241
|
105242
|
105243
|
105244
|
105245
|
109562
|
109563
|
109564
|
109565
|
109566
|
109567
|
112492
|
112887
|
113161
|
113212
|
113213
|
113214
|
113215
|
113216
|
113217
|
131816
|
131817
|
131818
|
131819
|
131820
|
135742
|
135743
|
136079
|
136080
|
136081
|
136082
|
136083
|
136084
|
138494
|
138495
|
138496
|
138497
|
138498
|
138499
|
146556
|
146557
|
146558
|
146559
|
146993
|
148679
|
148680
|
148681
|
148682
|
148683