Code

Updated gofon account.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 24 Jun 2008 10:01:51 +0000 (10:01 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 24 Jun 2008 10:01:51 +0000 (10:01 +0000)
-Update voicemail table entry correctly

git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@11412 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/gofon/phoneaccount/class_phoneAccount.inc

index 27fbbf800febff56cb62496bbc461a0bd7aa34f8..3acd47d61a64d8e0b1baaf23c9614a6125374629 100644 (file)
@@ -640,8 +640,19 @@ class phoneAccount extends plugin
         $voice_data_array['pager']   = $this->parent->by_object['user']->pager;
       }
 
+      $query  = "SELECT id,name,callerid FROM ".$a_New['SIP_TABLE']." WHERE name='".$this->uid."';";
+
+      $rid    = mysql_query($query,$new_connection);
+      @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query, "Database query");
+      $result = mysql_fetch_assoc($rid);
+
+      $old_customer_id = ""; 
+      if($result){
+        $old_customer_id = $result['callerid'];
+      }
+
       /* Check if there is already an entry in sip_users for this uid */
-      $query_tmp = "SELECT * FROM ".$a_New['VOICE_TABLE']." WHERE customer_id='".$customer_id."';\n";
+      $query_tmp = "SELECT * FROM ".$a_New['VOICE_TABLE']." WHERE customer_id='".$old_customer_id."';\n";
       $rid = mysql_query($query_tmp,$new_connection);
       @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query_tmp, "Database query");
       if(mysql_affected_rows($new_connection)){
@@ -664,7 +675,7 @@ class phoneAccount extends plugin
             $query.= "".$key."='".$val."',"; 
           } 
           $query = preg_replace("/,$/","",$query);
-          $query.= " WHERE customer_id='".$customer_id."';";
+          $query.= " WHERE customer_id='".$old_customer_id."';";
           $SQL_query_array[] = $query;
         }
       }else{