diff --git a/modules/Migration/schema/701_to_710.php b/modules/Migration/schema/701_to_710.php index 79212575994861133adb8bac2438b894450c147c..0283d4c6899e4d7bd31bf3f7785e8a13d76ec036 100644 --- a/modules/Migration/schema/701_to_710.php +++ b/modules/Migration/schema/701_to_710.php @@ -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 diff --git a/modules/Settings/Workflows/models/TaskType.php b/modules/Settings/Workflows/models/TaskType.php index 8d7bf75b1287ebb1e2b8290cacd8764129252718..c88d8fd33d723b80bc68d733059a4b2cb8acf458 100644 --- a/modules/Settings/Workflows/models/TaskType.php +++ b/modules/Settings/Workflows/models/TaskType.php @@ -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() {