[Koha-patches] [PATCH] Bug 4372 - Fix for bookcount.pl not counting started transfers as seeing an item

Chris Cormack chrisc at catalyst.net.nz
Sun Apr 25 21:44:33 CEST 2010


---
 C4/Circulation.pm |    3 ++-
 circ/bookcount.pl |    7 +++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/C4/Circulation.pm b/C4/Circulation.pm
index 00b11ef..77650a0 100644
--- a/C4/Circulation.pm
+++ b/C4/Circulation.pm
@@ -326,8 +326,9 @@ sub transferbook {
 
         # don't need to update MARC anymore, we do it in batch now
         $messages->{'WasTransfered'} = 1;
-		ModDateLastSeen( $itemnumber );
+
     }
+    ModDateLastSeen( $itemnumber );
     return ( $dotransfer, $messages, $biblio );
 }
 
diff --git a/circ/bookcount.pl b/circ/bookcount.pl
index 2ae4f4a..228772e 100755
--- a/circ/bookcount.pl
+++ b/circ/bookcount.pl
@@ -162,9 +162,12 @@ sub lastseenat {
     $sth->execute( $itm, $brc, $itm, $brc );
     my ($date1) = $sth->fetchrow_array;
     $sth = $dbh->prepare(
-"SELECT max(datearrived) FROM branchtransfers WHERE itemnumber=? AND tobranch = ?"
+    "SELECT MAX(transfer) FROM (SELECT max(datearrived) AS transfer FROM branchtransfers WHERE itemnumber=? AND tobranch = ?
+     UNION ALL
+     SELECT max(datesent) AS transfer FROM branchtransfers WHERE itemnumber=? AND frombranch = ?
+	) tmp"
     );
-    $sth->execute( $itm, $brc );
+    $sth->execute( $itm, $brc, $itm, $brc );
     my ($date2) = $sth->fetchrow_array;
 
     my $date = ( $date1 lt $date2 ) ? $date2 : $date1 ;
-- 
1.6.3.3



More information about the Koha-patches mailing list