From fb140ff09b900f646d93b100bba04271d76f5247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come@opensides.be> Date: Wed, 26 Apr 2017 09:28:49 +0200 Subject: [PATCH] Fixes #5487 Fixed template apply on multiple objects --- include/class_template.inc | 8 +++++--- include/simpleplugin/class_simpleManagement.inc | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/class_template.inc b/include/class_template.inc index 49b11d321..c6ba99e99 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 515fb6171..a2a23fd95 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 () -- GitLab