当前位置: 首页>>代码示例>>PHP>>正文


PHP VTEventsManager::triggerEvent方法代码示例

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


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

示例1: process

 function process(Vtiger_Request $request)
 {
     vimport('~include/events/include.inc');
     $db = PearDatabase::getInstance();
     $em = new VTEventsManager($db);
     $em->initTriggerCache();
     $em->triggerEvent('user.logout.before', []);
     Vtiger_Session::regenerateId(true);
     // to overcome session id reuse.
     Vtiger_Session::destroy();
     //Track the logout History
     $moduleName = $request->getModule();
     $moduleModel = Users_Module_Model::getInstance($moduleName);
     $moduleModel->saveLogoutHistory();
     //End
     header('Location: index.php');
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:17,代码来源:Logout.php

示例2: transformOwnerShipAndDelete

 function transformOwnerShipAndDelete($userId, $transformToUserId)
 {
     $adb = PearDatabase::getInstance();
     $em = new VTEventsManager($adb);
     // Initialize Event trigger cache
     $em->initTriggerCache();
     $entityData = VTEntityData::fromUserId($adb, $userId);
     //set transform user id
     $entityData->set('transformtouserid', $transformToUserId);
     $em->triggerEvent("vtiger.entity.beforedelete", $entityData);
     vtws_transferOwnership($userId, $transformToUserId);
     //delete from user vtiger_table;
     $sql = "delete from vtiger_users where id=?";
     $adb->pquery($sql, array($userId));
     //Delete user extension in asterisk.
     $sql = "delete from vtiger_asteriskextensions where userid=?";
     $adb->pquery($sql, array($userId));
 }
开发者ID:kduqi,项目名称:corebos,代码行数:18,代码来源:Users.php

示例3: relateEntities

/**
 * Function to related two records of different entity types
 */
function relateEntities($focus, $sourceModule, $sourceRecordId, $destinationModule, $destinationRecordIds)
{
    $adb = PearDatabase::getInstance();
    $log = vglobal('log');
    $log->debug("Entering relateEntities method ({$sourceModule}, {$sourceRecordId}, {$destinationModule}, {$destinationRecordIds})");
    require_once 'include/events/include.inc';
    //require_once('modules/com_vtiger_workflow/VTWorkflowManager.inc');
    //require_once('modules/com_vtiger_workflow/VTEntityCache.inc');
    $em = new VTEventsManager($adb);
    $em->initTriggerCache();
    if (!is_array($destinationRecordIds)) {
        $destinationRecordIds = [$destinationRecordIds];
    }
    $data = [];
    $data['CRMEntity'] = $focus;
    $data['entityData'] = VTEntityData::fromEntityId($adb, $sourceRecordId);
    $data['sourceModule'] = $sourceModule;
    $data['sourceRecordId'] = $sourceRecordId;
    $data['destinationModule'] = $destinationModule;
    foreach ($destinationRecordIds as $destinationRecordId) {
        $data['destinationRecordId'] = $destinationRecordId;
        $em->triggerEvent('vtiger.entity.link.before', $data);
        $focus->save_related_module($sourceModule, $sourceRecordId, $destinationModule, $destinationRecordId);
        $focus->trackLinkedInfo($sourceModule, $sourceRecordId, $destinationModule, $destinationRecordId);
        /*
         $wfs = new VTWorkflowManager($adb);
         $workflows = $wfs->getWorkflowsForModule($sourceModule, VTWorkflowManager::$ON_RELATED);
         $entityCache = new VTEntityCache(Users_Record_Model::getCurrentUserModel());
         $entityData = VTEntityData::fromCRMEntity($focus);
         $entityData->eventType = VTWorkflowManager::$ON_RELATED;
         $entityData->relatedInfo = [
         'destId' => $destinationRecordId,
         'destModule' => $destinationModule,
         ];
         foreach ($workflows as $id => $workflow) {
         if ($workflow->evaluate($entityCache, $entityData->getId())) {
         $workflow->performTasks($entityData);
         }
         }
        */
        $em->triggerEvent('vtiger.entity.link.after', $data);
    }
    $log->debug("Exiting relateEntities method ...");
}
开发者ID:nikdejan,项目名称:YetiForceCRM,代码行数:47,代码来源:utils.php

示例4: createRecords


//.........这里部分代码省略.........
                         }
                         $baseRecordId = $adb->query_result($duplicatesResult, $noOfDuplicates - 1, $fieldColumnMapping['id']);
                         $baseEntityId = vtws_getId($moduleObjectId, $baseRecordId);
                         if ($mergeType == Import_Utils_Helper::$AUTO_MERGE_OVERWRITE) {
                             $fieldData = $this->transformForImport($fieldData, $moduleMeta);
                             $fieldData['id'] = $baseEntityId;
                             $entityInfo = vtws_update($fieldData, $this->user);
                             $entityInfo['status'] = self::$IMPORT_RECORD_UPDATED;
                         }
                         if ($mergeType == Import_Utils_Helper::$AUTO_MERGE_MERGEFIELDS) {
                             $filteredFieldData = array();
                             foreach ($fieldData as $fieldName => $fieldValue) {
                                 // empty will give false for value = 0
                                 if (!empty($fieldValue) || $fieldValue != "") {
                                     $filteredFieldData[$fieldName] = $fieldValue;
                                 }
                             }
                             // Custom handling for default values & mandatory fields
                             // need to be taken care than normal import as we merge
                             // existing record values with newer values.
                             $fillDefault = false;
                             $mandatoryValueChecks = false;
                             $existingFieldValues = vtws_retrieve($baseEntityId, $this->user);
                             $defaultFieldValues = $this->getDefaultFieldValues($moduleMeta);
                             foreach ($existingFieldValues as $fieldName => $fieldValue) {
                                 if (empty($fieldValue) && empty($filteredFieldData[$fieldName]) && !empty($defaultFieldValues[$fieldName])) {
                                     $filteredFieldData[$fieldName] = $defaultFieldValues[$fieldName];
                                 }
                             }
                             $filteredFieldData = $this->transformForImport($filteredFieldData, $moduleMeta, $fillDefault, $mandatoryValueChecks);
                             $filteredFieldData['id'] = $baseEntityId;
                             $entityInfo = vtws_revise($filteredFieldData, $this->user);
                             $entityInfo['status'] = self::$IMPORT_RECORD_MERGED;
                             $fieldData = $filteredFieldData;
                         }
                     } else {
                         $createRecord = true;
                     }
                 } else {
                     $createRecord = true;
                 }
             } else {
                 $createRecord = true;
             }
             if ($createRecord) {
                 $fieldData = $this->transformForImport($fieldData, $moduleMeta);
                 if ($fieldData == null) {
                     $entityInfo = null;
                 } else {
                     try {
                         $entityInfo = vtws_create($moduleName, $fieldData, $this->user);
                     } catch (Exception $e) {
                     }
                 }
             }
         }
         if ($entityInfo == null) {
             $entityInfo = array('id' => null, 'status' => self::$IMPORT_RECORD_FAILED);
         } else {
             if ($createRecord) {
                 $entityInfo['status'] = self::$IMPORT_RECORD_CREATED;
             }
         }
         if ($createRecord || $mergeType == Import_Utils_Helper::$AUTO_MERGE_MERGEFIELDS || $mergeType == Import_Utils_Helper::$AUTO_MERGE_OVERWRITE) {
             $entityIdComponents = vtws_getIdComponents($entityInfo['id']);
             $recordId = $entityIdComponents[1];
             $entityfields = getEntityFieldNames($this->module);
             switch ($this->module) {
                 case 'HelpDesk':
                     $entityfields['fieldname'] = array('ticket_title');
                     break;
                 case 'Documents':
                     $entityfields['fieldname'] = array('notes_title');
                     break;
                 case 'Documents':
                     $entityfields['fieldname'] = array('notes_title');
                     break;
             }
             $label = '';
             if (is_array($entityfields['fieldname'])) {
                 foreach ($entityfields['fieldname'] as $field) {
                     $label .= $fieldData[$field] . " ";
                 }
             } else {
                 $label = $fieldData[$entityfields['fieldname']];
             }
             $label = trim($label);
             $adb->pquery('UPDATE vtiger_crmentity SET label=? WHERE crmid=?', array($label, $recordId));
         }
         $this->importedRecordInfo[$rowId] = $entityInfo;
         $this->updateImportStatus($rowId, $entityInfo);
     }
     if ($this->entityData) {
         $entity = new VTEventsManager($adb);
         $entity->triggerEvent('vtiger.batchevent.save', $this->entityData);
     }
     $this->entityData = null;
     $result = null;
     return true;
 }
开发者ID:cannking,项目名称:vtigercrm-debug,代码行数:101,代码来源:Data.php

示例5: vtws_convertlead

function vtws_convertlead($entityvalues, $user)
{
    $adb = PearDatabase::getInstance();
    $log = vglobal('log');
    $log->debug('Start ' . __CLASS__ . ':' . __FUNCTION__);
    if (empty($entityvalues['assignedTo'])) {
        $entityvalues['assignedTo'] = vtws_getWebserviceEntityId('Users', $user->id);
    }
    if (empty($entityvalues['transferRelatedRecordsTo'])) {
        $entityvalues['transferRelatedRecordsTo'] = 'Accounts';
    }
    $leadObject = VtigerWebserviceObject::fromName($adb, 'Leads');
    $handlerPath = $leadObject->getHandlerPath();
    $handlerClass = $leadObject->getHandlerClass();
    require_once $handlerPath;
    $leadHandler = new $handlerClass($leadObject, $user, $adb, $log);
    $leadInfo = vtws_retrieve($entityvalues['leadId'], $user);
    $sql = "select converted from vtiger_leaddetails where converted = 1 and leadid=?";
    $leadIdComponents = vtws_getIdComponents($entityvalues['leadId']);
    $result = $adb->pquery($sql, array($leadIdComponents[1]));
    if ($result === false) {
        $log->error('Error converting a lead: ' . vtws_getWebserviceTranslatedString('LBL_' . WebServiceErrorCode::$DATABASEQUERYERROR));
        throw new WebServiceException(WebServiceErrorCode::$DATABASEQUERYERROR, vtws_getWebserviceTranslatedString('LBL_' . WebServiceErrorCode::$DATABASEQUERYERROR));
    }
    $rowCount = $adb->num_rows($result);
    if ($rowCount > 0) {
        $log->error('Error converting a lead: Lead is already converted');
        throw new WebServiceException(WebServiceErrorCode::$LEAD_ALREADY_CONVERTED, "Lead is already converted");
    }
    require_once "include/events/include.inc";
    $em = new VTEventsManager($adb);
    // Initialize Event trigger cache
    $em->initTriggerCache();
    $entityData = VTEntityData::fromEntityId($adb, $leadIdComponents[1]);
    $em->triggerEvent('entity.convertlead.before', [$entityvalues, $user, $leadInfo]);
    $entityIds = [];
    $availableModules = ['Accounts', 'Contacts', 'Potentials'];
    if (!($entityvalues['entities']['Accounts']['create'] || $entityvalues['entities']['Contacts']['create'])) {
        return null;
    }
    foreach ($availableModules as $entityName) {
        if ($entityvalues['entities'][$entityName]['create']) {
            $entityvalue = $entityvalues['entities'][$entityName];
            $entityObject = VtigerWebserviceObject::fromName($adb, $entityvalue['name']);
            $handlerPath = $entityObject->getHandlerPath();
            $handlerClass = $entityObject->getHandlerClass();
            require_once $handlerPath;
            $entityHandler = new $handlerClass($entityObject, $user, $adb, $log);
            $entityObjectValues = array();
            $entityObjectValues['assigned_user_id'] = $entityvalues['assignedTo'];
            $entityObjectValues = vtws_populateConvertLeadEntities($entityvalue, $entityObjectValues, $entityHandler, $leadHandler, $leadInfo);
            //update potential related to property
            if ($entityvalue['name'] == 'Potentials') {
                if (!empty($entityIds['Accounts'])) {
                    $entityObjectValues['related_to'] = $entityIds['Accounts'];
                }
                if (!empty($entityIds['Contacts'])) {
                    $entityObjectValues['contact_id'] = $entityIds['Contacts'];
                }
            }
            //update the contacts relation
            if ($entityvalue['name'] == 'Contacts') {
                if (!empty($entityIds['Accounts'])) {
                    $entityObjectValues['parent_id'] = $entityIds['Accounts'];
                }
            }
            try {
                $create = true;
                if ($entityvalue['name'] == 'Accounts' && $entityvalue['convert_to_id'] && is_int($entityvalue['convert_to_id'])) {
                    $entityIds[$entityName] = vtws_getWebserviceEntityId('Accounts', $entityvalue['convert_to_id']);
                    $create = false;
                }
                if ($create) {
                    $entityRecord = vtws_create($entityvalue['name'], $entityObjectValues, $user);
                    $entityIds[$entityName] = $entityRecord['id'];
                }
            } catch (Exception $e) {
                $log->error('Error converting a lead: ' . $e->getMessage());
                throw new WebServiceException(WebServiceErrorCode::$UNKNOWNOPERATION, $e->getMessage() . ' : ' . $entityvalue['name']);
            }
        }
    }
    try {
        $accountIdComponents = vtws_getIdComponents($entityIds['Accounts']);
        $accountId = $accountIdComponents[1];
        $contactIdComponents = vtws_getIdComponents($entityIds['Contacts']);
        $contactId = $contactIdComponents[1];
        if (!empty($accountId) && !empty($contactId) && !empty($entityIds['Potentials'])) {
            $potentialIdComponents = vtws_getIdComponents($entityIds['Potentials']);
            $potentialId = $potentialIdComponents[1];
            $sql = "insert into vtiger_contpotentialrel values(?,?)";
            $result = $adb->pquery($sql, array($contactId, $potentialIdComponents[1]));
            if ($result === false) {
                throw new WebServiceException(WebServiceErrorCode::$FAILED_TO_CREATE_RELATION, "Failed to related Contact with the Potential");
            }
        }
        $transfered = vtws_convertLeadTransferHandler($leadIdComponents, $entityIds, $entityvalues);
        $relatedIdComponents = vtws_getIdComponents($entityIds[$entityvalues['transferRelatedRecordsTo']]);
        vtws_getRelatedActivities($leadIdComponents[1], $accountId, $contactId, $relatedIdComponents[1]);
        vtws_updateConvertLeadStatus($entityIds, $entityvalues['leadId'], $user);
//.........这里部分代码省略.........
开发者ID:rcrrich,项目名称:YetiForceCRM,代码行数:101,代码来源:ConvertLead.php

示例6: deleteGroup

/** Function to delete the specified group
 * @param $groupId -- Group Id :: Type integer
 * @param $transferId --  Id of the group/user to which record ownership is to be transferred:: Type integer
 * @param $transferType -- It can have only two values namely 'Groups' or 'Users'. This determines whether the owneship is to be transferred to a group or user :: Type varchar
 */
function deleteGroup($groupId, $transferId)
{
    global $log;
    $log->debug("Entering deleteGroup(" . $groupId . ") method ...");
    global $adb;
    $em = new VTEventsManager($adb);
    // Initialize Event trigger cache
    $em->initTriggerCache();
    $entityData = array();
    $entityData['groupid'] = $groupId;
    $entityData['transferToId'] = $transferId;
    $em->triggerEvent("vtiger.entity.beforegroupdelete", $entityData);
    tranferGroupOwnership($groupId, $transferId);
    deleteGroupRelatedSharingRules($groupId);
    $query = "delete from vtiger_groups where groupid=?";
    $adb->pquery($query, array($groupId));
    deleteGroupRelatedGroups($groupId);
    deleteGroupRelatedRoles($groupId);
    deleteGroupReportRelations($groupId);
    deleteGroupRelatedRolesAndSubordinates($groupId);
    deleteGroupRelatedUsers($groupId);
    $log->debug("Exiting deleteGroup method ...");
}
开发者ID:jaimeaga84,项目名称:corebos,代码行数:28,代码来源:UserInfoUtil.php

示例7: saveInventoryData

 /**
  * Save the inventory data
  */
 public function saveInventoryData()
 {
     //Event triggering code
     require_once "include/events/include.inc";
     $db = PearDatabase::getInstance();
     $log = vglobal('log');
     $log->debug('Entering ' . __CLASS__ . '::' . __METHOD__);
     $moduleName = $this->getModuleName();
     $inventory = Vtiger_InventoryField_Model::getInstance($moduleName);
     $fields = $inventory->getColumns();
     $table = $inventory->getTableName('data');
     $summaryFields = $inventory->getSummaryFields();
     $insertDataTemp = $summary = [];
     $request = new Vtiger_Request($_REQUEST, $_REQUEST);
     $numRow = $request->get('inventoryItemsNo');
     //In Bulk mode stop triggering events
     if (!CRMEntity::isBulkSaveMode()) {
         $em = new VTEventsManager($adb);
         // Initialize Event trigger cache
         $em->initTriggerCache();
         $em->triggerEvent('entity.inventory.beforesave', [$this, $inventory]);
     }
     $db->pquery("delete from {$table} where id = ?", [$this->getId()]);
     for ($i = 1; $i <= $numRow; $i++) {
         if (!$request->has(reset($fields)) && !$request->has(reset($fields) . $i)) {
             continue;
         }
         $insertData = ['id' => $this->getId(), 'seq' => $request->get('seq' . $i)];
         foreach ($fields as $field) {
             $value = $insertData[$field] = $inventory->getValueForSave($request, $field, $i);
             if (in_array($field, $summaryFields)) {
                 $summary[$field] += $value;
             }
         }
         $db->insert($table, $insertData);
         $insertDataTemp[] = $insertData;
     }
     foreach ($summary as $fieldName => $fieldValue) {
         if ($this->has($fieldName)) {
             $this->set($fieldName, CurrencyField::convertToUserFormat($fieldValue, null, true));
         }
     }
     if ($em) {
         //Event triggering code
         $em->triggerEvent('entity.inventory.aftersave', [$this, $inventory, $insertDataTemp, $summary]);
     }
     $log->debug('Exiting ' . __CLASS__ . '::' . __METHOD__);
 }
开发者ID:ecommercepoint,项目名称:YetiForceCRM,代码行数:51,代码来源:Record.php

示例8: save

 /** Function to saves the values in all the tables mentioned in the class variable $tab_name for the specified module
  * @param $module -- module:: Type varchar
  */
 function save($module_name, $fileid = '')
 {
     global $log;
     $log->debug("module name is " . $module_name);
     //Event triggering code
     require_once "include/events/include.inc";
     global $adb;
     $em = new VTEventsManager($adb);
     // Initialize Event trigger cache
     $em->initTriggerCache();
     $entityData = VTEntityData::fromCRMEntity($this);
     $em->triggerEvent("vtiger.entity.beforesave.modifiable", $entityData);
     $em->triggerEvent("vtiger.entity.beforesave", $entityData);
     $em->triggerEvent("vtiger.entity.beforesave.final", $entityData);
     //Event triggering code ends
     //GS Save entity being called with the modulename as parameter
     $this->saveentity($module_name, $fileid);
     //Event triggering code
     $em->triggerEvent("vtiger.entity.aftersave", $entityData);
     //Event triggering code ends
 }
开发者ID:vtiger-jp,项目名称:vtigercrm-5.1.x-ja,代码行数:24,代码来源:CRMEntity.php

示例9: relateEntities

/**
 * Function to related two records of different entity types
 */
function relateEntities($focus, $sourceModule, $sourceRecordId, $destinationModule, $destinationRecordIds)
{
    global $log, $adb;
    $log->debug("Entering relateEntities method ({$sourceModule}, {$sourceRecordId}, {$destinationModule}, {$destinationRecordIds})");
    require_once "include/events/include.inc";
    $em = new VTEventsManager($adb);
    $em->initTriggerCache();
    if (!is_array($destinationRecordIds)) {
        $destinationRecordIds = array($destinationRecordIds);
    }
    foreach ($destinationRecordIds as $destinationRecordId) {
        $data = array();
        $data['focus'] = $focus;
        $data['sourceModule'] = $sourceModule;
        $data['sourceRecordId'] = $sourceRecordId;
        $data['destinationModule'] = $destinationModule;
        $data['destinationRecordId'] = $destinationRecordId;
        $em->triggerEvent('vtiger.entity.link.before', $data);
        $focus->save_related_module($sourceModule, $sourceRecordId, $destinationModule, $destinationRecordId);
        $focus->trackLinkedInfo($sourceModule, $sourceRecordId, $destinationModule, $destinationRecordId);
        $em->triggerEvent('vtiger.entity.link.after', $data);
    }
    $log->debug("Exiting relateEntities method ...");
}
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:27,代码来源:utils.php

示例10: delete

 /**
  * Function to delete the group
  * @param <Settings_Groups_Record_Model> $transferToGroup
  */
 public function delete($transferToGroup)
 {
     $db = PearDatabase::getInstance();
     $groupId = $this->getId();
     $transferGroupId = $transferToGroup->getId();
     $em = new VTEventsManager($db);
     // Initialize Event trigger cache
     $em->initTriggerCache();
     $entityData = array();
     $entityData['groupid'] = $groupId;
     $entityData['transferToId'] = $transferGroupId;
     $em->triggerEvent("vtiger.entity.beforegroupdelete", $entityData);
     $this->transferOwnership($transferToGroup);
     deleteGroupRelatedSharingRules($groupId);
     $db->pquery('DELETE FROM vtiger_group2grouprel WHERE groupid=?', array($groupId));
     $db->pquery('DELETE FROM vtiger_group2role WHERE groupid=?', array($groupId));
     $db->pquery('DELETE FROM vtiger_group2rs WHERE groupid=?', array($groupId));
     $db->pquery('DELETE FROM vtiger_users2group WHERE groupid=?', array($groupId));
     $db->pquery("DELETE FROM vtiger_reportsharing WHERE shareid=? AND setype='groups'", array($groupId));
     $db->pquery('DELETE FROM vtiger_group2modules WHERE groupid=?', array($groupId));
     $db->pquery('DELETE FROM vtiger_groups WHERE groupid=?', array($groupId));
 }
开发者ID:JeRRimix,项目名称:YetiForceCRM,代码行数:26,代码来源:Record.php

示例11: undoImport

 function undoImport(Vtiger_Request $request)
 {
     $viewer = new Vtiger_Viewer();
     $db = PearDatabase::getInstance();
     $moduleName = $request->getModule();
     $ownerId = $request->get('foruser');
     $user = Users_Record_Model::getCurrentUserModel();
     $dbTableName = Import_Utils_Helper::getDbTableName($user);
     if (!$user->isAdminUser() && $user->id != $ownerId) {
         $viewer->assign('MESSAGE', 'LBL_PERMISSION_DENIED');
         $viewer->view('OperationNotPermitted.tpl', 'Vtiger');
         exit;
     }
     $previousBulkSaveMode = $VTIGER_BULK_SAVE_MODE;
     $VTIGER_BULK_SAVE_MODE = true;
     $query = "SELECT recordid FROM {$dbTableName} WHERE temp_status = ? AND recordid IS NOT NULL";
     //For inventory modules
     $inventoryModules = getInventoryModules();
     if (in_array($moduleName, $inventoryModules)) {
         $query .= ' GROUP BY subject';
     }
     //End
     $result = $db->pquery($query, array(Import_Data_Action::$IMPORT_RECORD_CREATED));
     $noOfRecords = $db->num_rows($result);
     $noOfRecordsDeleted = 0;
     $entityData = array();
     for ($i = 0; $i < $noOfRecords; $i++) {
         $recordId = $db->query_result($result, $i, 'recordid');
         if (isRecordExists($recordId) && isPermitted($moduleName, 'Delete', $recordId) == 'yes') {
             $recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
             $recordModel->setId($recordId);
             $recordModel->delete();
             $focus = $recordModel->getEntity();
             $focus->id = $recordId;
             $entityData[] = VTEntityData::fromCRMEntity($focus);
             $noOfRecordsDeleted++;
         }
     }
     $entity = new VTEventsManager($db);
     $entity->triggerEvent('vtiger.batchevent.delete', $entityData);
     $VTIGER_BULK_SAVE_MODE = $previousBulkSaveMode;
     $viewer->assign('FOR_MODULE', $moduleName);
     $viewer->assign('MODULE', 'Import');
     $viewer->assign('TOTAL_RECORDS', $noOfRecords);
     $viewer->assign('DELETED_RECORDS_COUNT', $noOfRecordsDeleted);
     $viewer->view('ImportUndoResult.tpl', 'Import');
 }
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:47,代码来源:Import.php

示例12: relateEntities

/**
 * Function to related two records of different entity types
 */
function relateEntities($focus, $sourceModule, $sourceRecordId, $destinationModule, $destinationRecordIds)
{
    $adb = PearDatabase::getInstance();
    $log = vglobal('log');
    $log->debug("Entering relateEntities method ({$sourceModule}, {$sourceRecordId}, {$destinationModule}, {$destinationRecordIds})");
    require_once "include/events/include.inc";
    $em = new VTEventsManager($adb);
    $em->initTriggerCache();
    if (!is_array($destinationRecordIds)) {
        $destinationRecordIds = [$destinationRecordIds];
    }
    $data = [];
    $data['CRMEntity'] = $focus;
    $data['entityData'] = VTEntityData::fromEntityId($adb, $sourceRecordId);
    $data['sourceModule'] = $sourceModule;
    $data['sourceRecordId'] = $sourceRecordId;
    $data['destinationModule'] = $destinationModule;
    foreach ($destinationRecordIds as $destinationRecordId) {
        $data['destinationRecordId'] = $destinationRecordId;
        $em->triggerEvent('vtiger.entity.link.before', $data);
        $focus->save_related_module($sourceModule, $sourceRecordId, $destinationModule, $destinationRecordId);
        $focus->trackLinkedInfo($sourceModule, $sourceRecordId, $destinationModule, $destinationRecordId);
        $em->triggerEvent('vtiger.entity.link.after', $data);
    }
    $log->debug("Exiting relateEntities method ...");
}
开发者ID:noclav,项目名称:UpdatePackages,代码行数:29,代码来源:utils.php

示例13: restore

 /** Function to restore a deleted record of specified module with given crmid
  * @param $module -- module name:: Type varchar
  * @param $entity_ids -- list of crmids :: Array
  */
 function restore($module, $id)
 {
     $db = PearDatabase::getInstance();
     $currentUser = vglobal('current_user');
     $db->startTransaction();
     $db->update('vtiger_crmentity', ['deleted' => 0, 'modifiedtime' => date('Y-m-d H:i:s'), 'modifiedby' => $currentUser->id], 'crmid = ?', [$id]);
     //Restore related entities/records
     $this->restoreRelatedRecords($module, $id);
     //Event triggering code
     require_once 'include/events/include.inc';
     $em = new VTEventsManager($db);
     // Initialize Event trigger cache
     $em->initTriggerCache();
     $this->id = $id;
     $entityData = VTEntityData::fromCRMEntity($this);
     //Event triggering code
     $em->triggerEvent('vtiger.entity.afterrestore', $entityData);
     //Event triggering code ends
     $db->completeTransaction();
 }
开发者ID:HoererUndFlamme,项目名称:YetiForceCRM,代码行数:24,代码来源:CRMEntity.php

示例14: Project

 require_once "modules/com_vtiger_workflow/VTWorkflowManager.inc";
 require_once "modules/com_vtiger_workflow/VTTaskManager.inc";
 require_once "modules/com_vtiger_workflow/VTWorkflowApplication.inc";
 require_once "modules/com_vtiger_workflow/VTEntityMethodManager.inc";
 require_once "include/utils/CommonUtils.php";
 require_once "include/events/SqlResultIterator.inc";
 require_once "modules/com_vtiger_workflow/VTWorkflowUtils.php";
 require_once "modules/Project/Project.php";
 $focus1 = new Project();
 $focus1->retrieve_entity_info($pcdetailsproject, "Project");
 $focus1->id = $pcdetailsproject;
 $em = new VTEventsManager($adb);
 // Initialize Event trigger cache
 $em->initTriggerCache();
 $entityData = VTEntityData::fromCRMEntity($focus1);
 $em->triggerEvent("vtiger.entity.beforesave.modifiable", $entityData);
 $em->triggerEvent("vtiger.entity.beforesave", $entityData);
 $em->triggerEvent("vtiger.entity.beforesave.final", $entityData);
 $em->triggerEvent("vtiger.entity.aftersave", $entityData);
 //}
 $projectQuery1 = $adb->query("select * from vtiger_project where projectid={$pcdetailsproject}");
 if ($adb->query_result($projectQuery1, 0, "substatusproj") == "CAT_parts sent by Teknema" && $adb->query_result($projectQuery1, 0, "statopartech") == 'SHIPPED') {
     $logpart .= "Movimento frecce avvenuto con successo </span><br><br>";
     $logs[$i - 1] .= "Movimento frecce avvenuto con successo";
 } elseif ($subs != "CAT_parts request" && strstr($subs, "attesa parti") != '' && $adb->query_result($projectQuery1, 0, "statopartech") == 'SHIPPED') {
     $logpart .= "<span style='color:blue'> Substatus errato {$d['2']} </span></span><br><br>";
     $logs[$i - 1] .= "Substatus errato {$d['2']}";
 } else {
     $logpart .= "Substatus non modificato </span><br><br>";
     $logs[$i - 1] .= "Substatus non modificato";
 }
开发者ID:evolutivo,项目名称:test,代码行数:31,代码来源:chiamataShippedadoc.php

示例15: trigger

 /**
  * Trigger event based on CRM Record
  * @param String Name of the Event to trigger
  * @param Integer CRM record id on which event needs to be triggered.
  */
 static function trigger($eventname, $crmid)
 {
     if (!self::hasSupport()) {
         return;
     }
     $adb = PearDatabase::getInstance();
     $checkres = $adb->pquery("SELECT setype, crmid, deleted FROM vtiger_crmentity WHERE crmid=?", array($crmid));
     if ($adb->num_rows($checkres)) {
         $result = $adb->fetch_array($checkres, 0);
         if ($result['deleted'] == '0') {
             $module = $result['setype'];
             $moduleInstance = CRMEntity::getInstance($module);
             $moduleInstance->retrieve_entity_info($result['crmid'], $module);
             $moduleInstance->id = $result['crmid'];
             $current_user = vglobal('current_user');
             if (!$current_user) {
                 $current_user = new Users();
                 $current_user->id = $moduleInstance->column_fields['assigned_user_id'];
             }
             // Trigger the event
             $em = new VTEventsManager($adb);
             $em->triggerEvent($eventname, VTEntityData::fromCRMEntity($moduleInstance));
         }
     }
 }
开发者ID:yozhi,项目名称:YetiForceCRM,代码行数:30,代码来源:Event.php


注:本文中的VTEventsManager::triggerEvent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。