From e568316b7bac37e2e99b412565ca18ff38672b39 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sun, 19 May 2013 15:25:18 +0200 Subject: [PATCH] Fixes issues with templates --- .../files/lib/acp/form/TemplateAddForm.class.php | 14 ++++++++++++++ wcfsetup/setup/db/install.sql | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/wcfsetup/install/files/lib/acp/form/TemplateAddForm.class.php b/wcfsetup/install/files/lib/acp/form/TemplateAddForm.class.php index f1b3dbdcca..fe3918cee6 100644 --- a/wcfsetup/install/files/lib/acp/form/TemplateAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/TemplateAddForm.class.php @@ -1,5 +1,7 @@ application = $this->copiedTemplate->application; $this->packageID = $this->copiedTemplate->packageID; } } @@ -173,7 +182,12 @@ class TemplateAddForm extends AbstractForm { public function save() { parent::save(); + if (empty($this->application)) { + $this->application = Package::getAbbreviation(PackageCache::getInstance()->getPackage($this->package)); + } + $this->objectAction = new TemplateAction(array(), 'create', array('data' => array( + 'application' => $this->application, 'templateName' => $this->tplName, 'packageID' => $this->packageID, 'templateGroupID' => $this->templateGroupID diff --git a/wcfsetup/setup/db/install.sql b/wcfsetup/setup/db/install.sql index 3930441ade..df1b8d6edf 100644 --- a/wcfsetup/setup/db/install.sql +++ b/wcfsetup/setup/db/install.sql @@ -589,8 +589,8 @@ CREATE TABLE wcf1_template ( application VARCHAR(255) NOT NULL, templateGroupID INT(10), lastModificationTime INT(10) NOT NULL DEFAULT 0, - UNIQUE KEY applicationTemplate (application, templateName), - UNIQUE KEY templateGroupID (application, templateGroupID, templateName) + UNIQUE KEY applicationTemplate (application, templateGroupID, templateName), + KEY templateGroupID (packageID, templateGroupID, templateName) ); DROP TABLE IF EXISTS wcf1_template_group; -- 2.20.1