summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6e8de23)
raw | patch | inline | side by side (parent: 6e8de23)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 22 Aug 2005 07:26:30 +0000 (07:26 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 22 Aug 2005 07:26:30 +0000 (07:26 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1194 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/gofon/phoneaccount/class_phoneAccount.inc | patch | blob | history | |
plugins/gofon/phoneaccount/generic.tpl | patch | blob | history |
diff --git a/plugins/gofon/phoneaccount/class_phoneAccount.inc b/plugins/gofon/phoneaccount/class_phoneAccount.inc
index 4d9b89b415adee2024276e12725deef6e92d4359..e0ff5e38542f437f90e191ed15729c10505b38e6 100644 (file)
var $hardware_list = array();
var $used_hardware = array();
var $goFonMacro = "";
- var $macro = 0; // Selected Macor
+ var $macro = 0; // Selected Macro
var $macros = array(); // List of macros for smarty select box
var $macroarray = array(); // All needed macro informations
var $macrostillavailable = false;
var $generate_error = "";
- var $a_old_telenums = array();
+ var $a_old_telenums = array();
+ var $goFonPINVoice = "";
/* CLI vars */
var $cli_summary = "Manage users phone account";
var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
/* attribute list for save action */
- var $attributes = array("goFonDeliveryMode", "goFonFormat", "uid",
+ var $attributes = array("goFonDeliveryMode", "goFonFormat","uid","cn","mail",
"goFonHardware", "goFonPIN", "telephoneNumber", "goFonMacro","macro");
var $objectclasses= array("goFonAccount");
}
}
+ $a_SETUP = $_SESSION['config']->data['SERVERS']['FON'];
+ $r_con = @mysql_pconnect($a_SETUP['SERVER'],$a_SETUP['LOGIN'],$a_SETUP['PASSWORD']);
+ if(!$r_con){
+ $this->generate_error = sprintf(_("The MySQL Server '%s' isn't reachable as user '%s', check GOsa log for mysql error."),
+ $a_SETUP['SERVER'],$a_SETUP['LOGIN']);
+ gosa_log(mysql_error());
+ return false;
+ }
+ $db = @mysql_select_db($a_SETUP['DB'],$r_con);
+ if(!$db){
+ $this->generate_error = sprintf(_("Can't select database %s on %s."),$a_SETUP['DB'],$a_SETUP['SERVER']);
+ gosa_log(mysql_error());
+ return false;
+ }
+
+ $first = false;
+ foreach($this->phoneNumbers as $key => $val){
+ if(!$first){
+ $first = $key;
+ }
+ }
+
+ $attrs = mysql_fetch_row(mysql_query("SELECT * FROM ".$a_SETUP['VOICE_TABLE']." WHERE customer_id=".$this->phoneNumbers[$first].";"));
+ if($attrs){
+ $this->goFonPINVoice = $attrs[4];
+ }else{
+ $this->goFonPINVoice = false;
+ }
/* Load hardware list */
$ldap= $this->config->get_ldap_link();
return false;
}
-
-
/* If Save == true, we should save something.
* Generate SQL, for drop of old entries
- * Generate SQL, for insert of new entries
+ * Generate SQL, for insert new entries
*/
if($save == true){
// Attribute GoFonDefaultIP set ?
$sip_entry['callerid'] =$this->phoneNumbers[$i_new_key];
$sip_entry['mailbox'] =$this->phoneNumbers[$i_new_key];
- if((isset($this->parent->by_object['mailAccount']->mail))&&($this->parent->by_object['mailAccount']->is_account==true)){
+ if((isset($this->parent))&&(isset($this->parent->by_object['mailAccount']))&&($this->parent->by_object['mailAccount']->is_account==true)){
$s_mail = $this->parent->by_object['mailAccount']->mail;
}else{
$s_mail = "";
}
}
+ if(empty($this->goFonPINVoice)){
+ $this->goFonPINVoice = $this->goFonPIN;
+ }
+
$SQL[]= "INSERT INTO ".$a_SETUP['VOICE_TABLE']."
(`customer_id`,`context`,`mailbox`,`password`,`fullname`,`email`,`pager`)
VALUES
- ('".$this->phoneNumbers[$i_new_key]."','default','".$this->phoneNumbers[$i_new_key]."','".$this->goFonPIN."','".$this->sn."','".$s_mail."','');";
+ ('".$this->phoneNumbers[$i_new_key]."','default','".$this->phoneNumbers[$i_new_key]."','".$this->goFonPINVoice."','".$this->sn."','".$s_mail."','');";
$i_is_accounted=false;
$this->macro ="none";
}
+ /* Set new Voicemail password */
+ if(isset($_POST['goFonPINVoiceSet'])){
+ $this->goFonPINVoice = $_POST['goFonPIN'];
+ }
+
/* tell user that the pluging selected is no longer available*/
if((!$this->macrostillavailable)&&($this->macro!="none")){
print_red(_("The macro you selected, is no longer available for you, please choose another one."));
if(isset($this->macroarray[$this->macro])){
foreach($this->macroarray[$this->macro] as $key => $paras){
if(isset($_POST[$paras['var']])){
- // $par = $this->macroarray[$this->macro][$key];
- // $string = "";
- // if(preg_match("/.*%telephoneNumber_.*/",$par['default'])){
- // $string = $par['default'];
- // foreach($nummsinorder as $nummsinorderkey=> $nummsinorderval){
- // $string = (str_replace("%telephoneNumber_".($nummsinorderkey+1),$nummsinorderval,$string));
- // }
- // }
-
- // if(preg_match("/.*%uid.*/",$par['default'])){
- // if(empty($string)) $string = $par['default'];
- // $string = str_replace("%uid",$this->uid,$string);
- // }
-
- // if(!empty($string)){
- // $this->macroarray[$this->macro][$key]['choosen'] = $string;
- // }else{
$this->macroarray[$this->macro][$key]['choosen'] = $_POST[$paras['var']];
- // }
}
/* Checkboxes are special, they are not Posted if they are not selected, so the won't be changed with the above code
function remove_from_parent()
{
+
+ foreach($this->attributes as $key=>$val){
+
+ if(in_array($val,array("uid","cn","mail"))){
+ unset($this->attributes[$key]);
+ unset($this->$val);
+ }
+
+ }
+
// Get Configuration for Mysql database Server
$a_SETUP = $_SESSION['config']->data['SERVERS']['FON'];
$s_parameter ="";
// Connect to DB server
- $r_con = @mysql_connect($a_SETUP['SERVER'],$a_SETUP['LOGIN'],$a_SETUP['PASSWORD']);
+ $r_con = @mysql_pconnect($a_SETUP['SERVER'],$a_SETUP['LOGIN'],$a_SETUP['PASSWORD']);
// Check if we are connected correctly
if(!$r_con){
$SQL="";
/* If deletion starts from userslist, cn uid are not set */
- $this->uid = $this->parent->by_object['user']->uid;
- $this->cn = $this->parent->by_object['user']->cn;
+ if((isset($this->parent->by_object['user']->uid))&&(!empty($this->parent->by_object['user']->uid))){
+ $this->uid = $this->parent->by_object['user']->uid;
+ }
+
+ if((isset($this->parent->by_object['user']->cn))&&(!empty($this->parent->by_object['user']->cn))){
+ $this->cn = $this->parent->by_object['user']->cn;
+ }
$first_num = false;
// Delete old entries
}
}
}
-
-
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
index 35619b04ca6fc5c749cf0820c1c0000deed62fc7..26035b4be4a62b929e92203c6143122850e7f549 100644 (file)
</td>
<td>
<input type="password" id="goFonPIN" name="goFonPIN" value="{$goFonPIN}" {$goFonPINACL}>
- </td>
+ <input type="submit" name="goFonPINVoiceSet" value="{t}Set voicemail password{/t}" {$goFonPINACL}>
+ </td>
</tr>
</table>
</td>