Bugzilla – Attachment 193382 Details for
Bug 38924
Introduce an organization level loan 'Quota' system for Koha
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38924: Add patron_quota_usage table
Bug-38924-Add-patronquotausage-table.patch (text/plain), 4.34 KB, created by
Jacob O'Mara
on 2026-02-19 12:05:12 UTC
(
hide
)
Description:
Bug 38924: Add patron_quota_usage table
Filename:
MIME Type:
Creator:
Jacob O'Mara
Created:
2026-02-19 12:05:12 UTC
Size:
4.34 KB
patch
obsolete
>From ba01d8f05e480602550ae568eaec0ced81afbb51 Mon Sep 17 00:00:00 2001 >From: Jacob O'Mara <jacobomara901@gmail.com> >Date: Thu, 30 Jan 2025 16:14:55 +0000 >Subject: [PATCH] Bug 38924: Add patron_quota_usage table > >Add the new patron_quota_usage table for recording usage of quota >allocations against user issues. >--- > .../atomicupdate/bug_38924-patron_quotas.pl | 24 ++++++++++++++++++- > installer/data/mysql/kohastructure.sql | 21 ++++++++++++++++ > 2 files changed, 44 insertions(+), 1 deletion(-) > >diff --git a/installer/data/mysql/atomicupdate/bug_38924-patron_quotas.pl b/installer/data/mysql/atomicupdate/bug_38924-patron_quotas.pl >index a6531fbb1ab..161f3d1511b 100755 >--- a/installer/data/mysql/atomicupdate/bug_38924-patron_quotas.pl >+++ b/installer/data/mysql/atomicupdate/bug_38924-patron_quotas.pl >@@ -3,7 +3,7 @@ use Koha::Installer::Output qw(say_warning say_success say_info); > > return { > bug_number => "38924", >- description => "Add patron quota table and permissions", >+ description => "Add patron quota and quota_usage tables and permissions", > up => sub { > my ($args) = @_; > my ( $dbh, $out ) = @$args{qw(dbh out)}; >@@ -36,5 +36,27 @@ return { > } else { > say_info( $out, "Patron quota table already exists" ); > } >+ >+ unless ( TableExists('patron_quota_usage') ) >+ { >+ $dbh->do(q{ >+ CREATE TABLE `patron_quota_usage` ( >+ `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for quota usage record', >+ `patron_quota_id` int(11) NOT NULL COMMENT 'foreign key linking to patron_quota.id', >+ `issue_id` int(11) DEFAULT NULL COMMENT 'linking to issues.issue_id or old_issues.issue_id', >+ `patron_id` int(11) NOT NULL COMMENT 'foreign key linking to borrowers.borrowernumber', >+ PRIMARY KEY (`id`), >+ KEY `patron_quota_usage_ibfk_1` (`patron_quota_id`), >+ >+ KEY `patron_quota_usage_ibfk_2` (`patron_id`), >+ CONSTRAINT `patron_quota_usage_ibfk_1` FOREIGN KEY (`patron_quota_id`) REFERENCES `patron_quota` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, >+ CONSTRAINT `patron_quota_usage_ibfk_2` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE >+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; >+ }); >+ >+ say_success( $out, "Patron quota usage table created successfully" ); >+ } else { >+ say_info( $out, "Patron quota usage table already exists" ); >+ } > }, > }; >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index cfb768a2987..0bd4cd87eda 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -7135,6 +7135,27 @@ CREATE TABLE `patron_quota` ( > /*!40101 SET character_set_client = @saved_cs_client */; > /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; > >+-- >+-- Table structure for table `patron_quota_usage` >+-- >+ >+DROP TABLE IF EXISTS `patron_quota_usage`; >+/*!40101 SET @saved_cs_client = @@character_set_client */; >+/*!40101 SET character_set_client = utf8 */; >+CREATE TABLE `patron_quota_usage` ( >+ `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for quota usage record', >+ `patron_quota_id` int(11) NOT NULL COMMENT 'foreign key linking to patron_quota.id', >+ `issue_id` int(11) DEFAULT NULL COMMENT 'linking to issues.issue_id or old_issues.issue_id', >+ `patron_id` int(11) NOT NULL COMMENT 'foreign key linking to borrowers.borrowernumber', >+ PRIMARY KEY (`id`), >+ KEY `patron_quota_usage_ibfk_1` (`patron_quota_id`), >+ KEY `patron_quota_usage_ibfk_2` (`patron_id`), >+ CONSTRAINT `patron_quota_usage_ibfk_1` FOREIGN KEY (`patron_quota_id`) REFERENCES `patron_quota` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, >+ CONSTRAINT `patron_quota_usage_ibfk_2` FOREIGN KEY (`patron_id`) 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 */; >+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; >+ > /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; > /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; > /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; >-- >2.39.5
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 38924
:
178582
|
178583
|
178584
|
178585
|
178586
|
178587
|
178588
|
178589
|
178590
|
178591
|
178592
|
178593
|
178594
|
178595
|
178596
|
178597
|
178598
|
178599
|
178600
|
178601
|
178602
|
178603
|
178604
|
178605
|
178606
|
178607
|
178608
|
185631
|
185632
|
185633
|
185634
|
185635
|
185636
|
185637
|
185638
|
185639
|
185640
|
185641
|
185642
|
185643
|
185644
|
185645
|
185646
|
185647
|
185648
|
185649
|
185650
|
185651
|
185652
|
185653
|
185654
|
185655
|
185656
|
185657
|
185675
|
185676
|
185677
|
185678
|
185679
|
185680
|
185681
|
185682
|
185683
|
185684
|
185685
|
185686
|
185687
|
185688
|
185689
|
185690
|
185691
|
185692
|
185693
|
185694
|
185695
|
185696
|
185697
|
185698
|
185699
|
185700
|
185701
|
185702
|
189266
|
189267
|
189268
|
189269
|
189270
|
189271
|
189272
|
189273
|
189274
|
189275
|
189276
|
189277
|
189278
|
189279
|
189280
|
189281
|
189282
|
189283
|
189284
|
189285
|
189286
|
189287
|
189288
|
189289
|
189290
|
189291
|
189292
|
193377
|
193378
|
193379
|
193380
|
193381
|
193382
|
193383
|
193384
|
193385
|
193386
|
193387
|
193388
|
193389
|
193390
|
193391
|
193392
|
193393
|
193394
|
193395
|
193396
|
193397
|
193398
|
193399
|
193400
|
193401
|
193402
|
193403
|
193404
|
193405
|
193406
|
193407
|
193408
|
193409
|
193410
|
193411
|
193412
|
193413
|
193414
|
193415
|
193416
|
193417
|
193418
|
193419
|
193420
|
193421
|
193422
|
193423
|
193424
|
193425
|
193426
|
193427
|
193428
|
193429
|
193430
|
193431
|
193432
|
193433
|
193434
|
193435
|
193436
|
193437
|
193438
|
193439
|
193440
|
193441
|
193442
|
193443
|
193444
|
193445
|
193446
|
193447
|
193448
|
193449
|
193450
|
193451
|
193452
|
193453
|
193454
|
193455
|
193456
|
193457
|
193458
|
193459
|
193460
|
193547
|
193548
|
193549
|
193550
|
193551
|
193552
|
193553
|
193554
|
193555
|
193556
|
193557
|
193558
|
193559
|
193560
|
193561
|
193562
|
193563
|
193564
|
193565
|
193566
|
193567
|
193568
|
193569
|
193570
|
193571
|
193572
|
193573
|
193574
|
193575
|
193576
|
193577