From abcf5a33d6536e3c825c2cdbf9721374233f4c65 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 5 Feb 2013 10:51:00 -0500 Subject: [PATCH] Bug 9322 - Delete 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. 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 has been deleted and the new open transfer has replaced it. --- C4/Items.pm | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/C4/Items.pm b/C4/Items.pm index dbd06b6..0ad6568 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("DELETE FROM branchtransfers 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