Bugzilla – Attachment 169290 Details for
Bug 18086
overduerules table is lacking foreign key constraints
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18086: Fix issues with NULL for categories
Bug-18086-Fix-issues-with-NULL-for-categories.patch (text/plain), 4.28 KB, created by
Baptiste Wojtkowski (bwoj)
on 2024-07-22 14:03:58 UTC
(
hide
)
Description:
Bug 18086: Fix issues with NULL for categories
Filename:
MIME Type:
Creator:
Baptiste Wojtkowski (bwoj)
Created:
2024-07-22 14:03:58 UTC
Size:
4.28 KB
patch
obsolete
>From 3846eb55c81901fcc4c82d0184ff2ece20fa8eef Mon Sep 17 00:00:00 2001 >From: Baptiste Wojtkowski <bski@laposte.net> >Date: Thu, 11 Jul 2024 14:54:26 +0200 >Subject: [PATCH] Bug 18086: Fix issues with NULL for categories > >See https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18086#c27 >for more context : >This addresses the 4th point of this comment. > >A few tests do not pass because they test the behaviour of functions concerning categoriees on an empty string, whi >ch is now forbidden due to the foreign key constraint. >I propose changes for categoriees and for categories in two different patches, changing the behaviour of functions >so that they interprete NULL in db as the default rule. >--- > installer/data/mysql/kohastructure.sql | 2 +- > t/db_dependent/Overdues.t | 10 +++++----- > 2 files changed, 6 insertions(+), 6 deletions(-) > >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index bbd72d4..76e24d5 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -4963,7 +4963,7 @@ DROP TABLE IF EXISTS `overduerules`; > CREATE TABLE `overduerules` ( > `overduerules_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for the overduerules', > `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT 'foreign key from the branches table to define which branch this rule is for (if blank it''s all libraries)', >- `categorycode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'foreign key from the categories table to define which patron category this rule is for', >+ `categorycode` varchar(10) COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT 'foreign key from the categories table to define which patron category this rule is for', > `delay1` int(4) DEFAULT NULL COMMENT 'number of days after the item is overdue that the first notice is sent', > `letter1` varchar(20) DEFAULT NULL COMMENT 'foreign key from the letter table to define which notice should be sent as the first notice', > `debarred1` varchar(1) DEFAULT '0' COMMENT 'is the patron restricted when the first notice is sent (1 for yes, 0 for no)', >diff --git a/t/db_dependent/Overdues.t b/t/db_dependent/Overdues.t >index 599ceec..de48746 100755 >--- a/t/db_dependent/Overdues.t >+++ b/t/db_dependent/Overdues.t >@@ -111,7 +111,7 @@ $dbh->do(q| > INSERT INTO overduerules > ( branchcode,categorycode, delay1,letter1,debarred1, delay2,letter2,debarred2, delay3,letter3,debarred3 ) > VALUES >- ( '', '', 1, 'LETTER_CODE1', 1, 5, 'LETTER_CODE2', 1, 10, 'LETTER_CODE3', 1 ) >+ ( NULL, NULL, 1, 'LETTER_CODE1', 1, 5, 'LETTER_CODE2', 1, 10, 'LETTER_CODE3', 1 ) > |); > > my @branchcodes = map { $_->branchcode } Koha::Libraries->search->as_list; >@@ -123,7 +123,7 @@ $dbh->do(q| > INSERT INTO overduerules > ( branchcode,categorycode, delay1,letter1,debarred1, delay2,letter2,debarred2, delay3,letter3,debarred3 ) > VALUES >- ( 'CPL', '', 1, 'LETTER_CODE1', 1, 5, 'LETTER_CODE2', 1, 10, 'LETTER_CODE3', 1 ) >+ ( 'CPL', NULL, 1, 'LETTER_CODE1', 1, 5, 'LETTER_CODE2', 1, 10, 'LETTER_CODE3', 1 ) > |); > > @overdue_branches = C4::Overdues::GetBranchcodesWithOverdueRules(); >@@ -134,7 +134,7 @@ $dbh->do(q| > INSERT INTO overduerules > ( branchcode,categorycode, delay1,letter1,debarred1, delay2,letter2,debarred2, delay3,letter3,debarred3 ) > VALUES >- ( 'CPL', '', 1, 'LETTER_CODE1', 1, 5, 'LETTER_CODE2', 1, 10, 'LETTER_CODE3', 1 ) >+ ( 'CPL', NULL, 1, 'LETTER_CODE1', 1, 5, 'LETTER_CODE2', 1, 10, 'LETTER_CODE3', 1 ) > |); > > @overdue_branches = C4::Overdues::GetBranchcodesWithOverdueRules(); >@@ -145,8 +145,8 @@ $dbh->do(q| > INSERT INTO overduerules > ( branchcode,categorycode, delay1,letter1,debarred1, delay2,letter2,debarred2, delay3,letter3,debarred3 ) > VALUES >- ( 'CPL', '', 1, 'LETTER_CODE1_CPL', 1, 5, 'LETTER_CODE2_CPL', 1, 10, 'LETTER_CODE3_CPL', 1 ), >- ( 'MPL', '', 1, 'LETTER_CODE1_MPL', 1, 5, 'LETTER_CODE2_MPL', 1, 10, 'LETTER_CODE3_MPL', 1 ) >+ ( 'CPL', NULL, 1, 'LETTER_CODE1_CPL', 1, 5, 'LETTER_CODE2_CPL', 1, 10, 'LETTER_CODE3_CPL', 1 ), >+ ( 'MPL', NULL, 1, 'LETTER_CODE1_MPL', 1, 5, 'LETTER_CODE2_MPL', 1, 10, 'LETTER_CODE3_MPL', 1 ) > |); > > @overdue_branches = C4::Overdues::GetBranchcodesWithOverdueRules(); >-- >2.43.0
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 18086
:
105368
|
105369
|
105380
|
105382
|
105387
|
105388
|
105424
|
105551
|
106201
|
134730
|
134731
|
168810
|
168811
|
168812
|
168813
|
168814
|
168815
|
169287
|
169288
|
169289
|
169290
|
169291
|
169292
|
169293
|
169294
|
169295
|
169296
|
169297
|
169298
|
169299
|
169300
|
169301
|
169302
|
169396
|
169397
|
169398
|
169399
|
169400
|
169401
|
169402
|
169403
|
169404
|
169455
|
169456
|
169457
|
169458
|
169459
|
169460
|
169461
|
169462
|
169463
|
169543
|
169544