From 621f338faa8ec51d5ca643a4a5e8cd0bf47a3701 Mon Sep 17 00:00:00 2001 From: liugang Date: Thu, 25 Jul 2019 13:02:18 +0800 Subject: [PATCH] * Optimize the function executeHooks. --- framework/control.class.php | 15 ++++----------- module/bug/control.php | 18 +++++++++--------- module/build/control.php | 8 ++++---- module/product/control.php | 10 +++++----- module/productplan/control.php | 8 ++++---- module/project/control.php | 18 +++++++++--------- module/release/control.php | 8 ++++---- module/story/control.php | 18 +++++++++--------- module/task/control.php | 28 ++++++++++++++-------------- module/testcase/control.php | 10 +++++----- module/testsuite/control.php | 8 ++++---- module/testtask/control.php | 16 ++++++++-------- 12 files changed, 79 insertions(+), 86 deletions(-) diff --git a/framework/control.class.php b/framework/control.class.php index 844158bf95..9b942bbcb5 100644 --- a/framework/control.class.php +++ b/framework/control.class.php @@ -198,24 +198,17 @@ class control extends baseControl /** * Execute hooks of a method. * - * @param string $methodName * @param int $objectID * @access public * @return void */ - public function executeHooks($methodName, $objectID) + public function executeHooks($objectID) { if(!isset($this->config->bizVersion)) return false; - $flowFile = $this->app->getModuleRoot() . 'workflow/model.php'; - $actionFile = $this->app->getModuleRoot() . 'workflowaction/model.php'; - $hookFile = $this->app->getModuleRoot() . 'workflowhook/model.php'; - if(is_file($flowFile) && is_file($actionFile) && is_file($hookFile)) - { - $flow = $this->loadModel('workflow')->getByModule($this->moduleName); - $action = $this->loadModel('workflowaction')->getByModuleAndAction($this->moduleName, $this->methodName); - if($flow && $action) $this->loadModel('workflowhook')->execute($flow, $action, $objectID); - } + $flow = $this->loadModel('workflow')->getByModule($this->moduleName); + $action = $this->loadModel('workflowaction')->getByModuleAndAction($this->moduleName, $this->methodName); + if($flow && $action) $this->loadModel('workflowhook')->execute($flow, $action, $objectID); } /** diff --git a/module/bug/control.php b/module/bug/control.php index d60fa5224c..62f3204dbe 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -295,7 +295,7 @@ class bug extends control $this->action->create('todo', $output['todoID'], 'finished', '', "BUG:$bugID"); } - $this->executeHooks($this->methodName, $bugID); + $this->executeHooks($bugID); if(defined('RUN_MODE') && RUN_MODE == 'api') $this->send(array('status' => 'success', 'data' => $bugID)); @@ -554,7 +554,7 @@ class bug extends control $productName = $this->products[$productID]; $branches = $this->session->currentProductType == 'normal' ? array() : $this->loadModel('branch')->getPairs($bug->product); - $this->executeHooks($this->methodName, $bugID); + $this->executeHooks($bugID); /* Header and positon. */ $this->view->title = "BUG #$bug->id $bug->title - " . $this->products[$productID]; @@ -617,7 +617,7 @@ class bug extends control if(defined('RUN_MODE') && RUN_MODE == 'api') $this->send(array('status' => 'success', 'data' => $bugID)); $bug = $this->bug->getById($bugID); - $this->executeHooks($this->methodName, $bugID); + $this->executeHooks($bugID); if($bug->toTask != 0) { @@ -834,7 +834,7 @@ class bug extends control $actionID = $this->action->create('bug', $bugID, 'Assigned', $this->post->comment, $this->post->assignedTo); $this->action->logHistory($actionID, $changes); - $this->executeHooks($this->methodName, $bugID); + $this->executeHooks($bugID); if(isonlybody()) die(js::closeModal('parent.parent')); die(js::locate($this->createLink('bug', 'view', "bugID=$bugID"), 'parent')); @@ -949,7 +949,7 @@ class bug extends control $actionID = $this->action->create('bug', $bugID, 'bugConfirmed', $this->post->comment); $this->action->logHistory($actionID, $changes); - $this->executeHooks($this->methodName, $bugID); + $this->executeHooks($bugID); if(isonlybody()) die(js::closeModal('parent.parent')); die(js::locate($this->createLink('bug', 'view', "bugID=$bugID"), 'parent')); @@ -1007,7 +1007,7 @@ class bug extends control $bug = $this->bug->getById($bugID); - $this->executeHooks($this->methodName, $bugID); + $this->executeHooks($bugID); if($bug->toTask != 0) { @@ -1099,7 +1099,7 @@ class bug extends control $actionID = $this->action->create('bug', $bugID, 'Activated', $this->post->comment); $this->action->logHistory($actionID, $changes); - $this->executeHooks($this->methodName, $bugID); + $this->executeHooks($bugID); if(isonlybody()) die(js::closeModal('parent.parent')); die(js::locate($this->createLink('bug', 'view', "bugID=$bugID"), 'parent')); @@ -1138,7 +1138,7 @@ class bug extends control $actionID = $this->action->create('bug', $bugID, 'Closed', $this->post->comment); $this->action->logHistory($actionID, $changes); - $this->executeHooks($this->methodName, $bugID); + $this->executeHooks($bugID); if(isonlybody()) die(js::closeModal('parent.parent')); if(defined('RUN_MODE') && RUN_MODE == 'api') @@ -1306,7 +1306,7 @@ class bug extends control $this->bug->delete(TABLE_BUG, $bugID); if($bug->toTask != 0) echo js::alert($this->lang->bug->remindTask . $bug->toTask); - $this->executeHooks($this->methodName, $bugID); + $this->executeHooks($bugID); die(js::locate($this->session->bugList, 'parent')); } diff --git a/module/build/control.php b/module/build/control.php index 8923f49641..6ccf578f75 100644 --- a/module/build/control.php +++ b/module/build/control.php @@ -26,7 +26,7 @@ class build extends control if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError())); $this->loadModel('action')->create('build', $buildID, 'opened'); - $this->executeHooks($this->methodName, $buildID); + $this->executeHooks($buildID); if(isonlybody()) $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => true, 'callback' => "parent.loadProjectBuilds($projectID)"));//Code for task #5126. $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('build', 'view', "buildID=$buildID"))); @@ -108,7 +108,7 @@ class build extends control if(!empty($changes)) $this->action->logHistory($actionID, $changes); } - $this->executeHooks($this->methodName, $buildID); + $this->executeHooks($buildID); $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('view', "buildID=$buildID"))); } @@ -230,7 +230,7 @@ class build extends control $this->view->type = $type; } - $this->executeHooks($this->methodName, $buildID); + $this->executeHooks($buildID); /* Assign. */ $this->view->users = $this->loadModel('user')->getPairs('noletter'); @@ -263,7 +263,7 @@ class build extends control $build = $this->build->getById($buildID); $this->build->delete(TABLE_BUILD, $buildID); - $this->executeHooks($this->methodName, $buildID); + $this->executeHooks($buildID); /* if ajax request, send result. */ if($this->server->ajax) diff --git a/module/product/control.php b/module/product/control.php index b8116a78c7..09a734b5b9 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -210,7 +210,7 @@ class product extends control if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError())); $this->loadModel('action')->create('product', $productID, 'opened'); - $this->executeHooks($this->methodName, $productID); + $this->executeHooks($productID); $locate = $this->createLink($this->moduleName, 'browse', "productID=$productID"); if(isset($this->config->global->flow) and $this->config->global->flow == 'onlyTest') $locate = $this->createLink($this->moduleName, 'build', "productID=$productID"); @@ -260,7 +260,7 @@ class product extends control $this->action->logHistory($actionID, $changes); } - $this->executeHooks($this->methodName, $productID); + $this->executeHooks($productID); $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('view', "product=$productID"))); } @@ -360,7 +360,7 @@ class product extends control $this->action->logHistory($actionID, $changes); } - $this->executeHooks($this->methodName, $productID); + $this->executeHooks($productID); die(js::reload('parent.parent')); } @@ -394,7 +394,7 @@ class product extends control $this->app->loadClass('pager', $static = true); $pager = new pager(0, 30, 1); - $this->executeHooks($this->methodName, $productID); + $this->executeHooks($productID); $this->view->title = $product->name . $this->lang->colon . $this->lang->product->view; $this->view->position[] = html::a($this->createLink($this->moduleName, 'browse'), $product->name); @@ -430,7 +430,7 @@ class product extends control $this->product->delete(TABLE_PRODUCT, $productID); $this->dao->update(TABLE_DOCLIB)->set('deleted')->eq(1)->where('product')->eq($productID)->exec(); $this->session->set('product', ''); // 清除session。 - $this->executeHooks($this->methodName, $productID); + $this->executeHooks($productID); die(js::locate($this->createLink('product', 'browse'), 'parent')); } } diff --git a/module/productplan/control.php b/module/productplan/control.php index 2a36115f83..c3facf8ff2 100644 --- a/module/productplan/control.php +++ b/module/productplan/control.php @@ -50,7 +50,7 @@ class productplan extends control if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError())); $this->loadModel('action')->create('productplan', $planID, 'opened'); - $this->executeHooks($this->methodName, $planID); + $this->executeHooks($planID); if(isonlybody()) die(js::closeModal('parent.parent', '', "function(){parent.parent.$('a.refresh').click()}")); $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('productplan', 'browse', "productID=$product&branch=$branch"))); @@ -99,7 +99,7 @@ class productplan extends control $actionID = $this->loadModel('action')->create('productplan', $planID, 'edited'); $this->action->logHistory($actionID, $changes); } - $this->executeHooks($this->methodName, $planID); + $this->executeHooks($planID); $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('view', "planID=$planID"))); } @@ -166,7 +166,7 @@ class productplan extends control $plan = $this->productplan->getById($planID); $this->productplan->delete(TABLE_PRODUCTPLAN, $planID); - $this->executeHooks($this->methodName, $planID); + $this->executeHooks($planID); /* if ajax request, send result. */ if($this->server->ajax) @@ -276,7 +276,7 @@ class productplan extends control $orderBy = str_replace('id', 'order', $orderBy); } - $this->executeHooks($this->methodName, $planID); + $this->executeHooks($planID); if($plan->parent > 0) $this->view->parentPlan = $this->productplan->getById($plan->parent); if($plan->parent == '-1') $this->view->childrenPlans = $this->productplan->getChildren($plan->id); diff --git a/module/project/control.php b/module/project/control.php index ed746fbd22..4c4ba81e6e 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -1055,7 +1055,7 @@ class project extends control $this->loadModel('action')->create('project', $projectID, 'opened', '', join(',', $_POST['products'])); - $this->executeHooks($this->methodName, $projectID); + $this->executeHooks($projectID); $planID = reset($_POST['plans']); if(!empty($planID)) @@ -1124,7 +1124,7 @@ class project extends control $actionID = $this->loadModel('action')->create('project', $projectID, 'edited'); $this->action->logHistory($actionID, $changes); } - $this->executeHooks($this->methodName, $projectID); + $this->executeHooks($projectID); $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('view', "projectID=$projectID"))); } @@ -1252,7 +1252,7 @@ class project extends control $actionID = $this->action->create('project', $projectID, 'Started', $this->post->comment); $this->action->logHistory($actionID, $changes); } - $this->executeHooks($this->methodName, $projectID); + $this->executeHooks($projectID); die(js::reload('parent.parent')); } @@ -1287,7 +1287,7 @@ class project extends control $actionID = $this->action->create('project', $projectID, 'Delayed', $this->post->comment); $this->action->logHistory($actionID, $changes); } - $this->executeHooks($this->methodName, $projectID); + $this->executeHooks($projectID); die(js::reload('parent.parent')); } @@ -1322,7 +1322,7 @@ class project extends control $actionID = $this->action->create('project', $projectID, 'Suspended', $this->post->comment); $this->action->logHistory($actionID, $changes); } - $this->executeHooks($this->methodName, $projectID); + $this->executeHooks($projectID); die(js::reload('parent.parent')); } @@ -1357,7 +1357,7 @@ class project extends control $actionID = $this->action->create('project', $projectID, 'Activated', $this->post->comment); $this->action->logHistory($actionID, $changes); } - $this->executeHooks($this->methodName, $projectID); + $this->executeHooks($projectID); die(js::reload('parent.parent')); } @@ -1399,7 +1399,7 @@ class project extends control $actionID = $this->action->create('project', $projectID, 'Closed', $this->post->comment); $this->action->logHistory($actionID, $changes); } - $this->executeHooks($this->methodName, $projectID); + $this->executeHooks($projectID); die(js::reload('parent.parent')); } @@ -1441,7 +1441,7 @@ class project extends control $this->app->loadClass('pager', $static = true); $pager = new pager(0, 30, 1); - $this->executeHooks($this->methodName, $projectID); + $this->executeHooks($projectID); $this->view->title = $this->lang->project->view; $this->view->position[] = html::a($this->createLink('project', 'browse', "projectID=$projectID"), $project->name); @@ -1710,7 +1710,7 @@ class project extends control $this->project->delete(TABLE_PROJECT, $projectID); $this->dao->update(TABLE_DOCLIB)->set('deleted')->eq(1)->where('project')->eq($projectID)->exec(); $this->session->set('project', ''); - $this->executeHooks($this->methodName, $projectID); + $this->executeHooks($projectID); die(js::locate(inlink('index'), 'parent')); } } diff --git a/module/release/control.php b/module/release/control.php index a86f511978..9fe14f25c9 100644 --- a/module/release/control.php +++ b/module/release/control.php @@ -63,7 +63,7 @@ class release extends control if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError())); $this->loadModel('action')->create('release', $releaseID, 'opened'); - $this->executeHooks($this->methodName, $releaseID); + $this->executeHooks($releaseID); $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('view', "releaseID=$releaseID"))); } @@ -103,7 +103,7 @@ class release extends control $actionID = $this->loadModel('action')->create('release', $releaseID, 'Edited', $fileAction); if(!empty($changes)) $this->action->logHistory($actionID, $changes); } - $this->executeHooks($this->methodName, $releaseID); + $this->executeHooks($releaseID); $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('view', "releaseID=$releaseID"))); } $this->loadModel('story'); @@ -162,7 +162,7 @@ class release extends control $this->commonAction($release->product); $product = $this->product->getById($release->product); - $this->executeHooks($this->methodName, $releaseID); + $this->executeHooks($releaseID); $this->view->title = "RELEASE #$release->id $release->name/" . $product->name; $this->view->position[] = $this->lang->release->view; @@ -202,7 +202,7 @@ class release extends control $build = $this->dao->select('*')->from(TABLE_BUILD)->where('id')->eq((int)$release->build)->fetch(); if(empty($build->project)) $this->loadModel('build')->delete(TABLE_BUILD, $build->id); - $this->executeHooks($this->methodName, $releaseID); + $this->executeHooks($releaseID); /* if ajax request, send result. */ if($this->server->ajax) diff --git a/module/story/control.php b/module/story/control.php index 3fe0950dca..778d5ecc85 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -113,7 +113,7 @@ class story extends control $this->action->create('todo', $todoID, 'finished', '', "STORY:$storyID"); } - $this->executeHooks($this->methodName, $storyID); + $this->executeHooks($storyID); if($this->post->newStory) { @@ -436,7 +436,7 @@ class story extends control $this->action->logHistory($actionID, $changes); } - $this->executeHooks($this->methodName, $storyID); + $this->executeHooks($storyID); if(defined('RUN_MODE') && RUN_MODE == 'api') { @@ -622,7 +622,7 @@ class story extends control $this->action->logHistory($actionID, $changes); } - $this->executeHooks($this->methodName, $storyID); + $this->executeHooks($storyID); die(js::locate($this->createLink('story', 'view', "storyID=$storyID"), 'parent')); } @@ -657,7 +657,7 @@ class story extends control if(dao::isError()) die(js::error(dao::getError())); $actionID = $this->action->create('story', $storyID, 'Activated', $this->post->comment); - $this->executeHooks($this->methodName, $storyID); + $this->executeHooks($storyID); if(isonlybody()) die(js::closeModal('parent.parent', 'this')); die(js::locate($this->createLink('story', 'view', "storyID=$storyID"), 'parent')); @@ -705,7 +705,7 @@ class story extends control if($project->status == 'done') $from = ''; } - $this->executeHooks($this->methodName, $storyID); + $this->executeHooks($storyID); $title = "STORY #$story->id $story->title - $product->name"; $position[] = html::a($this->createLink('product', 'browse', "product=$product->id&branch=$story->branch"), $product->name); @@ -752,7 +752,7 @@ class story extends control { $this->story->delete(TABLE_STORY, $storyID); - $this->executeHooks($this->methodName, $storyID); + $this->executeHooks($storyID); die(js::locate($this->session->storyList, 'parent')); } @@ -778,7 +778,7 @@ class story extends control $this->action->create('story', $storyID, 'Closed', '', ucfirst($this->post->closedReason)); } - $this->executeHooks($this->methodName, $storyID); + $this->executeHooks($storyID); die(js::locate(inlink('view', "storyID=$storyID"), 'parent')); } @@ -849,7 +849,7 @@ class story extends control $actionID = $this->action->create('story', $storyID, 'Closed', $this->post->comment, ucfirst($this->post->closedReason) . ($this->post->duplicateStory ? ':' . (int)$this->post->duplicateStory : '')); $this->action->logHistory($actionID, $changes); - $this->executeHooks($this->methodName, $storyID); + $this->executeHooks($storyID); if(isonlybody()) die(js::closeModal('parent.parent', 'this')); if(defined('RUN_MODE') && RUN_MODE == 'api') @@ -1078,7 +1078,7 @@ class story extends control $this->action->logHistory($actionID, $changes); } - $this->executeHooks($this->methodName, $storyID); + $this->executeHooks($storyID); if(isonlybody()) die(js::closeModal('parent.parent', 'this')); die(js::locate($this->createLink('story', 'view', "storyID=$storyID"), 'parent')); diff --git a/module/task/control.php b/module/task/control.php index 7164bd34ae..6ef67fee10 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -127,7 +127,7 @@ class task extends control /* If link from no head then reload*/ if(isonlybody()) { - $this->executeHooks($this->methodName, $taskID); + $this->executeHooks($taskID); $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent')); } @@ -137,7 +137,7 @@ class task extends control $this->action->create('todo', $todoID, 'finished', '', "TASK:$taskID"); } - $this->executeHooks($this->methodName, $taskID); + $this->executeHooks($taskID); /* Locate the browser. */ if($this->app->getViewType() == 'xhtml') @@ -321,7 +321,7 @@ class task extends control if(!empty($changes)) $this->action->logHistory($actionID, $changes); } - $this->executeHooks($this->methodName, $taskID); + $this->executeHooks($taskID); if($task->fromBug != 0) { @@ -485,7 +485,7 @@ class task extends control $actionID = $this->action->create('task', $taskID, 'Assigned', $this->post->comment, $this->post->assignedTo); $this->action->logHistory($actionID, $changes); - $this->executeHooks($this->methodName, $taskID); + $this->executeHooks($taskID); if(isonlybody()) die(js::closeModal('parent.parent', 'this')); die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent')); @@ -606,7 +606,7 @@ class task extends control $project = $this->project->getById($task->project); $this->project->setMenu($this->project->getPairs(), $project->id); - $this->executeHooks($this->methodName, $taskID); + $this->executeHooks($taskID); $title = "TASK#$task->id $task->name / $project->name"; $position[] = html::a($this->createLink('project', 'browse', "projectID=$task->project"), $project->name); @@ -638,7 +638,7 @@ class task extends control $this->dao->update(TABLE_TASK)->set('storyVersion')->eq($task->latestStoryVersion)->where('id')->eq($taskID)->exec(); $this->loadModel('action')->create('task', $taskID, 'confirmed', '', $task->latestStoryVersion); - $this->executeHooks($this->methodName, $taskID); + $this->executeHooks($taskID); die(js::reload('parent')); } @@ -670,7 +670,7 @@ class task extends control /* Remind whether to update status of the bug, if task which from that bug has been finished. */ $task = $this->task->getById($taskID); - $this->executeHooks($this->methodName, $taskID); + $this->executeHooks($taskID); if($changes and $this->task->needUpdateBugStatus($task)) { @@ -822,7 +822,7 @@ class task extends control $this->action->logHistory($actionID, $changes); } - $this->executeHooks($this->methodName, $taskID); + $this->executeHooks($taskID); if($this->task->needUpdateBugStatus($task)) { @@ -901,7 +901,7 @@ class task extends control $this->action->logHistory($actionID, $changes); } - $this->executeHooks($this->methodName, $taskID); + $this->executeHooks($taskID); if(isonlybody()) die(js::closeModal('parent.parent', 'this')); die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent')); @@ -938,7 +938,7 @@ class task extends control $this->action->logHistory($actionID, $changes); } - $this->executeHooks($this->methodName, $taskID); + $this->executeHooks($taskID); if(isonlybody()) die(js::closeModal('parent.parent', 'this')); die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent')); @@ -973,7 +973,7 @@ class task extends control $this->action->logHistory($actionID, $changes); } - $this->executeHooks($this->methodName, $taskID); + $this->executeHooks($taskID); if(isonlybody()) die(js::closeModal('parent.parent', 'this')); if(defined('RUN_MODE') && RUN_MODE == 'api') @@ -1098,7 +1098,7 @@ class task extends control $this->action->logHistory($actionID, $changes); } - $this->executeHooks($this->methodName, $taskID); + $this->executeHooks($taskID); if(isonlybody()) die(js::closeModal('parent.parent', 'this')); die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent')); @@ -1134,7 +1134,7 @@ class task extends control $this->action->logHistory($actionID, $changes); } - $this->executeHooks($this->methodName, $taskID); + $this->executeHooks($taskID); if(isonlybody()) die(js::closeModal('parent.parent', 'this')); die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent')); @@ -1178,7 +1178,7 @@ class task extends control } } - $this->executeHooks($this->methodName, $taskID); + $this->executeHooks($taskID); die(js::locate($this->session->taskList, 'parent')); } diff --git a/module/testcase/control.php b/module/testcase/control.php index 5558cd5689..455d232f12 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -238,7 +238,7 @@ class testcase extends control $this->loadModel('action'); $this->action->create('case', $caseID, 'Opened'); - $this->executeHooks($this->methodName, $caseID); + $this->executeHooks($caseID); /* If link from no head then reload. */ if(isonlybody()) $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => true)); @@ -516,7 +516,7 @@ class testcase extends control ->fetch('count'); $case->caseFails = $caseFails; - $this->executeHooks($this->methodName, $caseID); + $this->executeHooks($caseID); $this->view->position[] = $this->lang->testcase->common; $this->view->position[] = $this->lang->testcase->view; @@ -569,7 +569,7 @@ class testcase extends control $this->action->logHistory($actionID, $changes); } - $this->executeHooks($this->methodName, $caseID); + $this->executeHooks($caseID); die(js::locate($this->createLink('testcase', 'view', "caseID=$caseID"), 'parent')); } @@ -781,7 +781,7 @@ class testcase extends control $result = $this->post->result; $this->loadModel('action')->create('case', $caseID, 'Reviewed', $this->post->comment, ucfirst($result)); - $this->executeHooks($this->methodName, $caseID); + $this->executeHooks($caseID); die(js::reload('parent.parent')); } @@ -827,7 +827,7 @@ class testcase extends control { $this->testcase->delete(TABLE_CASE, $caseID); - $this->executeHooks($this->methodName, $caseID); + $this->executeHooks($caseID); /* if ajax request, send result. */ if($this->server->ajax) diff --git a/module/testsuite/control.php b/module/testsuite/control.php index 4b25be9332..cffacb98dd 100644 --- a/module/testsuite/control.php +++ b/module/testsuite/control.php @@ -89,7 +89,7 @@ class testsuite extends control } $actionID = $this->loadModel('action')->create('testsuite', $suiteID, 'opened'); - $this->executeHooks($this->methodName, $suiteID); + $this->executeHooks($suiteID); $response['locate'] = $this->createLink('testsuite', 'browse', "productID=$productID"); $response['message'] = $this->lang->testsuite->successSaved; @@ -142,7 +142,7 @@ class testsuite extends control $this->app->loadClass('pager', $static = true); $pager = pager::init($recTotal, $recPerPage, $pageID); - $this->executeHooks($this->methodName, $suiteID); + $this->executeHooks($suiteID); $this->view->title = "SUITE #$suite->id $suite->name/" . $this->products[$productID]; $this->view->position[] = html::a($this->createLink('testsuite', 'browse', "productID=$productID"), $this->products[$productID]); @@ -190,7 +190,7 @@ class testsuite extends control $this->action->logHistory($actionID, $changes); } - $this->executeHooks($this->methodName, $suiteID); + $this->executeHooks($suiteID); $method = $suite->type == 'library' ? 'libView' : 'view'; $response['locate'] = inlink($method, "suiteID=$suiteID"); @@ -252,7 +252,7 @@ class testsuite extends control $this->testsuite->delete($suiteID); - $this->executeHooks($this->methodName, $suiteID); + $this->executeHooks($suiteID); /* if ajax request, send result. */ if($this->server->ajax) diff --git a/module/testtask/control.php b/module/testtask/control.php index 85dd912a2e..28c2b795d6 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -106,7 +106,7 @@ class testtask extends control if(dao::isError()) die(js::error(dao::getError())); $this->loadModel('action')->create('testtask', $taskID, 'opened'); - $this->executeHooks($this->methodName, $taskID); + $this->executeHooks($taskID); die(js::locate($this->createLink('testtask', 'browse', "productID=$productID"), 'parent')); } @@ -216,7 +216,7 @@ class testtask extends control $this->testtask->setMenu($this->products, $productID, $task->branch, $taskID); - $this->executeHooks($this->methodName, $taskID); + $this->executeHooks($taskID); $this->view->title = "TASK #$task->id $task->name/" . $this->products[$productID]; $this->view->position[] = html::a($this->createLink('testtask', 'browse', "productID=$productID"), $this->products[$productID]); @@ -464,7 +464,7 @@ class testtask extends control $this->action->logHistory($actionID, $changes); } - $this->executeHooks($this->methodName, $taskID); + $this->executeHooks($taskID); die(js::locate(inlink('view', "taskID=$taskID"), 'parent')); } @@ -512,7 +512,7 @@ class testtask extends control $this->action->logHistory($actionID, $changes); } - $this->executeHooks($this->methodName, $taskID); + $this->executeHooks($taskID); if(isonlybody()) $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent')); $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('testtask', 'view', "taskID=$taskID"))); @@ -555,7 +555,7 @@ class testtask extends control $this->action->logHistory($actionID, $changes); } - $this->executeHooks($this->methodName, $taskID); + $this->executeHooks($taskID); if(isonlybody()) $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent')); $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('testtask', 'view', "taskID=$taskID"))); @@ -598,7 +598,7 @@ class testtask extends control $this->action->logHistory($actionID, $changes); } - $this->executeHooks($this->methodName, $taskID); + $this->executeHooks($taskID); if(isonlybody()) $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent')); $this->send(array('result' => 'success', 'message' => $this->lang->success, 'locate' => $this->createLink('testtask', 'view', "taskID=$taskID"))); @@ -643,7 +643,7 @@ class testtask extends control $this->action->logHistory($actionID, $changes); } - $this->executeHooks($this->methodName, $taskID); + $this->executeHooks($taskID); if(isonlybody()) $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent')); $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('testtask', 'view', "taskID=$taskID"))); @@ -683,7 +683,7 @@ class testtask extends control $task = $this->testtask->getByID($taskID); $this->testtask->delete(TABLE_TESTTASK, $taskID); - $this->executeHooks($this->methodName, $taskID); + $this->executeHooks($taskID); /* if ajax request, send result. */ if($this->server->ajax)