Bugzilla – Attachment 129179 Details for
Bug 29757
Add filter_by_non_reversible/reversible methods for offsets
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29757: Add filters for reversable offsets
Bug-29757-Add-filters-for-reversable-offsets.patch (text/plain), 2.23 KB, created by
Martin Renvoize (ashimema)
on 2022-01-07 14:28:45 UTC
(
hide
)
Description:
Bug 29757: Add filters for reversable offsets
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-01-07 14:28:45 UTC
Size:
2.23 KB
patch
obsolete
>From 2068c94be01c1f7fe8d35c6b0644cd827a704131 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 22 Dec 2021 16:36:07 -0300 >Subject: [PATCH] Bug 29757: Add filters for reversable offsets > >This patch adds filtering methods for (non)reversable offsets. > >To test: >1. Apply this patches >2. Run: > $ kshell > k$ prove t/db_dependent/Koha/Account/Offsets.t >=> SUCCESS: Tests pass! >3. Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/Account/Offsets.pm | 44 +++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 44 insertions(+) > >diff --git a/Koha/Account/Offsets.pm b/Koha/Account/Offsets.pm >index e2884114f6..725d4550d8 100644 >--- a/Koha/Account/Offsets.pm >+++ b/Koha/Account/Offsets.pm >@@ -60,6 +60,50 @@ sub total { > : 0; > } > >+=head3 filter_by_non_reversable >+ >+=cut >+ >+sub filter_by_non_reversable { >+ my ($self) = @_; >+ >+ my $me = $self->_resultset()->current_source_alias; >+ >+ my $where = { >+ debit_id => { '!=' => undef }, >+ credit_id => { '!=' => undef }, >+ type => 'APPLY', >+ 'credit.credit_type_code' => [ 'WRITEOFF', 'DISCOUNT', 'CANCELLATION' ], >+ 'credit.status' => [ { '!=' => 'VOID' }, undef ], >+ $me . '.amount' => { '<' => 0 } >+ }; >+ my $attr = { join => 'credit' }; >+ >+ return $self->search( $where, $attr ); >+} >+ >+=head3 filter_by_reversable >+ >+=cut >+ >+sub filter_by_reversable { >+ my ($self) = @_; >+ >+ my $me = $self->_resultset()->current_source_alias; >+ >+ my $where = { >+ debit_id => { '!=' => undef }, >+ credit_id => { '!=' => undef }, >+ type => 'APPLY', >+ 'credit.credit_type_code' => { -not_in => [ 'WRITEOFF', 'DISCOUNT', 'CANCELLATION' ] }, >+ 'credit.status' => [ { '!=' => 'VOID' }, undef ], >+ $me . '.amount' => { '<' => 0 } >+ }; >+ my $attr = { join => 'credit' }; >+ >+ return $self->search( $where, $attr ); >+} >+ > =head2 Internal methods > > =head3 _type >-- >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 29757
:
128865
|
128866
|
128867
|
129150
|
129151
|
129152
|
129178
| 129179 |
129180
|
129296