Bugzilla – Attachment 154940 Details for
Bug 34639
Item shown in transit on detail.pl even if marked as arrived or cancelled
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34639: Use coderef for releationship
Bug-34639-Use-coderef-for-releationship.patch (text/plain), 2.37 KB, created by
Lari Taskula
on 2023-08-30 09:27:03 UTC
(
hide
)
Description:
Bug 34639: Use coderef for releationship
Filename:
MIME Type:
Creator:
Lari Taskula
Created:
2023-08-30 09:27:03 UTC
Size:
2.37 KB
patch
obsolete
>From b94e1b27ff3ecbfce767344fa43c27ebce414028 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Tue, 29 Aug 2023 12:17:14 +0000 >Subject: [PATCH] Bug 34639: Use coderef for releationship > >This patch switches from a simple relationship to a custom join as >illustrated in the DBIx::Class docs > >Reference: >https://metacpan.org/pod/DBIx::Class::Relationship::Base#Custom-join-conditions > >This does not include an order_by, so I am not sure if it is sufficient > >To test: >1 - On command line: > export DBIC_TRACE=1; >2 - Save simple script: >use Modern::Perl; >use Koha::Items; > >my $items = Koha::Items->search( {'me.itemnumber'=>27}, {prefetch => 'current_branchtransfers'} ); >my $item = $items->next; > >warn $item->_result->current_branchtransfers->count(); >warn $item->get_transfer(); >3 - run it >4 - Note that the query doesn't include conditions on the transfers >5 - Apply patch >6 - Repeat >7 - Note that query is correct > >Test in staf client: >1. Add an item to library A >2. Go to Circulation -> Transfer >3. Transfer the item from library A to another library B >4. Set your currently logged in library to library B >5. Check-in the item >6. Observe message "Item received from A" >7. View the bibliographic record of the item (catalogue/detail.pl) >8. Observe item in "In transit from A to B since xx/xx/xxxx Available" >9. Apply patch >10. Restart all >11. Reload details - item no longer in transit > >Signed-off-by: Lari Taskula <lari.taskula@hypernova.fi> >--- > Koha/Schema/Result/Item.pm | 14 +++++++++----- > 1 file changed, 9 insertions(+), 5 deletions(-) > >diff --git a/Koha/Schema/Result/Item.pm b/Koha/Schema/Result/Item.pm >index ab5f09418b..43f0f9fc24 100644 >--- a/Koha/Schema/Result/Item.pm >+++ b/Koha/Schema/Result/Item.pm >@@ -975,11 +975,15 @@ __PACKAGE__->many_to_many( > __PACKAGE__->has_many( > "current_branchtransfers", > "Koha::Schema::Result::Branchtransfer", >- { 'foreign.itemnumber' => 'self.itemnumber' }, >- { >- where => { datearrived => undef, datecancelled => undef }, >- order_by => [ { -desc => 'datesent' }, { -asc => 'daterequested' } ] >- } >+ sub { >+ my $args = shift; >+ >+ return { >+ "$args->{foreign_alias}.itemnumber" => { -ident => "$args->{self_alias}.itemnumber" }, >+ "$args->{foreign_alias}.datearrived" => undef, >+ "$args->{foreign_alias}.datecancelled" => undef, >+ } >+ }, > ); > > # Relationship with bundled items >-- >2.34.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 34639
:
154895
|
154896
|
154900
|
154917
|
154918
|
154919
|
154939
|
154940
|
154941
|
155127
|
155128
|
155129
|
155211
|
155212
|
155213
|
155236
|
155237
|
155238