Bug 39658: DB: Add patron_account_links table and sysprefs

Adds table and 3 sysprefs for patron account linking feature.
Signed-off-by: Trevor Diamond <trevor.diamond@mainlib.org>
Signed-off-by: Kellie Stephens <kellie.stephens@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Jacob O'Mara 2026-01-21 15:36:16 +00:00 committed by Pedro Amorim
parent 9371504d98
commit 98ee7e3f0d
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
3 changed files with 78 additions and 0 deletions

View File

@ -0,0 +1,56 @@
use Modern::Perl;
use Koha::Installer::Output qw(say_warning say_success say_info);
return {
bug_number => "39658",
description => "Add patron account linking feature for multi-library patrons",
up => sub {
my ($args) = @_;
my ( $dbh, $out ) = @$args{qw(dbh out)};
# Create the patron_account_links table
unless ( TableExists('patron_account_links') ) {
$dbh->do(
q{
CREATE TABLE `patron_account_links` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
`link_group_id` int(11) NOT NULL COMMENT 'groups linked accounts together',
`borrowernumber` int(11) NOT NULL COMMENT 'foreign key to borrowers table',
`created_on` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'when the link was created',
PRIMARY KEY (`id`),
UNIQUE KEY `borrowernumber` (`borrowernumber`),
KEY `link_group_id` (`link_group_id`),
CONSTRAINT `patron_account_links_ibfk_1` FOREIGN KEY (`borrowernumber`)
REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
}
);
say_success( $out, "Added new table 'patron_account_links'" );
}
# Add system preferences
$dbh->do(
q{
INSERT IGNORE INTO systempreferences (variable, value)
VALUES ('EnablePatronAccountLinking', '0')
}
);
say_success( $out, "Added new system preference 'EnablePatronAccountLinking'" );
$dbh->do(
q{
INSERT IGNORE INTO systempreferences (variable, value)
VALUES ('NoIssuesChargeLinkedAccounts', '')
}
);
say_success( $out, "Added new system preference 'NoIssuesChargeLinkedAccounts'" );
$dbh->do(
q{
INSERT IGNORE INTO systempreferences (variable, value)
VALUES ('AllowLinkedAccountHoldPickup', '0')
}
);
say_success( $out, "Added new system preference 'AllowLinkedAccountHoldPickup'" );
},
};

View File

@ -5360,6 +5360,25 @@ CREATE TABLE `overduerules_transport_types` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `patron_account_links`
--
DROP TABLE IF EXISTS `patron_account_links`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `patron_account_links` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
`link_group_id` int(11) NOT NULL COMMENT 'groups linked accounts together',
`borrowernumber` int(11) NOT NULL COMMENT 'foreign key to borrowers table',
`created_on` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'when the link was created',
PRIMARY KEY (`id`),
UNIQUE KEY `borrowernumber` (`borrowernumber`),
KEY `link_group_id` (`link_group_id`),
CONSTRAINT `patron_account_links_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `patron_consent`
--

View File

@ -42,6 +42,7 @@ INSERT INTO systempreferences ( `variable`, `value` ) VALUES
('AllowItemsOnHoldCheckoutSCO','0'),
('AllowItemsOnHoldCheckoutSIP','0'),
('AllowItemsOnLoanCheckoutSIP','0'),
('AllowLinkedAccountHoldPickup','0'),
('AllowMultipleCovers','0'),
('AllowMultipleIssuesOnABiblio','1'),
('AllowNotForLoanOverride','0'),
@ -274,6 +275,7 @@ INSERT INTO systempreferences ( `variable`, `value` ) VALUES
('EnableItemGroupHolds','0'),
('EnableItemGroups','0'),
('EnableOpacSearchHistory','1'),
('EnablePatronAccountLinking','0'),
('EnablePointOfSale','0'),
('EnableSearchHistory','0'),
('EnableZotero','1'),
@ -464,6 +466,7 @@ INSERT INTO systempreferences ( `variable`, `value` ) VALUES
('noissuescharge','5'),
('NoIssuesChargeGuarantees',''),
('NoIssuesChargeGuarantorsWithGuarantees',''),
('NoIssuesChargeLinkedAccounts',''),
('noItemTypeImages','0'),
('NoRefundOnLostFinesPaidAge',''),
('NoRefundOnLostReturnedItemsAge',''),