Skip to content
Snippets Groups Projects
Commit 30338334 authored by Satish's avatar Satish
Browse files

Fixes #175 - Can't create custom Workflow Task because getTemplatePath is hardcoded!

Fixes #113 - Wrong Template path for custom Task Type
parent e17a5d5a
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,26 @@ if (defined('VTIGER_UPGRADE')) {
global $current_user;
$db = PearDatabase::getInstance();
//START::Workflow task's template path
$pathsList = array();
$result = $db->pquery('SELECT classname FROM com_vtiger_workflow_tasktypes', array());
while($rowData = $db->fetch_row($result)) {
$className = $rowData['classname'];
if ($className) {
$pathsList[$className] = vtemplate_path("Tasks/$className.tpl", 'Settings:Workflows');
}
}
if ($pathsList) {
$updateQuery = 'UPDATE com_vtiger_workflow_tasktypes SET templatepath = CASE';
foreach ($pathsList as $className => $templatePath) {
$updateQuery .= " WHEN classname='$className' THEN '$templatePath'";
}
$updateQuery .= ' ELSE templatepath END';
$db->pquery($updateQuery, array());
}
//END::Workflow task's template path
//Update existing package modules
Install_Utils_Model::installModules();
}
\ No newline at end of file
......@@ -28,9 +28,7 @@ class Settings_Workflows_TaskType_Model extends Vtiger_Base_Model {
}
public function getTemplatePath() {
// TODO - Do required template path transformation once the new template files are created, till the database is updated with new path
$templatePath = vtemplate_path('Tasks/'.$this->getName().'.tpl', 'Settings:Workflows');
return $templatePath;
return $this->get('templatepath');
}
public function getEditViewUrl() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment