Bugzilla – Attachment 189287 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: DBIC - DO NOT PUSH
Bug-38924-DBIC---DO-NOT-PUSH.patch (text/plain), 7.96 KB, created by
Jacob O'Mara
on 2025-11-07 12:13:45 UTC
(
hide
)
Description:
Bug 38924: DBIC - DO NOT PUSH
Filename:
MIME Type:
Creator:
Jacob O'Mara
Created:
2025-11-07 12:13:45 UTC
Size:
7.96 KB
patch
obsolete
>From 816d4961884ecf2b05b9733317f832437484f2ca Mon Sep 17 00:00:00 2001 >From: Jacob O'Mara <jacobomara901@gmail.com> >Date: Wed, 15 Jan 2025 14:55:20 +0000 >Subject: [PATCH] Bug 38924: DBIC - DO NOT PUSH > >--- > Koha/Schema/Result/Borrower.pm | 34 +++++- > Koha/Schema/Result/PatronQuota.pm | 150 +++++++++++++++++++++++++ > Koha/Schema/Result/PatronQuotaUsage.pm | 150 +++++++++++++++++++++++++ > 3 files changed, 332 insertions(+), 2 deletions(-) > create mode 100644 Koha/Schema/Result/PatronQuota.pm > create mode 100644 Koha/Schema/Result/PatronQuotaUsage.pm > >diff --git a/Koha/Schema/Result/Borrower.pm b/Koha/Schema/Result/Borrower.pm >index 2c8bf77f78b..2c3099dd9d0 100644 >--- a/Koha/Schema/Result/Borrower.pm >+++ b/Koha/Schema/Result/Borrower.pm >@@ -1721,6 +1721,36 @@ __PACKAGE__->has_many( > { cascade_copy => 0, cascade_delete => 0 }, > ); > >+=head2 patron_quota_usages >+ >+Type: has_many >+ >+Related object: L<Koha::Schema::Result::PatronQuotaUsage> >+ >+=cut >+ >+__PACKAGE__->has_many( >+ "patron_quota_usages", >+ "Koha::Schema::Result::PatronQuotaUsage", >+ { "foreign.patron_id" => "self.borrowernumber" }, >+ { cascade_copy => 0, cascade_delete => 0 }, >+); >+ >+=head2 patron_quotas >+ >+Type: has_many >+ >+Related object: L<Koha::Schema::Result::PatronQuota> >+ >+=cut >+ >+__PACKAGE__->has_many( >+ "patron_quotas", >+ "Koha::Schema::Result::PatronQuota", >+ { "foreign.patron_id" => "self.borrowernumber" }, >+ { cascade_copy => 0, cascade_delete => 0 }, >+); >+ > =head2 patronimage > > Type: might_have >@@ -2212,8 +2242,8 @@ Composing rels: L</user_permissions> -> permission > __PACKAGE__->many_to_many("permissions", "user_permissions", "permission"); > > >-# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-10-29 16:44:27 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:SSJcjPvlr82qecmbk1Q8iA >+# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-11-06 17:39:07 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:vB+lPQBN+56QCmNT0ARuLQ > > __PACKAGE__->belongs_to( > "library", >diff --git a/Koha/Schema/Result/PatronQuota.pm b/Koha/Schema/Result/PatronQuota.pm >new file mode 100644 >index 00000000000..42a7fb33a87 >--- /dev/null >+++ b/Koha/Schema/Result/PatronQuota.pm >@@ -0,0 +1,150 @@ >+use utf8; >+package Koha::Schema::Result::PatronQuota; >+ >+# Created by DBIx::Class::Schema::Loader >+# DO NOT MODIFY THE FIRST PART OF THIS FILE >+ >+=head1 NAME >+ >+Koha::Schema::Result::PatronQuota >+ >+=cut >+ >+use strict; >+use warnings; >+ >+use base 'DBIx::Class::Core'; >+ >+=head1 TABLE: C<patron_quota> >+ >+=cut >+ >+__PACKAGE__->table("patron_quota"); >+ >+=head1 ACCESSORS >+ >+=head2 id >+ >+ data_type: 'integer' >+ is_auto_increment: 1 >+ is_nullable: 0 >+ >+unique identifier for the quota record >+ >+=head2 description >+ >+ data_type: 'longtext' >+ is_nullable: 0 >+ >+user friendly description for the quota record >+ >+=head2 patron_id >+ >+ data_type: 'integer' >+ is_foreign_key: 1 >+ is_nullable: 0 >+ >+foreign key linking to borrowers.borrowernumber >+ >+=head2 allocation >+ >+ data_type: 'integer' >+ default_value: 0 >+ is_nullable: 0 >+ >+total quota allocation for the period >+ >+=head2 used >+ >+ data_type: 'integer' >+ default_value: 0 >+ is_nullable: 0 >+ >+amount of allocation used for current period >+ >+=head2 start_date >+ >+ data_type: 'date' >+ datetime_undef_if_invalid: 1 >+ is_nullable: 0 >+ >+start date of the allocation period >+ >+=head2 end_date >+ >+ data_type: 'date' >+ datetime_undef_if_invalid: 1 >+ is_nullable: 0 >+ >+end date of the allocation period >+ >+=cut >+ >+__PACKAGE__->add_columns( >+ "id", >+ { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, >+ "description", >+ { data_type => "longtext", is_nullable => 0 }, >+ "patron_id", >+ { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, >+ "allocation", >+ { data_type => "integer", default_value => 0, is_nullable => 0 }, >+ "used", >+ { data_type => "integer", default_value => 0, is_nullable => 0 }, >+ "start_date", >+ { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 0 }, >+ "end_date", >+ { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 0 }, >+); >+ >+=head1 PRIMARY KEY >+ >+=over 4 >+ >+=item * L</id> >+ >+=back >+ >+=cut >+ >+__PACKAGE__->set_primary_key("id"); >+ >+=head1 RELATIONS >+ >+=head2 patron >+ >+Type: belongs_to >+ >+Related object: L<Koha::Schema::Result::Borrower> >+ >+=cut >+ >+__PACKAGE__->belongs_to( >+ "patron", >+ "Koha::Schema::Result::Borrower", >+ { borrowernumber => "patron_id" }, >+ { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, >+); >+ >+=head2 patron_quota_usages >+ >+Type: has_many >+ >+Related object: L<Koha::Schema::Result::PatronQuotaUsage> >+ >+=cut >+ >+__PACKAGE__->has_many( >+ "patron_quota_usages", >+ "Koha::Schema::Result::PatronQuotaUsage", >+ { "foreign.patron_quota_id" => "self.id" }, >+ { cascade_copy => 0, cascade_delete => 0 }, >+); >+ >+ >+# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-01-30 16:04:36 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:KG/MIjPSLcpeSlPypwli2Q >+ >+ >+# You can replace this text with custom code or comments, and it will be preserved on regeneration >+1; >diff --git a/Koha/Schema/Result/PatronQuotaUsage.pm b/Koha/Schema/Result/PatronQuotaUsage.pm >new file mode 100644 >index 00000000000..dfef728c97c >--- /dev/null >+++ b/Koha/Schema/Result/PatronQuotaUsage.pm >@@ -0,0 +1,150 @@ >+use utf8; >+package Koha::Schema::Result::PatronQuotaUsage; >+ >+# Created by DBIx::Class::Schema::Loader >+# DO NOT MODIFY THE FIRST PART OF THIS FILE >+ >+=head1 NAME >+ >+Koha::Schema::Result::PatronQuotaUsage >+ >+=cut >+ >+use strict; >+use warnings; >+ >+use base 'DBIx::Class::Core'; >+ >+=head1 TABLE: C<patron_quota_usage> >+ >+=cut >+ >+__PACKAGE__->table("patron_quota_usage"); >+ >+=head1 ACCESSORS >+ >+=head2 id >+ >+ data_type: 'integer' >+ is_auto_increment: 1 >+ is_nullable: 0 >+ >+unique identifier for quota usage record >+ >+=head2 patron_quota_id >+ >+ data_type: 'integer' >+ is_foreign_key: 1 >+ is_nullable: 0 >+ >+foreign key linking to patron_quota.id >+ >+=head2 issue_id >+ >+ data_type: 'integer' >+ is_nullable: 1 >+ >+linking to issues.issue_id or old_issues.issue_id >+ >+=head2 patron_id >+ >+ data_type: 'integer' >+ is_foreign_key: 1 >+ is_nullable: 0 >+ >+foreign key linking to borrowers.borrowernumber >+ >+=head2 type >+ >+ data_type: 'enum' >+ extra: {list => ["ISSUE","RENEW"]} >+ is_nullable: 0 >+ >+The type of usage this is >+ >+=head2 creation_date >+ >+ data_type: 'timestamp' >+ datetime_undef_if_invalid: 1 >+ default_value: current_timestamp >+ is_nullable: 0 >+ >+the timestamp for when a usage was recorded >+ >+=cut >+ >+__PACKAGE__->add_columns( >+ "id", >+ { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, >+ "patron_quota_id", >+ { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, >+ "issue_id", >+ { data_type => "integer", is_nullable => 1 }, >+ "patron_id", >+ { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, >+ "type", >+ { >+ data_type => "enum", >+ extra => { list => ["ISSUE", "RENEW"] }, >+ is_nullable => 0, >+ }, >+ "creation_date", >+ { >+ data_type => "timestamp", >+ datetime_undef_if_invalid => 1, >+ default_value => \"current_timestamp", >+ is_nullable => 0, >+ }, >+); >+ >+=head1 PRIMARY KEY >+ >+=over 4 >+ >+=item * L</id> >+ >+=back >+ >+=cut >+ >+__PACKAGE__->set_primary_key("id"); >+ >+=head1 RELATIONS >+ >+=head2 patron >+ >+Type: belongs_to >+ >+Related object: L<Koha::Schema::Result::Borrower> >+ >+=cut >+ >+__PACKAGE__->belongs_to( >+ "patron", >+ "Koha::Schema::Result::Borrower", >+ { borrowernumber => "patron_id" }, >+ { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, >+); >+ >+=head2 patron_quota >+ >+Type: belongs_to >+ >+Related object: L<Koha::Schema::Result::PatronQuota> >+ >+=cut >+ >+__PACKAGE__->belongs_to( >+ "patron_quota", >+ "Koha::Schema::Result::PatronQuota", >+ { id => "patron_quota_id" }, >+ { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, >+); >+ >+ >+# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-11-06 17:47:10 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:hxeHkoIaFwVoiLReL04/4A >+ >+ >+# You can replace this text with custom code or comments, and it will be preserved on regeneration >+1; >-- >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