Bugzilla – Attachment 189272 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 Koha::Patron::Quota::Usage(s) classes
Bug-38924-Add-KohaPatronQuotaUsages-classes.patch (text/plain), 2.89 KB, created by
Jacob O'Mara
on 2025-11-07 12:13:04 UTC
(
hide
)
Description:
Bug 38924: Add Koha::Patron::Quota::Usage(s) classes
Filename:
MIME Type:
Creator:
Jacob O'Mara
Created:
2025-11-07 12:13:04 UTC
Size:
2.89 KB
patch
obsolete
>From 548833835ef631a6c2f05dbec18d977031973776 Mon Sep 17 00:00:00 2001 >From: Jacob O'Mara <jacobomara901@gmail.com> >Date: Thu, 30 Jan 2025 16:16:49 +0000 >Subject: [PATCH] Bug 38924: Add Koha::Patron::Quota::Usage(s) classes > >Add ::Usage(s) classes for working with quota allocation usage. > >We overload store to ensure data consistency for the checkout_id field >which is linked to either the issue or old_issue table appropriatly. > >We include a checkout relationship that handles the lack of foreign key >due to issues/old_issues. >--- > Koha/Patron/Quota/Usage.pm | 75 +++++++++++++++++++++++++++++++++++++ > Koha/Patron/Quota/Usages.pm | 35 +++++++++++++++++ > 2 files changed, 110 insertions(+) > create mode 100644 Koha/Patron/Quota/Usage.pm > create mode 100644 Koha/Patron/Quota/Usages.pm > >diff --git a/Koha/Patron/Quota/Usage.pm b/Koha/Patron/Quota/Usage.pm >new file mode 100644 >index 00000000000..7d3696fc7f7 >--- /dev/null >+++ b/Koha/Patron/Quota/Usage.pm >@@ -0,0 +1,75 @@ >+package Koha::Patron::Quota::Usage; >+ >+use base qw(Koha::Object); >+use Modern::Perl; >+use Koha::Patron::Quota; >+use Koha::Patron::Quota::Usages; >+ >+=head1 NAME >+ >+Koha::Patron::Quota::Usage - Koha Patron Quota Usage Object class >+ >+=head1 API >+ >+=head2 Class methods >+ >+=cut >+ >+=head3 patron >+ >+Returns the patron this quota usage belongs to >+ >+=cut >+ >+sub patron { >+ my ($self) = @_; >+ my $rs = $self->_result->patron; >+ return Koha::Patron->_new_from_dbic($rs); >+} >+ >+=head3 quota >+ >+Returns the quota this usage belongs to >+ >+=cut >+ >+sub quota { >+ my ($self) = @_; >+ my $rs = $self->_result->patron_quota; >+ return Koha::Patron::Quota->_new_from_dbic($rs); >+} >+ >+=head3 store >+ >+Overloaded I<store> method to set implement issue_id foreign key in code >+ >+=cut >+ >+sub store { >+ my ($self) = @_; >+ >+ # Check that we have a valid issue_id >+ unless ( !$self->issue_id >+ || Koha::Checkouts->find( $self->issue_id ) >+ || Koha::Old::Checkouts->find( $self->issue_id ) ) >+ { >+ Koha::Exceptions::Object::FKConstraint->throw( >+ error => 'Broken FK Contraint', >+ broken_fk => 'issue_id' >+ ); >+ } >+ >+ return $self->SUPER::store(); >+} >+ >+=head2 Internal methods >+ >+=head3 _type >+ >+=cut >+ >+sub _type { >+ return 'PatronQuotaUsage'; >+} >+ >+1; >diff --git a/Koha/Patron/Quota/Usages.pm b/Koha/Patron/Quota/Usages.pm >new file mode 100644 >index 00000000000..4fd82e26c67 >--- /dev/null >+++ b/Koha/Patron/Quota/Usages.pm >@@ -0,0 +1,35 @@ >+package Koha::Patron::Quota::Usages; >+ >+use base qw(Koha::Objects); >+use Modern::Perl; >+use Koha::Patron::Quota::Usage; >+ >+=head1 NAME >+ >+Koha::Patron::Quota::Usages - Koha Patron Quota Usages Object set class >+ >+=head1 API >+ >+=head2 Class methods >+ >+=cut >+ >+=head2 Internal methods >+ >+=head3 _type >+ >+=cut >+ >+sub _type { >+ return 'PatronQuotaUsage'; >+} >+ >+=head3 object_class >+ >+=cut >+ >+sub object_class { >+ return 'Koha::Patron::Quota::Usage'; >+} >+ >+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