1 <?php
3 class phonequeue extends plugin
4 {
5 /* plugin specific values */
6 var $mail= "";
7 var $cn= "";
10 var $goFonTimeOut ="20";
11 var $goFonMaxLen ="20"; //
12 var $goFonAnnounceFrequency ="60"; // Annouce Frequency in seconds
13 var $goFonDialOption_t ="";
14 var $goFonDialOption_T ="";
15 var $goFonDialOption_h ="";
16 var $goFonDialOption_r ="";
17 var $goFonQueueAnnounce ="gonicus-berlin-welcome";
18 var $goFonDialOption_H ="";
19 var $goFonMusiconHold ="default";
20 var $goFonWelcomeMusic ="gonicus-berlin-welcome";
21 var $goFonQueueReportHold ="yes";
22 var $goFonQueueYouAreNext ="queue-youarenext";
23 var $goFonQueueThereAre ="queue-thereare";
24 var $goFonQueueCallsWaiting ="queue-callswaiting";
25 var $goFonQueueThankYou ="queue-thankyou";
26 var $goFonQueueMinutes ="queue-minutes";
27 var $goFonQueueSeconds ="queue-seconds";
28 var $goFonQueueLessThan ="queue-lessthan";
29 var $goFonQueueLanguage ="queue-holdtime";
30 var $goFonQueueStrategy ="ringall";
31 var $goFonQueueAnnounceHoldtime="yes";
32 var $telephoneNumber =array();
33 var $goFonQueueMember =array();
34 var $goFonDialOption ="tThH";
35 var $goFonQueueRetry =5;
37 var $old_phone_numbers =array();
39 /* attribute list for save action */
40 var $attributes= array( "goFonTimeOut","goFonMaxLen","goFonAnnounceFrequency","goFonDialOption_t","goFonDialOption_T",
41 "goFonDialOption_h","goFonDialOption_r",
42 "goFonDialOption_H","goFonMusiconHold","goFonWelcomeMusic","goFonQueueReportHold","goFonQueueYouAreNext",
43 "goFonQueueThereAre","goFonQueueCallsWaiting","goFonQueueThankYou","goFonQueueMinutes","goFonQueueSeconds","goFonQueueLessThan",
44 "telephoneNumber","goFonQueueLanguage","goFonQueueStrategy","goFonQueueAnnounceHoldtime","goFonQueueAnnounce","goFonDialOption","goFonQueueRetry");
45 /* ObjectClass */
46 var $objectclasses= array("goFonQueue");
48 function phonequeue ($config, $dn= NULL)
49 {
50 plugin::plugin($config, $dn);
52 /* Include config object */
53 $this->config= $config;
55 /* Save initial account state */
56 $this->initially_was_account= $this->is_account;
58 if($this->is_account){
59 if(isset($this->attrs['telephoneNumber'])){
60 $this->telephoneNumber=$this->attrs['telephoneNumber'];
61 unset($this->telephoneNumber['count']);
62 }
64 for($i = 0; $i < strlen($this->goFonDialOption); $i++){
65 $name = "goFonDialOption_".$this->goFonDialOption[$i];
66 $this->$name=$this->goFonDialOption[$i];
67 }
68 }
70 if($this->goFonQueueAnnounceHoldtime == "no"){
71 $this->goFonQueueAnnounceHoldtime=false;
72 }
73 $this->old_phone_numbers = $this->telephoneNumber;
74 }
77 function execute()
78 {
79 /* Do we need to flip is_account state? */
80 if (isset($_POST['modify_state'])){
81 $this->is_account= !$this->is_account;
82 }
84 /* Show tab dialog headers */
85 if ($this->parent != NULL){
86 if ($this->is_account){
87 $display= $this->show_header(_("Remove the phone queue from this Account"),
88 _("Phone queue is enabled for this group. You can disable it by clicking below."));
89 } else {
90 $display= $this->show_header(_("Create phone queue"), _("For this group the phone queues are disabled. You can enable them by clicking below."));
91 return ($display);
92 }
93 }
95 /* Add queue number */
96 if(isset($_POST['add_phonenumber'])&&(isset($_POST['phonenumber']))&&(!empty($_POST['phonenumber']))){
97 if((!in_array($_POST['phonenumber'],$this->telephoneNumber))&&(is_numeric($_POST['phonenumber']))){
98 $this->telephoneNumber[]=$_POST['phonenumber'];
99 }
100 }
102 /* Delete queue number */
103 if(isset($_POST['delete_phonenumber'])&&(isset($_POST['goFonQueueNumber_List']))){
104 unset($this->telephoneNumber[$_POST['goFonQueueNumber_List']]);
105 }
107 $tmp = array();
108 foreach($this->telephoneNumber as $val){
109 if(!empty($val)){
110 $tmp[]= $val;
111 }
112 }
113 $this->telephoneNumber=$tmp;
115 /* queue number up */
116 if(isset($_POST['up_phonenumber'])&&(isset($_POST['goFonQueueNumber_List']))){
117 if($_POST['goFonQueueNumber_List']>0){
118 $up = $this->telephoneNumber[$_POST['goFonQueueNumber_List']];
119 $down = $this->telephoneNumber[$_POST['goFonQueueNumber_List']-1];
120 $this->telephoneNumber[$_POST['goFonQueueNumber_List']] = $down;
121 $this->telephoneNumber[$_POST['goFonQueueNumber_List']-1] = $up;
122 }
123 }
125 /* Queuenumber down */
126 if(isset($_POST['down_phonenumber'])&&(isset($_POST['goFonQueueNumber_List']))){
127 if(isset($this->telephoneNumber[($_POST['goFonQueueNumber_List']+1)])){
128 $up = $this->telephoneNumber[$_POST['goFonQueueNumber_List']+1];
129 $down = $this->telephoneNumber[$_POST['goFonQueueNumber_List']];
130 $this->telephoneNumber[$_POST['goFonQueueNumber_List']+1] = $down;
131 $this->telephoneNumber[$_POST['goFonQueueNumber_List']] = $up;
132 }
133 }
136 $smarty= get_smarty();
138 $smarty->assign("goFonQueueLanguageOptions",array('de'=>_('German'),'ur'=>_('Uruguai')));
139 $types= array('ringall' =>_("ring all"),
140 'roundrobin' =>_("round robin"),
141 'leastrecent'=>_("least recently called"),
142 'fewestcalls'=>_("fewest completed calls"),
143 'random' =>_("random"),
144 'rrmemory' =>_("round robin with memory"));
145 sort($types);
146 $smarty->assign("goFonQueueStrategyOptions", $types);
148 foreach($this->attributes as $key => $val){
149 $smarty->assign($val,$this->$val);
151 if($this->$val == false){
152 $smarty->assign($val."CHK","");
153 }else{
154 $smarty->assign($val."CHK"," checked ");
155 }
157 if(chkacl($this->acl,$key)==""){
158 $smarty->assign($val."ACL","");
159 }else{
160 $smarty->assign($val."ACL"," disabled ");
161 }
162 }
163 return ($display.$smarty->fetch (get_template_path('phonequeue.tpl', TRUE)));
164 }
167 /* Check formular input */
168 function check()
169 {
170 $message= array();
171 #fixme workaround : Tab is not initialised correct
172 if(!$this->is_account) return($message);
174 if($this->is_number_used()){
175 $message[] = $this->is_number_used();
176 }
178 if($this->generate_mysql_entension_entries()){
179 $message[] = $this->generate_mysql_entension_entries();
180 }
182 if(!((is_numeric($this->goFonTimeOut))||(empty($this->goFonTimeOut)))){
183 $message[] = _("Timeout must be numeric");
184 }
185 if(!((is_numeric($this->goFonQueueRetry))||(empty($this->goFonQueueRetry)))){
186 $message[] = _("Retry must be numeric");
187 }
188 if(!((is_numeric($this->goFonMaxLen))||(empty($this->goFonMaxLen)))){
189 $message[] = _("Max queue length must be numeric");
190 }
191 if(!((is_numeric($this->goFonAnnounceFrequency))||(empty($this->goFonAnnounceFrequency)))){
192 $message[] = _("Announce frequency must be numeric");
193 }
194 if(count($this->telephoneNumber)==0){
195 $message[] = _("There must be least one queue number defined.");
196 }
198 return $message;
199 }
203 function generate_mysql_entension_entries($save = false)
204 {
206 $SQL = array();
208 // Get Configuration for Mysql database Server
209 $a_SETUP = $_SESSION['config']->data['SERVERS']['FON'];
210 $s_parameter ="";
212 // Connect to DB server
213 $r_con = @mysql_pconnect($a_SETUP['SERVER'],$a_SETUP['LOGIN'],$a_SETUP['PASSWORD']);
215 // Check if we are connected correctly
216 if(!$r_con){
217 gosa_log(mysql_error());
218 return (sprintf(_("The MySQL Server '%s' isn't reachable as user '%s', check GOsa log for mysql error."),
219 $a_SETUP['SERVER'],$a_SETUP['LOGIN']));
220 }
222 // Select database for Extensions
223 $db = @mysql_select_db($a_SETUP['DB'],$r_con);
225 // Test if we have the database selected correctly
226 if(!$db){
227 gosa_log(mysql_error());
228 return( sprintf(_("Can't select database %s on %s."),$a_SETUP['DB'],$a_SETUP['SERVER']));
229 }
231 if($save){
232 $i = 0;
233 $prio = 11;
235 if(empty($this->cn)){
236 $this->cn = $this->parent->by_object['ogroup']->cn;
237 $this->attrs['cn'][0] = $this->parent->by_object['ogroup']->cn;
238 }
240 // Delete old Entries
241 $delete = array();
242 if(is_array($this->old_phone_numbers)){
243 foreach($this->old_phone_numbers as $phone){
244 $delete[]= "DELETE FROM ".$a_SETUP['EXT_TABLE']." WHERE exten='".$phone."';\n";
245 }
246 }
247 $delete[]= "DELETE FROM ".$a_SETUP['EXT_TABLE']." WHERE exten='".$this->attrs['cn'][0]."';\n";
248 $delete[]= "DELETE FROM ".$a_SETUP['QUEUE_TABLE']." WHERE name=\"".$this->attrs['cn'][0]."\"; \n";
249 $delete[]= "DELETE FROM ".$a_SETUP['QUEUE_MEMBER_TABLE']." WHERE queue_name=\"".$this->attrs['cn'][0]."\";\n";
251 /* Perform queries to delte old entries */
252 foreach($delete as $query){
253 if(!mysql_query($query)){
254 gosa_log(mysql_error());
255 return(mysql_error(). sprintf(_("Can't delete in Database %s, on Server %s."),$a_SETUP['DB'],$a_SETUP['SERVER']));
256 }
257 }
259 /* Append new Member for this queue */
260 $i = 0;
261 $queueuser =array();
262 foreach($this->parent->by_object['ogroup']->memberList as $member){
263 if(in_array("goFonAccount",$member['objectClass'])){
264 $i ++ ;
265 $queueuser[$i]['queue_name'] = $this->attrs['cn'][0];
266 $queueuser[$i]['interface'] = "SIP/".$member['uid'][0];
267 $queueuser[$i]['penalty'] = 1;
268 }
269 }
271 /* Parse and Add members to query Array */
272 if(is_array($queueuser)){
273 foreach($queueuser as $user){
274 $entries = "";
275 $values = "";
276 foreach($user as $attr => $val){
277 $entries.= "`".$attr."`,";
278 $values .= "'".$val."',";
279 }
280 $values = preg_replace("/,$/","",$values);
281 $entries = preg_replace("/,$/","",$entries );
283 $SQL[]="INSERT INTO ".$a_SETUP['QUEUE_MEMBER_TABLE']." (".$entries.") VALUES (".$values.")";
284 }
285 }
288 /* generate Extension entries, with priority */
290 $queueusers=0;
291 foreach($this->parent->by_object['ogroup']->memberList as $member){
292 if(in_array("goFonAccount",$member['objectClass'])){
293 $queueusers++;
294 }
295 }
298 $i = 0;
299 foreach($this->telephoneNumber as $num){
301 // If there are no member in a Queue
302 // Play sound an quit
304 // A Queue is not deleted directly, it is stored until the o group is deleted
306 $a_ext[$i]['context'] = 'GOsa';
307 $a_ext[$i]['exten'] = $this->attrs['cn'][0];
308 $a_ext[$i]['priority'] = 1;
309 $a_ext[$i]['app'] = "Goto";
310 $a_ext[$i]['appdata'] = $num."|1";
311 $i ++ ;
313 if($queueusers == 0){
314 $a_ext[$i]['context'] = 'GOsa';
315 $a_ext[$i]['exten'] = $num;
316 $a_ext[$i]['priority'] = 1;
317 $a_ext[$i]['app'] = "SetLanguage";
318 $a_ext[$i]['appdata'] = "de";
319 $i ++ ;
321 $a_ext[$i]['context'] = 'GOsa';
322 $a_ext[$i]['exten'] = $num;
323 $a_ext[$i]['priority'] = 2;
324 $a_ext[$i]['app'] = "Playback";
325 $a_ext[$i]['appdata'] = "ss-noservice";
326 $i ++ ;
328 $a_ext[$i]['context'] = 'GOsa';
329 $a_ext[$i]['exten'] = $num;
330 $a_ext[$i]['priority'] = 3;
331 $a_ext[$i]['app'] = "Goto";
332 $a_ext[$i]['appdata'] = "default";
333 $i ++ ;
334 }else{
335 $prio --;
336 $a_ext[$i]['context'] = 'GOsa';
337 $a_ext[$i]['exten'] = $num;
338 $a_ext[$i]['priority'] = 1;
339 $a_ext[$i]['app'] = "Wait";
340 $a_ext[$i]['appdata'] = "2";
341 $i ++ ;
342 $a_ext[$i]['context'] = 'GOsa';
343 $a_ext[$i]['exten'] = $num;
344 $a_ext[$i]['priority'] = 2;
345 $a_ext[$i]['app'] = "SetLanguage";
346 $a_ext[$i]['appdata'] = $this->goFonQueueLanguage;
347 $i ++ ;
348 $a_ext[$i]['context'] = 'GOsa';
349 $a_ext[$i]['exten'] = $num;
350 $a_ext[$i]['priority'] = 3;
351 $a_ext[$i]['app'] = "Playback";
352 $a_ext[$i]['appdata'] = $this->goFonWelcomeMusic;
353 $i ++ ;
354 $a_ext[$i]['context'] = 'GOsa';
355 $a_ext[$i]['exten'] = $num;
356 $a_ext[$i]['priority'] = 4;
357 $a_ext[$i]['app'] = "SetCIDName";
358 if(!empty($this->parent->by_object['ogroup']->description)){
359 $a_ext[$i]['appdata'] = $this->parent->by_object['ogroup']->description;
360 }else{
361 $a_ext[$i]['appdata'] = $this->attrs['cn'][0]." - ".$num;
362 }
363 $i ++ ;
364 $a_ext[$i]['context'] = 'GOsa';
365 $a_ext[$i]['exten'] = $num;
366 $a_ext[$i]['priority'] = 5;
367 $a_ext[$i]['app'] = "SetVar";
368 $a_ext[$i]['appdata'] = $prio;
369 $i ++ ;
370 $a_ext[$i]['context'] = 'GOsa';
371 $a_ext[$i]['exten'] = $num;
372 $a_ext[$i]['priority'] = 6;
373 $a_ext[$i]['app'] = "Queue";
374 $a_ext[$i]['appdata'] = $this->attrs['cn'][0].
375 "|".
376 $this->goFonDialOption_t.
377 $this->goFonDialOption_T.
378 $this->goFonDialOption_h.
379 $this->goFonDialOption_H.
380 $this->goFonDialOption_r;
381 }
383 if($this->goFonQueueAnnounceHoldtime != false) {
384 $this->goFonQueueAnnounceHoldtime = "yes";
385 }else{
386 $this->goFonQueueAnnounceHoldtime = "no";
387 }
390 /* Generate Priority Entry */
391 $queue["announce"] = "";
392 $queue["monitor_join"] = "";
393 $queue["monitor_format"] = "";
394 $queue["queue_holdtime"] = $this->goFonQueueAnnounce;
395 $queue["queue_lessthan"] = $this->goFonQueueLessThan;
396 $queue["announce_round_seconds"]= "";
397 $queue["retry"] = $this->goFonQueueRetry;
398 $queue["wrapuptime"] = "";
399 $queue["servicelevel"] = "";
400 $queue["joinempty"] = "no";
401 $queue["leavewhenempty"] = "yes";
402 $queue["eventmemberstatus"] = "";
403 $queue["eventwhencalled"] = "";
404 $queue["reportholdtime"] = "yes";
405 $queue["memberdelay"] = "";
406 $queue["weight"] = "";
407 $queue["timeoutrestart"] = "";
409 $queue["context"] = "default";
410 $queue["name"] = $this->attrs['cn'][0];
411 $queue["timeout"] = $this->goFonTimeOut;
412 $queue["maxlen"] = $this->goFonMaxLen;
413 $queue["strategy" ] = $this->goFonQueueStrategy;
414 $queue["queue_thankyou"] = $this->goFonQueueThankYou;
415 $queue["queue_reporthold"] = $this->goFonQueueReportHold;
416 $queue["announce_frequency"] = $this->goFonAnnounceFrequency;
417 $queue["queue_youarenext"] = $this->goFonQueueYouAreNext;
418 $queue["queue_thereare"] = $this->goFonQueueThereAre;
419 $queue["queue_callswaiting"] = $this->goFonQueueCallsWaiting;
420 $queue["queue_minutes"] = $this->goFonQueueMinutes;
421 $queue["queue_seconds"] = $this->goFonQueueSeconds;
422 $queue["announce_holdtime"] = $this->goFonQueueAnnounceHoldtime;
423 $queue["musiconhold"] = $this->goFonMusiconHold;
425 $i++;
426 }
428 /* Parse and Add Extension entries */
429 foreach($a_ext as $ext){
430 $entries = "";
431 $values = "";
432 foreach($ext as $attr => $val){
433 $entries.= "`".$attr."`,";
434 $values .= "'".$val."',";
435 }
436 $values = preg_replace("/,$/","",$values);
437 $entries = preg_replace("/,$/","",$entries );
438 $SQL[]="INSERT INTO ".$a_SETUP['EXT_TABLE']." (".$entries.") VALUES (".$values.")";
439 }
442 /* Parse and Add Queue */
443 $entries = "";
444 $values = "";
445 foreach($queue as $attr=>$val){
446 if($val == "") continue;
447 $entries.= "`".$attr."`,";
448 $values .= "'".$val."',";
449 }
450 $values = preg_replace("/,$/","",$values);
451 $entries = preg_replace("/,$/","",$entries );
452 $SQL[]="INSERT INTO ".$a_SETUP['QUEUE_TABLE']." (".$entries.") VALUES (".$values.")";
454 foreach($SQL as $query){
455 if(!mysql_query($query)){
456 gosa_log(mysql_error());
457 print_red(mysql_error());
458 return(mysql_error(). sprintf(_("Can't delete in Database %s, on Server %s."),$a_SETUP['DB'],$a_SETUP['SERVER']));
459 }
460 }
462 }
463 return(false);
464 }
468 /* This function checks if the given phonenumbers are available or already in use*/
470 function is_number_used()
471 {
472 $ldap= $this->config->get_ldap_link();
473 $ldap->cd($this->config->current['BASE']);
474 $ldap->search("(|(objectClass=goFonAccount)(objectClass=goFonQueue))", array("telephoneNumber","cn","uid"));
475 while($attrs = $ldap->fetch()) {
476 unset($attrs['telephoneNumber']['count']);
477 foreach($attrs['telephoneNumber'] as $tele){
478 if(!isset($attrs['cn'][0])) $attrs['cn'][0]=$attrs['dn'];
479 if(!isset($attrs['uid'][0])) $attrs['uid'][0]=$attrs['dn'];
480 $numbers[$tele]=$attrs;
481 }
482 }
484 foreach($this->telephoneNumber as $num){
485 if((isset($numbers[$num]))&&(($numbers[$num]['cn'][0]!= $this->attrs['cn'][0]))){
486 if(isset($numbers[$num]['uid'][0])){
487 return sprintf(_("The specified telephonenumber '%s' is already assigned to '%s'."),$num,$numbers[$num]['uid'][0]);
488 }else{
489 return sprintf(_("The specified telephonenumber '%s' is already assigned to '%s'."),$num,$numbers[$num]['cn'][0]);
490 }
491 }
492 }
493 }
499 function save_object()
500 {
501 plugin::save_object();
502 if(isset($_POST['phonenumber'])){
503 foreach(array("goFonDialOption_t","goFonDialOption_T","goFonDialOption_h","goFonDialOption_r","goFonDialOption_H","goFonMusiconHold") as $val){
504 if(isset($_POST[$val])){
505 $this->$val = $_POST[$val];
506 }else{
507 $this->$val = false;
508 }
509 }
510 if(isset($_POST['goFonQueueAnnounceHoldtime'])){
511 $this->goFonQueueAnnounceHoldtime = "yes";
512 }else{
513 $this->goFonQueueAnnounceHoldtime = false;
514 }
516 }
518 }
520 function save()
521 {
522 #fixme workaround : Tab is not initialised correct
523 if(!$this->is_account) return;
524 $ldap= $this->config->get_ldap_link();
526 plugin::save();
527 $this->attrs['goFonDialOption'] = "";
528 foreach(array("goFonDialOption_t","goFonDialOption_T","goFonDialOption_r","goFonDialOption_h","goFonDialOption_H") as $val){
529 $this->attrs['goFonDialOption'].=$this->$val;
530 unset($this->attrs[$val]);
531 }
532 $this->generate_mysql_entension_entries(true);
533 if($this->attrs['goFonDialOption']=="") $this->attrs['goFonDialOption']=array();
535 if($this->goFonQueueAnnounceHoldtime != "no" ){
536 $this->attrs['goFonQueueAnnounceHoldtime'] = "yes";
537 }else{
538 $this->attrs['goFonQueueAnnounceHoldtime'] = "no";
539 }
541 /* Save data to LDAP */
542 $ldap->cd($this->dn);
543 $ldap->modify($this->attrs);
545 show_ldap_error($ldap->get_error());
547 /* Optionally execute a command after we're done */
548 if ($this->initially_was_account == $this->is_account){
549 if ($this->is_modified){
550 $this->handle_post_events("mofify");
551 }
552 } else {
553 $this->handle_post_events("add");
554 }
555 }
558 /* remove object from parent */
559 function remove_from_parent()
560 {
561 $SQL = array();
563 // Get Configuration for Mysql database Server
564 $a_SETUP = $_SESSION['config']->data['SERVERS']['FON'];
565 $s_parameter ="";
567 // Connect to DB server
568 $r_con = @mysql_pconnect($a_SETUP['SERVER'],$a_SETUP['LOGIN'],$a_SETUP['PASSWORD']);
570 // Check if we are connected correctly
571 if(!$r_con){
572 gosa_log(mysql_error());
573 return (sprintf(_("The MySQL Server '%s' isn't reachable as user '%s', check GOsa log for mysql error."),
574 $a_SETUP['SERVER'],$a_SETUP['LOGIN']));
575 }
577 // Select database for Extensions
578 $db = @mysql_select_db($a_SETUP['DB'],$r_con);
580 // Test if we have the database selected correctly
581 if(!$db){
582 gosa_log(mysql_error());
583 return( sprintf(_("Can't select database %s on %s."),$a_SETUP['DB'],$a_SETUP['SERVER']));
584 }
586 $tmp = array_flip($this->attributes);
587 foreach(array("goFonDialOption_t","goFonDialOption_T","goFonDialOption_r","goFonDialOption_h","goFonDialOption_H") as $val){
588 unset($this->$val);
589 unset($this->attrs[$val]);
590 unset($tmp[$val]);
591 }
592 foreach(array_flip($tmp) as $key => $val){
593 $tmp2[]=$val;
594 }
595 $this->attributes = $tmp2;
597 $i = 0;
598 $prio = 11;
600 if(empty($this->cn)){
601 $this->cn = $this->parent->by_object['ogroup']->cn;
602 $this->attrs['cn'][0] = $this->parent->by_object['ogroup']->cn;
603 }
605 // Delete old Entries
606 $delete = array();
607 foreach($this->old_phone_numbers as $phone){
608 $delete[]= "DELETE FROM ".$a_SETUP['EXT_TABLE']." WHERE exten='".$phone."';\n";
609 }
610 $delete[]= "DELETE FROM ".$a_SETUP['EXT_TABLE']." WHERE exten='".$this->attrs['cn'][0]."';\n";
611 $delete[]= "DELETE FROM ".$a_SETUP['QUEUE_TABLE']." WHERE name=\"".$this->attrs['cn'][0]."\"; \n";
612 $delete[]= "DELETE FROM ".$a_SETUP['QUEUE_MEMBER_TABLE']." WHERE queue_name=\"".$this->attrs['cn'][0]."\";\n";
614 /* Perform queries to delte old entries */
615 foreach($delete as $query){
616 if(!mysql_query($query)){
617 gosa_log(mysql_error());
618 return(mysql_error(). sprintf(_("Can't delete in Database %s, on Server %s."),$a_SETUP['DB'],$a_SETUP['SERVER']));
619 }
620 }
624 /* Cancel if there's nothing to do here */
625 if (!$this->initially_was_account){
626 return;
627 }
629 /* include global link_info */
630 $ldap= $this->config->get_ldap_link();
632 /* Remove and write to LDAP */
633 plugin::remove_from_parent();
635 @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
636 $this->attributes, "Save");
637 $ldap->cd($this->dn);
638 $ldap->modify($this->attrs);
639 show_ldap_error($ldap->get_error());
640 }
642 }
644 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
645 ?>