From 0b783d9bfd260d2f45b549a9748a3ddd3af0cec8 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 24 Jun 2008 10:01:51 +0000 Subject: [PATCH] Updated gofon account. -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 | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/plugins/gofon/phoneaccount/class_phoneAccount.inc b/plugins/gofon/phoneaccount/class_phoneAccount.inc index 27fbbf800..3acd47d61 100644 --- a/plugins/gofon/phoneaccount/class_phoneAccount.inc +++ b/plugins/gofon/phoneaccount/class_phoneAccount.inc @@ -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{ -- 2.30.2