Bugzilla – Attachment 180181 Details for
Bug 35292
Define itemtype specific rules in the UpdateNotForLoanStatusOnCheckOut system preference
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35292: Database changes
Bug-35292-Database-changes.patch (text/plain), 5.48 KB, created by
Baptiste Wojtkowski (bwoj)
on 2025-04-01 13:15:39 UTC
(
hide
)
Description:
Bug 35292: Database changes
Filename:
MIME Type:
Creator:
Baptiste Wojtkowski (bwoj)
Created:
2025-04-01 13:15:39 UTC
Size:
5.48 KB
patch
obsolete
>From f4f1d74537528e63b40152a6750e04e5e8f300f2 Mon Sep 17 00:00:00 2001 >From: Baptiste <baptiste.wojtkowski@biblibre.com> >Date: Wed, 4 Dec 2024 17:22:06 +0100 >Subject: [PATCH] Bug 35292: Database changes > >--- > ...pdateNotForLoanStatusOnCheckOut_syspref.pl | 35 +++++++++++++++++++ > installer/data/mysql/mandatory/sysprefs.sql | 2 +- > 2 files changed, 36 insertions(+), 1 deletion(-) > create mode 100755 installer/data/mysql/atomicupdate/bug_35292-amend_UpdateNotForLoanStatusOnCheckOut_syspref.pl > >diff --git a/installer/data/mysql/atomicupdate/bug_35292-amend_UpdateNotForLoanStatusOnCheckOut_syspref.pl b/installer/data/mysql/atomicupdate/bug_35292-amend_UpdateNotForLoanStatusOnCheckOut_syspref.pl >new file mode 100755 >index 00000000000..ad866723d6b >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_35292-amend_UpdateNotForLoanStatusOnCheckOut_syspref.pl >@@ -0,0 +1,35 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "35292", >+ description => "Migrating existing UpdateNotForLoanStatusOnCheckout rules to new format", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ my ($UpdateNotForLoanStatusOnCheckout) = $dbh->selectrow_array( >+ q| >+ SELECT value FROM systempreferences WHERE variable='UpdateNotForLoanStatusOnCheckout' >+ | >+ ); >+ >+ my ( $new_rules, $updated_rules ); >+ if ( $UpdateNotForLoanStatusOnCheckout && $UpdateNotForLoanStatusOnCheckout !~ /[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/, $UpdateNotForLoanStatusOnCheckout; >+ 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 out, 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 = 'UpdateNotForLoanStatusOnCheckout' >+ } >+ ); >+ } >+ }, >+}; >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index 2bf9d0b6486..a765ad786bf 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -829,7 +829,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('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'), > ('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'), >-('UpdateNotForLoanStatusOnCheckout', '', 'NULL', 'This is a list of value pairs. When an item is checked out, 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. Each pair of values should be on a separate line.', 'Free'), >+('UpdateNotForLoanStatusOnCheckout', '', '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 out, 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.30.2
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 35292
:
175201
|
175202
|
175203
|
175316
|
175317
|
175318
|
175319
|
175320
|
175321
|
175322
|
179818
|
179819
|
179820
|
179821
|
179822
|
179823
|
179824
|
180101
|
180102
|
180103
|
180104
|
180105
|
180106
|
180181
|
180182
|
180183
|
180184
|
180185
|
180186
|
180210
|
180212
|
180213
|
180214
|
180215
|
180216
|
180217
|
180218
|
180632
|
180633
|
180634
|
180635
|
180636
|
180637
|
180638
|
180646