• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP VTWorkflowManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中VTWorkflowManager的典型用法代码示例。如果您正苦于以下问题:PHP VTWorkflowManager类的具体用法?PHP VTWorkflowManager怎么用?PHP VTWorkflowManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了VTWorkflowManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: vtDisplayWorkflowList

function vtDisplayWorkflowList($adb, $request, $requestUrl, $app_strings, $current_language)
{
    global $theme;
    $image_path = "themes/{$theme}/images/";
    $module = new VTWorkflowApplication("workflowlist");
    $util = new VTWorkflowUtils();
    $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();
    $wfs = new VTWorkflowManager($adb);
    $smarty->assign("moduleNames", $util->vtGetModules($adb));
    $smarty->assign("returnUrl", $requestUrl);
    $listModule = $request['list_module'];
    $smarty->assign("listModule", $listModule);
    if ($listModule == null || strtolower($listModule) == "all") {
        $smarty->assign("workflows", $wfs->getWorkflows());
    } else {
        $smarty->assign("workflows", $wfs->getWorkflowsForModule($listModule));
    }
    $smarty->assign("MOD", array_merge(return_module_language($current_language, 'Settings'), return_module_language($current_language, $module->name)));
    $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", $mod['LBL_WORKFLOW_LIST']);
    $smarty->assign("PAGE_TITLE", $mod['LBL_AVAILABLE_WORKLIST_LIST']);
    $smarty->assign("module", $module);
    $smarty->assign('MODULE', $module->name);
    $smarty->assign("CRON_TASK", Vtiger_Cron::getInstance('Workflow'));
    $smarty->display("{$module->name}/ListWorkflows.tpl");
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:35,代码来源:workflowlist.php


示例2: vtDeleteWorkflow

function vtDeleteWorkflow($adb, $request)
{
    $util = new VTWorkflowUtils();
    $module = new VTWorkflowApplication("deleteworkflow");
    $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 VTWorkflowManager($adb);
    $wm->delete($request['workflow_id']);
    if (isset($request["return_url"])) {
        $returnUrl = $request["return_url"];
    } else {
        $returnUrl = $module->listViewUrl($wf->id);
    }
    ?>
		<script type="text/javascript" charset="utf-8">
			window.location="<?php 
    echo $returnUrl;
    ?>
";
		</script>
		<a href="<?php 
    echo $returnUrl;
    ?>
">Return</a>
		<?php 
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:30,代码来源:deleteworkflow.php


示例3: process

 function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $record = $request->get('record');
     vimport('~~modules/com_vtiger_workflow/include.inc');
     vimport('~~modules/com_vtiger_workflow/VTEntityCache.inc');
     vimport('~~modules/com_vtiger_workflow/include.inc');
     vimport('~~include/Webservices/Utils.php');
     vimport('~~include/Webservices/Retrieve.php');
     $adb = PearDatabase::getInstance();
     $wfs = new VTWorkflowManager($adb);
     $workflows = $wfs->getWorkflowsForModule($moduleName, VTWorkflowManager::$TRIGGER);
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $wsId = vtws_getWebserviceEntityId($moduleName, $record);
     $entityCache = new VTEntityCache($currentUser);
     $entityData = $entityCache->forId($wsId);
     foreach ($workflows as $id => $workflow) {
         if (!$workflow->evaluate($entityCache, $entityData->getId())) {
             unset($workflows[$id]);
         }
     }
     $viewer = $this->getViewer($request);
     $viewer->assign('RECORD', $record);
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('WORKFLOWS', $workflows);
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $viewer->view('WorkflowTrigger.tpl', $moduleName);
 }
开发者ID:awflu,项目名称:YetiForceCRM,代码行数:28,代码来源:WorkflowTrigger.php


示例4: step1

 public function step1(Vtiger_Request $request)
 {
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     $qualifiedModuleName = $request->getModule(false);
     $recordId = $request->get('record');
     if ($recordId) {
         $workflowModel = Settings_Workflows_Record_Model::getInstance($recordId);
         $viewer->assign('RECORDID', $recordId);
         $viewer->assign('MODULE_MODEL', $workflowModel->getModule());
         $viewer->assign('MODE', 'edit');
     } else {
         $workflowModel = Settings_Workflows_Record_Model::getCleanInstance($moduleName);
         $selectedModule = $request->get('source_module');
         if (!empty($selectedModule)) {
             $viewer->assign('SELECTED_MODULE', $selectedModule);
         }
     }
     $db = PearDatabase::getInstance();
     $workflowManager = new VTWorkflowManager($db);
     $viewer->assign('MAX_ALLOWED_SCHEDULED_WORKFLOWS', $workflowManager->getMaxAllowedScheduledWorkflows());
     $viewer->assign('SCHEDULED_WORKFLOW_COUNT', $workflowManager->getScheduledWorkflowsCount());
     $viewer->assign('WORKFLOW_MODEL', $workflowModel);
     $viewer->assign('ALL_MODULES', Settings_Workflows_Module_Model::getSupportedModules());
     $viewer->assign('TRIGGER_TYPES', Settings_Workflows_Module_Model::getTriggerTypes());
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName);
     $viewer->assign('CURRENT_USER', $currentUser);
     $admin = Users::getActiveAdminUser();
     $viewer->assign('ACTIVE_ADMIN', $admin);
     $viewer->view('Step1.tpl', $qualifiedModuleName);
 }
开发者ID:JeRRimix,项目名称:YetiForceCRM,代码行数:33,代码来源:Edit.php


示例5: handleEvent

 function handleEvent($eventName, $data)
 {
     if ($eventName == 'vtiger.entity.beforesave') {
         // Entity is about to be saved, take required action
     }
     if ($eventName == 'vtiger.entity.aftersave') {
         $db = PearDatabase::getInstance();
         $relatedToId = $data->get('related_to');
         if ($relatedToId) {
             $moduleName = getSalesEntityType($relatedToId);
             $focus = CRMEntity::getInstance($moduleName);
             $focus->retrieve_entity_info($relatedToId, $moduleName);
             $focus->id = $relatedToId;
             $fromPortal = $data->get('from_portal');
             if ($fromPortal) {
                 $focus->column_fields['from_portal'] = $fromPortal;
             }
             $entityData = VTEntityData::fromCRMEntity($focus);
             $wfs = new VTWorkflowManager($db);
             $relatedToEventHandler = new VTWorkflowEventHandler();
             $relatedToEventHandler->workflows = $wfs->getWorkflowsForModuleSupportingComments($entityData->getModuleName());
             $wsId = vtws_getWebserviceEntityId($entityData->getModuleName(), $entityData->getId());
             $fromPortal = $entityData->get('from_portal');
             $util = new VTWorkflowUtils();
             $entityCache = new VTEntityCache($util->adminUser());
             $entityCacheData = $entityCache->forId($wsId);
             $entityCacheData->set('from_portal', $fromPortal);
             $entityCache->cache[$wsId] = $entityCacheData;
             $relatedToEventHandler->handleEvent($eventName, $entityData, $entityCache);
             $util->revertUser();
         }
     }
 }
开发者ID:cannking,项目名称:vtigercrm-debug,代码行数:33,代码来源:ModCommentsHandler.php


示例6: getDetailViewLinks

 /**
  * Function to get the detail view links (links and widgets)
  * @param <array> $linkParams - parameters which will be used to calicaulate the params
  * @return <array> - array of link models in the format as below
  *                   array('linktype'=>list of link models);
  */
 public function getDetailViewLinks($linkParams)
 {
     $linkTypes = array('DETAILVIEWBASIC', 'DETAILVIEW');
     $moduleModel = $this->getModule();
     $recordModel = $this->getRecord();
     $currentUserModel = Users_Record_Model::getCurrentUserModel();
     $moduleName = $moduleModel->getName();
     $recordId = $recordModel->getId();
     $detailViewLinks = [];
     $adb = PearDatabase::getInstance();
     vimport('~~modules/com_vtiger_workflow/include.inc');
     vimport('~~modules/com_vtiger_workflow/VTEntityMethodManager.inc');
     $wfs = new VTWorkflowManager($adb);
     $workflows = $wfs->getWorkflowsForModule($moduleName, VTWorkflowManager::$TRIGGER);
     if (Users_Privileges_Model::isPermitted($moduleName, 'WorkflowTrigger') && count($workflows) > 0) {
         $detailViewLinks[] = array('linktype' => 'DETAILVIEWBASIC', 'linklabel' => '', 'linkurl' => 'Vtiger_Detail_Js.showWorkflowTriggerView(this)', 'linkicon' => 'glyphicon glyphicon-plus-sign', 'linkhint' => 'BTN_WORKFLOW_TRIGGER');
     }
     $lockEdit = Users_Privileges_Model::checkLockEdit($moduleName, $recordId);
     $currentUserPriviligesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
     if (Users_Privileges_Model::isPermitted($moduleName, 'EditView', $recordId) && !$lockEdit) {
         $detailViewLinks[] = array('linktype' => 'DETAILVIEWBASIC', 'linklabel' => '', 'linkurl' => $recordModel->getEditViewUrl(), 'linkicon' => 'glyphicon glyphicon-pencil', 'linkclass' => 'btn', 'linkhint' => 'BTN_RECORD_EDIT');
     }
     foreach ($detailViewLinks as $detailViewLink) {
         $linkModelList['DETAILVIEWBASIC'][] = Vtiger_Link_Model::getInstanceFromValues($detailViewLink);
     }
     $linkModelListDetails = Vtiger_Link_Model::getAllByType($moduleModel->getId(), $linkTypes, $linkParams);
     //Mark all detail view basic links as detail view links.
     //Since ui will be look ugly if you need many basic links
     $detailViewBasiclinks = $linkModelListDetails['DETAILVIEWBASIC'];
     unset($linkModelListDetails['DETAILVIEWBASIC']);
     if (Users_Privileges_Model::isPermitted($moduleName, 'Delete', $recordId) && $recordPermissionToEditView) {
         $deletelinkModel = array('linktype' => 'DETAILVIEW', 'linklabel' => sprintf("%s %s", getTranslatedString('LBL_DELETE', $moduleName), vtranslate('SINGLE_' . $moduleName, $moduleName)), 'linkurl' => 'javascript:Vtiger_Detail_Js.deleteRecord("' . $recordModel->getDeleteUrl() . '")', 'linkicon' => 'glyphicon glyphicon-trash', 'title' => vtranslate('LBL_DELETE_RECORD'));
         $linkModelList['DETAILVIEW'][] = Vtiger_Link_Model::getInstanceFromValues($deletelinkModel);
     }
     if (Users_Privileges_Model::isPermitted($moduleName, 'DuplicateRecord')) {
         $duplicateLinkModel = array('linktype' => 'DETAILVIEWBASIC', 'linklabel' => 'LBL_DUPLICATE', 'linkurl' => $recordModel->getDuplicateRecordUrl(), 'linkicon' => 'glyphicon glyphicon-retweet', 'title' => vtranslate('LBL_DUPLICATE_RECORD'));
         $linkModelList['DETAILVIEW'][] = Vtiger_Link_Model::getInstanceFromValues($duplicateLinkModel);
     }
     if (!empty($detailViewBasiclinks)) {
         foreach ($detailViewBasiclinks as $linkModel) {
             // Remove view history, needed in vtiger5 to see history but not in vtiger6
             if ($linkModel->linklabel == 'View History') {
                 continue;
             }
             $linkModelList['DETAILVIEW'][] = $linkModel;
         }
     }
     $relatedLinks = $this->getDetailViewRelatedLinks();
     foreach ($relatedLinks as $relatedLinkEntry) {
         $relatedLink = Vtiger_Link_Model::getInstanceFromValues($relatedLinkEntry);
         $linkModelList[$relatedLink->getType()][] = $relatedLink;
     }
     if ($currentUserModel->isAdminUser()) {
         $settingsLinks = $moduleModel->getSettingLinks();
         foreach ($settingsLinks as $settingsLink) {
             $linkModelList['DETAILVIEWSETTING'][] = Vtiger_Link_Model::getInstanceFromValues($settingsLink);
         }
     }
     return $linkModelList;
 }
开发者ID:noclav,项目名称:UpdatePackages,代码行数:66,代码来源:DetailView.php


示例7: vtWorkflowSave

function vtWorkflowSave($adb, $request)
{
    $util = new VTWorkflowUtils();
    $module = new VTWorkflowApplication("saveworkflow");
    $mod = return_module_language($current_language, $module->name);
    $request = vtlib_purify($request);
    // this cleans all values of the array
    if (!$util->checkAdminAccess()) {
        $errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NOT_ADMIN']);
        $util->redirectTo($errorUrl, $mod['LBL_ERROR_NOT_ADMIN']);
        return;
    }
    $description = from_html($request["description"]);
    $moduleName = $request["module_name"];
    $conditions = $request["conditions"];
    $taskId = $request["task_id"];
    $saveType = $request["save_type"];
    $executionCondition = $request['execution_condition'];
    $wm = new VTWorkflowManager($adb);
    if ($saveType == 'new') {
        $wf = $wm->newWorkflow($moduleName);
        $wf->description = $description;
        $wf->test = $conditions;
        $wf->taskId = $taskId;
        $wf->executionConditionAsLabel($executionCondition);
        $wm->save($wf);
    } else {
        if ($saveType == 'edit') {
            $wf = $wm->retrieve($request["workflow_id"]);
            $wf->description = $description;
            $wf->test = $conditions;
            $wf->taskId = $taskId;
            $wf->executionConditionAsLabel($executionCondition);
            $wm->save($wf);
        } else {
            throw new Exception();
        }
    }
    if (isset($request["return_url"])) {
        $returnUrl = $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:mslokhat,项目名称:corebos,代码行数:56,代码来源:saveworkflow.php


示例8: 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


示例9: 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


示例10: 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


示例11: execute

 public function execute($moduleName, $record, $ids)
 {
     vimport('~~modules/com_vtiger_workflow/VTEntityCache.inc');
     vimport('~~modules/com_vtiger_workflow/include.inc');
     vimport('~~include/Webservices/Utils.php');
     vimport('~~include/Webservices/Retrieve.php');
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $wsId = vtws_getWebserviceEntityId($moduleName, $record);
     $adb = PearDatabase::getInstance();
     $wfs = new VTWorkflowManager($adb);
     $entityCache = new VTEntityCache($currentUser);
     $entityData = $entityCache->forId($wsId);
     foreach ($ids as $id) {
         $workflow = $wfs->retrieve($id);
         if ($workflow->evaluate($entityCache, $entityData->getId())) {
             $workflow->performTasks($entityData);
         }
     }
 }
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:19,代码来源:WorkflowTrigger.php


示例12: 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


示例13: 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


示例14: unlink

    if (file_exists($unWanted[$i])) {
        unlink($unWanted[$i]);
    }
}
// Ticket #2629
global $adb;
$query = 'SELECT tabid FROM vtiger_tab where name = ?';
$result = $adb->pquery($query, array('Accounts'));
$tabId = $adb->query_result($result, 0, 'tabid');
Migration_Index_View::ExecuteQuery('UPDATE vtiger_relatedlists SET name=? WHERE tabid=? AND label=?', array('get_dependents_list', $tabId, 'Act'));
Migration_Index_View::ExecuteQuery('UPDATE vtiger_relatedlists SET name=? WHERE tabid=? AND label=?', array('get_dependents_list', $tabId, 'Consignment'));
// Begin Ticket #2601 Creating Workflow for Updating Inventory Stock for Invoice
$checkQuery = "SELECT * FROM com_vtiger_workflows WHERE module_name = ? AND summary = ?";
$result = $adb->pquery($checkQuery, array('Invoice', 'UpdateInventoryProducts On Every Save'));
if ($adb->num_rows($result) < 1) {
    $vtWorkFlow = new VTWorkflowManager($adb);
    $invWorkFlow = $vtWorkFlow->newWorkFlow("Invoice");
    $invWorkFlow->test = '[{"fieldname":"subject","operation":"does not contain","value":"`!`"}]';
    $invWorkFlow->description = "UpdateInventoryProducts On Every Save";
    $invWorkFlow->defaultworkflow = 1;
    $vtWorkFlow->save($invWorkFlow);
}
// Begin Ticket #2668
$query = 'SELECT blockid FROM vtiger_settings_blocks WHERE label = ?';
$result = $adb->pquery($query, array('LBL_INTEGRATION'));
$blockId = $adb->query_result($result, 0, 'blockid');
Migration_Index_View::ExecuteQuery('UPDATE vtiger_settings_field SET blockid = ? WHERE name = ? OR name = ?', array($blockId, 'LBL_CML_SETTINGS', 'LBL_SOCIALCONNECTOR_SETTINGS'));
// Begin Ticket #2789
$query = 'SELECT tabid FROM vtiger_tab where name = ?';
$result = $adb->pquery($query, array('PBXManager'));
$tabId = $adb->query_result($result, 0, 'tabid');
开发者ID:Wasage,项目名称:werpa,代码行数:31,代码来源:610-201412_to_620-201505.php


示例15: vtTaskEdit

function vtTaskEdit($adb, $request, $current_language, $app_strings)
{
    global $theme;
    $util = new VTWorkflowUtils();
    $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"]);
        $workflowId = $task->workflowId;
    } else {
        $workflowId = $request["workflow_id"];
        $taskClass = $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']);
    $taskClass = get_class($task);
    $smarty->assign("taskTemplate", "{$module->name}/taskforms/{$taskClass}.tpl");
    $et = VTWSEntityType::usingGlobalCurrentUser($workflow->moduleName);
    $smarty->assign("entityType", $et);
    $smarty->assign('entityName', $workflow->moduleName);
    $smarty->assign("fieldNames", $et->getFieldNames());
    $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']));
    }
    $curr_date = "(general : (__VtigerMeta__) date)";
    $curr_time = '(general : (__VtigerMeta__) time)';
    $smarty->assign("DATE", $curr_date);
    $smarty->assign("TIME", $curr_time);
    $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']);
    $smarty->assign("module", $module);
    $smarty->display("{$module->name}/EditTask.tpl");
}
开发者ID:hardikk,项目名称:HNH,代码行数:81,代码来源:edittask.php


示例16: addWorkflow

 public function addWorkflow()
 {
     global $log, $adb;
     $workflow = array();
     $result = $adb->query("SELECT * FROM `com_vtiger_workflows` WHERE summary = 'Update Closed Time';");
     if ($adb->num_rows($result) == 0) {
         $workflow[] = array(54, 'HelpDesk', 'Update Closed Time', '[{"fieldname":"ticketstatus","operation":"is","value":"Rejected","valuetype":"rawtext","joincondition":"or","groupjoin":null,"groupid":"1"},{"fieldname":"ticketstatus","operation":"is","value":"Closed","valuetype":"rawtext","joincondition":"","groupjoin":null,"groupid":"1"}]', 2, NULL, 'basic', 6, NULL, NULL, NULL, NULL, NULL, NULL);
     }
     $result = $adb->query("SELECT * FROM `com_vtiger_workflows` WHERE summary = 'Generate mail address book';");
     if ($adb->num_rows($result) == 0) {
         $workflow[] = array(55, 'Contacts', 'Generate mail address book', '[]', 3, NULL, 'basic', 6, NULL, NULL, NULL, NULL, NULL, NULL);
     }
     $workflowTask = array();
     $workflowTask[] = array(121, 54, 'Update Closed Time', 'O:18:"VTUpdateClosedTime":6:{s:18:"executeImmediately";b:1;s:10:"workflowId";s:2:"54";s:7:"summary";s:18:"Update Closed Time";s:6:"active";b:1;s:7:"trigger";N;s:2:"id";i:121;}');
     $workflowTask[] = array(123, 55, 'Generate mail address book', 'O:17:"VTAddressBookTask":7:{s:18:"executeImmediately";b:0;s:10:"workflowId";s:2:"55";s:7:"summary";s:26:"Generate mail address book";s:6:"active";b:1;s:7:"trigger";N;s:4:"test";s:0:"";s:2:"id";i:123;}');
     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';
     $workflowManager = new VTWorkflowManager($adb);
     $taskManager = new VTTaskManager($adb);
     foreach ($workflow as $record) {
         $newWorkflow = $workflowManager->newWorkFlow($record[1]);
         $newWorkflow->description = $record[2];
         $newWorkflow->test = $record[3];
         $newWorkflow->executionCondition = $record[4];
         $newWorkflow->defaultworkflow = $record[5];
         $newWorkflow->type = $record[6];
         $newWorkflow->filtersavedinnew = $record[7];
         $workflowManager->save($newWorkflow);
         foreach ($workflowTask as $indexTask) {
             if ($indexTask[1] == $record[0]) {
                 $task = $taskManager->unserializeTask($indexTask[3]);
                 $task->id = '';
                 $task->workflowId = $newWorkflow->id;
                 $taskManager->saveTask($task);
             }
         }
     }
 }
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:39,代码来源:init.php


示例17: deleteRecord

 /**
  * Function to delete a given record model of the current module
  * @param Vtiger_Record_Model $recordModel
  */
 public function deleteRecord($recordModel)
 {
     $moduleName = $this->get('name');
     $focus = CRMEntity::getInstance($moduleName);
     $focus->trash($moduleName, $recordModel->getId());
     if (method_exists($focus, 'transferRelatedRecords')) {
         if ($recordModel->get('transferRecordIDs')) {
             $focus->transferRelatedRecords($moduleName, $recordModel->get('transferRecordIDs'), $recordModel->getId());
         }
     }
     vimport('~~modules/com_vtiger_workflow/include.inc');
     vimport('~~modules/com_vtiger_workflow/VTEntityMethodManager.inc');
     $wfs = new VTWorkflowManager(PearDatabase::getInstance());
     $workflows = $wfs->getWorkflowsForModule($moduleName, VTWorkflowManager::$ON_DELETE);
     if (count($workflows)) {
         $wsId = vtws_getWebserviceEntityId($moduleName, $recordModel->getId());
         $entityCache = new VTEntityCache(Users_Record_Model::getCurrentUserModel());
         $entityData = $entityCache->forId($wsId);
         foreach ($workflows as $id => $workflow) {
             if ($workflow->evaluate($entityCache, $entityData->getId())) {
                 $workflow->performTasks($entityData);
             }
         }
     }
 }
开发者ID:noclav,项目名称:UpdatePackages,代码行数:29,代码来源:Module.php


示例18: get_dependents_list

 /**
  * Default (generic) function to handle the dependents list for the module.
  * NOTE: UI type '10' is used to stored the references to other modules for a given record.
  * These dependent records can be retrieved through this function.
  * For eg: A trouble ticket can be related to an Account or a Contact.
  * From a given Contact/Account if we need to fetch all such dependent trouble tickets, get_dependents_list function can be used.
  */
 function get_dependents_list($id, $cur_tab_id, $rel_tab_id, $actions = false)
 {
     global $currentModule, $app_strings, $singlepane_view, $current_user, $adb;
     $parenttab = getParentTab();
     $related_module = vtlib_getModuleNameById($rel_tab_id);
     $other = CRMEntity::getInstance($related_module);
     // Some standard module class doesn't have required variables
     // that are used in the query, they are defined in this generic API
     vtlib_setup_modulevars($currentModule, $this);
     vtlib_setup_modulevars($related_module, $other);
     $singular_modname = 'SINGLE_' . $related_module;
     $button = '';
     // To make the edit or del link actions to return back to same 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP VTWorkflowUtils类代码示例发布时间:2022-05-23
下一篇:
PHP VTWS_PreserveGlobal类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap