--- filedepot/filedepot.class.php	2010-05-17 23:33:54.000000000 -0400
+++ ../rc2/filedepot/filedepot.class.php	2010-05-17 10:21:33.000000000 -0400
@@ -653,8 +653,8 @@ class filedepot {
 
     $filemoved = FALSE;
     if ($newcid > 0) {
-      $query = db_query("SELECT fname,cid,cckfid,version,submitter FROM {filedepot_files} WHERE fid=%d", $fid);
-      list ($fname, $orginalCid, $cckfid, $curVersion, $submitter) = array_values(db_fetch_array($query));
+      $query = db_query("SELECT fname,cid,version,submitter FROM {filedepot_files} WHERE fid=%d", $fid);
+      list ($fname, $orginalCid, $curVersion, $submitter) = array_values(db_fetch_array($query));
       if ($submitter == $user->uid OR fm_getPermission($newcid, 'admin')) {
         if ($newcid !== intval($orginalCid)) {
           // Check if there is more then 1 reference to this file in this category
@@ -672,11 +672,11 @@ class filedepot {
           /* Need to move the file */
           $query2 = db_query("SELECT fname FROM {filedepot_fileversions} WHERE fid=%d", $fid);
           while ($A = db_fetch_array($query2)) {
-            $fname = stripslashes($A['fname']);
-            $sourcefile = $this->root_storage_path . "{$orginalCid}/{$fname}";
-            if (!is_dir($sourcefile) AND file_exists($sourcefile) )  {
+            $vname = stripslashes($A['vname']);
+            $sourcefile = $this->root_storage_path . "{$orginalCid}/{$vname}";
+            if ( file_exists($sourcefile) )  {
               watchdog('filedepot', 'Checking if file @file exists - TRUE', array('@file' => $sourcefile));
-              $targetfile = $this->root_storage_path . "{$newcid}/{$fname}";
+              $targetfile = $this->root_storage_path . "{$newcid}/{$vname}";
               // If there is more then 1 reference to this file in this category
               if ($dupfile_inuse) {
                 @copy($sourcefile, $targetfile);
@@ -689,14 +689,10 @@ class filedepot {
                   @rename($sourcefile, $targetfile);
                 }
               }
-              // Test that file has actually been moved now
-              if (!is_dir($targetfile) AND file_exists($targetfile) )  {
-                $filemoved = TRUE;
-                db_query("UPDATE {files} SET filepath='%s' WHERE fid=%d", $targetfile, $cckfid);
-              }
+              $filemoved = TRUE;
             } 
             else {
-              watchdog('filedepot', 'Checking if file @file exists - FALSE', array('@file' => $sourcefile), WATCHDOG_ERROR);
+              watchdog('filedepot', 'Checking if file @file exists - FALSE', array('@file' => $sourcefile));
             }
           }
           if ($filemoved) {    // At least one file moved - so now update record
