Bugzilla – Attachment 164226 Details for
Bug 36480
Add GET /libraries/:library_id/desks
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36480: Add Koha::Library->desks
Bug-36480-Add-KohaLibrary-desks.patch (text/plain), 2.37 KB, created by
Tomás Cohen Arazi (tcohen)
on 2024-04-01 20:29:17 UTC
(
hide
)
Description:
Bug 36480: Add Koha::Library->desks
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2024-04-01 20:29:17 UTC
Size:
2.37 KB
patch
obsolete
>From d5b2c22201c7a3b4588b0b7d3c5c7527951817b0 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 1 Apr 2024 20:22:22 +0000 >Subject: [PATCH] Bug 36480: Add Koha::Library->desks > >We add an accessor for the related desks. Tests are added. > >To test: >1. Apply this patch >2. Run: > $ ktd --shell > k$ prove t/db_dependent/Koha/Library.t >=> SUCCESS: Tests pass! >3. Sign off :-D >--- > Koha/Library.pm | 14 ++++++++++++++ > t/db_dependent/Koha/Library.t | 26 +++++++++++++++++++++++++- > 2 files changed, 39 insertions(+), 1 deletion(-) > >diff --git a/Koha/Library.pm b/Koha/Library.pm >index decfa136170..65c784d6831 100644 >--- a/Koha/Library.pm >+++ b/Koha/Library.pm >@@ -24,6 +24,7 @@ use C4::Context; > > use Koha::Caches; > use Koha::Database; >+use Koha::Desks; > use Koha::StockRotationStages; > use Koha::SMTP::Servers; > >@@ -269,6 +270,19 @@ sub cash_registers { > return Koha::Cash::Registers->_new_from_dbic( $rs ); > } > >+=head3 desks >+ >+ my $desks = $library->desks; >+ >+Returns Koha::Desks associated with this library. >+ >+=cut >+ >+sub desks { >+ my ($self) = @_; >+ return Koha::Desks->_new_from_dbic( scalar $self->_result->desks ); >+} >+ > =head3 get_hold_libraries > > Return all libraries (including self) that belong to the same hold groups >diff --git a/t/db_dependent/Koha/Library.t b/t/db_dependent/Koha/Library.t >index 5c16eedb543..661803d815b 100755 >--- a/t/db_dependent/Koha/Library.t >+++ b/t/db_dependent/Koha/Library.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 2; >+use Test::More tests => 3; > > use Koha::Database; > use Koha::AdditionalContents; >@@ -161,3 +161,27 @@ subtest 'opac_info tests' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'desks() tests' => sub { >+ >+ plan tests => 5; >+ >+ $schema->storage->txn_begin; >+ >+ my $library = $builder->build_object( { class => 'Koha::Libraries' } ); >+ >+ my $rs = $library->desks; >+ is( ref($rs), 'Koha::Desks' ); >+ is( $rs->count, 0, 'No desks' ); >+ >+ my $desk_1 = $builder->build_object( { class => 'Koha::Desks', value => { branchcode => $library->id } } ); >+ my $desk_2 = $builder->build_object( { class => 'Koha::Desks', value => { branchcode => $library->id } } ); >+ >+ $rs = $library->desks; >+ >+ is( $rs->count, 2 ); >+ is( $rs->next->id, $desk_1->id ); >+ is( $rs->next->id, $desk_2->id ); >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.44.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 36480
:
164226
|
164227
|
164233
|
164234
|
164413
|
164414
|
169286