From: Matthias Schmidt Date: Thu, 31 Oct 2013 13:58:53 +0000 (+0100) Subject: Fixes packageID for copied templates X-Git-Tag: 2.0.0_Beta_11~8^2~15 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f5b007513b44694f6837f3875f0484d88604bc67;p=GitHub%2FWoltLab%2FWCF.git Fixes packageID for copied templates --- 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']; + } } }