Bug 27069: Update existing rules
authorTomas Cohen Arazi <tomascohen@theke.io>
Mon, 15 Mar 2021 18:33:03 +0000 (15:33 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 7 Apr 2021 14:08:04 +0000 (16:08 +0200)
commit34acb76a21c01c849283efe066d10d5ee78cd9e5
treee1ec43df9fa0c78e9fad7a354b48c5be1f2ed269
parent1d9d05613b90779b3ce214918cf1f2dffb64d264
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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
installer/data/mysql/atomicupdate/bug_27069.perl [new file with mode: 0644]