Bugzilla – Attachment 152012 Details for
Bug 21983
Better handling of deleted biblios on ILL requests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21983: Add Koha::Biblio->ill_requests
Bug-21983-Add-KohaBiblio-illrequests.patch (text/plain), 3.07 KB, created by
Martin Renvoize (ashimema)
on 2023-06-05 17:40:27 UTC
(
hide
)
Description:
Bug 21983: Add Koha::Biblio->ill_requests
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-06-05 17:40:27 UTC
Size:
3.07 KB
patch
obsolete
>From 4a864050cea2ae6f9133870eb8cec6ae2ad1bade Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 5 Jun 2023 13:53:18 -0300 >Subject: [PATCH] Bug 21983: Add Koha::Biblio->ill_requests > >This patch adds a new method, used for retrieving the linked ill >requests for a biblio. > >To test: >1. Apply this patch and run: > $ ktd --shell > k$ prove t/db_dependent/Koha/Biblio.t >=> SUCCESS: Tests pass! > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/Biblio.pm | 16 ++++++++++++++++ > Koha/Schema/Result/Biblio.pm | 7 +++++++ > t/db_dependent/Koha/Biblio.t | 28 +++++++++++++++++++++++++++- > 3 files changed, 50 insertions(+), 1 deletion(-) > >diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm >index 50d60c8a69..3b697ec536 100644 >--- a/Koha/Biblio.pm >+++ b/Koha/Biblio.pm >@@ -39,6 +39,7 @@ use Koha::Cache::Memory::Lite; > use Koha::Checkouts; > use Koha::CirculationRules; > use Koha::Exceptions; >+use Koha::Illrequests; > use Koha::Item::Transfer::Limits; > use Koha::Items; > use Koha::Libraries; >@@ -164,6 +165,21 @@ sub tickets { > return Koha::Tickets->_new_from_dbic( $rs ); > } > >+=head3 ill_requests >+ >+ my $ill_requests = $biblio->ill_requests(); >+ >+Returns a Koha::Illrequests object >+ >+=cut >+ >+sub ill_requests { >+ my ( $self ) = @_; >+ >+ my $ill_requests = $self->_result->ill_requests; >+ return Koha::Illrequests->_new_from_dbic($ill_requests); >+} >+ > =head3 item_groups > > my $item_groups = $biblio->item_groups(); >diff --git a/Koha/Schema/Result/Biblio.pm b/Koha/Schema/Result/Biblio.pm >index 42481e0ea2..24a2688cae 100644 >--- a/Koha/Schema/Result/Biblio.pm >+++ b/Koha/Schema/Result/Biblio.pm >@@ -611,6 +611,13 @@ __PACKAGE__->has_many( > { cascade_copy => 0, cascade_delete => 0 }, > ); > >+__PACKAGE__->has_many( >+ "ill_requests", >+ "Koha::Schema::Result::Illrequest", >+ { "foreign.biblio_id" => "self.biblionumber" }, >+ { cascade_copy => 0, cascade_delete => 0 }, >+); >+ > __PACKAGE__->has_one( > "metadata", > "Koha::Schema::Result::BiblioMetadata", >diff --git a/t/db_dependent/Koha/Biblio.t b/t/db_dependent/Koha/Biblio.t >index ef41c7636a..9f8754aa91 100755 >--- a/t/db_dependent/Koha/Biblio.t >+++ b/t/db_dependent/Koha/Biblio.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 23; # +1 >+use Test::More tests => 24; > use Test::Exception; > use Test::Warn; > >@@ -1061,6 +1061,32 @@ subtest 'Recalls tests' => sub { > $schema->storage->txn_rollback; > }; > >+subtest 'ill_requests() tests' => sub { >+ >+ plan tests => 3; >+ >+ $schema->storage->txn_begin; >+ >+ my $biblio = $builder->build_sample_biblio; >+ >+ my $rs = $biblio->ill_requests; >+ is( ref($rs), 'Koha::Illrequests' ); >+ is( $rs->count, 0, 'No linked requests' ); >+ >+ foreach ( 1..10 ) { >+ $builder->build_object( >+ { >+ class => 'Koha::Illrequests', >+ value => { biblio_id => $biblio->id } >+ } >+ ); >+ } >+ >+ is( $biblio->ill_requests->count, 10, 'Linked requests are present' ); >+ >+ $schema->storage->txn_rollback; >+}; >+ > subtest 'item_groups() tests' => sub { > > plan tests => 6; >-- >2.41.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 21983
:
83226
|
83227
|
152005
|
152006
|
152007
|
152008
|
152010
|
152011
|
152012
|
152013
|
152056
|
152057
|
152058
|
152059
|
152060
|
152063