@@ -, +, @@ --- installer/data/mysql/account_credit_types.sql | 1 + installer/data/mysql/account_offset_types.sql | 1 + .../data/mysql/atomicupdate/bug_24081.perl | 26 +++++++++++++++++++ installer/data/mysql/userpermissions.sql | 1 + 4 files changed, 29 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/bug_24081.perl --- a/installer/data/mysql/account_credit_types.sql +++ a/installer/data/mysql/account_credit_types.sql @@ -3,6 +3,7 @@ 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_FOUND', 'Lost item fee refund', 0, 1), ('PURCHASE', 'Purchase', 0, 1); --- a/installer/data/mysql/account_offset_types.sql +++ a/installer/data/mysql/account_offset_types.sql @@ -20,4 +20,5 @@ INSERT INTO account_offset_types ( type ) VALUES ('Void Payment'), ('Credit Applied'), ('PAYOUT'), +('DISOUNT'), ('REFUND'); --- a/installer/data/mysql/atomicupdate/bug_24081.perl +++ a/installer/data/mysql/atomicupdate/bug_24081.perl @@ -0,0 +1,26 @@ +$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) + } + ); + + $dbh->do(qq{ + INSERT IGNORE INTO account_offset_types ( type ) VALUES ('DISCOUNT'); + }); + + $dbh->do(qq{ + INSERT IGNORE permissions (module_bit, code, description) + VALUES + (10, 'discount', 'Perform account discount action') + }); + + SetVersion($DBversion); + print "Upgrade to $DBversion done (Bug 24081 - Add DISCOUNT to account_credit_types)\n"; + print "Upgrade to $DBversion done (Bug 24081 - Add DISCOUNT to account_offset_types)\n"; + print "Upgrade to $DBversion done (Bug 24081 - Add accounts discount permission)\n"; +} --- a/installer/data/mysql/userpermissions.sql +++ a/installer/data/mysql/userpermissions.sql @@ -46,6 +46,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 9, 'delete_all_items', 'Delete all items at once'), (10, 'payout', 'Perform account payout action'), (10, 'refund', 'Perform account refund action'), + (10, 'discount', 'Perform account discount action'), (10, 'writeoff', 'Write off fines and fees'), (10, 'remaining_permissions', 'Remaining permissions for managing fines and fees'), (11, 'currencies_manage', 'Manage currencies and exchange rates'), --