From 4449ef0b75a5fdd0dd7d212507b69a738f694d17 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 5 Feb 2013 10:51:00 -0500 Subject: [PATCH] Bug 9322 - 'Resolve' previous open transfer when adding a new transfer for a given item This patch prevents multiple unresolved item transfers for a given item to exist at the same time. If an item has an open transfer and is subject to a second open transfer, the previous open transfer will be given a datearrived time of '0000-00-00 00:00:00' to indicate the transfer was resolved but never completed. Test Plan: 1) Get an item's barcode 2) Go to circulation -> transfers 3) Select a branch to transfer to 4) Put in your barcode 5) Submit the transfer 6) Examine the branchtransfers table, note that there is now one open transfer for the item 7) Select a different branch to transfer to 8) Put your same barcode in again 9) Submit the transfer 10) Reexamine the branchtransfers table, note that the previous open transfer now has a datearrived value of '0000-00-00 00:00:00' and the new transfer is the only transfer for this item with a datearrived value of NULL --- C4/Items.pm | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/C4/Items.pm b/C4/Items.pm index dbd06b6..c3688db 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -571,6 +571,9 @@ sub ModItemTransfer { # Remove the 'shelving cart' location status if it is being used. CartToShelf( $itemnumber ) if ( C4::Context->preference("ReturnToShelvingCart") ); + # Remove any previous branch transfers + $dbh->do("UPDATE branchtransfers SET datearrived = '0000-00-00 00:00:00' WHERE itemnumber = ? AND datearrived IS NULL", undef, $itemnumber ); + #new entry in branchtransfers.... my $sth = $dbh->prepare( "INSERT INTO branchtransfers (itemnumber, frombranch, datesent, tobranch) -- 1.7.2.5