Code

Allow savind voicemail context too.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 13 May 2008 12:28:36 +0000 (12:28 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 13 May 2008 12:28:36 +0000 (12:28 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10881 594d385d-05f5-0310-b6e9-bd551577e9d8

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

index e665c36c0a7b7808b5c0c8c8c6ab24ad1450a2ef..e89cc3f69990200f63b8c687d6ca1ac980e741d0 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- */,
@@ -279,11 +280,17 @@ class phoneAccount extends plugin
       if($r_con){
         $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");
         if((isset($vp['password']))&&(!empty($vp['password']))){
           $this->goFonPINVoice = $vp['password'];
@@ -291,6 +298,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;
@@ -637,6 +647,7 @@ class phoneAccount extends plugin
           "mailbox"     => $customer_id,
           "password"    => $this->goFonVoicemailPIN,
           "fullname"    => $CNname,
+          "context"     => $this->voice_context,
           "email"       => $s_mail);
 
       /* Set pager number if available */
@@ -676,7 +687,7 @@ class phoneAccount extends plugin
         /********************** 
          * Insert Voice mail entry  
          **********************/
-        $voice_data_array['context'] = "default";
+        $voice_data_array['context'] = $this->voice_context;
   
         /* There is currently no voice mail entry for this user. 
          * We should create one 
@@ -918,6 +929,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", $this->getacl("context"));
 
     /* check if there is a FON server created */
@@ -1147,6 +1159,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(is_array($this->phoneNumbers)){
         foreach($this->phoneNumbers as $telenumms) {
           $nummsinorder[]=$telenumms; 
index 1a61ba1af98e900c5814e3116191772757e2ff2b..6162872d895dba1547f8597a62503883979b0175 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>