From d72c6895ebd411179fdb6a31ed08f8879bf02e16 Mon Sep 17 00:00:00 2001
From: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Date: Wed, 14 Sep 2022 14:51:51 +0300
Subject: [PATCH] Bug 16223: Add new columns to table restriction_types
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This patch adds two new columns, lift_after_payment and fee_limit,
to table restriction_types. These colums are used to control
lifting patrons restrictions after paying their fees.

To test:
1. Apply this patch.
2. Update your database via updatedatabase.pl.
=> Confirm your table restriction_types has two new columns.

Sponsored-by: Koha-Suomi Oy
Signed-off-by: Anneli Österman <anneli.osterman@koha-suomi.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
---
 .../data/mysql/atomicupdate/bug_16223.pl      | 24 +++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100755 installer/data/mysql/atomicupdate/bug_16223.pl

diff --git a/installer/data/mysql/atomicupdate/bug_16223.pl b/installer/data/mysql/atomicupdate/bug_16223.pl
new file mode 100755
index 0000000000..12aa40823a
--- /dev/null
+++ b/installer/data/mysql/atomicupdate/bug_16223.pl
@@ -0,0 +1,24 @@
+use Modern::Perl;
+
+return {
+    bug_number => "16223",
+    description => "Add new columns lift_after_payment and fee_limit to table restriction_types",
+    up => sub {
+        my ($args) = @_;
+        my ($dbh, $out) = @$args{qw(dbh out)};
+
+        if( !column_exists( 'restriction_types', 'lift_after_payment' ) ) {
+            $dbh->do(q{
+                ALTER TABLE restriction_types ADD COLUMN `lift_after_payment` tinyint(1) NOT NULL DEFAULT 0
+            });
+        }
+        say $out "Added column lift_after_payment";
+
+        if( !column_exists( 'restriction_types', 'fee_limit' ) ) {
+            $dbh->do(q{
+                ALTER TABLE restriction_types ADD COLUMN `fee_limit` decimal(28,6) DEFAULT NULL
+            });
+        }
+        say $out "Added column fee_limit";
+    },
+};
-- 
2.40.0