From e62ac805c4df45f46f0035a466e73a901ff23765 Mon Sep 17 00:00:00 2001
From: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Date: Wed, 12 Jul 2023 09:15:03 +0000
Subject: [PATCH] Bug 18203: DB specific and atomicupdate

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
---
 installer/data/mysql/atomicupdate/bug_18203.pl | 17 +++++++++++++++++
 installer/data/mysql/kohastructure.sql         |  1 +
 2 files changed, 18 insertions(+)
 create mode 100755 installer/data/mysql/atomicupdate/bug_18203.pl

diff --git a/installer/data/mysql/atomicupdate/bug_18203.pl b/installer/data/mysql/atomicupdate/bug_18203.pl
new file mode 100755
index 0000000000..68a2145739
--- /dev/null
+++ b/installer/data/mysql/atomicupdate/bug_18203.pl
@@ -0,0 +1,17 @@
+use Modern::Perl;
+
+return {
+    bug_number => "18203",
+    description => "Add per borrower category restrictions on ILL placement",
+    up => sub {
+        my ($args) = @_;
+        my ($dbh, $out) = @$args{qw(dbh out)};
+        unless ( column_exists('categories', 'canplaceillopac') ) {
+            $dbh->do(q{
+                ALTER TABLE `categories`
+                ADD COLUMN `canplaceillopac` TINYINT(1) NOT NULL DEFAULT 1 COMMENT 'can this patron category place interlibrary loan requests'
+                AFTER `checkprevcheckout`;
+            });
+        }
+    },
+};
diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql
index 0e907eff38..8c363874fe 100644
--- a/installer/data/mysql/kohastructure.sql
+++ b/installer/data/mysql/kohastructure.sql
@@ -1762,6 +1762,7 @@ CREATE TABLE `categories` (
   `BlockExpiredPatronOpacActions` tinyint(1) NOT NULL DEFAULT -1 COMMENT 'wheither or not a patron of this category can renew books or place holds once their card has expired. 0 means they can, 1 means they cannot, -1 means use syspref BlockExpiredPatronOpacActions',
   `default_privacy` enum('default','never','forever') NOT NULL DEFAULT 'default' COMMENT 'Default privacy setting for this patron category',
   `checkprevcheckout` varchar(7) NOT NULL DEFAULT 'inherit' COMMENT 'produce a warning for this patron category if this item has previously been checked out to this patron if ''yes'', not if ''no'', defer to syspref setting if ''inherit''.',
+  `canplaceillopac` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'can this patron category place interlibrary loan requests',
   `can_be_guarantee` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'if patrons of this category can be guarantees',
   `reset_password` tinyint(1) DEFAULT NULL COMMENT 'if patrons of this category can do the password reset flow,',
   `change_password` tinyint(1) DEFAULT NULL COMMENT 'if patrons of this category can change their passwords in the OAPC',
-- 
2.30.2