本文整理汇总了PHP中VTTaskManager类的典型用法代码示例。如果您正苦于以下问题:PHP VTTaskManager类的具体用法?PHP VTTaskManager怎么用?PHP VTTaskManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VTTaskManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: vtDisplayTaskList
function vtDisplayTaskList($adb, $requestUrl, $current_language)
{
global $theme, $app_strings;
$image_path = "themes/{$theme}/images/";
$util = new VTWorkflowUtils();
$module = new VTWorkflowApplication("tasklist");
$mod = return_module_language($current_language, $module->name);
if (!$util->checkAdminAccess()) {
$errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NOT_ADMIN']);
$util->redirectTo($errorUrl, $mod['LBL_ERROR_NOT_ADMIN']);
return;
}
$smarty = new vtigerCRM_Smarty();
$tm = new VTTaskManager($adb);
$smarty->assign("tasks", $tm->getTasks());
$smarty->assign("moduleNames", array("Contacts", "Applications"));
$smarty->assign("taskTypes", array("VTEmailTask", "VTDummyTask"));
$smarty->assign("returnUrl", $requestUrl);
$smarty->assign("MOD", return_module_language($current_language, 'Settings'));
$smarty->assign("APP", $app_strings);
$smarty->assign("THEME", $theme);
$smarty->assign("IMAGE_PATH", $image_path);
$smarty->assign("MODULE_NAME", $module->label);
$smarty->assign("PAGE_NAME", 'Task List');
$smarty->assign("PAGE_TITLE", 'List available tasks');
$smarty->assign("moduleName", $moduleName);
$smarty->display("{$module->name}/ListTasks.tpl");
}
开发者ID:sacredwebsite,项目名称:vtigercrm,代码行数:28,代码来源:tasklist.php
示例2: vtDeleteWorkflow
function vtDeleteWorkflow($adb, $request)
{
$util = new VTWorkflowUtils();
$module = new VTWorkflowApplication("deltetask");
$mod = return_module_language($current_language, $module->name);
if (!$util->checkAdminAccess()) {
$errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NOT_ADMIN']);
$util->redirectTo($errorUrl, $mod['LBL_ERROR_NOT_ADMIN']);
return;
}
$wm = new VTTaskManager($adb);
$wm->deleteTask($request['task_id']);
if (isset($request["return_url"])) {
$returnUrl = vtlib_purify($request["return_url"]);
} else {
$returnUrl = $module->editWorkflowUrl($wf->id);
}
?>
<script type="text/javascript" charset="utf-8">
window.location="<?php
echo $returnUrl;
?>
";
</script>
<a href="<?php
echo $returnUrl;
?>
">Return</a>
<?php
}
开发者ID:shamimhasan,项目名称:Vtiger-CRM-5.4.0,代码行数:30,代码来源:deletetask.php
示例3: vtSaveTask
function vtSaveTask($adb, $request)
{
$util = new VTWorkflowUtils();
$module = new VTWorkflowApplication("savetask");
$mod = return_module_language($current_language, $module->name);
if (!$util->checkAdminAccess()) {
$errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NOT_ADMIN']);
$util->redirectTo($errorUrl, $mod['LBL_ERROR_NOT_ADMIN']);
return;
}
$tm = new VTTaskManager($adb);
if (isset($request["task_id"])) {
$task = $tm->retrieveTask($request["task_id"]);
} else {
$taskType = vtlib_purifyForSql($request["task_type"]);
$workflowId = $request["workflow_id"];
$task = $tm->createTask($taskType, $workflowId);
}
$task->summary = $request["summary"];
if ($request["active"] == "true") {
$task->active = true;
} else {
if ($request["active"] == "false") {
$task->active = false;
}
}
if (isset($request['check_select_date'])) {
$trigger = array('days' => ($request['select_date_direction'] == 'after' ? 1 : -1) * (int) $request['select_date_days'], 'field' => $request['select_date_field']);
$task->trigger = $trigger;
} else {
$task->trigger = null;
}
$fieldNames = $task->getFieldNames();
foreach ($fieldNames as $fieldName) {
$task->{$fieldName} = $request[$fieldName];
if ($fieldName == 'calendar_repeat_limit_date') {
$task->{$fieldName} = DateTimeField::convertToDBFormat($request[$fieldName]);
}
}
$tm->saveTask($task);
if (isset(vtlib_purify($request["return_url"]))) {
$returnUrl = vtlib_purify($request["return_url"]);
} else {
$returnUrl = $module->editTaskUrl($task->id);
}
?>
<script type="text/javascript" charset="utf-8">
window.location="<?php
echo $returnUrl;
?>
";
</script>
<a href="<?php
echo $returnUrl;
?>
">Return</a>
<?php
}
开发者ID:shamimhasan,项目名称:Vtiger-CRM-5.4.0,代码行数:58,代码来源:savetask.php
示例4: queueScheduledWorkflowTasks
public function queueScheduledWorkflowTasks()
{
global $default_timezone;
$adb = $this->db;
$vtWorflowManager = new VTWorkflowManager($adb);
$taskQueue = new VTTaskQueue($adb);
$entityCache = new VTEntityCache($this->user);
// set the time zone to the admin's time zone, this is needed so that the scheduled workflow will be triggered
// at admin's time zone rather than the systems time zone. This is specially needed for Hourly and Daily scheduled workflows
$admin = Users::getActiveAdminUser();
$adminTimeZone = $admin->time_zone;
@date_default_timezone_set($adminTimeZone);
$currentTimestamp = date("Y-m-d H:i:s");
@date_default_timezone_set($default_timezone);
$scheduledWorkflows = $vtWorflowManager->getScheduledWorkflows($currentTimestamp);
$noOfScheduledWorkflows = count($scheduledWorkflows);
foreach ($scheduledWorkflows as $workflow) {
$tm = new VTTaskManager($adb);
$tasks = $tm->getTasksForWorkflow($workflow->id);
if ($tasks) {
$records = $this->getEligibleWorkflowRecords($workflow);
$noOfRecords = count($records);
for ($j = 0; $j < $noOfRecords; ++$j) {
$recordId = $records[$j];
// We need to pass proper module name to get the webservice
if ($workflow->moduleName == 'Calendar') {
$moduleName = vtws_getCalendarEntityType($recordId);
} else {
$moduleName = $workflow->moduleName;
}
$wsEntityId = vtws_getWebserviceEntityId($moduleName, $recordId);
$entityData = $entityCache->forId($wsEntityId);
$data = $entityData->getData();
foreach ($tasks as $task) {
if ($task->active) {
$trigger = $task->trigger;
if ($trigger != null) {
$delay = strtotime($data[$trigger['field']]) + $trigger['days'] * 86400;
} else {
$delay = 0;
}
if ($task->executeImmediately == true) {
if (empty($task->test) or $task->evaluate($entityCache, $entityData->getId())) {
$task->doTask($entityData);
}
} else {
$taskQueue->queueTask($task->id, $entityData->getId(), $delay);
}
}
}
}
}
$vtWorflowManager->updateNexTriggerTime($workflow);
}
$scheduledWorkflows = null;
}
开发者ID:kikojover,项目名称:corebos,代码行数:56,代码来源:WorkFlowScheduler.php
示例5: applyChange
function applyChange()
{
global $adb;
if ($this->hasError()) {
$this->sendError();
}
if ($this->isApplied()) {
$this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
} else {
global $adb;
$chktbl = $adb->query('select 1 from com_vtiger_workflow_tasktypes limit 1');
if ($chktbl) {
$moduleInstance = Vtiger_Module::getInstance('Potentials');
$block = Vtiger_Block::getInstance('LBL_OPPORTUNITY_INFORMATION', $moduleInstance);
$field = Vtiger_Field::getInstance('forecast_amount', $moduleInstance);
if ($field) {
$this->ExecuteQuery('update vtiger_field set presence=2 where fieldid=' . $field->id);
} else {
$forecast_field = new Vtiger_Field();
$forecast_field->name = 'forecast_amount';
$forecast_field->label = 'Forecast Amount';
$forecast_field->table = 'vtiger_potential';
$forecast_field->column = 'forecast_amount';
$forecast_field->columntype = 'decimal(25,4)';
$forecast_field->typeofdata = 'N~O';
$forecast_field->uitype = '71';
$forecast_field->masseditable = '0';
$block->addField($forecast_field);
}
$wfrs = $adb->query("SELECT workflow_id FROM com_vtiger_workflows WHERE summary='Calculate or Update forecast amount'");
if ($wfrs and $adb->num_rows($wfrs) == 1) {
$this->sendMsg('Workfolw already exists!');
} else {
$workflowManager = new VTWorkflowManager($adb);
$taskManager = new VTTaskManager($adb);
$potentailsWorkFlow = $workflowManager->newWorkFlow("Potentials");
$potentailsWorkFlow->test = '';
$potentailsWorkFlow->description = "Calculate or Update forecast amount";
$potentailsWorkFlow->executionCondition = VTWorkflowManager::$ON_EVERY_SAVE;
$potentailsWorkFlow->defaultworkflow = 1;
$workflowManager->save($potentailsWorkFlow);
$task = $taskManager->createTask('VTUpdateFieldsTask', $potentailsWorkFlow->id);
$task->active = true;
$task->summary = 'update forecast amount';
$task->field_value_mapping = '[{"fieldname":"forecast_amount","valuetype":"expression","value":"amount * probability / 100"}]';
$taskManager->saveTask($task);
}
$this->sendMsg('Changeset ' . get_class($this) . ' applied!');
$this->markApplied();
} else {
$this->sendMsgError('This changeset could not be applied because it depends on create_workflow_tasktype which probably has not been applied yet. Apply that changeset and try this one again.');
}
}
$this->finishExecution();
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:55,代码来源:PotentialForecastAmount.php
示例6: vtWorkflowEdit
function vtWorkflowEdit($adb, $request, $requestUrl, $current_language, $app_strings)
{
global $theme;
$util = new VTWorkflowUtils();
$image_path = "themes/{$theme}/images/";
$module = new VTWorkflowApplication("editworkflow");
$mod = return_module_language($current_language, $module->name);
if (!$util->checkAdminAccess()) {
$errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NOT_ADMIN']);
$util->redirectTo($errorUrl, $mod['LBL_ERROR_NOT_ADMIN']);
return;
}
$smarty = new vtigerCRM_Smarty();
if ($request['source'] == 'from_template') {
$tm = new VTWorkflowTemplateManager($adb);
$template = $tm->retrieveTemplate($request['template_id']);
$workflow = $tm->createWorkflow($template);
} else {
$wfs = new VTWorkflowManager($adb);
if (isset($request["workflow_id"])) {
$workflow = $wfs->retrieve($request["workflow_id"]);
} else {
$moduleName = $request["module_name"];
$workflow = $wfs->newWorkflow($moduleName);
}
}
if ($workflow == null) {
$errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NO_WORKFLOW']);
$util->redirectTo($errorUrl, $mod['LBL_ERROR_NO_WORKFLOW']);
return;
}
$workflow->test = addslashes($workflow->test);
$tm = new VTTaskManager($adb);
$tasks = $tm->getTasksForWorkflow($workflow->id);
$smarty->assign("tasks", $tasks);
$taskTypes = $tm->getTaskTypes($workflow->moduleName);
$smarty->assign("taskTypes", $taskTypes);
$smarty->assign("newTaskReturnUrl", vtlib_purify($requestUrl));
$smarty->assign("returnUrl", vtlib_purify($request["return_url"]));
$smarty->assign("APP", $app_strings);
$smarty->assign("MOD", array_merge(return_module_language($current_language, 'Settings'), return_module_language($current_language, $module->name)));
$smarty->assign("THEME", $theme);
$smarty->assign("IMAGE_PATH", $image_path);
$smarty->assign("MODULE_NAME", $module->label);
$smarty->assign("PAGE_NAME", $mod['LBL_EDIT_WORKFLOW']);
$smarty->assign("PAGE_TITLE", $mod['LBL_EDIT_WORKFLOW_TITLE']);
$smarty->assign("workflow", $workflow);
$smarty->assign("saveType", isset($workflow->id) ? "edit" : "new");
$smarty->assign("module", $module);
$smarty->assign("WORKFLOW_TRIGGER_TYPES_HELP_LINK", WORKFLOW_TRIGGER_TYPES);
$smarty->display("{$module->name}/EditWorkflow.tpl");
}
开发者ID:mslokhat,项目名称:corebos,代码行数:52,代码来源:editworkflow.php
示例7: vtRunTaskJob
function vtRunTaskJob($adb)
{
$util = new VTWorkflowUtils();
$adminUser = $util->adminUser();
$tq = new VTTaskQueue($adb);
$readyTasks = $tq->getReadyTasks();
$tm = new VTTaskManager($adb);
foreach ($readyTasks as $pair) {
list($taskId, $entityId) = $pair;
$task = $tm->retrieveTask($taskId);
$entity = new VTWorkflowEntity($adminUser, $entityId);
$task->doTask($entity);
}
}
开发者ID:vtiger-jp,项目名称:vtigercrm-5.1.x-ja,代码行数:14,代码来源:runtaskjob.php
示例8: queueScheduledWorkflowTasks
public function queueScheduledWorkflowTasks()
{
global $default_timezone;
$adb = $this->db;
$vtWorflowManager = new VTWorkflowManager($adb);
$entityCache = new VTEntityCache($this->user);
// set the time zone to the admin's time zone, this is needed so that the scheduled workflow will be triggered
// at admin's time zone rather than the systems time zone. This is specially needed for Hourly and Daily scheduled workflows
$admin = Users::getActiveAdminUser();
$adminTimeZone = $admin->time_zone;
@date_default_timezone_set($adminTimeZone);
$currentTimestamp = date("Y-m-d H:i:s");
@date_default_timezone_set($default_timezone);
$scheduledWorkflows = $vtWorflowManager->getScheduledWorkflows($currentTimestamp);
$noOfScheduledWorkflows = count($scheduledWorkflows);
for ($i = 0; $i < $noOfScheduledWorkflows; ++$i) {
$workflow = $scheduledWorkflows[$i];
if ($workflow->active != 1) {
continue;
}
$tm = new VTTaskManager($adb);
$tasks = $tm->getTasksForWorkflow($workflow->id);
if ($tasks) {
$records = $this->getEligibleWorkflowRecords($workflow);
$noOfRecords = count($records);
for ($j = 0; $j < $noOfRecords; ++$j) {
$recordId = $records[$j];
// We need to pass proper module name to get the webservice
if ($workflow->moduleName == 'Calendar') {
$moduleName = vtws_getCalendarEntityType($recordId);
} else {
$moduleName = $workflow->moduleName;
}
$wsEntityId = vtws_getWebserviceEntityId($moduleName, $recordId);
$entityData = $entityCache->forId($wsEntityId);
$tm->performTasks($entityData, false);
}
}
$vtWorflowManager->updateNexTriggerTime($workflow);
}
$scheduledWorkflows = null;
}
开发者ID:Wasage,项目名称:werpa,代码行数:42,代码来源:WorkFlowScheduler.php
示例9: applyChange
function applyChange()
{
if ($this->hasError()) {
$this->sendError();
}
if ($this->isApplied()) {
$this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
} else {
global $adb;
$emm = new VTEntityMethodManager($adb);
// Adding EntityMethod for Updating Products data after updating PurchaseOrder
$emm->addEntityMethod("PurchaseOrder", "UpdateInventory", "include/InventoryHandler.php", "handleInventoryProductRel");
// Creating Workflow for Updating Inventory Stock on PO
$vtWorkFlow = new VTWorkflowManager($adb);
$invWorkFlow = $vtWorkFlow->newWorkFlow("PurchaseOrder");
$invWorkFlow->test = '[{"fieldname":"subject","operation":"does not contain","value":"`!`"}]';
$invWorkFlow->description = "UpdateInventoryProducts On Every Save";
$invWorkFlow->defaultworkflow = 1;
$vtWorkFlow->save($invWorkFlow);
$tm = new VTTaskManager($adb);
$task = $tm->createTask('VTEntityMethodTask', $invWorkFlow->id);
$task->active = true;
$task->methodName = "UpdateInventory";
$task->summary = "Update product stock";
$tm->saveTask($task);
// add Cancel status to Invoice and SO for stock control
$moduleInstance = Vtiger_Module::getInstance('Invoice');
$field = Vtiger_Field::getInstance('invoicestatus', $moduleInstance);
if ($field) {
$field->setPicklistValues(array('Cancel'));
}
$this->sendMsg('Changeset ' . get_class($this) . ' applied! Add Workflow Custom Function complete!');
$this->markApplied();
}
$this->finishExecution();
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:36,代码来源:inventoryproductstockcontrol.php
示例10: populateDefaultWorkflows
function populateDefaultWorkflows($adb)
{
require_once "modules/com_vtiger_workflow/include.inc";
require_once "modules/com_vtiger_workflow/tasks/VTEntityMethodTask.inc";
require_once "modules/com_vtiger_workflow/VTEntityMethodManager.inc";
// Creating Workflow for Updating Inventory Stock for Invoice
$vtWorkFlow = new VTWorkflowManager($adb);
$invWorkFlow = $vtWorkFlow->newWorkFlow("Invoice");
$invWorkFlow->test = '[{"fieldname":"subject","operation":"does not contain","value":"`!`"}]';
$invWorkFlow->description = "UpdateInventoryProducts On Every Save";
$vtWorkFlow->save($invWorkFlow);
$tm = new VTTaskManager($adb);
$task = $tm->createTask('VTEntityMethodTask', $invWorkFlow->id);
$task->active = true;
$task->methodName = "UpdateInventory";
$tm->saveTask($task);
}
开发者ID:vtiger-jp,项目名称:vtigercrm-5.1.x-ja,代码行数:17,代码来源:CreateTables.inc.php
示例11: foreach
}
foreach ($dateTimeFieldsList as $moduleName => $fieldNamesList) {
foreach ($fieldNamesList as $fieldName) {
$propertyValue = str_replace("({$moduleName}) {$fieldName}) {$timeZone}", "({$moduleName}) {$fieldName})", $propertyValue);
}
}
$emailTask->{$propertyName} = $propertyValue;
}
$tm->saveTask($emailTask);
}
$result = $adb->pquery('SELECT task_id FROM com_vtiger_workflowtasks WHERE workflow_id IN
(SELECT workflow_id FROM com_vtiger_workflows WHERE module_name IN (?, ?))
AND task LIKE ?', array('Calendar', 'Events', '%VTSendNotificationTask%'));
$numOfRowas = $adb->num_rows($result);
for ($i = 0; $i < $numOfRows; $i++) {
$tm = new VTTaskManager($adb);
$task = $tm->retrieveTask($adb->query_result($result, $i, 'task_id'));
$emailTask = new VTEmailTask();
$properties = get_object_vars($task);
foreach ($properties as $propertyName => $propertyValue) {
$propertyValue = str_replace('$date_start $time_start ( $(general : (__VtigerMeta__) usertimezone) ) ', '$date_start', $propertyValue);
$propertyValue = str_replace('$due_date $time_end ( $(general : (__VtigerMeta__) usertimezone) )', '$due_date', $propertyValue);
$propertyValue = str_replace('$due_date ( $(general : (__VtigerMeta__) usertimezone) )', '$due_date', $propertyValue);
$propertyValue = str_replace('$(contact_id : (Contacts) lastname) $(contact_id : (Contacts) firstname)', '$contact_id', $propertyValue);
$emailTask->{$propertyName} = $propertyValue;
}
$tm->saveTask($emailTask);
}
// $maxActionIdResult = $adb->pquery('SELECT MAX(actionid) AS maxid FROM vtiger_actionmapping', array());
// $maxActionId = $adb->query_result($maxActionIdResult, 0, 'maxid');
// Migration_Index_View::ExecuteQuery('INSERT INTO vtiger_actionmapping(actionid, actionname, securitycheck) VALUES(?,?,?)', array($maxActionId+1 ,'Print', '0'));
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:31,代码来源:migrate_from_vt61.php
示例12: getActiveCount
/**
* Function to get the count of active workflows
* @return <Integer> count of acive workflows
*/
public static function getActiveCount()
{
$db = PearDatabase::getInstance();
vimport('~~/modules/com_vtiger_workflow/VTTaskManager.inc');
$taskManager = new VTTaskManager($db);
$taskList = $taskManager->getTasks();
$examinedIdList = array();
foreach ($taskList as $taskDetails) {
$workFlowId = $taskDetails->workflowId;
if (in_array($workFlowId, $examinedIdList)) {
continue;
}
if ($taskDetails->active) {
array_push($examinedIdList, $workFlowId);
}
}
return count($examinedIdList);
}
开发者ID:artisan4710,项目名称:YetiForceCRM,代码行数:22,代码来源:Record.php
示例13: vtWorkflowEdit
function vtWorkflowEdit($adb, $request, $requestUrl, $current_language, $app_strings)
{
global $theme, $current_user;
$util = new VTWorkflowUtils();
$image_path = "themes/{$theme}/images/";
$module = new VTWorkflowApplication("editworkflow");
$mod = return_module_language($current_language, $module->name);
if (!$util->checkAdminAccess()) {
$errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NOT_ADMIN']);
$util->redirectTo($errorUrl, $mod['LBL_ERROR_NOT_ADMIN']);
return;
}
$smarty = new vtigerCRM_Smarty();
if ($request['source'] == 'from_template') {
$tm = new VTWorkflowTemplateManager($adb);
$template = $tm->retrieveTemplate($request['template_id']);
$workflow = $tm->createWorkflow($template);
} else {
$wfs = new VTWorkflowManager($adb);
if (isset($request["workflow_id"])) {
$workflow = $wfs->retrieve($request["workflow_id"]);
} else {
$moduleName = $request["module_name"];
$workflow = $wfs->newWorkflow($moduleName);
}
$smarty->assign('ScheduledWorkflowsCount', $wfs->getScheduledWorkflowsCount());
$smarty->assign('MaxAllowedScheduledWorkflows', $wfs->getMaxAllowedScheduledWorkflows());
$smarty->assign('schdtime_12h', date('h:ia', strtotime(substr($workflow->schtime, 0, strrpos($workflow->schtime, ':')))));
$schannualdates = json_decode($workflow->schannualdates);
if (count($schannualdates) > 0) {
$schannualdates = DateTimeField::convertToUserFormat($schannualdates[0]);
} else {
$schannualdates = '';
}
$smarty->assign('schdate', $schannualdates);
$smarty->assign('selected_days1_31', json_decode($workflow->schdayofmonth));
$smarty->assign('dayOfWeek', json_decode($workflow->schdayofweek));
}
if ($workflow == null) {
$errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NO_WORKFLOW']);
$util->redirectTo($errorUrl, $mod['LBL_ERROR_NO_WORKFLOW']);
return;
}
$workflow->test = addslashes($workflow->test);
$tm = new VTTaskManager($adb);
$tasks = $tm->getTasksForWorkflow($workflow->id);
$smarty->assign("tasks", $tasks);
$taskTypes = $tm->getTaskTypes($workflow->moduleName);
$smarty->assign("taskTypes", $taskTypes);
$smarty->assign("newTaskReturnUrl", vtlib_purify($requestUrl));
$dayrange = array();
for ($d = 1; $d <= 31; $d++) {
$dayrange[$d] = $d;
}
$smarty->assign('days1_31', $dayrange);
$smarty->assign('wfnexttrigger_time', DateTimeField::convertToUserFormat($workflow->nexttrigger_time));
$smarty->assign("dateFormat", parse_calendardate($current_user->date_format));
$smarty->assign("returnUrl", vtlib_purify($request["return_url"]));
$smarty->assign("APP", $app_strings);
$smarty->assign("MOD", array_merge(return_module_language($current_language, 'Settings'), return_module_language($current_language, $module->name)));
$smarty->assign("THEME", $theme);
$smarty->assign("IMAGE_PATH", $image_path);
$smarty->assign("MODULE_NAME", $module->label);
$smarty->assign("PAGE_NAME", $mod['LBL_EDIT_WORKFLOW']);
$smarty->assign("PAGE_TITLE", $mod['LBL_EDIT_WORKFLOW_TITLE']);
$smarty->assign("workflow", $workflow);
$smarty->assign("saveType", isset($workflow->id) ? "edit" : "new");
$smarty->assign("module", $module);
$smarty->assign("WORKFLOW_TRIGGER_TYPES_HELP_LINK", WORKFLOW_TRIGGER_TYPES);
$smarty->display("{$module->name}/EditWorkflow.tpl");
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:71,代码来源:editworkflow.php
示例14: vtTaskEdit
function vtTaskEdit($adb, $request, $current_language, $app_strings)
{
global $theme;
$util = new VTWorkflowUtils();
$request = vtlib_purify($request);
// this cleans all values of the array
$image_path = "themes/{$theme}/images/";
$module = new VTWorkflowApplication('edittask');
$mod = return_module_language($current_language, $module->name);
if (!$util->checkAdminAccess()) {
$errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NOT_ADMIN']);
$util->redirectTo($errorUrl, $mod['LBL_ERROR_NOT_ADMIN']);
return;
}
$smarty = new vtigerCRM_Smarty();
$tm = new VTTaskManager($adb);
$smarty->assign('edit', isset($request["task_id"]));
if (isset($request["task_id"])) {
$task = $tm->retrieveTask($request["task_id"]);
$taskClass = get_class($task);
$workflowId = $task->workflowId;
} else {
$workflowId = $request["workflow_id"];
$taskClass = vtlib_purifyForSql($request["task_type"]);
$task = $tm->createTask($taskClass, $workflowId);
}
if ($task == null) {
$errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NO_TASK']);
$util->redirectTo($errorUrl, $mod['LBL_ERROR_NO_TASK']);
return;
}
$wm = new VTWorkflowManager($adb);
$workflow = $wm->retrieve($workflowId);
if ($workflow == null) {
$errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NO_WORKFLOW']);
$util->redirectTo($errorUrl, $mod['LBL_ERROR_NO_WORKFLOW']);
return;
}
$smarty->assign("workflow", $workflow);
$smarty->assign("returnUrl", $request["return_url"]);
$smarty->assign("task", $task);
$smarty->assign("taskType", $taskClass);
$smarty->assign("saveType", $request['save_type']);
$taskTypeInstance = VTTaskType::getInstanceFromTaskType($taskClass);
$taskTemplateClass = $tm->retrieveTemplatePath($module->name, $taskTypeInstance);
$smarty->assign("taskTemplate", $taskTemplateClass);
$et = VTWSEntityType::usingGlobalCurrentUser($workflow->moduleName);
$smarty->assign("entityType", $et);
$smarty->assign('entityName', $workflow->moduleName);
$smarty->assign("fieldNames", $et->getFieldNames());
$repeat_date = $task->calendar_repeat_limit_date;
if (!empty($repeat_date)) {
$repeat_date = DateTimeField::convertToUserFormat($repeat_date);
}
$smarty->assign('REPEAT_DATE', $repeat_date);
$dateFields = array();
$fieldTypes = $et->getFieldTypes();
$fieldLabels = $et->getFieldLabels();
foreach ($fieldTypes as $name => $type) {
if ($type->type == 'Date' || $type->type == 'DateTime') {
$dateFields[$name] = $fieldLabels[$name];
}
}
$smarty->assign('dateFields', $dateFields);
if ($task->trigger != null) {
$trigger = $task->trigger;
$days = $trigger['days'];
if ($days < 0) {
$days *= -1;
$direction = 'before';
} else {
$direction = 'after';
}
$smarty->assign('trigger', array('days' => $days, 'direction' => $direction, 'field' => $trigger['field']));
}
$metaVariables = $task->getMetaVariables();
$date = new DateTimeField(null);
$time = substr($date->getDisplayTime(), 0, 5);
$smarty->assign("META_VARIABLES", $metaVariables);
$smarty->assign("SYSTEM_TIMEZONE", $db_timezone);
$smarty->assign("USER_TIME", $task->formatTimeForTimePicker($time));
$smarty->assign("USER_DATE", $date->getDisplayDate());
$smarty->assign("MOD", array_merge(return_module_language($current_language, 'Settings'), return_module_language($current_language, 'Calendar'), return_module_language($current_language, $module->name)));
$smarty->assign("APP", $app_strings);
$smarty->assign("dateFormat", parse_calendardate($app_strings['NTC_DATE_FORMAT']));
$smarty->assign("IMAGE_PATH", $image_path);
$smarty->assign("THEME", $theme);
$smarty->assign("MODULE_NAME", $module->label);
$smarty->assign("PAGE_NAME", $mod['LBL_EDIT_TASK']);
$smarty->assign("PAGE_TITLE", $mod['LBL_EDIT_TASK_TITLE']);
$users = $group = array();
$users['user'] = get_user_array();
$users['group'] = get_group_array();
$smarty->assign('ASSIGNED_TO', $users);
$smarty->assign("module", $module);
$smarty->display("{$module->name}/EditTask.tpl");
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:97,代码来源:edittask.php
示例15: array
}
$dateTimeFields = array();
foreach ($dateTimeFieldsList as $moduleName => $fieldNamesList) {
$dateTimeFields = array_merge($dateTimeFields, $fieldNamesList);
}
$taskIdsList = array();
$result = $adb->pquery('SELECT task_id, module_name FROM com_vtiger_workflowtasks
INNER JOIN com_vtiger_workflows ON com_vtiger_workflows.workflow_id = com_vtiger_workflowtasks.workflow_id
WHERE task LIKE ?', array('%VTEmailTask%'));
while ($rowData = $adb->fetch_array($result)) {
$taskIdsList[$rowData['task_id']] = $rowData['module_name'];
}
$dateFormat = '($_DATE_FORMAT_)';
$timeZone = '($(general : (__VtigerMeta__) usertimezone))';
foreach ($taskIdsList as $taskId => $taskModuleName) {
$tm = new VTTaskManager($adb);
$task = $tm->retrieveTask($taskId);
$emailTask = new VTEmailTask();
$properties = get_object_vars($task);
foreach ($properties as $propertyName => $propertyValue) {
$propertyValue = str_replace('$(general : (__VtigerMeta__) date)', "(general : (__VtigerMeta__) date) {$dateFormat}", $propertyValue);
foreach ($dateFields as $fieldName) {
if ($taskModuleName === 'Events' && $fieldName === 'due_date') {
continue;
}
$propertyValue = str_replace("\${$fieldName}", "\${$fieldName} {$dateFormat}", $propertyValue);
}
foreach ($dateTimeFields as $fieldName) {
if ($taskModuleName === 'Calendar' && $fieldName === 'due_date') {
continue;
}
开发者ID:lsmonki,项目名称:vtigercrm,代码行数:31,代码来源:600_to_610.php
示例16: VTWorkflowUtils
require_once 'include/Webservices/WebserviceEntityOperation.php';
require_once "include/language/{$default_language}.lang.php";
require_once 'include/Webservices/Retrieve.php';
require_once 'modules/Emails/mail.php';
require_once 'modules/Users/Users.php';
require_once 'modules/com_vtiger_workflow/VTSimpleTemplate.inc';
require_once 'modules/com_vtiger_workflow/VTEntityCache.inc';
require_once 'modules/com_vtiger_workflow/VTWorkflowUtils.php';
require_once 'modules/com_vtiger_workflow/include.inc';
global $current_user, $adb;
$util = new VTWorkflowUtils();
$adminUser = $util->adminUser();
$current_user = $adminUser;
$tq = new VTTaskQueue($adb);
$readyTasks = $tq->getReadyTasks();
$tm = new VTTaskManager($adb);
$taskId = 41;
$entityId = '12x136';
$task = $tm->retrieveTask($taskId);
if (!empty($task)) {
list($moduleId, $crmId) = explode('x', $entityId);
$query = "select deleted from vtiger_crmentity where crmid={$crmId}";
$res = $adb->query($query);
if ($adb->num_rows($res) == 0 || $adb->query_result($res, 0, 0)) {
echo "Deleted Record\n";
} else {
//error_reporting(E_ALL);ini_set('display_errors','on');
$entity = new VTWorkflowEntity($adminUser, $entityId);
$task->doTask($entity);
}
} else {
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:31,代码来源:runwftask.php
示例17: ExecuteQuery
ExecuteQuery("ALTER TABLE vtiger_inventoryproductrel ADD COLUMN incrementondel int(11) not null default '0'");
$invoiceids = $adb->pquery("SELECT invoiceid from vtiger_invoice", array());
$noOfRows = $adb->num_rows($invoiceids);
for ($i = 0; $i < $noOfRows; $i++) {
$adb->pquery("UPDATE vtiger_inventoryproductrel SET incrementondel = 1 WHERE id=?", array($adb->query_result($invoiceids, $i, "invoiceid")));
}
$emm->addEntityMethod("SalesOrder", "UpdateInventory", "include/InventoryHandler.php", "handleInventoryProductRel");
//Adding EntityMethod for Updating Products data after creating SalesOrder
$emm->addEntityMethod("Invoice", "UpdateInventory", "include/InventoryHandler.php", "handleInventoryProductRel");
//Adding EntityMethod for Updating Products data after creating Invoice
$vtWorkFlow = new VTWorkflowManager($adb);
$invWorkFlow = $vtWorkFlow->newWorkFlow("Invoice");
$invWorkFlow->test = '[{"fieldname":"subject","operation":"does not contain","value":"`!`"}]';
$invWorkFlow->description = "UpdateInventoryProducts On Every Save";
$vtWorkFlow->save($invWorkFlow);
$tm = new VTTaskManager($adb);
$task = $tm->createTask('VTEntityMethodTask', $invWorkFlow->id);
$task->active = true;
$task->methodName = "UpdateInventory";
$tm->saveTask($task);
/* Support to track if a module is of CrmEntity type or not */
ExecuteQuery("ALTER TABLE vtiger_tab ADD COLUMN isentitytype INT NOT NULL DEFAULT 1");
ExecuteQuery("UPDATE vtiger_tab SET isentitytype=0 WHERE name IN ('Home','Dashboard','Rss','Reports','Portal','Users','Recyclebin')");
/* Support for different languages to be stored in database instead of config file - Vtlib */
ExecuteQuery("CREATE TABLE IF NOT EXISTS vtiger_language(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(50), " . "prefix VARCHAR(10), label VARCHAR(30), lastupdated DATETIME, sequence INT, isdefault INT(1), active INT(1)) ENGINE=InnoDB DEFAULT CHARSET=utf8;");
/* Register default language English. This will automatically register all the other langauges from config file */
require_once 'vtlib/Vtiger/Language.php';
$vtlanguage = new Vtiger_Language();
$vtlanguage->register('en_us', 'US English', 'English', true, true, true);
/* To store relationship between the modules in a common table */
ExecuteQuery("CREATE TABLE IF NOT EXISTS vtiger_crmentityrel (crmid int(11) NOT NULL, module varchar(100) NOT NULL, relcrmid int(11) NOT NULL, relmodule varchar(100) NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8;");
开发者ID:sacredwebsite,项目名称:vtigercrm,代码行数:31,代码来源:504_to_510rc.php
示例18: databaseData
public function databaseData()
{
global $log, $adb;
$log->debug("Entering YetiForceUpdate::databaseData() method ...");
$this->addFields();
$adb->query("UPDATE vtiger_eventhandlers_seq SET `id` = (SELECT MAX(eventhandler_id) FROM `vtiger_eventhandlers`);");
$result = $adb->pquery("SELECT * FROM `vtiger_eventhandlers` WHERE event_name = ? AND handler_class = ?;", array('vtiger.entity.link.after', 'HelpDeskHandler'));
if ($adb->num_rows($result) == 0) {
$addHandler = array();
$addHandler[] = array('vtiger.entity.link.after', 'modules/HelpDesk/handlers/HelpDeskHandler.php', 'HelpDeskHandler', '', '1', '[]');
$em = new VTEventsManager($adb);
foreach ($addHandler as $handler) {
$em->registerHandler($handler[0], $handler[1], $handler[2], $handler[3], $handler[5]);
}
}
$template[] = array('Notify Owner On Ticket Change', 'HelpDesk', 'PLL_RECORD');
$template[] = array('Notify Account On Ticket Change', 'HelpDesk', 'PLL_RECORD');
$template[] = array('Notify Contact On Ticket Closed', 'HelpDesk', 'PLL_RECORD');
$template[] = array('Notify Account On Ticket Closed', 'HelpDesk', 'PLL_RECORD');
$template[] = array('Notify Contact On Ticket Create', 'HelpDesk', 'PLL_RECORD');
$template[] = array('Notify Account On Ticket Create', 'HelpDesk', 'PLL_RECORD');
$template[] = array('Notify Contact On Ticket Change', 'HelpDesk', 'PLL_RECORD');
$template[] = array('Notify Owner On Ticket Closed', 'HelpDesk', 'PLL_RECORD');
$template[] = array('Notify Owner On Ticket Create', 'HelpDesk', 'PLL_RECORD');
$template[] = array('Customer Portal Login Details', 'Contacts', 'PLL_RECORD');
$template[] = array('Send invitations', 'Events', 'PLL_RECORD');
$template[] = array('Send Notification Email to Record Owner', 'Calendar', 'PLL_RECORD');
$template[] = array('Activity Reminder Notification', 'Calendar', 'PLL_RECORD');
$template[] = array('Activity Reminder Notification', 'Events', 'PLL_RECORD');
$template[] = array('Test mail about the mail server configuration.', 'Users', 'PLL_RECORD');
$template[] = array('ForgotPassword', 'Users', 'PLL_RECORD');
$template[] = array('Customer Portal - ForgotPassword', 'Contacts', 'PLL_RECORD');
$template[] = array('New comment added to ticket from portal', 'ModComments', 'PLL_RECORD');
$template[] = array('New comment added to ticket', 'ModComments', 'PLL_RECORD');
$template[] = array('Security risk has been detected - Brute Force', 'Contacts', 'PLL_MODULE');
$template[] = array('Backup has been made', 'Contacts', 'PLL_MODULE');
$result = $adb->query("SHOW COLUMNS FROM `vtiger_ossmailtemplates` LIKE 'ossmailtemplates_type';");
if ($adb->num_rows($result) == 1) {
foreach ($template as $temp) {
$adb->pquery("UPDATE `vtiger_ossmailtemplates` set ossmailtemplates_type = ? WHERE `name
|
请发表评论