Bugzilla – Attachment 183918 Details for
Bug 40337
checkprevcheckout must be defined as ENUM at DB level
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40337: Define checkprevcheckout as ENUM
Bug-40337-Define-checkprevcheckout-as-ENUM.patch (text/plain), 6.92 KB, created by
Jonathan Druart
on 2025-07-10 07:17:06 UTC
(
hide
)
Description:
Bug 40337: Define checkprevcheckout as ENUM
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2025-07-10 07:17:06 UTC
Size:
6.92 KB
patch
obsolete
>From 8979dafbecc07752667d94128e313518cd98f33b Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 10 Jul 2025 09:10:01 +0200 >Subject: [PATCH] Bug 40337: Define checkprevcheckout as ENUM > >On bug 40178 and bug 40179 we defined checkprevcheckout attributes as >ENUM at the REST API level, so the specs prevent us from inserting >values that are no yes, no, inherit in DB. >However the DB schema didn't have that constraint. >This has been caught by some tests that were failing: >eg. t/db_dependent/selenium/patrons_search.t with "Not in enum list: yes, no, inherit." > >Test plan: >Apply this patch, run `updatedatabase`, `dbic` and `restart_all` >`prove t/db_dependent/selenium/patrons_search.t` should now pass. >--- > .../data/mysql/atomicupdate/bug_40337.pl | 32 +++++++++++++++++++ > installer/data/mysql/kohastructure.sql | 6 ++-- > 2 files changed, 35 insertions(+), 3 deletions(-) > create mode 100755 installer/data/mysql/atomicupdate/bug_40337.pl > >diff --git a/installer/data/mysql/atomicupdate/bug_40337.pl b/installer/data/mysql/atomicupdate/bug_40337.pl >new file mode 100755 >index 00000000000..951097d56dd >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_40337.pl >@@ -0,0 +1,32 @@ >+use Modern::Perl; >+use Koha::Installer::Output qw(say_warning say_success say_info); >+ >+return { >+ bug_number => "40337", >+ description => "Define checkprevcheckout as ENUM", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ $dbh->do( >+ q{ >+ ALTER TABLE borrowers >+ MODIFY COLUMN `checkprevcheckout` enum('yes', 'no', 'inherit') NOT NULL DEFAULT 'inherit' COMMENT 'produce a warning for this patron if this item has previously been checked out to this patron if ''yes'', not if ''no'', defer to category setting if ''inherit''.' >+ } >+ ); >+ >+ $dbh->do( >+ q{ >+ ALTER TABLE categories >+ MODIFY COLUMN `checkprevcheckout` enum('yes', 'no', 'inherit') 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''.' >+ } >+ ); >+ >+ $dbh->do( >+ q{ >+ ALTER TABLE deletedborrowers >+ MODIFY COLUMN `checkprevcheckout` enum('yes', 'no', 'inherit') NOT NULL DEFAULT 'inherit' COMMENT 'produce a warning for this patron if this item has previously been checked out to this patron if ''yes'', not if ''no'', defer to category setting if ''inherit''.' >+ } >+ ); >+ }, >+}; >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 5d7139383c2..11018d4f7b4 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -1598,7 +1598,7 @@ CREATE TABLE `borrowers` ( > `privacy` int(11) NOT NULL DEFAULT 1 COMMENT 'patron/borrower''s privacy settings related to their checkout history', > `privacy_guarantor_fines` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if relatives can see this patron''s fines', > `privacy_guarantor_checkouts` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if relatives can see this patron''s checkouts', >- `checkprevcheckout` varchar(7) NOT NULL DEFAULT 'inherit' COMMENT 'produce a warning for this patron if this item has previously been checked out to this patron if ''yes'', not if ''no'', defer to category setting if ''inherit''.', >+ `checkprevcheckout` enum('yes', 'no', 'inherit') NOT NULL DEFAULT 'inherit' COMMENT 'produce a warning for this patron if this item has previously been checked out to this patron if ''yes'', not if ''no'', defer to category setting if ''inherit''.', > `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'time of last change could be useful for synchronization with external systems (among others)', > `lastseen` datetime DEFAULT NULL COMMENT 'last time a patron has been seen (connected at the OPAC or staff interface)', > `lang` varchar(25) NOT NULL DEFAULT 'default' COMMENT 'lang to use to send notices to this patron', >@@ -1808,7 +1808,7 @@ CREATE TABLE `categories` ( > `category_type` varchar(1) NOT NULL DEFAULT 'A' COMMENT 'type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)', > `BlockExpiredPatronOpacActions` varchar(128) NOT NULL DEFAULT 'follow_syspref_BlockExpiredPatronOpacActions' COMMENT 'specific actions expired patrons of this category are blocked from performing or if the BlockExpiredPatronOpacActions system preference is to be followed', > `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''.', >+ `checkprevcheckout` enum('yes', 'no', 'inherit') 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''.', > `can_place_ill_in_opac` 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,', >@@ -2760,7 +2760,7 @@ CREATE TABLE `deletedborrowers` ( > `privacy` int(11) NOT NULL DEFAULT 1 COMMENT 'patron/borrower''s privacy settings related to their checkout history KEY `borrowernumber` (`borrowernumber`),', > `privacy_guarantor_fines` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if relatives can see this patron''s fines', > `privacy_guarantor_checkouts` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if relatives can see this patron''s checkouts', >- `checkprevcheckout` varchar(7) NOT NULL DEFAULT 'inherit' COMMENT 'produce a warning for this patron if this item has previously been checked out to this patron if ''yes'', not if ''no'', defer to category setting if ''inherit''.', >+ `checkprevcheckout` enum('yes', 'no', 'inherit') NOT NULL DEFAULT 'inherit' COMMENT 'produce a warning for this patron if this item has previously been checked out to this patron if ''yes'', not if ''no'', defer to category setting if ''inherit''.', > `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'time of last change could be useful for synchronization with external systems (among others)', > `lastseen` datetime DEFAULT NULL COMMENT 'last time a patron has been seen (connected at the OPAC or staff interface)', > `lang` varchar(25) NOT NULL DEFAULT 'default' COMMENT 'lang to use to send notices to this patron', >-- >2.34.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 40337
:
183918
|
183919
|
183946
|
183947
|
183948
|
183969
|
183970