diff --git a/plugins/admin/systems/class_printGeneric.inc b/plugins/admin/systems/class_printGeneric.inc
index ee8a25a8973e263b234fced8b5f13cd1b5c9e9fb..24fe12cf057acbee5ddc243475a043dc437aba20 100644 (file)
}else{
$this->type = "terminal";
$this->is_terminal = "true";
- $this->dn = preg_replace("/ou=terminal/","ou=printers",$this->dn);
+ $this->dn = preg_replace("/ou=terminals/","ou=printers",$this->dn);
}
}else{
/* Save dn for later references */
function remove_from_parent()
{
- $this->dn= preg_replace('/ou=workstations,/', 'ou=printers,', $this->dn);
- $ldap= $this->config->get_ldap_link();
- $ldap->rmdir($this->dn);
- show_ldap_error($ldap->get_error());
- $this->handle_post_events("remove");
-
- /* Delete references to object groups */
- $ldap->cd ($this->config->current['BASE']);
- $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
- while ($ldap->fetch()){
- $og= new ogroup($this->config, $ldap->getDN());
- unset($og->member[$this->dn]);
- $og->save ();
+ if($this->initially_was_account){
+ $ldap= $this->config->get_ldap_link();
+ $ldap->cat($this->dn);
+ if(count($ldap->fetch()) ){
+
+ $ldap->rmdir($this->dn);
+ show_ldap_error($ldap->get_error());
+ $this->handle_post_events("remove");
+
+ /* Delete references to object groups */
+ $ldap->cd ($this->config->current['BASE']);
+ $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
+ while ($ldap->fetch()){
+ $og= new ogroup($this->config, $ldap->getDN());
+ unset($og->member[$this->dn]);
+ $og->save ();
+ }
+ }
}
}
-
- /* Save data to object */
- function save_object()
+ /* Save data to object */
+ function save_object()
{
plugin::save_object();