Bugzilla – Attachment 125594 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]
Bug 29139: Add exceptions to relation accessors
Bug-29139-Add-exceptions-to-relation-accessors.patch (text/plain), 1.94 KB, created by
Martin Renvoize (ashimema)
on 2021-10-01 09:17:01 UTC
(
hide
)
Description:
Bug 29139: Add exceptions to relation accessors
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-10-01 09:17:01 UTC
Size:
1.94 KB
patch
obsolete
>From 66daae48abe98b7f82b739c011ebc8480d908f2a 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] 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 | 15 ++++++++++++++- > 1 file changed, 14 insertions(+), 1 deletion(-) > >diff --git a/Koha/Account/Line.pm b/Koha/Account/Line.pm >index c0964fc006..9b402a1b39 100644 >--- a/Koha/Account/Line.pm >+++ b/Koha/Account/Line.pm >@@ -145,6 +145,13 @@ Return the credit_offsets linked to this account line if some exist > > sub credit_offsets { > 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); >@@ -158,12 +165,18 @@ Return the debit_offsets linked to this account line if some exist > > sub debit_offsets { > 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.20.1
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