summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: be8ceea)
raw | patch | inline | side by side (parent: be8ceea)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 9 Jan 2007 08:48:59 +0000 (08:48 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 9 Jan 2007 08:48:59 +0000 (08:48 +0000) |
Fixed some bugs.
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@5491 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@5491 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/admin/ogroups/class_phonequeue.inc | patch | blob | history |
diff --git a/plugins/admin/ogroups/class_phonequeue.inc b/plugins/admin/ogroups/class_phonequeue.inc
index ac0107cc356cd8bb978bb7609f98c910deb212c8..20af0d88b584cd9cd71584a7fdee5f9239044426 100644 (file)
/* ObjectClass */
var $objectclasses= array("goFonQueue");
+
+
+ /* Pluigin initialization
+ * - Check currently selected and available home server.
+ * - Set default home server if necessary
+ * - Parse phone options flags
+ * - Get phone numbers
+ */
function phonequeue ($config, $dn= NULL)
{
plugin::plugin($config, $dn);
- /* Include config object */
- $this->config= $config;
-
- /* Save initial account state */
- $this->initially_was_account= $this->is_account;
-
/* Check server configurations
* Load all server configuration in $this->goFonHomeServers if available
* and use first server as default if necessary.
}
- /* Load telephone numbers */
+ /* Variable init
+ * Load phone nubmers and parse dial options
+ */
if($this->is_account){
if(isset($this->attrs['telephoneNumber'])){
$this->telephoneNumber=$this->attrs['telephoneNumber'];
}
}
+ /* Set Queue announce hold time to true/false */
if(preg_match("/no/i",$this->goFonQueueAnnounceHoldtime)){
$this->goFonQueueAnnounceHoldtime=false;
+ }else{
+ $this->goFonQueueAnnounceHoldtime=true;
}
- $this->old_phone_numbers = $this->telephoneNumber;
+ /* Define all available ringdown types */
$types= array('ringall' =>_("ring all"),
'roundrobin' =>_("round robin"),
'leastrecent'=>_("least recently called"),
'fewestcalls'=>_("fewest completed calls"),
'random' =>_("random"),
'rrmemory' =>_("round robin with memory"));
-
$i = 0;
foreach($types as $type => $name){
$i++;
$this->goFonQueueStrategyOptionsR[$i] =$type;
$tmp[$type] = $i;
}
-
-
- $this->old_cn = $this->cn;
$this->goFonQueueStrategy= $tmp[$this->goFonQueueStrategy];
+ $this->old_cn = $this->cn;
+ $this->old_phone_numbers = $this->telephoneNumber;
}
- /* This function ensure that the selected home server
- * and the initially selecte home server are reachable and accessible
- **/
+ /* This function ensures that the selected home server
+ * and the initially selected home server are reachable and accessible
+ */
function check_database_accessibility()
{
/* Check if mysql extension is available */
}
}
-
-
-
+
+ /* Display plugin ui */
function execute()
{
/* Call parent execute */
}
-
/* This function removes the old database entries.
* If this entry should be removed or the home server has changed
* this function is called to ensure that all old entries will be deleted.
$this->cn = $this->parent->by_object['ogroup']->cn;
if($save){
-
+
+ /*****************
+ * Create queue table entry
+ *****************/
+
/* Check if QUEUE_TABLE entry exists.
* If this entry is missing - create it
* else update the entry with new values.
*/
- $query = "SELECT * FROM ".$cfg_Current['QUEUE_TABLE']." WHERE name='".$this->cn."';";
+ $query = "SELECT * FROM ".$cfg_Current['QUEUE_TABLE']." WHERE name='".$this->old_cn."';";
$res = mysql_query($query,$res_cur);
if(!$res){
gosa_log(@mysql_error($res_cur));
/* Create queue table entry */
$queue["announce"] = "0";
$queue["monitor_join"] = "0";
- $queue["monitor_format"] = "0";
+ $queue["monitor_format"] = "";
$queue["queue_holdtime"] = $this->goFonQueueAnnounce;
$queue["queue_lessthan"] = $this->goFonQueueLessThan;
$queue["announce_round_seconds"]= "0";
$queue["musiconhold"] = $this->goFonMusiconHold;
+ /* Check if we must create a new queue entry
+ * or if we can update an existing entry
+ * $cnt contains the number of entries matching this cn
+ */
+
/* Create new queue table entry
*/
if($cnt == 0){
$query.= "".$key."='".$val."',";
}
$query = preg_replace("/,$/","",$query);
- $query.= " WHERE name='".$this->cn."';";
+ $query.= " WHERE name='".$this->old_cn."';";
$SQL[] = $query;
}
}else{
return(sprintf(_("More than one entry in queue table found, that uses the name ('%s'). Please fix this issue manually first."),$this->cn));
}
+
+ /*****************
+ * Create queue member entries
+ *****************/
/* Add the queue member entries
* First we must remove all old user entries.
}
}
+
+ /*****************
+ * Create extension entries
+ *****************/
/* Add the extension entries
* First we must remove all old entensions.
/* Create a extension entry fpr each telephoneNumber */
$i_insert_only_once = false;
- $prio = 11;
+ $prio = 11; // This represents the priority for each telephoneNumber
foreach($this->telephoneNumber as $num){
/* The naming refrences */
$i ++ ;
}
-
+ /* If there is currently no user for this queue
+ * Play no service sound file and return to default context.
+ */
if(count($queueuser)==0){
$a_ext[$i]['context'] = 'GOsa';
$a_ext[$i]['exten'] = $num;
$a_ext[$i]['appdata'] = "default";
$i ++ ;
}else{
+
+ /* Dcrement priority to avoid using same priority twice */
$prio --;
+
+ /* Wait for 2 seconds */
$a_ext[$i]['context'] = 'GOsa';
$a_ext[$i]['exten'] = $num;
$a_ext[$i]['priority'] = 1;
$a_ext[$i]['app'] = "Wait";
$a_ext[$i]['appdata'] = "2";
$i ++ ;
+
+ /* Set language to queue language */
$a_ext[$i]['context'] = 'GOsa';
$a_ext[$i]['exten'] = $num;
$a_ext[$i]['priority'] = 2;
$a_ext[$i]['app'] = "SetLanguage";
$a_ext[$i]['appdata'] = $this->goFonQueueLanguage;
$i ++ ;
+
+ /* Play welcome sound file */
$a_ext[$i]['context'] = 'GOsa';
$a_ext[$i]['exten'] = $num;
$a_ext[$i]['priority'] = 3;
$a_ext[$i]['app'] = "Playback";
$a_ext[$i]['appdata'] = $this->goFonWelcomeMusic;
$i ++ ;
+
+ /* Set CID name */
$a_ext[$i]['context'] = 'GOsa';
$a_ext[$i]['exten'] = $num;
$a_ext[$i]['priority'] = 4;
$a_ext[$i]['appdata'] = $this->cn." - ".$num;
}
$i ++ ;
+
+ /* Set queue priority */
$a_ext[$i]['context'] = 'GOsa';
$a_ext[$i]['exten'] = $num;
$a_ext[$i]['priority'] = 5;
$a_ext[$i]['app'] = "SetVar";
$a_ext[$i]['appdata'] = "QUEUE_PRIO=".$prio;
$i ++ ;
+
+ /* Open queue */
$a_ext[$i]['context'] = 'GOsa';
$a_ext[$i]['exten'] = $num;
$a_ext[$i]['priority'] = 6;
$SQL[]="INSERT INTO ".$cfg_Current['EXT_TABLE']." (".$entries.") VALUES (".$values.")";
}
+ /* Do all collected mysql queries
+ */
foreach($SQL as $query)
$res = mysql_query($query,$res_cur);
if(!$res){
function save()
{
- #fixme workaround : Tab is not initialised correct
- if(!$this->is_account) return;
-
$ldap= $this->config->get_ldap_link();
plugin::save();
+
+ /* Create dial option attribute */
$this->attrs['goFonDialOption'] = "";
foreach(array("goFonDialOption_t","goFonDialOption_T","goFonDialOption_r","goFonDialOption_h","goFonDialOption_H","cn") as $val){
$this->attrs['goFonDialOption'].=$this->$val;
unset($this->attrs[$val]);
}
- if($this->attrs['goFonDialOption']=="") $this->attrs['goFonDialOption']=array();
-
+ if(empty($this->attrs['goFonDialOption'])) {
+ $this->attrs['goFonDialOption']=array();
+ }
+
+ /* Set announce hold time to yes no .. */
if($this->goFonQueueAnnounceHoldtime != "no" ){
$this->attrs['goFonQueueAnnounceHoldtime'] = "yes";
}else{
$this->attrs['goFonQueueAnnounceHoldtime'] = "no";
}
+ /* Set strategy */
$this->attrs['goFonQueueStrategy'] = $this->goFonQueueStrategyOptionsR[$this->goFonQueueStrategy];
-
+ /* Add database entry, display error and abort if this fails */
$str = $this->add_to_database(true);
if(!empty($str)){
print_red($str);