From: hickert Date: Thu, 19 Jul 2007 13:35:01 +0000 (+0000) Subject: Only warn user that mysql isn't reachable if we really have changed something X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=76913c5ec9ac6716b5af503edfa0576d3d2ac1ee;p=gosa.git Only warn user that mysql isn't reachable if we really have changed something git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6924 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/gofon/phoneaccount/class_phoneAccount.inc b/plugins/gofon/phoneaccount/class_phoneAccount.inc index 0387abb0f..169393524 100644 --- a/plugins/gofon/phoneaccount/class_phoneAccount.inc +++ b/plugins/gofon/phoneaccount/class_phoneAccount.inc @@ -117,13 +117,13 @@ class phoneAccount extends plugin $r_con = @mysql_pconnect($cur_cfg['SERVER'],$cur_cfg['LOGIN'],$cur_cfg['PASSWORD']); if(!$r_con){ - print_red( sprintf(_("The MySQL Server '%s' isn't reachable as user '%s', check GOsa log for mysql error."), - $cur_cfg['SERVER'],$cur_cfg['LOGIN'])); +# print_red( sprintf(_("The MySQL Server '%s' isn't reachable as user '%s', check GOsa log for mysql error."), +# $cur_cfg['SERVER'],$cur_cfg['LOGIN'])); new log("debug","gofonreport/".get_class($this),"",array(),@mysql_error()); } $db = @mysql_select_db($cur_cfg['DB'],$r_con); if(!$db){ - print_red(sprintf(_("Can't select database %s on %s."),$cur_cfg['DB'],$cur_cfg['SERVER'])); +# print_red(sprintf(_("Can't select database %s on %s."),$cur_cfg['DB'],$cur_cfg['SERVER'])); new log("debug","gofonreport/".get_class($this),"",array(),@mysql_error()); } @@ -257,11 +257,6 @@ class phoneAccount extends plugin ksort($this->hardware_list); $this->a_old_telenums = $this->phoneNumbers; - if($this->is_account){ - $this->is_modified = true; - } - - /* Get voicemail PIN from MySQL DB * Because every user can change his PIN directly from the phone * without any update to the ldap @@ -1075,6 +1070,7 @@ class phoneAccount extends plugin { $SkipWrite = (!isset($this->parent) || !$this->parent) && !isset($_SESSION['edit']); if (isset($_POST["phoneTab"])){ + plugin::save_object(); /* Save checkbox */ @@ -1094,6 +1090,10 @@ class phoneAccount extends plugin $this->macrostillavailable=true; } + if(isset($_POST['macro']) && $_POST['macro'] != $this->macro){ + $this->is_modified =true; + } + if(is_array($this->phoneNumbers)){ foreach($this->phoneNumbers as $telenumms) { $nummsinorder[]=$telenumms; @@ -1105,8 +1105,12 @@ class phoneAccount extends plugin /* get all Postvars */ if(isset($this->macroarray[$this->macro])){ + if($this->acl_is_writeable("goFonMarco",$SkipWrite)){ foreach($this->macroarray[$this->macro] as $key => $paras){ + + $backup = $this->macroarray[$this->macro][$key]; + if(isset($_POST[$paras['var']])){ $this->macroarray[$this->macro][$key]['choosen'] = $_POST[$paras['var']]; } @@ -1125,6 +1129,9 @@ class phoneAccount extends plugin } } } + if(count(array_diff($this->macroarray[$this->macro][$key],$backup))){ + $this->modified = TRUE; + } } } } @@ -1159,8 +1166,10 @@ class phoneAccount extends plugin } } - if(!$this->generate_mysql_entension_entries()){ - $message[] = $this->generate_error; + if ($this->initially_was_account != $this->is_account || $this->is_modified){ + if(!$this->generate_mysql_entension_entries()){ + $message[] = $this->generate_error; + } } /* We need at least one phone number */ @@ -1216,9 +1225,11 @@ class phoneAccount extends plugin $this->attrs['goFonForwarding']=array(); - $str = $this->generate_mysql_entension_entries(true); - if(empty($str)){ - print_red($str); + if ($this->initially_was_account != $this->is_account || $this->is_modified){ + $str = $this->generate_mysql_entension_entries(true); + if(empty($str)){ + print_red($str); + } } if($this->attrs['goFonMacro']==""){