Bugzilla – Attachment 118326 Details for
Bug 27069
Change holdallowed values from numbers to strings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27069: Update existing rules
Bug-27069-Update-existing-rules.patch (text/plain), 2.48 KB, created by
Martin Renvoize (ashimema)
on 2021-03-16 14:20:43 UTC
(
hide
)
Description:
Bug 27069: Update existing rules
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-03-16 14:20:43 UTC
Size:
2.48 KB
patch
obsolete
>From 3c67883755a75cd5b142dedcca365f34a9df6a5a Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 15 Mar 2021 15:33:03 -0300 >Subject: [PATCH] Bug 27069: Update existing rules > >This patch adds an atomic update file that takes care of translating >existing rules. It constrains the rules to translate to those currently >expected by Koha and leaves any other value out. > >To test: >1. Have some manually added rules: > $ koha-mysql kohadev > > INSERT INTO circulation_rules (rule_name,rule_value) VALUES > ('holdallowed', -1); > > INSERT INTO circulation_rules (rule_name,rule_value) VALUES > ('holdallowed', 1); > > INSERT INTO circulation_rules (rule_name,rule_value) VALUES > ('holdallowed', 2); > > INSERT INTO circulation_rules (rule_name,rule_value) VALUES > ('holdallowed', 3); > > INSERT INTO circulation_rules (rule_name,rule_value) VALUES > ('holdallowed', 0); > > INSERT INTO circulation_rules (rule_name,rule_value) VALUES > ('holdallowed', 4); >2. Apply this patch >3. Run: > $ updatedatabase >=> SUCCESS: It doesn't explode >4. Verify the created rules were updated correctly: > > SELECT * FROM circulation_rules WHERE rule_name='holdallowed'; >5: Verify all the tests that dealt with this rule still pass! > $ kshell > k$ git diff origin/master --name-only | grep -e '\.t$' | \ > xargs prove >=> SUCCESS: Tests pass! >6. Verify the UI handles setting things correctly >7. Sign off :-D > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > .../data/mysql/atomicupdate/bug_27069.perl | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > create mode 100644 installer/data/mysql/atomicupdate/bug_27069.perl > >diff --git a/installer/data/mysql/atomicupdate/bug_27069.perl b/installer/data/mysql/atomicupdate/bug_27069.perl >new file mode 100644 >index 0000000000..854c051346 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_27069.perl >@@ -0,0 +1,17 @@ >+$DBversion = 'XXX'; >+if( CheckVersion( $DBversion ) ) { >+ >+ $dbh->do(q{ >+ UPDATE circulation_rules >+ SET >+ rule_value = CASE >+ WHEN rule_value='0' THEN 'not_allowed' >+ WHEN rule_value='1' THEN 'from_home_library' >+ WHEN rule_value='2' THEN 'from_any_library' >+ WHEN rule_value='3' THEN 'from_local_hold_group' >+ END >+ WHERE rule_name='holdallowed' AND rule_value >= 0 AND rule_value <= 3; >+ }); >+ >+ NewVersion( $DBversion, 27069, "Change holdallowed values from numbers to strings"); >+} >-- >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 27069
:
118252
|
118253
|
118254
|
118324
|
118325
|
118326
|
119223
|
119224
|
119225
|
119454