Code

Allow saving voice mial context
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 13 May 2008 12:34:26 +0000 (12:34 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 13 May 2008 12:34:26 +0000 (12:34 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@10882 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/gofon/phoneaccount/class_phoneAccount.inc
plugins/gofon/phoneaccount/generic.tpl

index 4edb5afc1c245703f08b2967620d8288dd5927e2..cc75b6f3d1fc12e90d17f064569be3e6643bcc38 100644 (file)
@@ -32,6 +32,7 @@ class phoneAccount extends plugin
   var $goFonHomeServers       = array();        // Contains all available server configurations 
 
   var $context                = "default";
+  var $voice_context          = "default";
     
   /* attribute list for save action */
   var $CopyPasteVars          = array("phoneNumbers","macroarray","macrostillavailable"/*"phoneNumbers" -Reset- */,
@@ -263,9 +264,15 @@ class phoneAccount extends plugin
       if($r_con){
         restore_error_handler();
         $r_db  =  @mysql_select_db($cur_cfg['DB'],$r_con);
-        $query_tmp = "SELECT ".$cur_cfg['SIP_TABLE'].".context,".$cur_cfg['VOICE_TABLE'].".password 
-                      FROM  ".$cur_cfg['VOICE_TABLE'].", ".$cur_cfg['SIP_TABLE']."  
-                      WHERE customer_id = sip_users.mailbox AND name='".$this->uid."'";
+        $query_tmp = "
+          SELECT 
+          ".$cur_cfg['VOICE_TABLE'].".context as 'v_context', 
+          ".$cur_cfg['SIP_TABLE'].".context,
+          ".$cur_cfg['VOICE_TABLE'].".password 
+            FROM  ".$cur_cfg['VOICE_TABLE'].", 
+          ".$cur_cfg['SIP_TABLE']."  
+            WHERE customer_id = sip_users.mailbox AND name='".$this->uid."';";
+
         $res = mysql_query($query_tmp);
         $vp  = mysql_fetch_assoc($res);
         @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query_tmp, "Database query");
@@ -275,6 +282,9 @@ class phoneAccount extends plugin
         if((isset($vp['context']))&&(!empty($vp['context']))){
           $this->context = $vp['context'];
         }
+        if((isset($vp['v_context']))&&(!empty($vp['v_context']))){
+          $this->voice_context = $vp['v_context'];
+        }
       }
     }
     $this->lastmacro=$this->macro;
@@ -622,7 +632,7 @@ class phoneAccount extends plugin
           "mailbox"     => $customer_id,
           "password"    => $this->goFonVoicemailPIN,
           "fullname"    => $CNname,
-          "context"     => "default"; //$this->context,
+          "context"     => $this->voice_context,
           "email"       => $s_mail);
 
       /* Set pager number if available */
@@ -662,7 +672,7 @@ class phoneAccount extends plugin
         /********************** 
          * Insert Voice mail entry  
          **********************/
-        $voice_data_array['context'] = "default";//$this->context;
+        $voice_data_array['context'] = $this->voice_context;
   
         /* There is currently no voice mail entry for this user. 
          * We should create one 
@@ -894,6 +904,7 @@ class phoneAccount extends plugin
     /* Assign contexts */
     $smarty->assign("contexts",$this->get_asterisk_contexts());
     $smarty->assign("context" ,$this->context);
+    $smarty->assign("voice_context" ,$this->voice_context);
     $smarty->assign("goFonContextACL", chkacl($this->acl,"context"));
 
     /* Assing macroselectbox values  */
@@ -1124,6 +1135,14 @@ class phoneAccount extends plugin
         $this->context= $_POST['context'];
       }
 
+      /* Save voice_context */
+      if(isset($_POST['voice_context'])){
+        if($this->voice_context != $_POST['voice_context']){
+          $this->is_modified= TRUE;
+        }
+        $this->voice_context= $_POST['voice_context'];
+      }
+
       if(isset($_POST['macro']) && $_POST['macro'] != $this->macro){
         $this->is_modified =true;
       }
index 3271b6882b9d1496c8aced73681027d62a24e72f..e94a867a27e286848c7d03da00bbbfdd8c5d828d 100644 (file)
       </select>        
      </td>
     </tr>
+    <tr>
+     <td>{t}Voicemail context{/t}
+     </td>
+     <td>
+      <select name='voice_context' title='{t}Select the accounts context{/t}' {$goFonContextACL}>  
+               {html_options values=$contexts output=$contexts selected=$voice_context}
+      </select>        
+     </td>
+    </tr>
 
                        <tr>
                                <td>