diff --git a/plugins/admin/systems/class_printGeneric.inc b/plugins/admin/systems/class_printGeneric.inc
index fc743ce969414ae6b89fe9511a60c69e73967518..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 */
/* Call parent execute */
plugin::execute();
+ if(isset($this->parent->by_name['workgeneric'])){
+// echo "workstation";
+ if($this->parent->by_object['workgeneric']->cn == "wdefault"){
+ $display= $this->show_header(_("Add printer extension"),
+ _("This is a workstation template, printer tab is disabled."),TRUE,TRUE);
+ $this->is_account= false;
+ return $display;
+ }
+ }elseif(isset($this->parent->by_name['termgeneric'])){
+ if($this->parent->by_object['termgeneric']->cn == "default"){
+ $display= $this->show_header(_("Add printer extension"),
+ _("This is a terminal template, printer tab is disabled."),TRUE,TRUE);
+ $this->is_account= false;
+ return $display;
+ }
+ }elseif(isset($this->parent->by_name['printgeneric'])){
+// echo "printer";
+ }
+
+
$smarty= get_smarty();
$display="";
/* Template management.
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();
function check()
{
$message= array();
+
+ if(isset($this->parent->by_name['workgeneric'])){
+ if($this->parent->by_object['workgeneric']->cn == "wdefault"){
+ return $message;
+ }
+ }elseif(isset($this->parent->by_name['termgeneric'])){
+ if($this->parent->by_object['termgeneric']->cn == "default"){
+ return $message;
+ }
+ }
+
$this->dn= "cn=".$this->cn.",ou=printers,ou=systems,".$this->base;
/* must: cn */
if (!$this->is_account){
return;
}
-
+ if(isset($this->parent->by_name['workgeneric'])){
+ if($this->parent->by_object['workgeneric']->cn == "wdefault"){
+ return;
+ }
+ }elseif(isset($this->parent->by_name['termgeneric'])){
+ if($this->parent->by_object['termgeneric']->cn == "default"){
+ return;
+ }
+ }
+
if($this->PPDdialogToSave){
$this->PPDdialogToSave->save_ppd();
}