Bugzilla – Attachment 93024 Details for
Bug 23321
Add 'cash registers' to the accounts system
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23321: Koha::Library additions
Bug-23321-KohaLibrary-additions.patch (text/plain), 2.62 KB, created by
Tomás Cohen Arazi (tcohen)
on 2019-09-20 19:01:54 UTC
(
hide
)
Description:
Bug 23321: Koha::Library additions
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2019-09-20 19:01:54 UTC
Size:
2.62 KB
patch
obsolete
>From 8e41155ef3f51b9812caf0f95406b31de0d949ec Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 17 Sep 2019 12:24:01 +0100 >Subject: [PATCH] Bug 23321: Koha::Library additions > >This patch adds the relationship accessor for Cash::Registers to the >Koha::Library class and include the relevant tests. > >Sponsored-by: PTFS Europe >Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/Library.pm | 12 +++++++++++ > t/db_dependent/Koha/Libraries.t | 37 ++++++++++++++++++++++++++++++++- > 2 files changed, 48 insertions(+), 1 deletion(-) > >diff --git a/Koha/Library.pm b/Koha/Library.pm >index f1a5597305..6870e84cc4 100644 >--- a/Koha/Library.pm >+++ b/Koha/Library.pm >@@ -77,6 +77,18 @@ sub library_groups { > return Koha::Library::Groups->_new_from_dbic( $rs ); > } > >+=head3 cash_registers >+ >+Return Cash::Registers associated with this Library >+ >+=cut >+ >+sub cash_registers { >+ my ( $self ) = @_; >+ my $rs = $self->_result->cash_registers; >+ return Koha::Cash::Registers->_new_from_dbic( $rs ); >+} >+ > =head2 Internal methods > > =head3 _type >diff --git a/t/db_dependent/Koha/Libraries.t b/t/db_dependent/Koha/Libraries.t >index 5c356c1998..d58d0592a9 100644 >--- a/t/db_dependent/Koha/Libraries.t >+++ b/t/db_dependent/Koha/Libraries.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 7; >+use Test::More tests => 8; > > use C4::Biblio; > use C4::Context; >@@ -451,3 +451,38 @@ subtest '->get_effective_marcorgcode' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'cash_registers' => sub { >+ plan tests => 3; >+ >+ $schema->storage->txn_begin; >+ >+ my $library = $builder->build_object( { class => 'Koha::Libraries' } ); >+ my $register1 = $builder->build_object( >+ { >+ class => 'Koha::Cash::Registers', >+ value => { branch => $library->branchcode }, >+ } >+ ); >+ my $register2 = $builder->build_object( >+ { >+ class => 'Koha::Cash::Registers', >+ value => { branch => $library->branchcode }, >+ } >+ ); >+ >+ my $registers = $library->cash_registers; >+ is( ref($registers), 'Koha::Cash::Registers', >+'Koha::Library->cash_registers should return a set of Koha::Cash::Registers' >+ ); >+ is( $registers->count, 2, >+ 'Koha::Library->cash_registers should return the correct cash registers' >+ ); >+ >+ $register1->delete; >+ is( $library->cash_registers->next->id, $register2->id, >+ 'Koha::Library->cash_registers should return the correct cash registers' >+ ); >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.23.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 23321
:
91596
|
91597
|
91598
|
91599
|
91600
|
91601
|
91602
|
91621
|
92057
|
92058
|
92059
|
92060
|
92061
|
92062
|
92063
|
92064
|
92065
|
92083
|
92084
|
92085
|
92086
|
92087
|
92088
|
92089
|
92090
|
92091
|
92394
|
92395
|
92396
|
92397
|
92398
|
92399
|
92400
|
92401
|
92402
|
92467
|
92468
|
92469
|
92470
|
92471
|
92472
|
92473
|
92474
|
92475
|
92803
|
92804
|
92805
|
92806
|
92807
|
92808
|
92809
|
92810
|
92811
|
92812
|
92813
|
92814
|
92829
|
92879
|
92880
|
92881
|
92882
|
92883
|
92884
|
92885
|
92886
|
92887
|
92888
|
92889
|
93019
|
93020
|
93021
|
93022
|
93023
| 93024 |
93025
|
93026
|
93027
|
93028
|
93029
|
93030
|
93031
|
93032
|
93033
|
93034
|
93035
|
93188