Skip to content

Commit

Permalink
Fixed issue: Fetch global options when copying template
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Oct 16, 2017
1 parent 394b696 commit 7e3eb40
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion application/controllers/admin/templates.php
Expand Up @@ -485,7 +485,7 @@ public function templatecopy()
$oFileHelper->copyDirectory($copydirname,$newdirname, array('fileTypes' => array('xml', 'png', 'jpg')));
//TemplateConfiguration::removeAllNodes($newdirname);
TemplateManifest::extendsConfig($copydir, $newname );
TemplateConfiguration::importManifest($newname);
TemplateConfiguration::importManifest($newname, ['extends' => $copydir]);
$this->getController()->redirect(array("admin/templates/sa/view",'templatename'=>$newname));
}

Expand Down
9 changes: 9 additions & 0 deletions application/models/TemplateConfiguration.php
Expand Up @@ -324,6 +324,15 @@ public static function importManifest($sTemplateName, $aDatas=array() )
$aDatas['version'] = $oEditTemplateDb->version;
$aDatas['license'] = $oEditTemplateDb->license;
$aDatas['files_folder'] = $oEditTemplateDb->files_folder;
$options = TemplateConfiguration::model()->find(
'sid IS NULL AND gsid IS NULL AND uid IS NULL AND template_name = :template_name',
['template_name' => $aDatas['extends']]
);
if (empty($options)) {
throw new Exception('Could not find global options for template ' . $aDatas['extends']);
} else {
$aDatas['aOptions'] = $options;
}
}

return parent::importManifest($sTemplateName, $aDatas );
Expand Down

0 comments on commit 7e3eb40

Please sign in to comment.