diff --git a/include/class_template.inc b/include/class_template.inc index 49b11d3213490dc360fd5db23e216098fd2da515..c6ba99e999aa64fa38e7a39de60ca0b43eaa07aa 100644 --- a/include/class_template.inc +++ b/include/class_template.inc @@ -193,6 +193,11 @@ class template * Cannot be called twice! If you need to, call reset between calls */ function apply($targetdn = NULL) { + if ($this->applied) { + trigger_error('Templates can’t be applied twice without calling reset before'); + return; + } + if ($targetdn !== NULL) { $this->tabObject = objects::open($targetdn, $this->type); unset($this->attrs['objectClass']['count']); @@ -201,9 +206,6 @@ class template $this->attrs['objectClass'] = $plugin->mergeObjectClasses($this->attrs['objectClass']); } } - } elseif ($this->applied) { - trigger_error('Templates can’t be applied twice without calling reset before'); - return; } foreach ($this->tabObject->by_object as $class => &$plugin) { diff --git a/include/simpleplugin/class_simpleManagement.inc b/include/simpleplugin/class_simpleManagement.inc index 515fb61716e8f9d1a5cd85b460eaf0c66186e701..a2a23fd955ef394dbdbe568986ce7733729b564e 100644 --- a/include/simpleplugin/class_simpleManagement.inc +++ b/include/simpleplugin/class_simpleManagement.inc @@ -85,6 +85,7 @@ class templateDialog function setNextTarget ($target) { $this->target = $target; + $this->template->reset(); } function execute ()