/
activatedeactivateTask.php
36 lines (35 loc) · 1.33 KB
/
activatedeactivateTask.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
/*+**********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
************************************************************************************/
require_once 'include/utils/CommonUtils.php';
require_once 'include/events/SqlResultIterator.inc';
require_once 'VTWorkflowApplication.inc';
require_once 'VTTaskManager.inc';
require_once 'VTWorkflowUtils.php';
function activatedeactivateTask($adb, $request) {
$status = $request['active'];
$vtw = new VTWorkflowApplication('edittask');
$tm = new VTTaskManager($adb);
$tasks = $tm->getTasksForWorkflow($request['workflow_id']);
foreach ($tasks as $task) {
$t = $tm->retrieveTask($task->id);
$t->active = $status;
$tm->saveTask($t);
$vtw->setReturnUrl('');
$returnUrl = $vtw->editWorkflowUrl($task->workflowId);
}
?>
<script type="text/javascript" charset="utf-8">
window.location="<?php echo $returnUrl?>";
</script>
<?php
}
Vtiger_Request::validateRequest();
activatedeactivateTask($adb, $_REQUEST);
?>