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

PHP VTEventsManager类代码示例

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

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



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

示例1: vt530_registerVTEntityDeltaApi

function vt530_registerVTEntityDeltaApi()
{
    $db = PearDatabase::getInstance();
    $em = new VTEventsManager($db);
    $em->registerHandler('vtiger.entity.beforesave', 'data/VTEntityDelta.php', 'VTEntityDelta');
    $em->registerHandler('vtiger.entity.aftersave', 'data/VTEntityDelta.php', 'VTEntityDelta');
}
开发者ID:hbsman,项目名称:vtigercrm-5.3.0-ja,代码行数:7,代码来源:521_to_530rc.php


示例2: registerEvent

function registerEvent($event)
{
    global $adb;
    $em = new VTEventsManager($adb);
    $em->registerHandler($event, 'build/HelperScripts/coreBOSEventsExample.php', 'coreBOSEventsExample');
    echo "<h4>Event {$event} registered.</h4>";
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:7,代码来源:coreBOSEventsLoader.php


示例3: applyChange

 function applyChange()
 {
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         $this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
     } else {
         global $adb;
         if (vtlib_isModuleActive("Timecontrol") && !vtlib_isModuleActive("Task")) {
             $result = $adb->pquery("SELECT eventhandler_id FROM vtiger_eventhandlers WHERE handler_path = 'modules/Timecontrol/convertTZListView.php'", array());
             if ($adb->num_rows($result) == 0) {
                 $result = $adb->pquery("SELECT eventhandler_id FROM vtiger_eventhandlers WHERE handler_path = 'modules/Task/convertTZListView.php'", array());
                 if ($adb->num_rows($result) == 1) {
                     $handler_id = $adb->query_result($result, 0, 'eventhandler_id');
                     $this->ExecuteQuery("UPDATE vtiger_eventhandlers SET handler_path = 'modules/Timecontrol/convertTZListView.php', handler_class = 'convertTZListViewOnTimecontrol' WHERE eventhandler_id = ?", array($handler_id));
                 } else {
                     $em = new VTEventsManager($adb);
                     $em->registerHandler('corebos.filter.listview.render', 'modules/Timecontrol/convertTZListView.php', 'convertTZListViewOnTimecontrol');
                 }
             }
         } elseif (vtlib_isModuleActive("Timecontrol") && vtlib_isModuleActive("Task")) {
             $result = $adb->pquery("SELECT eventhandler_id FROM vtiger_eventhandlers WHERE handler_path = 'modules/Timecontrol/convertTZListView.php'", array());
             if ($adb->num_rows($result) == 0) {
                 $em = new VTEventsManager($adb);
                 $em->registerHandler('corebos.filter.listview.render', 'modules/Timecontrol/convertTZListView.php', 'convertTZListViewOnTimecontrol');
             }
         }
         $this->sendMsg('Changeset ' . get_class($this) . ' applied!');
         $this->markApplied(false);
     }
     $this->finishExecution();
 }
开发者ID:kduqi,项目名称:corebos,代码行数:33,代码来源:fixEventHandlerPathForConvertTZ.php


示例4: process

 public function process(Vtiger_Request $request)
 {
     $adb = \PearDatabase::getInstance();
     switch ($request->get('option')) {
         case 'recreateUserPrivilegs':
             $sql = 'SELECT id FROM vtiger_users WHERE status = "Active"';
             $result = $adb->query($sql);
             require_once 'modules/Users/CreateUserPrivilegeFile.php';
             while ($row = $adb->fetchByAssoc($result)) {
                 createUserPrivilegesfile($row['id']);
                 createUserSharingPrivilegesfile($row['id']);
                 ini_set('display_errors', 1);
                 global $root_directory;
                 require_once $root_directory . 'user_privileges/user_privileges_' . $row['id'] . '.php';
                 require_once $root_directory . 'user_privileges/sharing_privileges_' . $row['id'] . '.php';
             }
             break;
         case 'enableModComments':
             $commentsModuleModel = Vtiger_Module_Model::getInstance('ModComments');
             if ($commentsModuleModel && $commentsModuleModel->isActive()) {
                 $relatedToFieldResult = $adb->pquery('SELECT fieldid FROM vtiger_field WHERE fieldname = ? AND tabid = ?', array('related_to', $commentsModuleModel->getId()));
                 $fieldId = $adb->query_result($relatedToFieldResult, 0, 'fieldid');
                 $sql = 'SELECT * FROM vtiger_tab WHERE (isentitytype = 1  AND presence = 0) OR name = "Events"';
                 $result = $adb->query($sql);
                 while ($row = $adb->fetchByAssoc($result)) {
                     $sql = 'SELECT fieldid FROM vtiger_fieldmodulerel WHERE fieldid = ? AND module = "ModComments" AND relmodule = ?';
                     $check = $adb->pquery($sql, array($fieldId, $row['name']));
                     if ($adb->num_rows($check) == 0) {
                         $sql = 'INSERT INTO vtiger_fieldmodulerel SET fieldid = ?, module = "ModComments", relmodule = ?';
                         $adb->pquery($sql, array($fieldId, $row['name']));
                     }
                 }
             }
             break;
         case 'initFilterSortOrder':
             \SwVtTools\DbCheck::checkColumn('vtiger_customview', 'order_col', 'VARCHAR(255)');
             \SwVtTools\DbCheck::checkColumn('vtiger_customview', 'order_dir', 'VARCHAR(4)');
             \SwVtTools\DbCheck::checkColumn('vtiger_customview', 'order_numeric_check', 'TINYINT');
             \SwVtTools\DbCheck::checkColumn('vtiger_customview', 'order_numeric', 'VARCHAR(10)');
             $adb = PearDatabase::getInstance();
             $em = new VTEventsManager($adb);
             // Registering event for Recurring Invoices
             $em->registerHandler('vtiger.filter.process.customview.editajax.view.before', 'modules/SwVtTools/EventHandler.php', 'SwVtToolsEventHandler', "");
             $em->registerHandler('vtiger.process.customview.editajax.view.finish', 'modules/SwVtTools/EventHandler.php', 'SwVtToolsEventHandler', "");
             $em->registerHandler('vtiger.filter.process.customview.save.action.before', 'modules/SwVtTools/EventHandler.php', 'SwVtToolsEventHandler', "");
             $em->registerHandler('vtiger.filter.listview.orderby', 'modules/SwVtTools/EventHandler.php', 'SwVtToolsEventHandler', "");
             break;
     }
 }
开发者ID:Neodracir,项目名称:VtigerCRM-Tools,代码行数:49,代码来源:GeneralOptions.php


示例5: applyChange

 function applyChange()
 {
     global $adb;
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         $this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
     } else {
         $em = new VTEventsManager($adb);
         $em->registerHandler('vtiger.entity.aftersave', 'modules/PBXManager/PBXManagerHandler.php', 'PBXManagerAfterSaveCreateActivity');
         $this->sendMsg('Changeset ' . get_class($this) . ' applied!');
         $this->markApplied();
     }
     $this->finishExecution();
 }
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:16,代码来源:PBXManagerAfterSaveCreateActivity.php


示例6: vtlib_handler

    /**
     * Invoked when special actions are performed on the module.
     * @param String Module name
     * @param String Event Type
     */
    function vtlib_handler($moduleName, $eventType)
    {
        require_once 'include/utils/utils.php';
        global $adb;
        if ($eventType == 'module.postinstall') {
            $fieldid = $adb->getUniqueID('vtiger_settings_field');
            $blockid = getSettingsBlockId('LBL_MODULE_MANAGER');
            $seq_res = $adb->query("SELECT max(sequence) AS max_seq FROM vtiger_settings_field");
            $seq = 1;
            if ($adb->num_rows($seq_res) > 0) {
                $cur_seq = $adb->query_result($seq_res, 0, 'max_seq');
                if ($cur_seq != null) {
                    $seq = $cur_seq + 1;
                }
            }
            $adb->pquery('INSERT INTO vtiger_settings_field(fieldid, blockid, name, iconpath, description, linkto, sequence) 
				VALUES (?,?,?,?,?,?,?)', array($fieldid, $blockid, 'LBL_FIELDFORMULAS', 'modules/FieldFormulas/resources/FieldFormulas.png', 'LBL_FIELDFORMULAS_DESCRIPTION', 'index.php?module=FieldFormulas&action=index&parenttab=Settings', $seq));
            $tabid = getTabid('FieldFormulas');
            if (isset($tabid) && $tabid != '') {
                $adb->pquery('DELETE FROM vtiger_profile2tab WHERE tabid = ?', array($tabid));
            }
            // Mark the module as Standard module
            $adb->pquery('UPDATE vtiger_tab SET customized=0 WHERE name=?', array($moduleName));
        } else {
            if ($eventType == 'module.disabled') {
                $em = new VTEventsManager($adb);
                $em->setHandlerInActive('VTFieldFormulasEventHandler');
            } else {
                if ($eventType == 'module.enabled') {
                    $em = new VTEventsManager($adb);
                    $em->setHandlerActive('VTFieldFormulasEventHandler');
                } else {
                    if ($eventType == 'module.preuninstall') {
                        // TODO Handle actions when this module is about to be deleted.
                    } else {
                        if ($eventType == 'module.preupdate') {
                            // TODO Handle actions before this module is updated.
                        } else {
                            if ($eventType == 'module.postupdate') {
                                // TODO Handle actions after this module is updated.
                            }
                        }
                    }
                }
            }
        }
    }
开发者ID:hbsman,项目名称:vtigercrm-5.3.0-ja,代码行数:52,代码来源:FieldFormulas.php


示例7: vtlib_handler

    /**
     * Invoked when special actions are performed on the module.
     * @param String Module name
     * @param String Event Type
     */
    function vtlib_handler($moduleName, $eventType)
    {
        global $adb, $currentModule;
        $modtrackerModule = Vtiger_Module::getInstance($currentModule);
        $otherModuleNames = $this->getModTrackerEnabledModules();
        if ($eventType == 'module.postinstall') {
            $adb->pquery('UPDATE vtiger_tab SET customized=0 WHERE name=?', array($moduleName));
            $fieldid = $adb->getUniqueID('vtiger_settings_field');
            $blockid = getSettingsBlockId('LBL_OTHER_SETTINGS');
            $seq_res = $adb->pquery("SELECT max(sequence) AS max_seq FROM vtiger_settings_field WHERE blockid = ?", array($blockid));
            if ($adb->num_rows($seq_res) > 0) {
                $cur_seq = $adb->query_result($seq_res, 0, 'max_seq');
                if ($cur_seq != null) {
                    $seq = $cur_seq + 1;
                }
            }
            $adb->pquery('INSERT INTO vtiger_settings_field(fieldid, blockid, name, iconpath, description, linkto, sequence)
				VALUES (?,?,?,?,?,?,?)', array($fieldid, $blockid, 'ModTracker', 'set-IcoLoginHistory.gif', 'LBL_MODTRACKER_DESCRIPTION', 'index.php?module=ModTracker&action=BasicSettings&parenttab=Settings&formodule=ModTracker', $seq));
        } else {
            if ($eventType == 'module.disabled') {
                $em = new VTEventsManager($adb);
                $em->setHandlerInActive('ModTrackerHandler');
                // De-register Common Javascript
                $modtrackerModule->deleteLink('HEADERSCRIPT', 'ModTrackerCommon_JS');
            } else {
                if ($eventType == 'module.enabled') {
                    $em = new VTEventsManager($adb);
                    $em->setHandlerActive('ModTrackerHandler');
                    // Register Common Javascript
                    $modtrackerModule->addLink('HEADERSCRIPT', 'ModTrackerCommon_JS', 'modules/ModTracker/ModTrackerCommon.js');
                } else {
                    if ($eventType == 'module.preuninstall') {
                        // TODO Handle actions when this module is about to be deleted.
                    } else {
                        if ($eventType == 'module.preupdate') {
                            // TODO Handle actions before this module is updated.
                        } else {
                            if ($eventType == 'module.postupdate') {
                                // TODO Handle actions after this module is updated.
                            }
                        }
                    }
                }
            }
        }
    }
开发者ID:nouphet,项目名称:vtigercrm-6.0.0-ja,代码行数:51,代码来源:ModTracker.php


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


示例9: addHandler

 public function addHandler($addHandler = [])
 {
     $log = vglobal('log');
     $adb = PearDatabase::getInstance();
     $log->debug('Entering ' . __CLASS__ . '::' . __METHOD__ . ' method ...');
     if ($addHandler) {
         $em = new VTEventsManager($adb);
         foreach ($addHandler as $handler) {
             $result = $adb->pquery('SELECT * FROM `vtiger_eventhandlers` WHERE event_name = ? AND handler_class = ?;', [$handler[0], $handler[2]]);
             if ($result->rowCount() == 0) {
                 $em->registerHandler($handler[0], $handler[1], $handler[2], $handler[3], $handler[5]);
             }
         }
     }
     $log->debug('Exiting ' . __CLASS__ . '::' . __METHOD__ . ' method ...');
 }
开发者ID:noclav,项目名称:UpdatePackages,代码行数:16,代码来源:init.php


示例10: VTEventsManager

<?php

require_once 'include/utils/utils.php';
require 'include/events/include.inc';
$em = new VTEventsManager($adb);
$em->registerHandler("vtiger.entity.beforesave", "modules/Contacts/ContactosHandler.php", "ContactosHandler", "ModuleName in ['Contacts']");
echo 'Custom Handler Registered !';
开发者ID:jmangarret,项目名称:vtigercrm,代码行数:7,代码来源:handlerUpdateFirmas.php


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


示例12: array

//Avoid premature deletion of activity related records
$relatedToQuery = "SELECT fieldid FROM vtiger_field WHERE tabid=? AND fieldname=?";
$calendarInstance = Vtiger_Module::getInstance('Calendar');
$tabId = $calendarInstance->id;
$result = $adb->pquery($relatedToQuery, array($tabId, 'parent_id'));
$fieldId = $adb->query_result($result, 0, 'fieldid');
$insertQuery = "DELETE FROM vtiger_fieldmodulerel where fieldid=?";
$adb->pquery($insertQuery, array($fieldId));
//For contacts the fieldname is contact_id
$contactsRelatedToQuery = "SELECT fieldid FROM vtiger_field WHERE tabid=? AND fieldname=?";
$contactsResult = $adb->pquery($contactsRelatedToQuery, array($tabId, 'contact_id'));
$contactsFieldId = $adb->query_result($contactsResult, 0, 'fieldid');
$insertQuery = "DELETE FROM vtiger_fieldmodulerel where fieldid=?";
$adb->pquery($insertQuery, array($contactsFieldId));
$module = Vtiger_Module::getInstance('PBXManager');
$ev = new VTEventsManager($adb);
$ev->unregisterHandler('PBXManagerHandler');
$ev->unregisterHandler('PBXManagerBatchHandler');
if ($module) {
    $module->deleteRelatedLists();
    $module->deleteLinks();
    $module->delete();
    ExecuteQuery("DELETE FROM vtiger_def_org_share WHERE tabid=?", array($module->id));
}
ExecuteQuery("delete from vtiger_asterisk");
ExecuteQuery("DROP TABLE vtiger_pbxmanager");
ExecuteQuery("DROP TABLE vtiger_pbxmanager_phonelookup");
ExecuteQuery("DELETE FROM vtiger_links WHERE linktype=? AND linklabel=? AND linkurl=?", array('HEADERSCRIPT', 'Incoming Calls', 'modules/PBXManager/resources/PBXManagerJS.js'));
ExecuteQuery("DELETE FROM vtiger_relatedlists WHERE name=? and label=?", array('get_dependents_list', "PBXManager"));
vtws_deleteWebserviceEntity('PBXManager');
ExecuteQuery('DELETE FROM vtiger_settings_blocks WHERE label=?', array('LBL_INTEGRATION'));
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:31,代码来源:migrate_from_vt61.php


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


示例14: 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)
 {
     global $current_user, $adb;
     $this->db->println("TRANS restore starts {$module}");
     $this->db->startTransaction();
     $date_var = date("Y-m-d H:i:s");
     $query = 'UPDATE vtiger_crmentity SET deleted=0,modifiedtime=?,modifiedby=? WHERE crmid = ?';
     $this->db->pquery($query, array($this->db->formatDate($date_var, true), $current_user->id, $id), true, "Error restoring records :");
     //Restore related entities/records
     $this->restoreRelatedRecords($module, $id);
     //Event triggering code
     require_once "include/events/include.inc";
     global $adb;
     $em = new VTEventsManager($adb);
     // 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
     $this->db->completeTransaction();
     $this->db->println("TRANS restore ends");
 }
开发者ID:gitter-badger,项目名称:openshift-salesplatform,代码行数:28,代码来源:CRMEntity.php


示例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;
         $em = new VTEventsManager($adb);
         $em->registerHandler('vtiger.entity.aftersave', 'modules/Emails/evcbrcHandler.php', 'evcbrcHandler');
         $modPrj = Vtiger_Module::getInstance('Project');
         $modPrjTsk = Vtiger_Module::getInstance('ProjectTask');
         $modPot = Vtiger_Module::getInstance('Potentials');
         $modHD = Vtiger_Module::getInstance('HelpDesk');
         $modEmail = Vtiger_Module::getInstance('Emails');
         $modPrj->setRelatedList($modEmail, 'Emails', array('add'), 'get_emails');
         $modPrjTsk->setRelatedList($modEmail, 'Emails', array('add'), 'get_emails');
         $modPot->setRelatedList($modEmail, 'Emails', array('add'), 'get_emails');
         $modHD->setRelatedList($modEmail, 'Emails', array('add'), 'get_emails');
         $block = VTiger_Block::getInstance('LBL_PROJECT_INFORMATION', $modPrj);
         $field = Vtiger_Field::getInstance('email', $modPrj);
         if ($field) {
             $this->ExecuteQuery('update vtiger_field set presence=2 where fieldid=' . $field->id);
         } else {
             $field = new Vtiger_Field();
             $field->name = 'email';
             $field->uitype = 13;
             $field->label = 'Email';
             $field->columntype = 'VARCHAR(150)';
             $field->typeofdata = 'E~O';
             $field->displaytype = 2;
             $block->addField($field);
         }
         $block = VTiger_Block::getInstance('LBL_PROJECT_TASK_INFORMATION', $modPrjTsk);
         $field = Vtiger_Field::getInstance('email', $modPrjTsk);
         if ($field) {
             $this->ExecuteQuery('update vtiger_field set presence=2 where fieldid=' . $field->id);
         } else {
             $field = new Vtiger_Field();
             $field->name = 'email';
             $field->uitype = 13;
             $field->label = 'Email';
             $field->columntype = 'VARCHAR(150)';
             $field->typeofdata = 'E~O';
             $field->displaytype = 2;
             $block->addField($field);
         }
         $block = VTiger_Block::getInstance('LBL_OPPORTUNITY_INFORMATION', $modPot);
         $field = Vtiger_Field::getInstance('email', $modPot);
         if ($field) {
             $this->ExecuteQuery('update vtiger_field set presence=2 where fieldid=' . $field->id);
         } else {
             $field = new Vtiger_Field();
             $field->name = 'email';
             $field->uitype = 13;
             $field->label = 'Email';
             $field->columntype = 'VARCHAR(150)';
             $field->typeofdata = 'E~O';
             $field->displaytype = 2;
             $block->addField($field);
         }
         $block = VTiger_Block::getInstance('LBL_TICKET_INFORMATION', $modHD);
         $field = Vtiger_Field::getInstance('email', $modHD);
         if ($field) {
             $this->ExecuteQuery('update vtiger_field set presence=2 where fieldid=' . $field->id);
         } else {
             $field = new Vtiger_Field();
             $field->name = 'email';
             $field->uitype = 13;
             $field->label = 'Email';
             $field->columntype = 'VARCHAR(150)';
             $field->typeofdata = 'E~O';
             $field->displaytype = 2;
             $block->addField($field);
         }
         $this->sendMsg('Changeset ' . get_class($this) . ' applied!');
         $this->markApplied();
     }
     $this->finishExecution();
 }
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:82,代码来源:directemailPPTHP.php


示例16: triggerAfterSaveEventHandlers

 public function triggerAfterSaveEventHandlers()
 {
     $adb = PearDatabase::getInstance();
     require_once "include/events/include.inc";
     //In Bulk mode stop triggering events
     if (!self::isBulkSaveMode()) {
         $em = new VTEventsManager($adb);
         // Initialize Event trigger cache
         $em->initTriggerCache();
         $entityData = VTEntityData::fromCRMEntity($this);
     }
     //Event triggering code ends
     if ($em) {
         //Event triggering code
         $em->triggerEvent("vtiger.entity.aftersave", $entityData);
         $em->triggerEvent("vtiger.entity.aftersave.final", $entityData);
     }
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:18,代码来源:Users.php


示例17: 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) {
//.........这里部分代码省略.........
开发者ID:noclav,项目名称:UpdatePackages,代码行数:101,代码来源:init.php


示例18: VTEventsManager

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP VTTaskManager类代码示例发布时间:2022-05-23
下一篇:
PHP VTEntityData类代码示例发布时间: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