From bedcf5f2cb29080d04eaec35a2ee4df05bf058cb Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 21 Nov 2019 15:20:45 +0000 Subject: [PATCH] Bug 23442: Add account credit types --- installer/data/mysql/account_credit_types.sql | 2 ++ installer/data/mysql/account_offset_types.sql | 4 +++- .../data/mysql/atomicupdate/bug_23442.perl | 20 +++++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 installer/data/mysql/atomicupdate/bug_23442.perl diff --git a/installer/data/mysql/account_credit_types.sql b/installer/data/mysql/account_credit_types.sql index 1105ab9b85..03954025b4 100644 --- a/installer/data/mysql/account_credit_types.sql +++ b/installer/data/mysql/account_credit_types.sql @@ -3,4 +3,6 @@ INSERT INTO account_credit_types ( code, description, can_be_added_manually, is_ ('WRITEOFF', 'Writeoff', 0, 1), ('FORGIVEN', 'Forgiven', 1, 1), ('CREDIT', 'Credit', 1, 1), +('DISCOUNT', 'A discount applied to a patrons fine', 0, 1), +('REFUND', 'A refund applied to a patrons fine', 0, 1), ('LOST_RETURN', 'Lost item fee refund', 0, 1); diff --git a/installer/data/mysql/account_offset_types.sql b/installer/data/mysql/account_offset_types.sql index 95d4296f06..076d49619b 100644 --- a/installer/data/mysql/account_offset_types.sql +++ b/installer/data/mysql/account_offset_types.sql @@ -17,4 +17,6 @@ INSERT INTO account_offset_types ( type ) VALUES ('OVERDUE'), ('Void Payment'), ('Credit Applied'), -('PAYOUT'); +('PAYOUT'), +('DISOUNT'), +('REFUND'); diff --git a/installer/data/mysql/atomicupdate/bug_23442.perl b/installer/data/mysql/atomicupdate/bug_23442.perl new file mode 100644 index 0000000000..6900fd259d --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_23442.perl @@ -0,0 +1,20 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if ( CheckVersion($DBversion) ) { + + $dbh->do( + qq{ + INSERT IGNORE INTO account_credit_types (code, description, can_be_added_manually, is_system) + VALUES + ('DISCOUNT', 'A discount applied to a patrons fine', 0, 1), + ('REFUND', 'A refund applied to a patrons fine', 0, 1) + } + ); + + $dbh->do(qq{ + INSERT IGNORE INTO account_offset_types ( type ) VALUES ('DISCOUNT'), ('REFUND'); + }); + + SetVersion($DBversion); + print "Upgrade to $DBversion done (Bug 23442 - Add REFUND and DISCOUNT account_credit_types)\n"; + print "Upgrade to $DBversion done (Bug 23442 - Add REFUNDED and DISCOUNTED account_offset_types)\n"; +} -- 2.20.1