Bugzilla – Attachment 100203 Details for
Bug 24815
Koha::Cash::Register relations should return sets not undef
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24815: Correct return values of Koha::Cash::Register relations
Bug-24815-Correct-return-values-of-KohaCashRegiste.patch (text/plain), 2.29 KB, created by
Martin Renvoize (ashimema)
on 2020-03-05 16:13:14 UTC
(
hide
)
Description:
Bug 24815: Correct return values of Koha::Cash::Register relations
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-03-05 16:13:14 UTC
Size:
2.29 KB
patch
obsolete
>From 1e63b3d2dad00ffb0379c5d7b843a2eee6c4f156 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 5 Mar 2020 16:11:33 +0000 >Subject: [PATCH] Bug 24815: Correct return values of Koha::Cash::Register > relations > >This patch correct all cases of return undef to instead return an empty >resultset. >--- > Koha/Cash/Register.pm | 16 ++++++---------- > 1 file changed, 6 insertions(+), 10 deletions(-) > >diff --git a/Koha/Cash/Register.pm b/Koha/Cash/Register.pm >index ac14db6d6c..3549c7a0d1 100644 >--- a/Koha/Cash/Register.pm >+++ b/Koha/Cash/Register.pm >@@ -46,9 +46,7 @@ Return the library linked to this cash register > > sub library { > my ($self) = @_; >- my $rs = $self->_result->branch; >- return unless $rs; >- return Koha::Library->_new_from_dbic($rs); >+ return Koha::Library->_new_from_dbic($self->_result->branch); > } > > =head3 cashups >@@ -67,7 +65,7 @@ sub cashups { > my $rs = > $self->_result->search_related( 'cash_register_actions', > $merged_conditions, $attrs ); >- return unless $rs; >+ > return Koha::Cash::Register::Actions->_new_from_dbic($rs); > } > >@@ -86,7 +84,6 @@ sub last_cashup { > { order_by => { '-desc' => [ 'timestamp', 'id' ] }, rows => 1 } > )->single; > >- return unless $rs; > return Koha::Cash::Register::Action->_new_from_dbic($rs); > } > >@@ -98,10 +95,7 @@ Return a set of accountlines linked to this cash register > > sub accountlines { > my ($self) = @_; >- >- my $rs = $self->_result->accountlines; >- return unless $rs; >- return Koha::Account::Lines->_new_from_dbic($rs); >+ return Koha::Account::Lines->_new_from_dbic($self->_result->accountlines); > } > > =head3 outstanding_accountlines >@@ -136,7 +130,7 @@ sub outstanding_accountlines { > my $rs = > $self->_result->search_related( 'accountlines', $merged_conditions, > $attrs ); >- return unless $rs; >+ > return Koha::Account::Lines->_new_from_dbic($rs); > } > >@@ -148,6 +142,7 @@ Local store method to prevent direct manipulation of the 'branch_default' field > > sub store { > my ($self) = @_; >+ > $self->_result->result_source->schema->txn_do( > sub { > if ( $self->_result->is_column_changed('branch_default') ) { >@@ -163,6 +158,7 @@ sub store { > } > } > ); >+ > return $self; > } > >-- >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 24815
:
100203
|
100219
|
100220
|
101907
|
101908
|
103559
|
103560
|
103786
|
103787
|
103788
|
103790
|
103791