Bugzilla – Attachment 117599 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: Update ModItemTransfer for daterequested/datecancelled
Bug-24446-Update-ModItemTransfer-for-daterequested.patch (text/plain), 3.04 KB, created by
Jonathan Druart
on 2021-03-03 14:32:21 UTC
(
hide
)
Description:
Bug 24446: Update ModItemTransfer for daterequested/datecancelled
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2021-03-03 14:32:21 UTC
Size:
3.04 KB
patch
obsolete
>From 5460d6dfae5b30a6df9c363b2538fbe7f6a12062 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 18 Dec 2020 16:29:32 +0000 >Subject: [PATCH] Bug 24446: Update ModItemTransfer for > daterequested/datecancelled >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >C4::Items::ModItemTransfer is used throughout the codebase and currently >it will never set the daterequested or datecancelled fields. With the >modifications to how circulation deals with transfers we need to update >this function to set those fields appropriately. Functionality has been >retained, ModItemTransfer will continue to add a transfer regardless of >limits or current transits existing. > >Signed-off-by: Kathleen Milne <kathleen.milne@cne-siar.gov.uk> >Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi> >--- > C4/Items.pm | 34 ++++++++++++++++++++++------------ > 1 file changed, 22 insertions(+), 12 deletions(-) > >diff --git a/C4/Items.pm b/C4/Items.pm >index 861b845045..f987fbf81f 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -351,20 +351,30 @@ sub ModItemTransfer { > my $dbh = C4::Context->dbh; > my $item = Koha::Items->find( $itemnumber ); > >- # Remove the 'shelving cart' location status if it is being used. >- CartToShelf( $itemnumber ) if $item->location && $item->location eq 'CART' && ( !$item->permanent_location || $item->permanent_location ne 'CART' ); >- >- $dbh->do("UPDATE branchtransfers SET datearrived = NOW(), comments = ? WHERE itemnumber = ? AND datearrived IS NULL", undef, "Canceled, new transfer from $frombranch to $tobranch created", $itemnumber); >+ # NOTE: This retains the existing hard coded behaviour by ignoring transfer limits >+ # and always replacing any existing transfers. (In theory, calls to ModItemTransfer >+ # will have been preceded by a check of branch transfer limits) >+ my $to_library = Koha::Libraries->find($tobranch); >+ my $transfer = $item->request_transfer( >+ { >+ to => $to_library, >+ reason => $trigger, >+ ignore_limits => 1, >+ replace => 1 >+ } >+ ); > >- #new entry in branchtransfers.... >- my $sth = $dbh->prepare( >- "INSERT INTO branchtransfers (itemnumber, frombranch, datesent, tobranch, reason) >- VALUES (?, ?, NOW(), ?, ?)"); >- $sth->execute($itemnumber, $frombranch, $tobranch, $trigger); >+ # Immediately set the item to in transit if it is checked in >+ if ( !$item->checkout ) { >+ $item->holdingbranch($frombranch)->store( >+ { >+ log_action => 0, >+ skip_record_index => $params->{skip_record_index} >+ } >+ ); >+ $transfer->transit; >+ } > >- # FIXME we are fetching the item twice in the 2 next statements! >- Koha::Items->find($itemnumber)->holdingbranch($frombranch)->store({ log_action => 0, skip_record_index => $params->{skip_record_index} }); >- ModDateLastSeen($itemnumber, undef, { skip_record_index => $params->{skip_record_index} }); > return; > } > >-- >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