本文整理汇总了PHP中VTTaskManager::saveTask方法的典型用法代码示例。如果您正苦于以下问题:PHP VTTaskManager::saveTask方法的具体用法?PHP VTTaskManager::saveTask怎么用?PHP VTTaskManager::saveTask使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VTTaskManager
的用法示例。
在下文中一共展示了VTTaskManager::saveTask方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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
}
示例2: 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();
}
示例3: 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();
}
示例4: 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);
}
}
}
}
示例5: 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'));
// echo "<br> added print to vtiger_actionnmapping";
// $module = Vtiger_Module_Model::getInstance('Reports');
// $module->enableTools(Array('Print', 'Export'));
// echo "<br> enabled Print and export";
ExecuteQuery('DELETE FROM vtiger_actionmapping WHERE actionname=? and securitycheck=0', array('Print'));
//Migration_Index_View::ExecuteQuery("UPDATE vtiger_field SET quickcreate = ? WHERE tabid = 8 AND (fieldname = ? OR fieldname = ?);", array(0,"filename","filelocationtype"));
//Making document module fields NON masseditable
ExecuteQuery("UPDATE vtiger_field SET masseditable = ? WHERE tabid = 8 AND fieldname = ?", array(0, "notes_title"));
ExecuteQuery("UPDATE vtiger_field SET masseditable = ? WHERE tabid = 8 AND fieldname = ?", array(0, "assigned_user_id"));
ExecuteQuery("UPDATE vtiger_field SET masseditable = ? WHERE tabid = 8 AND fieldname = ?", array(0, "notecontent"));
ExecuteQuery("UPDATE vtiger_field SET masseditable = ? WHERE tabid = 8 AND fieldname = ?", array(0, "fileversion"));
示例6: 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";
$invWorkFlow->defaultworkflow = 1;
$vtWorkFlow->save($invWorkFlow);
$tm = new VTTaskManager($adb);
$task = $tm->createTask('VTEntityMethodTask', $invWorkFlow->id);
$task->active = true;
$task->methodName = "UpdateInventory";
$tm->saveTask($task);
// Creating Workflow for Accounts when Notifyowner is true
$vtaWorkFlow = new VTWorkflowManager($adb);
$accWorkFlow = $vtaWorkFlow->newWorkFlow("Accounts");
$accWorkFlow->test = '[{"fieldname":"notify_owner","operation":"is","value":"true:boolean"}]';
$accWorkFlow->description = "Send Email to user when Notifyowner is True";
$accWorkFlow->executionCondition = 2;
$accWorkFlow->defaultworkflow = 1;
$vtaWorkFlow->save($accWorkFlow);
$id1 = $accWorkFlow->id;
$tm = new VTTaskManager($adb);
$task = $tm->createTask('VTEmailTask', $accWorkFlow->id);
$task->active = true;
$task->methodName = "NotifyOwner";
$task->recepient = "\$(assigned_user_id : (Users) email1)";
$task->subject = "Regarding Account Creation";
$task->content = "An Account has been assigned to you on vtigerCRM<br>Details of account are :<br><br>" . "AccountId:" . '<b>$account_no</b><br>' . "AccountName:" . '<b>$accountname</b><br>' . "Rating:" . '<b>$rating</b><br>' . "Industry:" . '<b>$industry</b><br>' . "AccountType:" . '<b>$accounttype</b><br>' . "Description:" . '<b>$description</b><br><br><br>' . "Thank You<br>Admin";
$task->summary = "An account has been created ";
$tm->saveTask($task);
$adb->pquery("update com_vtiger_workflows set defaultworkflow=? where workflow_id=?", array(1, $id1));
// Creating Workflow for Contacts when Notifyowner is true
$vtcWorkFlow = new VTWorkflowManager($adb);
$conWorkFlow = $vtcWorkFlow->newWorkFlow("Contacts");
$conWorkFlow->summary = "A contact has been created ";
$conWorkFlow->executionCondition = 2;
$conWorkFlow->test = '[{"fieldname":"notify_owner","operation":"is","value":"true:boolean"}]';
$conWorkFlow->description = "Send Email to user when Notifyowner is True";
$conWorkFlow->defaultworkflow = 1;
$vtcWorkFlow->save($conWorkFlow);
$id1 = $conWorkFlow->id;
$tm = new VTTaskManager($adb);
$task = $tm->createTask('VTEmailTask', $conWorkFlow->id);
$task->active = true;
$task->methodName = "NotifyOwner";
$task->recepient = "\$(assigned_user_id : (Users) email1)";
$task->subject = "Regarding Contact Creation";
$task->content = "An Contact has been assigned to you on vtigerCRM<br>Details of Contact are :<br><br>" . "Contact Id:" . '<b>$contact_no</b><br>' . "LastName:" . '<b>$lastname</b><br>' . "FirstName:" . '<b>$firstname</b><br>' . "Lead Source:" . '<b>$leadsource</b><br>' . "Department:" . '<b>$department</b><br>' . "Description:" . '<b>$description</b><br><br><br>' . "Thank You<br>Admin";
$task->summary = "An contact has been created ";
$tm->saveTask($task);
$adb->pquery("update com_vtiger_workflows set defaultworkflow=? where workflow_id=?", array(1, $id1));
// Creating Workflow for Contacts when PortalUser is true
$vtcWorkFlow = new VTWorkflowManager($adb);
$conpuWorkFlow = $vtcWorkFlow->newWorkFlow("Contacts");
$conpuWorkFlow->test = '[{"fieldname":"portal","operation":"is","value":"true:boolean"}]';
$conpuWorkFlow->description = "Send Email to user when Portal User is True";
$conpuWorkFlow->executionCondition = 2;
$conpuWorkFlow->defaultworkflow = 1;
$vtcWorkFlow->save($conpuWorkFlow);
$id1 = $conpuWorkFlow->id;
$tm = new VTTaskManager($adb);
$task = $tm->createTask('VTEmailTask', $conpuWorkFlow->id);
$task->active = true;
$task->methodName = "NotifyOwner";
$task->recepient = "\$(assigned_user_id : (Users) email1)";
$task->subject = "Regarding Contact Assignment";
$task->content = "An Contact has been assigned to you on vtigerCRM<br>Details of Contact are :<br><br>" . "Contact Id:" . '<b>$contact_no</b><br>' . "LastName:" . '<b>$lastname</b><br>' . "FirstName:" . '<b>$firstname</b><br>' . "Lead Source:" . '<b>$leadsource</b><br>' . "Department:" . '<b>$department</b><br>' . "Description:" . '<b>$description</b><br><br><br>' . "And <b>CustomerPortal Login Details</b> is sent to the " . "EmailID :-" . '$email<br>' . "<br>Thank You<br>Admin";
$task->summary = "An contact has been created ";
$tm->saveTask($task);
$adb->pquery("update com_vtiger_workflows set defaultworkflow=? where workflow_id=?", array(1, $id1));
// Creating Workflow for Potentials
$vtcWorkFlow = new VTWorkflowManager($adb);
$potentialWorkFlow = $vtcWorkFlow->newWorkFlow("Potentials");
$potentialWorkFlow->description = "Send Email to users on Potential creation";
$potentialWorkFlow->executionCondition = 1;
$potentialWorkFlow->defaultworkflow = 1;
$vtcWorkFlow->save($potentialWorkFlow);
$id1 = $potentialWorkFlow->id;
$tm = new VTTaskManager($adb);
$task = $tm->createTask('VTEmailTask', $potentialWorkFlow->id);
$task->active = true;
$task->recepient = "\$(assigned_user_id : (Users) email1)";
$task->subject = "Regarding Potential Assignment";
$task->content = "An Potential has been assigned to you on vtigerCRM<br>Details of Potential are :<br><br>" . "Potential No:" . '<b>$potential_no</b><br>' . "Potential Name:" . '<b>$potentialname</b><br>' . "Amount:" . '<b>$amount</b><br>' . "Expected Close Date:" . '<b>$closingdate</b><br>' . "Type:" . '<b>$opportunity_type</b><br><br><br>' . "Description :" . '$description<br>' . "<br>Thank You<br>Admin";
$task->summary = "An Potential has been created ";
$tm->saveTask($task);
$workflowManager = new VTWorkflowManager($adb);
$taskManager = new VTTaskManager($adb);
// Contact workflow on creation/modification
$contactWorkFlow = $workflowManager->newWorkFlow("Contacts");
$contactWorkFlow->test = '';
$contactWorkFlow->description = "Workflow for Contact Creation or Modification";
$contactWorkFlow->executionCondition = VTWorkflowManager::$ON_EVERY_SAVE;
$contactWorkFlow->defaultworkflow = 1;
$workflowManager->save($contactWorkFlow);
//.........这里部分代码省略.........
示例7: array
$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;");
/* To store the field to module relationship for uitype 10 */
ExecuteQuery("CREATE TABLE IF NOT EXISTS vtiger_fieldmodulerel (fieldid int(11) NOT NULL, module varchar(100) NOT NULL, relmodule varchar(100) NOT NULL,\n \t\t\t\t\tstatus varchar(10) default NULL, sequence int(11) default NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8;");
/* Making users and groups depends on vtiger_users_seq */
$max_grp_id = $adb->query("SELECT MAX(groupid) as maxid from vtiger_groups");
示例8: 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";
//added column defaultworkflow
//For default workflows it sets column defaultworkflow=true
$column_name = "defaultworkflow";
$adb->pquery("alter table com_vtiger_workflows add column {$column_name} int(1)", array());
// Creating Workflow for Accounts when Notifyowner is true
$vtaWorkFlow = new VTWorkflowManager($adb);
$accWorkFlow = $vtaWorkFlow->newWorkFlow("Accounts");
$accWorkFlow->test = '[{"fieldname":"notify_owner","operation":"is","value":"true:boolean"}]';
$accWorkFlow->description = "Send Email to user when Notifyowner is True";
$accWorkFlow->executionCondition = 2;
$vtaWorkFlow->save($accWorkFlow);
$id1 = $accWorkFlow->id;
$tm = new VTTaskManager($adb);
$task = $tm->createTask('VTEmailTask', $accWorkFlow->id);
$task->active = true;
$task->methodName = "NotifyOwner";
$task->recepient = "\$(assigned_user_id : (Users) email1)";
$task->subject = "Regarding Account Creation";
$task->content = "An Account has been assigned to you on vtigerCRM<br>Details of account are :<br><br>" . "AccountId:" . '<b>$account_no</b><br>' . "AccountName:" . '<b>$accountname</b><br>' . "Rating:" . '<b>$rating</b><br>' . "Industry:" . '<b>$industry</b><br>' . "AccountType:" . '<b>$accounttype</b><br>' . "Description:" . '<b>$description</b><br><br><br>' . "Thank You<br>Admin";
$task->summary = "An account has been created ";
$tm->saveTask($task);
$adb->pquery("update com_vtiger_workflows set defaultworkflow=? where workflow_id=?", array(1, $id1));
// Creating Workflow for Contacts when Notifyowner is true
$vtcWorkFlow = new VTWorkflowManager($adb);
$conWorkFlow = $vtcWorkFlow->newWorkFlow("Contacts");
$conWorkFlow->summary = "Test accounut";
$conWorkFlow->executionCondition = 2;
$conWorkFlow->test = '[{"fieldname":"notify_owner","operation":"is","value":"true:boolean"}]';
$conWorkFlow->description = "Send Email to user when Notifyowner is True";
$vtcWorkFlow->save($conWorkFlow);
$id1 = $conWorkFlow->id;
$tm = new VTTaskManager($adb);
$task = $tm->createTask('VTEmailTask', $conWorkFlow->id);
$task->active = true;
$task->methodName = "NotifyOwner";
$task->recepient = "\$(assigned_user_id : (Users) email1)";
$task->subject = "Regarding Contact Creation";
$task->content = "An Contact has been assigned to you on vtigerCRM<br>Details of Contact are :<br><br>" . "Contact Id:" . '<b>$contact_no</b><br>' . "LastName:" . '<b>$lastname</b><br>' . "FirstName:" . '<b>$firstname</b><br>' . "Lead Source:" . '<b>$leadsource</b><br>' . "Department:" . '<b>$department</b><br>' . "Description:" . '<b>$description</b><br><br><br>' . "Thank You<br>Admin";
$task->summary = "An contact has been created ";
$tm->saveTask($task);
$adb->pquery("update com_vtiger_workflows set defaultworkflow=? where workflow_id=?", array(1, $id1));
// Creating Workflow for Contacts when PortalUser is true
$vtcWorkFlow = new VTWorkflowManager($adb);
$conpuWorkFlow = $vtcWorkFlow->newWorkFlow("Contacts");
$conpuWorkFlow->test = '[{"fieldname":"portal","operation":"is","value":"true:boolean"}]';
$conpuWorkFlow->description = "Send Email to user when Portal User is True";
$conpuWorkFlow->executionCondition = 2;
$vtcWorkFlow->save($conpuWorkFlow);
$id1 = $conpuWorkFlow->id;
$tm = new VTTaskManager($adb);
$task = $tm->createTask('VTEmailTask', $conpuWorkFlow->id);
$task->active = true;
$task->methodName = "NotifyOwner";
$task->recepient = "\$(assigned_user_id : (Users) email1)";
$task->subject = "Regarding Contact Assignment";
$task->content = "An Contact has been assigned to you on vtigerCRM<br>Details of Contact are :<br><br>" . "Contact Id:" . '<b>$contact_no</b><br>' . "LastName:" . '<b>$lastname</b><br>' . "FirstName:" . '<b>$firstname</b><br>' . "Lead Source:" . '<b>$leadsource</b><br>' . "Department:" . '<b>$department</b><br>' . "Description:" . '<b>$description</b><br><br><br>' . "And <b>CustomerPortal Login Details</b> is sent to the " . "EmailID :-" . '$email<br>' . "<br>Thank You<br>Admin";
$task->summary = "An contact has been created ";
$tm->saveTask($task);
$adb->pquery("update com_vtiger_workflows set defaultworkflow=? where workflow_id=?", array(1, $id1));
// Creating Workflow for Potentials
$vtcWorkFlow = new VTWorkflowManager($adb);
$potentialWorkFlow = $vtcWorkFlow->newWorkFlow("Potentials");
$potentialWorkFlow->description = "Send Email to user on Potential creation";
$potentialWorkFlow->executionCondition = 1;
$vtcWorkFlow->save($potentialWorkFlow);
$id1 = $potentialWorkFlow->id;
$tm = new VTTaskManager($adb);
$task = $tm->createTask('VTEmailTask', $potentialWorkFlow->id);
$task->active = true;
$task->recepient = "\$(assigned_user_id : (Users) email1)";
$task->subject = "Regarding Potential Assignment";
$task->content = "An Potential has been assigned to you on vtigerCRM<br>Details of Potential are :<br><br>" . "Potential No:" . '<b>$potential_no</b><br>' . "Potential Name:" . '<b>$potentialname</b><br>' . "Amount:" . '<b>$amount</b><br>' . "Expected Close Date:" . '<b>$closingdate</b><br>' . "Type:" . '<b>$opportunity_type</b><br><br><br>' . "Description :" . '$description<br>' . "<br>Thank You<br>Admin";
$task->summary = "An Potential has been created ";
$tm->saveTask($task);
$adb->pquery("update com_vtiger_workflows set defaultworkflow=? where workflow_id=?", array(1, $id1));
}
示例9: 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);
// Creating Workflow for Accounts when Notifyowner is true
$vtaWorkFlow = new VTWorkflowManager($adb);
$accWorkFlow = $vtaWorkFlow->newWorkFlow("Accounts");
$accWorkFlow->test = '[{"fieldname":"notify_owner","operation":"is","value":"true:boolean"}]';
$accWorkFlow->description = "Send Email to user when Notifyowner is True";
$accWorkFlow->executionCondition = 2;
$vtaWorkFlow->save($accWorkFlow);
$id1 = $accWorkFlow->id;
$tm = new VTTaskManager($adb);
$task = $tm->createTask('VTEmailTask', $accWorkFlow->id);
$task->active = true;
$task->methodName = "NotifyOwner";
$task->recepient = "\$(assigned_user_id : (Users) email1)";
$task->subject = "Regarding Account Creation";
// JFV - add Japanese localization to email notification
$task->subject = "顧客企業が作成されました / " . $task->subject;
// JFV END
$task->content = "An Account has been assigned to you on vtigerCRM<br>Details of account are :<br><br>" . "AccountId:" . '<b>$account_no</b><br>' . "AccountName:" . '<b>$accountname</b><br>' . "Rating:" . '<b>$rating</b><br>' . "Industry:" . '<b>$industry</b><br>' . "AccountType:" . '<b>$accounttype</b><br>' . "Description:" . '<b>$description</b><br><br><br>' . "Thank You<br>Admin";
// JFV - add Japanese localization to email notification
$task->content = "vtigerCRM にて顧客企業があなたに割り当てられました。<br>顧客企業の詳細は次のとおりです:<br><br>" . "顧客企業 No:" . '<b>$account_no</b><br>' . "顧客企業名:" . '<b>$accountname</b><br>' . "各付け:" . '<b>$rating</b><br>' . "業界:" . '<b>$industry</b><br>' . "タイプ:" . '<b>$accounttype</b><br>' . "詳細:" . '<b>$description</b><br><br><br>' . "宜しくお願いします<br>管理者" . "<br><br>---------------<br>" . $task->content;
// JFV END
$task->summary = "An account has been created ";
$tm->saveTask($task);
$adb->pquery("update com_vtiger_workflows set defaultworkflow=? where workflow_id=?", array(1, $id1));
// Creating Workflow for Contacts when Notifyowner is true
$vtcWorkFlow = new VTWorkflowManager($adb);
$conWorkFlow = $vtcWorkFlow->newWorkFlow("Contacts");
$conWorkFlow->summary = "A contact has been created ";
$conWorkFlow->executionCondition = 2;
$conWorkFlow->test = '[{"fieldname":"notify_owner","operation":"is","value":"true:boolean"}]';
$conWorkFlow->description = "Send Email to user when Notifyowner is True";
$vtcWorkFlow->save($conWorkFlow);
$id1 = $conWorkFlow->id;
$tm = new VTTaskManager($adb);
$task = $tm->createTask('VTEmailTask', $conWorkFlow->id);
$task->active = true;
$task->methodName = "NotifyOwner";
$task->recepient = "\$(assigned_user_id : (Users) email1)";
$task->subject = "Regarding Contact Creation";
// JFV - add Japanese localization to email notification
$task->subject = "顧客担当者が作成されました / " . $task->subject;
// JFV END
$task->content = "An Contact has been assigned to you on vtigerCRM<br>Details of Contact are :<br><br>" . "Contact Id:" . '<b>$contact_no</b><br>' . "LastName:" . '<b>$lastname</b><br>' . "FirstName:" . '<b>$firstname</b><br>' . "Lead Source:" . '<b>$leadsource</b><br>' . "Department:" . '<b>$department</b><br>' . "Description:" . '<b>$description</b><br><br><br>' . "Thank You<br>Admin";
// JFV - add Japanese localization to email notification
$task->content = "vtigerCRM にて顧客担当者があなたに割り当てられました。<br>詳細は次のとおりです:<br><br>" . "顧客担当者 ID:" . '<b>$contact_no</b><br>' . "姓:" . '<b>$lastname</b><br>' . "名:" . '<b>$firstname</b><br>' . "紹介元:" . '<b>$leadsource</b><br>' . "部門:" . '<b>$department</b><br>' . "詳細:" . '<b>$description</b><br><br><br>' . "宜しくお願いします<br>管理者" . "<br><br>---------------<br>" . $task->content;
// JFV END
$task->summary = "An contact has been created ";
$tm->saveTask($task);
$adb->pquery("update com_vtiger_workflows set defaultworkflow=? where workflow_id=?", array(1, $id1));
// Creating Workflow for Contacts when PortalUser is true
$vtcWorkFlow = new VTWorkflowManager($adb);
$conpuWorkFlow = $vtcWorkFlow->newWorkFlow("Contacts");
$conpuWorkFlow->test = '[{"fieldname":"portal","operation":"is","value":"true:boolean"}]';
$conpuWorkFlow->description = "Send Email to user when Portal User is True";
$conpuWorkFlow->executionCondition = 2;
$vtcWorkFlow->save($conpuWorkFlow);
$id1 = $conpuWorkFlow->id;
$tm = new VTTaskManager($adb);
$task = $tm->createTask('VTEmailTask', $conpuWorkFlow->id);
$task->active = true;
$task->methodName = "NotifyOwner";
$task->recepient = "\$(assigned_user_id : (Users) email1)";
$task->subject = "Regarding Contact Assignment";
// JFV - add Japanese localization to email notification
$task->subject = "顧客担当者が割り当てられました / " . $task->subject;
// JFV END
$task->content = "An Contact has been assigned to you on vtigerCRM<br>Details of Contact are :<br><br>" . "Contact Id:" . '<b>$contact_no</b><br>' . "LastName:" . '<b>$lastname</b><br>' . "FirstName:" . '<b>$firstname</b><br>' . "Lead Source:" . '<b>$leadsource</b><br>' . "Department:" . '<b>$department</b><br>' . "Description:" . '<b>$description</b><br><br><br>' . "And <b>CustomerPortal Login Details</b> is sent to the " . "EmailID :-" . '$email<br>' . "<br>Thank You<br>Admin";
// JFV - add Japanese localization to email notification
$task->content = "vtigerCRM にて顧客担当者があなたに割り当てられました。<br>詳細は次のとおりです<br><br>" . "顧客担当者 ID:" . '<b>$contact_no</b><br>' . "姓:" . '<b>$lastname</b><br>' . "名:" . '<b>$firstname</b><br>' . "紹介元:" . '<b>$leadsource</b><br>' . "部門:" . '<b>$department</b><br>' . "詳細:" . '<b>$description</b><br><br><br>' . "また、<b>顧客ポータルのログインの詳細は</b>、次に送信しました:" . "電子メール :-" . '$email<br>' . "<br>宜しくお願いします<br>管理者" . "<br><br>---------------<br>" . $task->content;
// JFV END
$task->summary = "An contact has been created ";
$tm->saveTask($task);
$adb->pquery("update com_vtiger_workflows set defaultworkflow=? where workflow_id=?", array(1, $id1));
// Creating Workflow for Potentials
$vtcWorkFlow = new VTWorkflowManager($adb);
$potentialWorkFlow = $vtcWorkFlow->newWorkFlow("Potentials");
$potentialWorkFlow->description = "Send Email to users on Potential creation";
$potentialWorkFlow->executionCondition = 1;
$vtcWorkFlow->save($potentialWorkFlow);
$id1 = $potentialWorkFlow->id;
$tm = new VTTaskManager($adb);
$task = $tm->createTask('VTEmailTask', $potentialWorkFlow->id);
$task->active = true;
$task->recepient = "\$(assigned_user_id : (Users) email1)";
//.........这里部分代码省略.........
示例10: addWorkflow
private function addWorkflow($moduleName)
{
vimport('~~modules/com_vtiger_workflow/include.inc');
vimport('~~modules/com_vtiger_workflow/tasks/VTEntityMethodTask.inc');
vimport('~~modules/com_vtiger_workflow/VTEntityMethodManager.inc');
$db = PearDatabase::getInstance();
$functionName = 'UpdateBalance';
$emm = new VTEntityMethodManager($db);
$emm->addEntityMethod($moduleName, $functionName, "modules/PaymentsIn/workflow/UpdateBalance.php", $functionName);
$workflowManager = new VTWorkflowManager($db);
$taskManager = new VTTaskManager($db);
$newWorkflow = $workflowManager->newWorkFlow($moduleName);
$newWorkflow->test = '[]';
$newWorkflow->defaultworkflow = 0;
$newWorkflow->description = "{$moduleName} - UpdateBalance";
$newWorkflow->executionCondition = 3;
$workflowManager->save($newWorkflow);
$task = $taskManager->createTask('VTEntityMethodTask', $newWorkflow->id);
$task->active = true;
$task->summary = 'UpdateBalance';
$task->methodName = $functionName;
$taskManager->saveTask($task);
}
示例11: 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);
}
示例12: populateDefaultWorkflows
/**
* Function adds default system workflows
* @param <PearDatabase> $adb
*/
static function populateDefaultWorkflows($adb)
{
vimport("~~modules/com_vtiger_workflow/include.inc");
vimport("~~modules/com_vtiger_workflow/tasks/VTEntityMethodTask.inc");
vimport("~~modules/com_vtiger_workflow/VTEntityMethodManager.inc");
vimport("~~modules/com_vtiger_workflow/VTTaskManager.inc");
// register the workflow tasks
$taskTypes = array();
$defaultModules = array('include' => array(), 'exclude' => array());
$createToDoModules = array('include' => array("Leads", "Accounts", "Potentials", "Contacts", "HelpDesk", "Campaigns", "Quotes", "PurchaseOrder", "SalesOrder", "Invoice"), 'exclude' => array("Calendar", "FAQ", "Events"));
$createEventModules = array('include' => array("Leads", "Accounts", "Potentials", "Contacts", "HelpDesk", "Campaigns"), 'exclude' => array("Calendar", "FAQ", "Events"));
$taskTypes[] = array("name" => "VTEmailTask", "label" => "Send Mail", "classname" => "VTEmailTask", "classpath" => "modules/com_vtiger_workflow/tasks/VTEmailTask.inc", "templatepath" => "com_vtiger_workflow/taskforms/VTEmailTask.tpl", "modules" => $defaultModules, "sourcemodule" => '');
$taskTypes[] = array("name" => "VTEntityMethodTask", "label" => "Invoke Custom Function", "classname" => "VTEntityMethodTask", "classpath" => "modules/com_vtiger_workflow/tasks/VTEntityMethodTask.inc", "templatepath" => "com_vtiger_workflow/taskforms/VTEntityMethodTask.tpl", "modules" => $defaultModules, "sourcemodule" => '');
$taskTypes[] = array("name" => "VTCreateTodoTask", "label" => "Create Todo", "classname" => "VTCreateTodoTask", "classpath" => "modules/com_vtiger_workflow/tasks/VTCreateTodoTask.inc", "templatepath" => "com_vtiger_workflow/taskforms/VTCreateTodoTask.tpl", "modules" => $createToDoModules, "sourcemodule" => '');
$taskTypes[] = array("name" => "VTCreateEventTask", "label" => "Create Event", "classname" => "VTCreateEventTask", "classpath" => "modules/com_vtiger_workflow/tasks/VTCreateEventTask.inc", "templatepath" => "com_vtiger_workflow/taskforms/VTCreateEventTask.tpl", "modules" => $createEventModules, "sourcemodule" => '');
$taskTypes[] = array("name" => "VTUpdateFieldsTask", "label" => "Update Fields", "classname" => "VTUpdateFieldsTask", "classpath" => "modules/com_vtiger_workflow/tasks/VTUpdateFieldsTask.inc", "templatepath" => "com_vtiger_workflow/taskforms/VTUpdateFieldsTask.tpl", "modules" => $defaultModules, "sourcemodule" => '');
$taskTypes[] = array("name" => "VTCreateEntityTask", "label" => "Create Entity", "classname" => "VTCreateEntityTask", "classpath" => "modules/com_vtiger_workflow/tasks/VTCreateEntityTask.inc", "templatepath" => "com_vtiger_workflow/taskforms/VTCreateEntityTask.tpl", "modules" => $defaultModules, "sourcemodule" => '');
$taskTypes[] = array("name" => "VTSMSTask", "label" => "SMS Task", "classname" => "VTSMSTask", "classpath" => "modules/com_vtiger_workflow/tasks/VTSMSTask.inc", "templatepath" => "com_vtiger_workflow/taskforms/VTSMSTask.tpl", "modules" => $defaultModules, "sourcemodule" => 'SMSNotifier');
foreach ($taskTypes as $taskType) {
VTTaskType::registerTaskType($taskType);
}
// 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";
$invWorkFlow->defaultworkflow = 1;
$vtWorkFlow->save($invWorkFlow);
$tm = new VTTaskManager($adb);
$task = $tm->createTask('VTEntityMethodTask', $invWorkFlow->id);
$task->active = true;
$task->methodName = "UpdateInventory";
$tm->saveTask($task);
// Creating Workflow for Accounts when Notifyowner is true
$vtaWorkFlow = new VTWorkflowManager($adb);
$accWorkFlow = $vtaWorkFlow->newWorkFlow("Accounts");
$accWorkFlow->test = '[{"fieldname":"notify_owner","operation":"is","value":"true:boolean"}]';
// SalesPlatform.ru begin
$accWorkFlow->description = "Отправить Email пользователю, если указано Уведомлять ответственного";
//$accWorkFlow->description = "Send Email to user when Notifyowner is True";
// SalesPlatform.ru end
$accWorkFlow->executionCondition = 2;
$accWorkFlow->defaultworkflow = 1;
$vtaWorkFlow->save($accWorkFlow);
$id1 = $accWorkFlow->id;
$tm = new VTTaskManager($adb);
$task = $tm->createTask('VTEmailTask', $accWorkFlow->id);
$task->active = true;
$task->methodName = "NotifyOwner";
$task->recepient = "\$(assigned_user_id : (Users) email1)";
// SalesPlatform.ru begin
$task->subject = "Уведомление о назначении Контрагента";
$task->content = "В системе vtigerCRM Вам был назначен контрагент<br>Информация о контрагенте :<br><br>" . "Контрагент №:" . '<b>$account_no</b><br>' . "Контрагент:" . '<b>$accountname</b><br>' . "Рейтинг:" . '<b>$rating</b><br>' . "Отрасль:" . '<b>$industry</b><br>' . "Тип:" . '<b>$accounttype</b><br>' . "Описание:" . '<b>$description</b><br><br><br>' . "Спасибо,<br>Admin";
$task->summary = "Создан Контрагент ";
//$task->subject = "Regarding Account Creation";
//$task->content = "An Account has been assigned to you on vtigerCRM<br>Details of account are :<br><br>".
// "AccountId:".'<b>$account_no</b><br>'."AccountName:".'<b>$accountname</b><br>'."Rating:".'<b>$rating</b><br>'.
// "Industry:".'<b>$industry</b><br>'."AccountType:".'<b>$accounttype</b><br>'.
// "Description:".'<b>$description</b><br><br><br>'."Thank You<br>Admin";
//$task->summary="An account has been created ";
// SalesPlatform.ru end
$tm->saveTask($task);
$adb->pquery("update com_vtiger_workflows set defaultworkflow=? where workflow_id=?", array(1, $id1));
// Creating Workflow for Contacts when Notifyowner is true
$vtcWorkFlow = new VTWorkflowManager($adb);
$conWorkFlow = $vtcWorkFlow->newWorkFlow("Contacts");
// SalesPlatform.ru begin
$conWorkFlow->summary = "Создан Контакт ";
//$conWorkFlow->summary="A contact has been created ";
// SalesPlatform.ru end
$conWorkFlow->executionCondition = 2;
$conWorkFlow->test = '[{"fieldname":"notify_owner","operation":"is","value":"true:boolean"}]';
// SalesPlatform.ru begin
$conWorkFlow->description = "Отправить Email пользователю, если указано Уведомлять ответственного";
//$conWorkFlow->description = "Send Email to user when Notifyowner is True";
// SalesPlatform.ru end
$conWorkFlow->defaultworkflow = 1;
$vtcWorkFlow->save($conWorkFlow);
$id1 = $conWorkFlow->id;
$tm = new VTTaskManager($adb);
$task = $tm->createTask('VTEmailTask', $conWorkFlow->id);
$task->active = true;
$task->methodName = "NotifyOwner";
$task->recepient = "\$(assigned_user_id : (Users) email1)";
// SalesPlatform.ru begin
$task->subject = "Уведомление о назначении Контакта";
$task->content = "В системе vtigerCRM Вам был назначен контакт<br>Информация о контакте :<br><br>" . "Контакт №:" . '<b>$contact_no</b><br>' . "Фамилия:" . '<b>$lastname</b><br>' . "Имя:" . '<b>$firstname</b><br>' . "Источник:" . '<b>$leadsource</b><br>' . "Отдел:" . '<b>$department</b><br>' . "Описание:" . '<b>$description</b><br><br><br>' . "Спасибо,<br>Admin";
$task->summary = "Создан Контакт ";
//$task->subject = "Regarding Contact Creation";
//$task->content = "An Contact has been assigned to you on vtigerCRM<br>Details of Contact are :<br><br>".
// "Contact Id:".'<b>$contact_no</b><br>'."LastName:".'<b>$lastname</b><br>'."FirstName:".'<b>$firstname</b><br>'.
// "Lead Source:".'<b>$leadsource</b><br>'.
// "Department:".'<b>$department</b><br>'.
// "Description:".'<b>$description</b><br><br><br>'."Thank You<br>Admin";
//$task->summary="An contact has been created ";
// SalesPlatform.ru end
//.........这里部分代码省略.........
示例13: saveActivityTask
function saveActivityTask($wf_task, $activity) {
global $adb;
require_once("modules/com_vtiger_workflow/VTTaskManager.inc");
$tm = new VTTaskManager($adb);
for ($i=0; $i<count($wf_task); $i++) {
$task_res = $adb->pquery("select task_id from com_vtiger_workflowtasks ".
"where summary = ?", array($wf_task[$i]));
if ($task_res) {
if ($adb->num_rows($task_res) > 0) {
$task_id = $adb->query_result($task_res, 0, 'task_id');
$task = $tm->retrieveTask($task_id);
$task->active = $activity;
$tm->saveTask($task);
}
}
}
}
示例14: 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` = ? AND oss_module_list = ? ", array($temp[2], $temp[0], $temp[1]));
}
}
$result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(getTabid('OSSMailTemplates'), getTabid('Documents'), 'get_attachments', 'Documents'));
if ($adb->num_rows($result) == 0) {
$moduleInstance = Vtiger_Module::getInstance('Documents');
$target_Module = Vtiger_Module::getInstance('OSSMailTemplates');
$target_Module->setRelatedList($moduleInstance, 'Documents', array('add,select'), 'get_attachments');
}
$result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(getTabid('HelpDesk'), getTabid('Contacts'), 'get_related_list', 'Contacts'));
if ($adb->num_rows($result) == 0) {
$moduleInstance = Vtiger_Module::getInstance('Contacts');
$target_Module = Vtiger_Module::getInstance('HelpDesk');
$target_Module->setRelatedList($moduleInstance, 'Contacts', array('SELECT'), 'get_related_list');
}
$adb->pquery("UPDATE `vtiger_field` set displaytype = ? WHERE `columnname` = ?;", array(2, 'was_read'));
$adb->pquery("UPDATE `vtiger_field` set uitype = ? WHERE `columnname` = ? AND tablename = ?;", array(15, 'industry', 'vtiger_leaddetails'));
$adb->pquery("UPDATE `vtiger_calendar_default_activitytypes` set active = ? ;", array(1));
$adb->pquery("UPDATE `com_vtiger_workflows` SET `type` = ? WHERE `summary` = ? AND module_name = ? ;", array('[]', 'Ticket Creation: Send Email to Record Contact', 'HelpDesk'));
$result = $adb->pquery("SELECT workflow_id FROM `com_vtiger_workflows` WHERE summary = ? AND module_name =? ", array('Send Customer Login Details', 'Contacts'));
if ($adb->num_rows($result) == 1) {
$workflow_id = $adb->query_result_raw($result, 0, 'workflow_id');
$workflowTaskAdd = array(128, 53, 'Mark portal users password as sent.', 'O:18:"VTEntityMethodTask":7:{s:18:"executeImmediately";b:1;s:10:"workflowId";s:2:"53";s:7:"summary";s:35:"Mark portal users password as sent.";s:6:"active";b:0;s:7:"trigger";N;s:10:"methodName";s:16:"MarkPasswordSent";s:2:"id";i:128;}');
$result = $adb->pquery("SELECT * FROM `com_vtiger_workflowtasks` WHERE summary = ? AND workflow_id =? ", array($workflowTaskAdd[2], $workflow_id));
if ($adb->num_rows($result) == 0) {
$taskManager = new VTTaskManager($adb);
$task = $taskManager->unserializeTask($workflowTaskAdd[3]);
$task->id = '';
$task->workflowId = $workflow_id;
$taskManager->saveTask($task);
}
}
$adb->pquery('UPDATE com_vtiger_workflows SET defaultworkflow = "0" WHERE `summary` = ? AND module_name = ?;', array('Ticket Creation: Send Email to Record Contact', 'HelpDesk'));
$result = $adb->pquery('SELECT * FROM com_vtiger_workflows WHERE `summary` = ? AND module_name = ?;', array('Ticket Creation: Send Email to Record Contact', 'HelpDesk'));
for ($i = 0; $i < $adb->num_rows($result); $i++) {
$recordId = $adb->query_result($result, $i, 'workflow_id');
$adb->pquery("DELETE FROM com_vtiger_workflowtasks WHERE workflow_id IN\n\t\t\t\t\t\t\t(SELECT workflow_id FROM com_vtiger_workflows WHERE workflow_id=? AND (defaultworkflow IS NULL OR defaultworkflow != 1))", array($recordId));
$adb->pquery("DELETE FROM com_vtiger_workflows WHERE workflow_id=? AND (defaultworkflow IS NULL OR defaultworkflow != 1)", array($recordId));
}
$result = $adb->pquery('SELECT * FROM com_vtiger_workflowtasks WHERE `summary` IN (?,?);', array('Notify Contact On Ticket Closed', 'Notify Contact On Ticket Change'));
for ($i = 0; $i < $adb->num_rows($result); $i++) {
$recordId = $adb->query_result($result, $i, 'task_id');
$adb->pquery("delete from com_vtiger_workflowtasks where task_id=?", array($recordId));
}
$task_entity_method[] = array('HelpDesk', 'HeldDeskChangeNotifyContacts', 'modules/HelpDesk/workflows/HelpDeskWorkflow.php', 'HeldDeskChangeNotifyContacts');
$task_entity_method[] = array('HelpDesk', 'HeldDeskClosedNotifyContacts', 'modules/HelpDesk/workflows/HelpDeskWorkflow.php', 'HeldDeskClosedNotifyContacts');
$emm = new VTEntityMethodManager($adb);
foreach ($task_entity_method as $method) {
$result = $adb->pquery("SELECT * FROM `com_vtiger_workflowtasks_entitymethod` WHERE method_name = ? ", array($method[1]));
if ($adb->num_rows($result) == 0) {
$emm->addEntityMethod($method[0], $method[1], $method[2], $method[3]);
}
}
$adb->pquery('UPDATE com_vtiger_workflows SET test = ? WHERE `summary` = ? AND module_name = ?;', array('[{"fieldname":"ticketstatus","operation":"has changed","value":null,"valuetype":"rawtext","joincondition":"and","groupjoin":"and","groupid":"0"},{"fieldname":"ticketstatus","operation":"is","value":"Closed","valuetype":"rawtext","joincondition":"","groupjoin":"and","groupid":"0"}]', 'Ticket Closed: Send Email to Record Contact', 'HelpDesk'));
$adb->pquery('UPDATE com_vtiger_workflows SET test = ? WHERE `summary` = ? AND module_name = ?;', array('[{"fieldname":"ticketstatus","operation":"has changed","value":null,"valuetype":"rawtext","joincondition":"and","groupjoin":"and","groupid":"0"},{"fieldname":"ticketstatus","operation":"is not","value":"Closed","valuetype":"rawtext","joincondition":"","groupjoin":"and","groupid":"0"}]', 'Ticket change: Send Email to Record Contact', 'HelpDesk'));
$result = $adb->pquery("SELECT workflow_id FROM `com_vtiger_workflows` WHERE summary = ? AND module_name =? ", array('Ticket change: Send Email to Record Contact', 'HelpDesk'));
if ($adb->num_rows($result) == 1) {
$workflow_id = $adb->query_result_raw($result, 0, 'workflow_id');
$workflowTaskAdd = array(133, 26, 'Notify Contact On Ticket Change', 'O:18:"VTEntityMethodTask":7:{s:18:"executeImmediately";b:1;s:10:"workflowId";s:2:"26";s:7:"summary";s:31:"Notify Contact On Ticket Change";s:6:"active";b:0;s:7:"trigger";N;s:10:"methodName";s:28:"HeldDeskChangeNotifyContacts";s:2:"id";i:133;}');
$result = $adb->pquery("SELECT * FROM `com_vtiger_workflowtasks` WHERE summary = ? AND workflow_id =? ", array($workflowTaskAdd[2], $workflow_id));
if ($adb->num_rows($result) == 0) {
//.........这里部分代码省略.........
示例15: applyChange
function applyChange()
{
global $adb;
if ($this->hasError()) {
$this->sendError();
}
if ($this->isApplied()) {
$this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
} else {
global $adb;
$modname = 'CobroPago';
$module = Vtiger_Module::getInstance($modname);
$block = Vtiger_Block::getInstance('LBL_COBROPAGO_INFORMATION', $module);
$fld_ref = Vtiger_Field::getInstance('reference', $module);
$this->ExecuteQuery("UPDATE vtiger_field SET typeofdata='V~O' WHERE fieldid={$fld_ref->id}");
$this->ExecuteQuery("UPDATE vtiger_field SET sequence=sequence+1 WHERE block={$block->id} AND sequence>1");
$field = Vtiger_Field::getInstance('cyp_no', $module);
if (!$field) {
$field1 = new Vtiger_Field();
$field1->name = 'cyp_no';
$field1->label = 'CyP No';
$field1->column = 'cyp_no';
$field1->columntype = 'VARCHAR(50)';
$field1->sequence = 2;
$field1->uitype = 4;
$field1->typeofdata = 'V~M';
$field1->displaytype = 1;
$field1->presence = 0;
$block->addField($field1);
}
$fld_due = Vtiger_Field::getInstance('duedate', $module);
$qry = "SELECT sequence FROM vtiger_field WHERE fieldid={$fld_due->id}";
$res = $adb->query($qry);
$seq = $adb->query_result($res, 0, 'sequence');
$this->ExecuteQuery("UPDATE vtiger_field SET sequence=sequence+1 WHERE block={$block->id} AND sequence>{$seq}");
$field = Vtiger_Field::getInstance('paymentdate', $module);
if (!$field) {
$field1 = new Vtiger_Field();
$field1->name = 'paymentdate';
$field1->label = 'PaymentDate';
$field1->column = 'paymentdate';
$field1->columntype = 'DATE';
$field1->sequence = $seq + 1;
$field1->uitype = 5;
$field1->typeofdata = 'D~O';
$field1->displaytype = 1;
$field1->presence = 0;
$block->addField($field1);
}
$res_ui4 = $adb->pquery("SELECT * FROM vtiger_field WHERE tabid=? AND uitype=? AND fieldname<>?", array($module->id, '4', 'cyp_no'));
if ($adb->num_rows($res_ui4) != 0) {
$fld_ui4_id = $adb->query_result($res_ui4, 0, 'fieldid');
$fld_ui4_name = $adb->query_result($res_ui4, 0, 'fieldname');
$fld_ui4_colname = $adb->query_result($res_ui4, 0, 'columnname');
$this->ExecuteQuery("UPDATE vtiger_field SET uitype=? WHERE fieldid=?", array('1', $fld_ui4_id));
}
$res = $adb->query("SELECT * FROM vtiger_modentity_num WHERE semodule='CobroPago'");
if ($adb->num_rows($res) == 0) {
$focus = CRMEntity::getInstance($modname);
$focus->setModuleSeqNumber('configure', $modname, 'PAY-', '0000001');
$focus->updateMissingSeqNumber($modname);
} elseif (!is_null($fld_ui4_colname)) {
$this->ExecuteQuery("UPDATE vtiger_cobropago SET cyp_no={$fld_ui4_colname}");
//Workflow, copy CyP No to Reference
$vtWorkFlow = new VTWorkflowManager($adb);
$invWorkFlow = $vtWorkFlow->newWorkFlow('CobroPago');
$invWorkFlow->description = "Number to Reference";
$invWorkFlow->executionCondition = 3;
$invWorkFlow->defaultworkflow = 1;
$vtWorkFlow->save($invWorkFlow);
$tm = new VTTaskManager($adb);
$task = $tm->createTask('VTUpdateFieldsTask', $invWorkFlow->id);
$task->active = true;
$task->summary = "Number to Reference";
$task->field_value_mapping = '[{"fieldname":"' . $fld_ui4_name . '","valuetype":"fieldname","value":"cyp_no "}]';
$tm->saveTask($task);
}
$this->ExecuteQuery("UPDATE vtiger_entityname SET fieldname=CONCAT(fieldname,',cyp_no') WHERE tabid={$module->id}");
$this->ExecuteQuery("UPDATE vtiger_cobropago SET paymentdate=duedate");
$this->sendMsg('Changeset ' . get_class($this) . ' applied!');
$this->markApplied();
}
$this->finishExecution();
}