Code

Added some more checks to avoid saving with empty home server
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 9 Jan 2007 03:52:44 +0000 (03:52 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 9 Jan 2007 03:52:44 +0000 (03:52 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@5480 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/gofon/phoneaccount/class_phoneAccount.inc

index 9dc1c40eedb2f959675fb56406cb620f3b00f2e3..8f1f2869ab9bd54b7df0533593456fedeeb6815a 100644 (file)
@@ -123,6 +123,10 @@ class phoneAccount extends plugin
       }
     }
 
+    /* Check if previously selected server is still available */
+    if($this->is_account && !isset($this->goFonHomeServers[$this->goFonHomeServer])){
+      print_red(sprintf(_("The previously selected asterisk home server (%s) is no longer available."),preg_replace("/,/",", ",$this->goFonHomeServer)));
+    }
 
     /* Get available phone hardware  
      * Search for all available phone hardware  
@@ -1093,6 +1097,14 @@ class phoneAccount extends plugin
     /* Call common method to give check the hook */
     $message= plugin::check();
 
+    if(!count($this->goFonHomeServers)){
+      $message[] = _("There must be at least one server with an asterisk database to create a phone account.");
+    }
+
+    if(empty($this->goFonHomeServer)){
+      $message[] = _("Please select a valid goFonHomeServer.");
+    }
+
     if((strlen($this->goFonVoicemailPIN)==0)||(strlen($this->goFonVoicemailPIN)>4)){
       $message[]=(_("Voicemail PIN must be between 1-4 characters."));
     }else{