Bugzilla – Attachment 125846 Details for
Bug 29139
Paying gives ISE if UseEmailReceipts is enabled
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[21.05.x] Bug 29139: Add exceptions to relation accessors
2105x-Bug-29139-Add-exceptions-to-relation-accesso.patch (text/plain), 2.13 KB, created by
Tomás Cohen Arazi (tcohen)
on 2021-10-06 18:10:17 UTC
(
hide
)
Description:
[21.05.x] Bug 29139: Add exceptions to relation accessors
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2021-10-06 18:10:17 UTC
Size:
2.13 KB
patch
obsolete
>From 19a1474b561026cc16155944812b9c34d2271ae4 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 30 Sep 2021 09:28:29 +0100 >Subject: [PATCH] [21.05.x] Bug 29139: Add exceptions to relation accessors > >We already had exceptions on the many-to-many links, but we didn't have >them for the middle table. The underlying dbic relations make it clear >which id's are being used for linking. A 'credit' has 'credit_offsets', >a 'debit' has 'debit_offsets'. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/Account/Line.pm | 23 ++++++++++++++++++----- > 1 file changed, 18 insertions(+), 5 deletions(-) > >diff --git a/Koha/Account/Line.pm b/Koha/Account/Line.pm >index bd233e3b36..770156fd27 100644 >--- a/Koha/Account/Line.pm >+++ b/Koha/Account/Line.pm >@@ -132,8 +132,15 @@ Return the credit_offsets linked to this account line if some exist > =cut > > sub credit_offsets { >- my ( $self ) = @_; >- my $rs = $self->_result->account_offsets_credits; >+ my ( $self, $cond, $attr ) = @_; >+ >+ unless ( $self->is_credit ) { >+ Koha::Exceptions::Account::IsNotCredit->throw( >+ error => 'Account line ' . $self->id . ' is not a credit' >+ ); >+ } >+ >+ my $rs = $self->_result->search_related( 'account_offsets_credits', $cond, $attr); > return unless $rs; > return Koha::Account::Offsets->_new_from_dbic($rs); > } >@@ -145,13 +152,19 @@ Return the debit_offsets linked to this account line if some exist > =cut > > sub debit_offsets { >- my ( $self ) = @_; >- my $rs = $self->_result->account_offsets_debits; >+ my ( $self, $cond, $attr ) = @_; >+ >+ unless ( $self->is_debit ) { >+ Koha::Exceptions::Account::IsNotDebit->throw( >+ error => 'Account line ' . $self->id . ' is not a debit' >+ ); >+ } >+ >+ my $rs = $self->_result->search_related( 'account_offsets_debits', $cond, $attr); > return unless $rs; > return Koha::Account::Offsets->_new_from_dbic($rs); > } > >- > =head3 credits > > my $credits = $accountline->credits; >-- >2.32.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 29139
:
125463
|
125464
|
125474
|
125475
|
125476
|
125504
|
125505
|
125506
|
125507
|
125508
|
125509
|
125510
|
125511
|
125512
|
125513
|
125592
|
125593
|
125594
|
125595
|
125596
|
125844
|
125845
| 125846 |
125847
|
125848