From f5b007513b44694f6837f3875f0484d88604bc67 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Thu, 31 Oct 2013 14:58:53 +0100 Subject: [PATCH] Fixes packageID for copied templates --- .../lib/acp/form/TemplateAddForm.class.php | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/wcfsetup/install/files/lib/acp/form/TemplateAddForm.class.php b/wcfsetup/install/files/lib/acp/form/TemplateAddForm.class.php index f9f1afbee5..f238c1827a 100644 --- a/wcfsetup/install/files/lib/acp/form/TemplateAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/TemplateAddForm.class.php @@ -110,15 +110,17 @@ class TemplateAddForm extends AbstractForm { if (isset($_POST['templateGroupID'])) $this->templateGroupID = intval($_POST['templateGroupID']); // get package id for this template - $sql = "SELECT packageID - FROM wcf".WCF_N."_template - WHERE templateName = ? - AND templateGroupID IS NULL"; - $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->tplName)); - $row = $statement->fetchArray(); - if ($row !== false) { - $this->packageID = $row['packageID']; + if (!$this->packageID) { + $sql = "SELECT packageID + FROM wcf".WCF_N."_template + WHERE templateName = ? + AND templateGroupID IS NULL"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute(array($this->tplName)); + $row = $statement->fetchArray(); + if ($row !== false) { + $this->packageID = $row['packageID']; + } } } -- 2.20.1