Bugzilla – Attachment 107256 Details for
Bug 24446
Stockrotation: Update to use daterequested in branchtransfers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24446: Catch daterequested in circ returns
Bug-24446-Catch-daterequested-in-circ-returns.patch (text/plain), 9.60 KB, created by
Martin Renvoize (ashimema)
on 2020-07-23 14:11:31 UTC
(
hide
)
Description:
Bug 24446: Catch daterequested in circ returns
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-07-23 14:11:31 UTC
Size:
9.60 KB
patch
obsolete
>From 7f5eb86ecc00c982a33132c4553471efc1c38cb6 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 17 Jan 2020 13:58:12 +0000 >Subject: [PATCH] Bug 24446: Catch daterequested in circ returns > >Update C4::Circulation::AddReturn to use Koha::Item->get_transfer to >find requested transfers and use Koha::Item::Transfer->receipt to complete >transfer requests if they have arrived at their destination or return the >relevant 'WrongTransfer', 'WasTransfered' and 'TransferTrigger' messages >to the end user. >--- > C4/Circulation.pm | 53 ++++++++++++------- > circ/returns.pl | 3 +- > .../prog/en/modules/circ/returns.tt | 23 +++++++- > 3 files changed, 58 insertions(+), 21 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 34fe73583f..8c10fd8e02 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -365,7 +365,7 @@ sub transferbook { > ModItemTransfer( $itemnumber, $fbr, $tbr, $trigger ); > > # don't need to update MARC anymore, we do it in batch now >- $messages->{'WasTransfered'} = 1; >+ $messages->{'WasTransfered'} = $tbr; > > } > ModDateLastSeen( $itemnumber ); >@@ -1881,7 +1881,6 @@ sub AddReturn { > my $messages; > my $patron; > my $doreturn = 1; >- my $validTransfert = 0; > my $stat_type = 'return'; > > # get information on item >@@ -2030,23 +2029,32 @@ sub AddReturn { > ModDateLastSeen( $item->itemnumber, $leave_item_lost ); > > # check if we have a transfer for this document >- my ($datesent,$frombranch,$tobranch) = GetTransfers( $item->itemnumber ); >+ my $transfer = $item->get_transfer; > > # if we have a transfer to do, we update the line of transfers with the datearrived > my $is_in_rotating_collection = C4::RotatingCollections::isItemInAnyCollection( $item->itemnumber ); >- if ($datesent) { >- if ( $tobranch eq $branch ) { >- my $sth = C4::Context->dbh->prepare( >- "UPDATE branchtransfers SET datearrived = now() WHERE itemnumber= ? AND datearrived IS NULL" >- ); >- $sth->execute( $item->itemnumber ); >- # if we have a reservation with valid transfer, we can set it's status to 'W' >- C4::Reserves::ModReserveStatus($item->itemnumber, 'W'); >- } else { >- $messages->{'WrongTransfer'} = $tobranch; >- $messages->{'WrongTransferItem'} = $item->itemnumber; >+ if ($transfer) { >+ if ( $transfer->in_transit ) { >+ if ( $transfer->tobranch eq $branch ) { >+ $transfer->receipt(); >+ >+ # if we have a reservation with completed transfer, we can set it's status to 'W' >+ C4::Reserves::ModReserveStatus( $item->itemnumber, 'W' ); >+ } >+ else { >+ $messages->{'WrongTransfer'} = $transfer->tobranch; >+ $messages->{'WrongTransferItem'} = $item->itemnumber; >+ } >+ } >+ else { >+ if ( $transfer->tobranch eq $branch ) { >+ $transfer->receipt(); >+ } >+ else { >+ $messages->{'WasTransfered'} = $transfer->tobranch; >+ $messages->{'TransferTrigger'} = $transfer->reason; >+ } > } >- $validTransfert = 1; > } > > # fix up the accounts..... >@@ -2170,7 +2178,13 @@ sub AddReturn { > } > > # Transfer to returnbranch if Automatic transfer set or append message NeedsTransfer >- if (!$is_in_rotating_collection && ($doreturn or $messages->{'NotIssued'}) and !$resfound and ($branch ne $returnbranch) and not $messages->{'WrongTransfer'}){ >+ if ( !$is_in_rotating_collection >+ && ( $doreturn or $messages->{'NotIssued'} ) >+ and !$resfound >+ and ( $branch ne $returnbranch ) >+ and not $messages->{'WrongTransfer'} >+ and not $messages->{'WasTransfered'} ) >+ { > my $BranchTransferLimitsType = C4::Context->preference("BranchTransferLimitsType") eq 'itemtype' ? 'effective_itemtype' : 'ccode'; > if (C4::Context->preference("AutomaticItemReturn" ) or > (C4::Context->preference("UseBranchTransferLimits") and >@@ -2179,7 +2193,8 @@ sub AddReturn { > $debug and warn sprintf "about to call ModItemTransfer(%s, %s, %s, %s)", $item->itemnumber,$branch, $returnbranch, $transfer_trigger; > $debug and warn "item: " . Dumper($item->unblessed); > ModItemTransfer($item->itemnumber, $branch, $returnbranch, $transfer_trigger); >- $messages->{'WasTransfered'} = 1; >+ $messages->{'WasTransfered'} = $returnbranch; >+ $messages->{'TransferTrigger'} = $transfer_trigger; > } else { > $messages->{'NeedsTransfer'} = $returnbranch; > $messages->{'TransferTrigger'} = $transfer_trigger; >@@ -3430,7 +3445,9 @@ sub GetTransfers { > SELECT datesent, > frombranch, > tobranch, >- branchtransfer_id >+ branchtransfer_id, >+ daterequested, >+ reason > FROM branchtransfers > WHERE itemnumber = ? > AND datearrived IS NULL >diff --git a/circ/returns.pl b/circ/returns.pl >index e1bce3c3f1..db4ba1a7c0 100755 >--- a/circ/returns.pl >+++ b/circ/returns.pl >@@ -358,7 +358,8 @@ my $reserved = 0; > if ( $messages->{'WasTransfered'} ) { > $template->param( > found => 1, >- transfer => 1, >+ transfer => $messages->{'WasTransfered'}, >+ trigger => $messages->{'TransferTrigger'}, > itemnumber => $itemnumber, > ); > } >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 84efebe53d..c918caefb4 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >@@ -106,6 +106,25 @@ > </div> <!-- /.hold-auto-filled --> > [% END # /IF hold_auto_filled %] > >+ [% IF ( trigger ) %] >+ <div id="transfer-trigger" class="dialog message"> >+ <h3>Reason for transfer</h3> >+ <p> >+ [%- SWITCH trigger -%] >+ [%- CASE 'Manual' -%]Manual >+ [%- CASE 'StockrotationAdvance' -%]Stock rotation advance >+ [%- CASE 'StockrotationRepatriation' -%]Stock rotation repatriation >+ [%- CASE 'ReturnToHome' -%]Return to home library >+ [%- CASE 'ReturnToHolding' -%]Return to holding library >+ [%- CASE 'RotatingCollection' -%]Rotating collection >+ [%- CASE 'Reserve' -%]Reserve >+ [%- CASE 'LostReserve' -%]Lost reserve >+ [%- CASE 'CancelReserve' -%]Cancelled reserve >+ [%- END -%] >+ </p> >+ </div> >+ [% END %] >+ > [% IF privacy == 2 AND NOT Koha.Preference('AnonymousPatron') %] > <div class="dialog alert"> > <strong>Error:</strong> >@@ -494,7 +513,7 @@ > > <div class="modal-header"> > <h3> >- Please return this item to [% Branches.GetName( returnbranch ) | html %] >+ Please return this item to [% IF transfer %][% Branches.GetName( transfer ) | html %][% ELSE %][% Branches.GetName( returnbranch ) | html %][% END %] > </h3> > </div> > <div class="modal-body"> >@@ -521,7 +540,7 @@ > <button type="button" data-dismiss="modal" class="btn btn-default deny" name="notransfer" value="No"><i class="fa fa-times"></i> No</button> > [% ELSE %] > <button type="button" data-dismiss="modal" class="btn btn-default approve"><i class="fa fa-check"></i> OK</button> >- <button type="button" data-dismiss="modal" 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> Print slip</button> >+ <button type="button" data-dismiss="modal" name="dotransfer" class="btn btn-default print openWin" data-url="transfer-slip.pl?transferitem=[% itemnumber | uri %]&branchcode=[% transfer | uri %]&op=slip"><i class="fa fa-print"></i> Print slip</button> > [% END %] > <input type="hidden" name="return_date_override" value="[% return_date_override | html %]" /> > <input type="hidden" name="return_date_override_remember" value="[% return_date_override_remember | html %]" /> >-- >2.20.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 24446
:
105943
|
105944
|
105945
|
107246
|
107247
|
107248
|
107249
|
107250
|
107252
|
107253
|
107254
|
107255
|
107256
|
107301
|
107302
|
107303
|
107304
|
107305
|
110280
|
110281
|
110282
|
110283
|
110533
|
110534
|
110535
|
110536
|
110537
|
110538
|
110539
|
110540
|
110541
|
110542
|
111322
|
116557
|
116558
|
116559
|
116560
|
116561
|
116562
|
116563
|
116564
|
116565
|
116566
|
116567
|
116568
|
116569
|
116570
|
117589
|
117590
|
117591
|
117592
|
117593
|
117594
|
117595
|
117596
|
117597
|
117598
|
117599
|
117600
|
117601
|
117602
|
117603
|
117604
|
117605
|
117606
|
117607
|
120116