Bugzilla – Attachment 160628 Details for
Bug 35100
Items assigned to StockRotation do not advance if a hold is triggered before the initial transfer
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35100: Various fixes
Bug-35100-Various-fixes.patch (text/plain), 9.15 KB, created by
Nick Clemens (kidclamp)
on 2024-01-08 14:42:59 UTC
(
hide
)
Description:
Bug 35100: Various fixes
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2024-01-08 14:42:59 UTC
Size:
9.15 KB
patch
obsolete
>From 8bc1daad2a022749110f14a0513f0ca7bec855c0 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 5 Jan 2024 16:08:44 +0000 >Subject: [PATCH] Bug 35100: Various fixes > >1) Don't automagically always set a transfer to in transit on checkin.. > wait for the user to actually confirm that's the case >2) New transfers triggered by a hold should take precidence, so hide > transfers for any other reason from display >3) Remove current_branchtransfers prefetch from detail.pl as doing a > prefetch completely nukes the order_by that this transfer method > relies heavily upon to get the right modified FIFO transfer of the > queue. > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > C4/Circulation.pm | 12 +++---- > C4/Items.pm | 2 +- > Koha/Item.pm | 1 - > Koha/Schema/Result/Item.pm | 34 ++++++++++++------- > catalogue/detail.pl | 2 +- > circ/returns.pl | 4 +++ > .../prog/en/modules/circ/returns.tt | 5 +-- > 7 files changed, 37 insertions(+), 23 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index b98c267f4b7..3ad9f62ca50 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2376,10 +2376,9 @@ sub AddReturn { > else { > $messages->{'TransferTrigger'} = $transfer->reason; > if ( $transfer->frombranch eq $branch ) { >- $transfer->transit; >- $messages->{'WasTransfered'} = $transfer->tobranch; >- } >- else { >+ $messages->{'TransferTo'} = $transfer->tobranch; >+ $messages->{'WasTransfered'} = $transfer->id; >+ } else { > $messages->{'WrongTransfer'} = $transfer->tobranch; > $messages->{'WrongTransferItem'} = $item->itemnumber; > } >@@ -2533,8 +2532,9 @@ sub AddReturn { > (C4::Context->preference("UseBranchTransferLimits") and > ! IsBranchTransferAllowed($branch, $returnbranch, $item->$BranchTransferLimitsType ) > )) { >- ModItemTransfer($item->itemnumber, $branch, $returnbranch, $transfer_trigger, { skip_record_index => 1 }); >- $messages->{'WasTransfered'} = $returnbranch; >+ my $transfer = ModItemTransfer($item->itemnumber, $branch, $returnbranch, $transfer_trigger, { skip_record_index => 1 }); >+ $messages->{'TransferTo'} = $returnbranch; >+ $messages->{'WasTransfered'} = $transfer->id; > $messages->{'TransferTrigger'} = $transfer_trigger; > } else { > $messages->{'NeedsTransfer'} = $returnbranch; >diff --git a/C4/Items.pm b/C4/Items.pm >index c640b63baa3..c2f7ae16b54 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -386,7 +386,7 @@ sub ModItemTransfer { > $transfer->transit({ skip_record_index => $params->{skip_record_index} }); > } > >- return; >+ return $transfer; > } > > =head2 ModDateLastSeen >diff --git a/Koha/Item.pm b/Koha/Item.pm >index a86b9287645..b084d7b74aa 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -776,7 +776,6 @@ we still expect the item to end up at a final location eventually. > > sub get_transfer { > my ($self) = @_; >- > my $transfer = $self->_result->current_branchtransfers->next; > return Koha::Item::Transfer->_new_from_dbic($transfer) if $transfer; > } >diff --git a/Koha/Schema/Result/Item.pm b/Koha/Schema/Result/Item.pm >index 8320ce4c761..be3dc681767 100644 >--- a/Koha/Schema/Result/Item.pm >+++ b/Koha/Schema/Result/Item.pm >@@ -1013,19 +1013,29 @@ __PACKAGE__->many_to_many( > "ordernumber", > ); > >+#__PACKAGE__->has_many( >+# "current_branchtransfers", >+# "Koha::Schema::Result::Branchtransfer", >+# sub { >+# my $args = shift; >+# >+# return { >+# "$args->{foreign_alias}.itemnumber" => { -ident => "$args->{self_alias}.itemnumber" }, >+# "$args->{foreign_alias}.datearrived" => undef, >+# "$args->{foreign_alias}.datecancelled" => undef, >+# }; >+# }, >+# { order_by => [ { -desc => 'datesent' }, { -asc => 'daterequested' } ] } >+#); >+ > __PACKAGE__->has_many( >- "current_branchtransfers", >- "Koha::Schema::Result::Branchtransfer", >- sub { >- my $args = shift; >- >- return { >- "$args->{foreign_alias}.itemnumber" => { -ident => "$args->{self_alias}.itemnumber" }, >- "$args->{foreign_alias}.datearrived" => undef, >- "$args->{foreign_alias}.datecancelled" => undef, >- }; >- }, >- { order_by => [ { -desc => 'datesent' }, { -asc => 'daterequested' } ] } >+ "current_branchtransfers", >+ "Koha::Schema::Result::Branchtransfer", >+ { "foreign.itemnumber" => "self.itemnumber" }, >+ { >+ where => { 'datearrived' => undef, 'datecancelled' => undef }, >+ order_by => [ { -desc => 'datesent' }, { -asc => 'daterequested' } ] >+ } > ); > > # Relationship with bundled items >diff --git a/catalogue/detail.pl b/catalogue/detail.pl >index 9edaf3f3bbf..823f42d08ce 100755 >--- a/catalogue/detail.pl >+++ b/catalogue/detail.pl >@@ -196,7 +196,7 @@ $params->{ itemlost } = 0 if $patron->category->hidelostitems && !$showallitems; > my $items_params = { > ( $invalid_marc_record ? () : ( host_items => 1 ) ), > }; >-my $items = $biblio->items($items_params)->search_ordered( $params, { prefetch => ['issue','current_branchtransfers'] } ); >+my $items = $biblio->items($items_params)->search_ordered( $params, { prefetch => ['issue'] } ); > > # flag indicating existence of at least one item linked via a host record > my $hostrecords = $biblio->host_items->count; >diff --git a/circ/returns.pl b/circ/returns.pl >index c0df0611390..4ec8cc22596 100755 >--- a/circ/returns.pl >+++ b/circ/returns.pl >@@ -521,6 +521,7 @@ if ( $messages->{'WasTransfered'} ) { > $template->param( > found => 1, > transfer => $messages->{'WasTransfered'}, >+ transferto => $messages->{'TransferTo'}, > trigger => $messages->{'TransferTrigger'}, > itemnumber => $itemnumber, > ); >@@ -696,6 +697,9 @@ foreach my $code ( keys %$messages ) { > elsif ( $code eq 'WasTransfered' ) { > ; # FIXME... anything to do here? > } >+ elsif ( $code eq 'TransferTo' ) { >+ ; # Handled above, along with WasTransfered >+ } > elsif ( $code eq 'withdrawn' ) { > $err{withdrawn} = 1; > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >index 2abde7f9c5a..f937133addd 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >@@ -121,7 +121,7 @@ > </div> <!-- /.hold-auto-filled --> > [% END # /IF hold_auto_filled %] > >- [% IF ( trigger ) %] >+ [% IF ( trigger && !transfertodo ) %] > <div id="transfer-trigger" class="dialog message"> > <h3>Reason for transfer</h3> > <p> >@@ -737,7 +737,7 @@ > > <div class="modal-header"> > <h3> >- Please return this item to [% IF transfer %][% Branches.GetName( transfer ) | html %][% ELSE %][% Branches.GetName( returnbranch ) | html %][% END %] >+ Please return this item to [% IF transferto %][% Branches.GetName( transferto ) | html %][% ELSE %][% Branches.GetName( returnbranch ) | html %][% END %] > </h3> > </div> > <div class="modal-body"> >@@ -763,6 +763,7 @@ > <button type="button" name="dotransfer" class="btn btn-default print openWin" data-url="transfer-slip.pl?transferitem=[% itemnumber | uri %]&&branchcode=[% returnbranch | uri %]&op=slip"><i class="fa fa-print"></i> Yes, print slip</button> > <button type="button" data-dismiss="modal" class="btn btn-default deny" name="notransfer" value="No" accesskey="n"><i class="fa fa-times"></i> No (N)</button> > [% ELSE %] >+ <input type="hidden" name="transit" value="[% transfer | uri %]"/> > <button type="button" data-dismiss="modal" class="btn btn-default approve" accesskey="y"><i class="fa fa-check"></i> OK (Y)</button> > <button type="button" data-dismiss="modal" class="btn btn-default print openWin" data-url="transfer-slip.pl?transferitem=[% itemnumber | uri %]&branchcode=[% transfer | uri %]&op=slip" accesskey="p"><i class="fa fa-print"></i> Print slip (P)</button> > [% END %] >-- >2.30.2
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 35100
:
160514
|
160515
|
160557
|
160558
|
160575
|
160623
|
160628
|
160641
|
160642
|
160643
|
160647
|
160648
|
160687
|
160688
|
160689
|
160690
|
162740
|
162741
|
162742
|
162743
|
162744
|
162745
|
162746
|
162747
|
162757
|
162758
|
162759
|
162760
|
162761
|
162762
|
165096
|
165097
|
165098
|
165099
|
165100
|
165101
|
168273
|
168274
|
168275
|
168276
|
168277
|
168278
|
169347
|
169348
|
169349
|
169350
|
169351
|
169352
|
169353
|
171530
|
171531
|
171532
|
171533
|
171534
|
171535
|
171559
|
171560
|
171561
|
171562
|
171563
|
171564