From dd57e094cfc5030796073b57368a6435ab47496d Mon Sep 17 00:00:00 2001
From: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Date: Tue, 2 Jan 2024 12:32:07 +0000
Subject: [PATCH] Bug 35539: Remove 'issuelimit' column/field from categories
 table

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
---
 Koha/Patron/Category.pm                            |  1 -
 .../data/mysql/en/optional/patron_categories.yml   | 12 ------------
 installer/data/mysql/kohastructure.sql             |  1 -
 t/db_dependent/Circulation/GetHardDueDate.t        | 14 ++++++--------
 4 files changed, 6 insertions(+), 22 deletions(-)

diff --git a/Koha/Patron/Category.pm b/Koha/Patron/Category.pm
index 8c0c009ee41..50d206b59da 100644
--- a/Koha/Patron/Category.pm
+++ b/Koha/Patron/Category.pm
@@ -289,7 +289,6 @@ sub to_api_mapping {
         dateofbirthrequired               => 'lower_age_limit',
         enrolmentfee                      => 'enrolment_fee',
         overduenoticerequired             => 'overdue_notice_required',
-        issuelimit                        => undef,                                 # Unused
         reservefee                        => 'reserve_fee',
         hidelostitems                     => 'hide_lost_items',
         category_type                     => 'category_type',
diff --git a/installer/data/mysql/en/optional/patron_categories.yml b/installer/data/mysql/en/optional/patron_categories.yml
index 488ee9e3c4c..2d4038c6893 100644
--- a/installer/data/mysql/en/optional/patron_categories.yml
+++ b/installer/data/mysql/en/optional/patron_categories.yml
@@ -54,7 +54,6 @@ tables:
           dateofbirthrequired: 18
           enrolmentfee: '0.000000'
           overduenoticerequired: 1
-          issuelimit: ~
           reservefee: '0.000000'
           category_type: 'A'
           can_be_guarantee: 0
@@ -66,7 +65,6 @@ tables:
           dateofbirthrequired: 18
           enrolmentfee: '0.000000'
           overduenoticerequired: 1
-          issuelimit: ~
           reservefee: '0.000000'
           category_type: 'A'
           can_be_guarantee: 0
@@ -78,7 +76,6 @@ tables:
           dateofbirthrequired: 18
           enrolmentfee: '0.000000'
           overduenoticerequired: 1
-          issuelimit: ~
           reservefee: '0.000000'
           category_type: 'A'
           can_be_guarantee: 0
@@ -91,7 +88,6 @@ tables:
           dateofbirthrequired: 5
           enrolmentfee: '0.000000'
           overduenoticerequired: 1
-          issuelimit: ~
           reservefee: '0.000000'
           category_type: 'C'
           can_be_guarantee: 1
@@ -103,7 +99,6 @@ tables:
           dateofbirthrequired: 5
           enrolmentfee: '0.000000'
           overduenoticerequired: 1
-          issuelimit: ~
           reservefee: '0.000000'
           category_type: 'C'
           can_be_guarantee: 1
@@ -115,7 +110,6 @@ tables:
           dateofbirthrequired: 5
           enrolmentfee: '0.000000'
           overduenoticerequired: 1
-          issuelimit: ~
           reservefee: '0.000000'
           category_type: 'C'
           can_be_guarantee: 1
@@ -128,7 +122,6 @@ tables:
           dateofbirthrequired: 18
           enrolmentfee: '0.000000'
           overduenoticerequired: 0
-          issuelimit: ~
           reservefee: '0.000000'
           category_type: 'P'
           can_be_guarantee: 1
@@ -140,7 +133,6 @@ tables:
           dateofbirthrequired: 5
           enrolmentfee: '0.000000'
           overduenoticerequired: 1
-          issuelimit: ~
           reservefee: '0.000000'
           category_type: 'P'
           can_be_guarantee: 1
@@ -153,7 +145,6 @@ tables:
           dateofbirthrequired: 18
           enrolmentfee: '0.000000'
           overduenoticerequired: 1
-          issuelimit: ~
           reservefee: '0.000000'
           category_type: 'I'
           can_be_guarantee: 0
@@ -165,7 +156,6 @@ tables:
           dateofbirthrequired: 18
           enrolmentfee: '0.000000'
           overduenoticerequired: 1
-          issuelimit: ~
           reservefee: '0.000000'
           category_type: 'I'
           can_be_guarantee: 0
@@ -177,7 +167,6 @@ tables:
           dateofbirthrequired: 18
           enrolmentfee: '0.000000'
           overduenoticerequired: 1
-          issuelimit: ~
           reservefee: '0.000000'
           category_type: 'I'
           can_be_guarantee: 0
@@ -190,7 +179,6 @@ tables:
           dateofbirthrequired: 18
           enrolmentfee: '0.000000'
           overduenoticerequired: 0
-          issuelimit: ~
           reservefee: '0.000000'
           category_type: 'S'
           can_be_guarantee: 0
diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql
index a70ee18722a..2872835308d 100644
--- a/installer/data/mysql/kohastructure.sql
+++ b/installer/data/mysql/kohastructure.sql
@@ -1790,7 +1790,6 @@ CREATE TABLE `categories` (
   `dateofbirthrequired` tinyint(1) DEFAULT NULL COMMENT 'the minimum age required for the patron category',
   `enrolmentfee` decimal(28,6) DEFAULT NULL COMMENT 'enrollment fee for the patron',
   `overduenoticerequired` tinyint(1) DEFAULT NULL COMMENT 'are overdue notices sent to this patron category (1 for yes, 0 for no)',
-  `issuelimit` smallint(6) DEFAULT NULL COMMENT 'unused in Koha',
   `reservefee` decimal(28,6) DEFAULT NULL COMMENT 'cost to place holds',
   `hidelostitems` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'are lost items shown to this category (1 for yes, 0 for no)',
   `category_type` varchar(1) NOT NULL DEFAULT 'A' COMMENT 'type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)',
diff --git a/t/db_dependent/Circulation/GetHardDueDate.t b/t/db_dependent/Circulation/GetHardDueDate.t
index 8a24c64f5ce..227bde390ce 100755
--- a/t/db_dependent/Circulation/GetHardDueDate.t
+++ b/t/db_dependent/Circulation/GetHardDueDate.t
@@ -81,21 +81,19 @@ my $samplecat = {
     dateofbirthrequired   => undef,
     enrolmentfee          => undef,
     overduenoticerequired => undef,
-    issuelimit            => undef,
     reservefee            => undef,
     hidelostitems         => 0,
     category_type         => 'A',
 };
 my $query =
-"INSERT INTO categories (categorycode,description,enrolmentperiod,enrolmentperioddate,dateofbirthrequired,enrolmentfee,overduenoticerequired,issuelimit ,reservefee ,hidelostitems ,category_type) VALUES( ?,?,?,?,?,?,?,?,?,?,?)";
+"INSERT INTO categories (categorycode,description,enrolmentperiod,enrolmentperioddate,dateofbirthrequired,enrolmentfee,overduenoticerequired ,reservefee ,hidelostitems ,category_type) VALUES( ?,?,?,?,?,?,?,?,?,?)";
 $dbh->do(
     $query, {},
-    $samplecat->{categorycode},        $samplecat->{description},
-    $samplecat->{enrolmentperiod},     $samplecat->{enrolmentperioddate},
-    $samplecat->{dateofbirthrequired}, $samplecat->{enrolmentfee},
-    $samplecat->{overduenoticerequired}, $samplecat->{issuelimit},
-    $samplecat->{reservefee}, $samplecat->{hidelostitems},
-    $samplecat->{category_type}
+    $samplecat->{categorycode},          $samplecat->{description},
+    $samplecat->{enrolmentperiod},       $samplecat->{enrolmentperioddate},
+    $samplecat->{dateofbirthrequired},   $samplecat->{enrolmentfee},
+    $samplecat->{overduenoticerequired}, $samplecat->{reservefee},
+    $samplecat->{hidelostitems},         $samplecat->{category_type}
 );
 
 my $builder = t::lib::TestBuilder->new;
-- 
2.30.2