summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 29d231c)
raw | patch | inline | side by side (parent: 29d231c)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 16 Sep 2005 09:04:15 +0000 (09:04 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 16 Sep 2005 09:04:15 +0000 (09:04 +0000) |
plugins/gofon/phoneaccount/class_phoneAccount.inc | patch | blob | history |
diff --git a/plugins/gofon/phoneaccount/class_phoneAccount.inc b/plugins/gofon/phoneaccount/class_phoneAccount.inc
index 58b506b9eefc9b48023a6128bf2ce385e71b2af1..6268e9a6ae52efcb9f104cbb29402f7a3d6ee94e 100644 (file)
$SQL[] = "DELETE FROM ".$a_SETUP['EXT_TABLE']." WHERE exten='".$this->uid."';\n";
$SQL[] = "DELETE FROM ".$a_SETUP['SIP_TABLE']." WHERE name='".$this->uid."';\n";
$SQL[] = "DELETE FROM ".$a_SETUP['VOICE_TABLE']." WHERE customer_id=".$this->phoneNumbers[$i_new_key].";";
+ // Delete old entries
+ $b_first_deleted =false;
+ foreach($this->a_old_telenums as $s_telenums){
+ $SQL[] = "DELETE FROM ".$a_SETUP['EXT_TABLE']." WHERE exten='".$s_telenums."';\n";
+ if(!$b_first_deleted){
+ $b_first_deleted=true;
+ $SQL[] = "DELETE FROM ".$a_SETUP['VOICE_TABLE']." WHERE customer_id=".$s_telenums.";";
+ }
+ }
+
+
+ if($this->goFonHardware=="automatic"){
+ foreach($SQL as $query ){
+ mysql_query($query) ;
+ }
+ return;
+ }
// Generate Strings with keys and values
foreach($sip_entry as $s_sip_key=>$s_sip_val){
// Append SIP Entry
$SQL[] ="INSERT INTO ".$a_SETUP['SIP_TABLE']." (".$s_sip_keys.") VALUES (".$s_sip_values.");";
- // Delete old entries
- $b_first_deleted =false;
- foreach($this->a_old_telenums as $s_telenums){
- $SQL[] = "DELETE FROM ".$a_SETUP['EXT_TABLE']." WHERE exten='".$s_telenums."';\n";
- if(!$b_first_deleted){
- $b_first_deleted=true;
- $SQL[] = "DELETE FROM ".$a_SETUP['VOICE_TABLE']." WHERE customer_id=".$s_telenums.";";
- }
- }
-
/* If deletion starts from userslist, cn uid are not set */
if((isset($this->parent->by_object['user']->uid))&&(!empty($this->parent->by_object['user']->uid))){
$this->uid = $this->parent->by_object['user']->uid;
$i_is_accounted=false;
$i = 0;
-
+
+ $is_inserted_once = false;
+
// Entension entries Hint / Dial / Goto
foreach($this->phoneNumbers as $s_telenums){
- /* Mapping : Name TO Number*/
- $EXT[$i]['context'] = 'GOsa';
- $EXT[$i]['exten'] = $this->uid;
- $EXT[$i]['priority']= 1;
- $EXT[$i]['app'] = "Goto";
- $EXT[$i]['appdata'] = $s_telenums."|1";
- $i ++;
+ if(!$is_inserted_once){
+ $is_inserted_once = true;
+ $EXT[$i]['context'] = 'GOsa';
+ $EXT[$i]['exten'] = $this->uid;
+ $EXT[$i]['priority']= 1;
+ $EXT[$i]['app'] = "Goto";
+ $EXT[$i]['appdata'] = $s_telenums."|1";
+ $i ++;
+ }
/* Hint Entry */
$EXT[$i]['context'] = 'GOsa';
$EXT[$i]['exten'] = $s_telenums;
$s_par = $macroname."|".$s_parameter;
}else{
$s_app = "Dial";
- $s_par = 'SIP/'.$this->uid;
+ $s_par = 'SIP/'.$this->uid."|20|r";
}
$EXT[$i]['context'] = 'GOsa';