https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35292
--- Comment #52 from Victor Grousset/tuxayo <vic...@tuxayo.net> --- Comment on attachment 180632 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=180632 Bug 35292: Database changes >From 318c2ddedf9bacb00bebf1e8465a8c1df40d84fe Mon Sep 17 00:00:00 2001 >From: Baptiste <baptiste.wojtkow...@biblibre.com> >Date: Wed, 4 Dec 2024 17:22:06 +0100 >Subject: [PATCH] Bug 35292: Database changes >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Signed-off-by: Emmanuel Bétemps <e.bete...@gmail.com> >--- > ...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 0000000000..ad866723d6 >--- /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 2bf9d0b648..a765ad786b 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.39.5 -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list Koha-bugs@lists.koha-community.org https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/