本文整理汇总了PHP中ModTracker类的典型用法代码示例。如果您正苦于以下问题:PHP ModTracker类的具体用法?PHP ModTracker怎么用?PHP ModTracker使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ModTracker类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: changeActiveStatus
public function changeActiveStatus($tabid, $status)
{
include_once 'modules/ModTracker/ModTracker.php';
$moduleModTrackerInstance = new ModTracker();
if ($status) {
$moduleModTrackerInstance->enableTrackingForModule($tabid);
} else {
$moduleModTrackerInstance->disableTrackingForModule($tabid);
}
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:10,代码来源:Module.php
示例2: 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;
if ($eventType == 'module.postinstall') {
include_once 'vtlib/Vtiger/Module.php';
$moduleInstance = CRMEntity::getInstance('RequirementCards');
$moduleInstance->setModuleSeqNumber("configure", 'RequirementCards', 'RC', '1');
$adb->pquery('UPDATE vtiger_tab SET customized=0 WHERE name=?', array('RequirementCards'));
$moduleInstance = Vtiger_Module::getInstance('RequirementCards');
$targetModule = Vtiger_Module::getInstance('Accounts');
$targetModule->setRelatedList($moduleInstance, 'RequirementCards', array('ADD'), 'get_dependents_list');
$modcommentsModuleInstance = Vtiger_Module::getInstance('ModComments');
if ($modcommentsModuleInstance && file_exists('modules/ModComments/ModComments.php')) {
include_once 'modules/ModComments/ModComments.php';
if (class_exists('ModComments')) {
ModComments::addWidgetTo(array('RequirementCards'));
}
}
$modcommentsModuleInstance = Vtiger_Module::getInstance('ModTracker');
if ($modcommentsModuleInstance && file_exists('modules/ModTracker/ModTracker.php')) {
include_once 'vtlib/Vtiger/Module.php';
include_once 'modules/ModTracker/ModTracker.php';
$tabid = Vtiger_Functions::getModuleId('RequirementCards');
$moduleModTrackerInstance = new ModTracker();
if (!$moduleModTrackerInstance->isModulePresent($tabid)) {
$res = $adb->pquery("INSERT INTO vtiger_modtracker_tabs VALUES(?,?)", array($tabid, 1));
$moduleModTrackerInstance->updateCache($tabid, 1);
} else {
$updatevisibility = $adb->pquery("UPDATE vtiger_modtracker_tabs SET visible = 1 WHERE tabid = ?", array($tabid));
$moduleModTrackerInstance->updateCache($tabid, 1);
}
if (!$moduleModTrackerInstance->isModTrackerLinkPresent($tabid)) {
$moduleInstance = Vtiger_Module::getInstance($tabid);
$moduleInstance->addLink('DETAILVIEWBASIC', 'View History', "javascript:ModTrackerCommon.showhistory('\$RECORD\$')", '', '', array('path' => 'modules/ModTracker/ModTracker.php', 'class' => 'ModTracker', 'method' => 'isViewPermitted'));
}
}
} else {
if ($eventType == 'module.disabled') {
// TODO Handle actions before this module is being uninstalled.
} 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:rcrrich,项目名称:UpdatePackages,代码行数:59,代码来源:RequirementCards.php
示例3: vtlib_handler
/**
* Invoked when special actions are performed on the module.
* @param String Module name
* @param String Event Type (module.postinstall, module.disabled, module.enabled, module.preuninstall)
*/
function vtlib_handler($modulename, $event_type)
{
$adb = PearDatabase::getInstance();
if ($event_type == 'module.postinstall') {
$ModuleInstance = CRMEntity::getInstance($modulename);
$ModuleInstance->setModuleSeqNumber("configure", $modulename, '', '1');
$modcommentsModuleInstance = Vtiger_Module::getInstance('ModComments');
if ($modcommentsModuleInstance && file_exists('modules/ModComments/ModComments.php')) {
include_once 'modules/ModComments/ModComments.php';
if (class_exists('ModComments')) {
ModComments::addWidgetTo(array('Payments'));
}
}
$adb->pquery('UPDATE vtiger_tab SET customized=0 WHERE name=?', array($modulename));
$tabid = Vtiger_Functions::getModuleId($modulename);
include_once 'modules/ModTracker/ModTracker.php';
$moduleModTrackerInstance = new ModTracker();
if (!$moduleModTrackerInstance->isModulePresent($tabid)) {
$res = $adb->pquery("INSERT INTO vtiger_modtracker_tabs VALUES(?,?)", array($tabid, 1));
$moduleModTrackerInstance->updateCache($tabid, 1);
} else {
$updatevisibility = $adb->pquery("UPDATE vtiger_modtracker_tabs SET visible = 1 WHERE tabid = ?", array($tabid));
$moduleModTrackerInstance->updateCache($tabid, 1);
}
if (!$moduleModTrackerInstance->isModTrackerLinkPresent($tabid)) {
$moduleInstance = Vtiger_Module::getInstance($tabid);
$moduleInstance->addLink('DETAILVIEWBASIC', 'View History', "javascript:ModTrackerCommon.showhistory('\$RECORD\$')", '', '', array('path' => 'modules/ModTracker/ModTracker.php', 'class' => 'ModTracker', 'method' => 'isViewPermitted'));
}
$this->addWorkflow($modulename);
} else {
if ($event_type == 'module.disabled') {
// TODO Handle actions when this module is disabled.
} else {
if ($event_type == 'module.enabled') {
// TODO Handle actions when this module is enabled.
} else {
if ($event_type == 'module.preuninstall') {
// TODO Handle actions when this module is about to be deleted.
} else {
if ($event_type == 'module.preupdate') {
// TODO Handle actions before this module is updated.
} else {
if ($event_type == 'module.postupdate') {
}
}
}
}
}
}
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:55,代码来源:PaymentsOut.php
示例4: modTrac_changeModuleVisibility
static function modTrac_changeModuleVisibility($tabid, $status)
{
if ($status == 'module_disable') {
ModTracker::disableTrackingForModule($tabid);
} else {
ModTracker::enableTrackingForModule($tabid);
}
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:8,代码来源:ModTrackerUtils.php
示例5: handleEvent
function handleEvent($eventName, $data)
{
global $log, $current_module, $adb, $current_user;
$moduleName = $data->getModuleName();
$flag = ModTracker::isTrackingEnabledForModule($moduleName);
if ($flag) {
if ($eventName == 'vtiger.entity.aftersave.final') {
$recordId = $data->getId();
$columnFields = $data->getData();
$vtEntityDelta = new VTEntityDelta();
$delta = $vtEntityDelta->getEntityDelta($moduleName, $recordId, true);
$newerEntity = $vtEntityDelta->getNewEntity($moduleName, $recordId);
$newerColumnFields = $newerEntity->getData();
if (is_array($delta)) {
$inserted = false;
foreach ($delta as $fieldName => $values) {
if ($fieldName != 'modifiedtime') {
if (!$inserted) {
$checkRecordPresentResult = $adb->pquery('SELECT * FROM vtiger_modtracker_basic WHERE
crmid = ?', array($recordId));
if ($adb->num_rows($checkRecordPresentResult)) {
$status = ModTracker::$UPDATED;
} else {
$status = ModTracker::$CREATED;
}
// get modified time from database in case it has been hidden in GUI
$crmrs = $adb->pquery('select modifiedtime from vtiger_crmentity where crmid=?', array($recordId));
$modtime = $adb->query_result($crmrs, 0, 0);
$this->id = $adb->getUniqueId('vtiger_modtracker_basic');
$adb->pquery('INSERT INTO vtiger_modtracker_basic(id, crmid, module, whodid, changedon, status)
VALUES(?,?,?,?,?,?)', array($this->id, $recordId, $moduleName, $current_user->id, $modtime, $status));
$inserted = true;
}
$adb->pquery('INSERT INTO vtiger_modtracker_detail(id,fieldname,prevalue,postvalue) VALUES(?,?,?,?)', array($this->id, $fieldName, $values['oldValue'], $values['currentValue']));
}
}
}
}
if ($eventName == 'vtiger.entity.beforedelete') {
$recordId = $data->getId();
$columnFields = $data->getData();
$id = $adb->getUniqueId('vtiger_modtracker_basic');
$adb->pquery('INSERT INTO vtiger_modtracker_basic(id, crmid, module, whodid, changedon, status)
VALUES(?,?,?,?,?,?)', array($id, $recordId, $moduleName, $current_user->id, date('Y-m-d H:i:s', time()), ModTracker::$DELETED));
}
if ($eventName == 'vtiger.entity.afterrestore') {
$recordId = $data->getId();
$columnFields = $data->getData();
$id = $adb->getUniqueId('vtiger_modtracker_basic');
$adb->pquery('INSERT INTO vtiger_modtracker_basic(id, crmid, module, whodid, changedon, status)
VALUES(?,?,?,?,?,?)', array($id, $recordId, $moduleName, $current_user->id, date('Y-m-d H:i:s', time()), ModTracker::$RESTORED));
}
}
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:54,代码来源:ModTrackerHandler.php
示例6: transferRecordsOwnership
public function transferRecordsOwnership($module, $transferOwnerId, $relatedModuleRecordIds)
{
$currentUser = vglobal('current_user');
$db = PearDatabase::getInstance();
$db->update('vtiger_crmentity', ['smownerid' => $transferOwnerId, 'modifiedby' => $currentUser->id, 'modifiedtime' => date('Y-m-d H:i:s')], 'crmid IN (' . implode(',', $relatedModuleRecordIds) . ')');
vimport('~modules/ModTracker/ModTracker.php');
$flag = ModTracker::isTrackingEnabledForModule($module);
if ($flag) {
foreach ($relatedModuleRecordIds as $record) {
$id = $db->getUniqueID('vtiger_modtracker_basic');
$query = 'INSERT INTO vtiger_modtracker_basic ( id, whodid, whodidsu, changedon, crmid, module ) SELECT ? , ? , ?, ?, crmid, setype FROM vtiger_crmentity WHERE crmid = ?';
$db->pquery($query, [$id, $currentUser->id, Vtiger_Session::get('baseUserId'), date('Y-m-d H:i:s', time()), $record]);
$query = 'INSERT INTO vtiger_modtracker_detail ( id, fieldname, postvalue , prevalue ) SELECT ? , ? ,? , smownerid FROM vtiger_crmentity WHERE crmid = ?';
$db->pquery($query, [$id, 'assigned_user_id', $currentUser->id, $record]);
}
}
}
开发者ID:awflu,项目名称:YetiForceCRM,代码行数:17,代码来源:TransferOwnership.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)
{
require_once 'include/utils/utils.php';
$adb = PearDatabase::getInstance();
if ($eventType == 'module.postinstall') {
include_once 'vtlib/Vtiger/Module.php';
$myCustomEntity = CRMEntity::getInstance($moduleName);
$myCustomEntity->setModuleSeqNumber("configure", $moduleName, '', '1');
$adb->query("UPDATE vtiger_tab SET customized=0 WHERE name='{$moduleName}'");
$modcommentsModuleInstance = Vtiger_Module::getInstance('ModTracker');
if ($modcommentsModuleInstance && file_exists('modules/ModTracker/ModTracker.php')) {
include_once 'vtlib/Vtiger/Module.php';
include_once 'modules/ModTracker/ModTracker.php';
$tabid = Vtiger_Functions::getModuleId($moduleName);
$moduleModTrackerInstance = new ModTracker();
if (!$moduleModTrackerInstance->isModulePresent($tabid)) {
$res = $adb->pquery("INSERT INTO vtiger_modtracker_tabs VALUES(?,?)", array($tabid, 1));
$moduleModTrackerInstance->updateCache($tabid, 1);
} else {
$updatevisibility = $adb->pquery("UPDATE vtiger_modtracker_tabs SET visible = 1 WHERE tabid = ?", array($tabid));
$moduleModTrackerInstance->updateCache($tabid, 1);
}
}
} else {
if ($eventType == 'module.readonly="readonly"') {
// TODO Handle actions when this module is readonly="readonly".
} else {
if ($eventType == 'module.enabled') {
// TODO Handle actions when this module is enabled.
} 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') {
}
}
}
}
}
}
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:49,代码来源:Calculations.php
示例8: vtlib_handler
/**
* Invoked when special actions are performed on the module.
* @param String Module name
* @param String Event Type (module.postinstall, module.disabled, module.enabled, module.preuninstall)
*/
function vtlib_handler($modulename, $event_type)
{
$adb = PearDatabase::getInstance();
if ($event_type == 'module.postinstall') {
$ModuleInstance = CRMEntity::getInstance($modulename);
$ModuleInstance->setModuleSeqNumber("configure", $modulename, '', '1');
$modcommentsModuleInstance = Vtiger_Module::getInstance('ModComments');
if ($modcommentsModuleInstance && file_exists('modules/ModComments/ModComments.php')) {
include_once 'modules/ModComments/ModComments.php';
if (class_exists('ModComments')) {
ModComments::addWidgetTo(array('Payments'));
}
}
$adb->pquery('UPDATE vtiger_tab SET customized=0 WHERE name=?', array($modulename));
$tabid = Vtiger_Functions::getModuleId($modulename);
include_once 'modules/ModTracker/ModTracker.php';
$moduleModTrackerInstance = new ModTracker();
if (!$moduleModTrackerInstance->isModulePresent($tabid)) {
$res = $adb->pquery("INSERT INTO vtiger_modtracker_tabs VALUES(?,?)", array($tabid, 1));
$moduleModTrackerInstance->updateCache($tabid, 1);
} else {
$updatevisibility = $adb->pquery("UPDATE vtiger_modtracker_tabs SET visible = 1 WHERE tabid = ?", array($tabid));
$moduleModTrackerInstance->updateCache($tabid, 1);
}
if (!$moduleModTrackerInstance->isModTrackerLinkPresent($tabid)) {
$moduleInstance = Vtiger_Module::getInstance($tabid);
$moduleInstance->addLink('DETAILVIEWBASIC', 'View History', "javascript:ModTrackerCommon.showhistory('\$RECORD\$')", '', '', array('path' => 'modules/ModTracker/ModTracker.php', 'class' => 'ModTracker', 'method' => 'isViewPermitted'));
}
vimport('~~vtlib/Vtiger/Module.php');
$moduleInstance = Vtiger_Module::getInstance('Invoice');
$blockInstance = Vtiger_Block::getInstance('LBL_INVOICE_INFORMATION', $moduleInstance);
$fieldInstance = new Vtiger_Field();
$fieldInstance->name = 'payment_balance';
$fieldInstance->table = 'vtiger_invoice';
$fieldInstance->label = 'Payment balance';
$fieldInstance->column = 'payment_balance';
$fieldInstance->columntype = 'decimal(25,8)';
$fieldInstance->uitype = 7;
$fieldInstance->typeofdata = 'NN~O';
$fieldInstance->displaytype = 2;
$blockInstance->addField($fieldInstance);
$moduleInstance = Vtiger_Module::getInstance('Accounts');
$blockInstance = Vtiger_Block::getInstance('LBL_ACCOUNT_INFORMATION', $moduleInstance);
$fieldInstance = new Vtiger_Field();
$fieldInstance->name = 'payment_balance';
$fieldInstance->table = 'vtiger_account';
$fieldInstance->label = 'Payment balance';
$fieldInstance->column = 'payment_balance';
$fieldInstance->columntype = 'decimal(25,8)';
$fieldInstance->uitype = 7;
$fieldInstance->typeofdata = 'NN~O';
$fieldInstance->displaytype = 2;
$blockInstance->addField($fieldInstance);
$moduleInstance = Vtiger_Module::getInstance('Potentials');
$blockInstance = Vtiger_Block::getInstance('LBL_OPPORTUNITY_INFORMATION', $moduleInstance);
$fieldInstance = new Vtiger_Field();
$fieldInstance->name = 'payment_balance';
$fieldInstance->table = 'vtiger_potential';
$fieldInstance->label = 'Payment balance';
$fieldInstance->column = 'payment_balance';
$fieldInstance->columntype = 'decimal(25,8)';
$fieldInstance->uitype = 7;
$fieldInstance->typeofdata = 'NN~O';
$fieldInstance->displaytype = 2;
$blockInstance->addField($fieldInstance);
$this->addWorkflow($modulename);
$this->addWorkflow('Invoice');
} else {
if ($event_type == 'module.disabled') {
// TODO Handle actions when this module is disabled.
} else {
if ($event_type == 'module.enabled') {
// TODO Handle actions when this module is enabled.
} else {
if ($event_type == 'module.preuninstall') {
// TODO Handle actions when this module is about to be deleted.
} else {
if ($event_type == 'module.preupdate') {
// TODO Handle actions before this module is updated.
} else {
if ($event_type == 'module.postupdate') {
}
}
}
}
}
}
}
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:93,代码来源:PaymentsIn.php
示例9: trackUnLinkedInfo
/**
* Function to track when a record is unlinked to a given record
*/
function trackUnLinkedInfo($module, $crmid, $with_module, $with_crmid)
{
global $current_user;
$adb = PearDatabase::getInstance();
$currentTime = date('Y-m-d H:i:s');
$adb->pquery('UPDATE vtiger_crmentity SET modifiedtime = ?, modifiedby = ? WHERE crmid = ?', array($currentTime, $current_user->id, $crmid));
// @Note: We should extend this to event handlers
if (vtlib_isModuleActive('ModTracker')) {
//Track the time the relation was deleted
require_once 'modules/ModTracker/ModTracker.php';
ModTracker::unLinkRelation($module, $crmid, $with_module, $with_crmid);
}
}
开发者ID:gitter-badger,项目名称:openshift-salesplatform,代码行数:16,代码来源:CRMEntity.php
示例10: enableTracking
public function enableTracking()
{
$log = vglobal('log');
$log->debug('Entering ' . __CLASS__ . '::' . __METHOD__ . ' method ...');
include_once 'modules/ModTracker/ModTracker.php';
ModTracker::enableTrackingForModule(Vtiger_Functions::getModuleId('OSSTimeControl'));
$log->debug('Exiting ' . __CLASS__ . '::' . __METHOD__ . ' method ...');
}
开发者ID:noclav,项目名称:UpdatePackages,代码行数:8,代码来源:init.php
示例11: vtws_history
function vtws_history($element, $user)
{
$MAXLIMIT = 100;
$adb = PearDatabase::getInstance();
// Mandatory input validation
if (empty($element['module']) && empty($element['record'])) {
throw new WebServiceException(WebServiceErrorCode::$MANDFIELDSMISSING, "Missing mandatory input values.");
}
if (!CRMEntity::getInstance('ModTracker') || !vtlib_isModuleActive('ModTracker')) {
throw new WebServiceException("TRACKING_MODULE_NOT_ACTIVE", "Tracking module not active.");
}
$idComponents = NULL;
$moduleName = $element['module'];
$record = $element['record'];
$mode = empty($element['mode']) ? 'Private' : $element['mode'];
// Private or All
$page = empty($element['page']) ? 0 : intval($element['page']);
// Page to start
$acrossAllModule = false;
if ($moduleName == 'Home') {
$acrossAllModule = true;
}
// Pre-condition check
if (empty($moduleName)) {
$moduleName = Mobile_WS_Utils::detectModulenameFromRecordId($record);
$idComponents = vtws_getIdComponents($record);
// We have it - as the input is validated.
}
if (!$acrossAllModule && !ModTracker::isTrackingEnabledForModule($moduleName)) {
throw new WebServiceException("Module_NOT_TRACKED", "Module not tracked for changes.");
}
// Per-condition has been met, perform the operation
$sql = '';
$params = array();
// REFER: modules/ModTracker/ModTracker.php
// Two split phases for data extraction - so we can apply limit of retrieveal at record level.
$sql = 'SELECT vtiger_modtracker_basic.* FROM vtiger_modtracker_basic
INNER JOIN vtiger_crmentity ON vtiger_modtracker_basic.crmid = vtiger_crmentity.crmid
AND vtiger_crmentity.deleted = 0';
if ($mode == 'Private') {
$sql .= ' WHERE vtiger_modtracker_basic.whodid = ?';
$params[] = $user->getId();
} else {
if ($mode == 'All') {
if ($acrossAllModule) {
// TODO collate only active (or enabled) modules for tracking.
} else {
if ($moduleName) {
$sql .= ' WHERE vtiger_modtracker_basic.module = ?';
$params[] = $moduleName;
} else {
$sql .= ' WHERE vtiger_modtracker_basic.crmid = ?';
$params[] = $idComponents[1];
}
}
}
}
// Get most recently tracked changes with limit
$start = $page * $MAXLIMIT;
if ($start > 0) {
$start = $start + 1;
}
// Adjust the start range
$sql .= sprintf(' ORDER BY vtiger_modtracker_basic.id DESC LIMIT %s,%s', $start, $MAXLIMIT);
$result = $adb->pquery($sql, $params);
$recordValuesMap = array();
$orderedIds = array();
while ($row = $adb->fetch_array($result)) {
$orderedIds[] = $row['id'];
$whodid = vtws_history_entityIdHelper('Users', $row['whodid']);
$crmid = vtws_history_entityIdHelper($acrossAllModule ? '' : $moduleName, $row['crmid']);
$status = $row['status'];
$statuslabel = '';
switch ($status) {
case ModTracker::$UPDATED:
$statuslabel = 'updated';
break;
case ModTracker::$DELETED:
$statuslabel = 'deleted';
break;
case ModTracker::$CREATED:
$statuslabel = 'created';
break;
case ModTracker::$RESTORED:
$statuslabel = 'restored';
break;
case ModTracker::$LINK:
$statuslabel = 'link';
break;
case ModTracker::$UNLINK:
$statuslabel = 'unlink';
break;
}
$item['modifieduser'] = $whodid;
$item['id'] = $crmid;
$item['modifiedtime'] = $row['changedon'];
$item['status'] = $status;
$item['statuslabel'] = $statuslabel;
$item['values'] = array();
$recordValuesMap[$row['id']] = $item;
//.........这里部分代码省略.........
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:101,代码来源:History.php
示例12: handleEvent
function handleEvent($eventName, $data)
{
$adb = PearDatabase::getInstance();
$current_user = vglobal('current_user');
$log = vglobal('log');
$current_module = vglobal('current_module');
if (!is_object($data)) {
$extendedData = $data;
$data = $extendedData['entityData'];
}
$moduleName = $data->getModuleName();
$flag = ModTracker::isTrackingEnabledForModule($moduleName);
if ($flag) {
if ($eventName == 'vtiger.entity.aftersave.final') {
$recordId = $data->getId();
$columnFields = $data->getData();
$vtEntityDelta = new VTEntityDelta();
$delta = $vtEntityDelta->getEntityDelta($moduleName, $recordId, true);
$newerEntity = $vtEntityDelta->getNewEntity($moduleName, $recordId);
$newerColumnFields = $newerEntity->getData();
$newerColumnFields = array_change_key_case($newerColumnFields, CASE_LOWER);
$delta = array_change_key_case($delta, CASE_LOWER);
if (is_array($delta)) {
$inserted = false;
foreach ($delta as $fieldName => $values) {
if ($fieldName != 'modifiedtime') {
if (!$inserted) {
$checkRecordPresentResult = $adb->pquery('SELECT * FROM vtiger_modtracker_basic WHERE crmid = ?', array($recordId));
if (!$adb->num_rows($checkRecordPresentResult) && $data->isNew()) {
$status = ModTracker::$CREATED;
} else {
$status = ModTracker::$UPDATED;
}
$this->id = $adb->getUniqueId('vtiger_modtracker_basic');
$adb->insert('vtiger_modtracker_basic', ['id' => $this->id, 'crmid' => $recordId, 'module' => $moduleName, 'whodid' => $current_user->id, 'changedon' => $newerColumnFields['modifiedtime'], 'status' => $status, 'whodidsu' => Vtiger_Session::get('baseUserId')]);
$inserted = true;
}
$adb->pquery('INSERT INTO vtiger_modtracker_detail(id,fieldname,prevalue,postvalue) VALUES(?,?,?,?)', array($this->id, $fieldName, $values['oldValue'], $values['currentValue']));
}
}
}
$isMyRecord = $adb->pquery('SELECT crmid FROM vtiger_crmentity WHERE smownerid <> ? AND crmid = ?', array($current_user->id, $recordId));
if ($adb->num_rows($isMyRecord) > 0) {
$adb->pquery("UPDATE vtiger_crmentity SET was_read = 0 WHERE crmid = ?;", array($recordId));
}
}
if ($eventName == 'vtiger.entity.beforedelete') {
$recordId = $data->getId();
$columnFields = $data->getData();
$id = $adb->getUniqueId('vtiger_modtracker_basic');
$adb->insert('vtiger_modtracker_basic', ['id' => $id, 'crmid' => $recordId, 'module' => $moduleName, 'whodid' => $current_user->id, 'changedon' => date('Y-m-d H:i:s', time()), 'status' => ModTracker::$DELETED, 'whodidsu' => Vtiger_Session::get('baseUserId')]);
$isMyRecord = $adb->pquery('SELECT crmid FROM vtiger_crmentity WHERE smownerid <> ? AND crmid = ?', array($current_user->id, $recordId));
if ($adb->num_rows($isMyRecord) > 0) {
$adb->pquery("UPDATE vtiger_crmentity SET was_read = 0 WHERE crmid = ?;", array($recordId));
}
}
if ($eventName == 'vtiger.entity.afterrestore') {
$recordId = $data->getId();
$columnFields = $data->getData();
$id = $adb->getUniqueId('vtiger_modtracker_basic');
$adb->insert('vtiger_modtracker_basic', ['id' => $id, 'crmid' => $recordId, 'module' => $moduleName, 'whodid' => $current_user->id, 'changedon' => date('Y-m-d H:i:s', time()), 'status' => ModTracker::$RESTORED, 'whodidsu' => Vtiger_Session::get('baseUserId')]);
$isMyRecord = $adb->pquery('SELECT crmid FROM vtiger_crmentity WHERE smownerid <> ? AND crmid = ?', array($current_user->id, $recordId));
if ($adb->num_rows($isMyRecord) > 0) {
$adb->pquery("UPDATE vtiger_crmentity SET was_read = 0 WHERE crmid = ?;", array($recordId));
}
}
if ($eventName == 'vtiger.entity.link.after') {
ModTracker::linkRelation($extendedData['sourceModule'], $extendedData['sourceRecordId'], $extendedData['destinationModule'], $extendedData['destinationRecordId']);
}
if ($eventName == 'vtiger.entity.unlink.after') {
ModTracker::unLinkRelation($extendedData['sourceModule'], $extendedData['sourceRecordId'], $extendedData['destinationModule'], $extendedData['destinationRecordId']);
}
}
}
开发者ID:yozhi,项目名称:YetiForceCRM,代码行数:74,代码来源:ModTrackerHandler.php
示例13: updateRecords
//.........这里部分代码省略.........
$adb->pquery("UPDATE vtiger_calendar_default_activitytypes SET `active` = ? ;", array(1));
// links
$instanceModule = Vtiger_Module::getInstance('Potentials');
$instanceModule->addLink('DASHBOARDWIDGET', 'KPI', 'index.php?module=Potentials&view=ShowWidget&name=Kpi');
$instanceModule = Vtiger_Module::getInstance('Home');
$instanceModule->addLink('DASHBOARDWIDGET', 'Employees Time Control', 'index.php?module=OSSTimeControl&view=ShowWidget&name=TimeControl');
$instanceModule->addLink('DASHBOARDWIDGET', 'Delagated Events/To Dos', 'index.php?module=Home&view=ShowWidget&name=AssignedUpcomingCalendarTasks');
$instanceModule->addLink('DASHBOARDWIDGET', 'Delegated (overdue) Events/ToDos', 'index.php?module=Home&view=ShowWidget&name=AssignedOverdueCalendarTasks');
$instanceModule->addLink('DASHBOARDWIDGET', 'Delegated (overdue) project tasks', 'index.php?module=Home&view=ShowWidget&name=AssignedOverdueProjectsTasks');
$instanceModule->addLink('DASHBOARDWIDGET', 'Delegated project tasks', 'index.php?module=Home&view=ShowWidget&name=AssignedUpcomingProjectsTasks');
$instanceModule->addLink('DASHBOARDWIDGET', 'Leads by Status Converted', 'index.php?module=Leads&view=ShowWidget&name=LeadsByStatusConverted');
$instanceModule->addLink('DASHBOARDWIDGET', 'Calculations', 'index.php?module=Calculations&view=ShowWidget&name=Calculations');
$instanceModule->addLink('DASHBOARDWIDGET', 'PotentialsList', 'index.php?module=Potentials&view=ShowWidget&name=PotentialsList');
$instanceModule->addLink('DASHBOARDWIDGET', 'Mails List', 'index.php?module=Home&view=ShowWidget&name=MailsList');
$instanceModule->addLink('DASHBOARDWIDGET', 'Calendar', 'index.php?module=Home&view=ShowWidget&name=Calendar');
$instanceModule = Vtiger_Module::getInstance('Leads');
$instanceModule->addLink('DASHBOARDWIDGET', 'Leads by Status Converted', 'index.php?module=Leads&view=ShowWidget&name=LeadsByStatusConverted');
$adb->pquery("UPDATE `vtiger_links` SET `handler_path` = NULL, `handler` = '', `handler_class` = '', `linkicon` = 'icon-file' WHERE `linklabel` = ?;", array('Add Note'));
$adb->pquery("UPDATE `vtiger_links` SET `handler_path` = NULL, `handler` = '', `handler_class` = '', `linkicon` = 'icon-tasks' WHERE `linklabel` = ?;", array('Add Project Task'));
$result = $adb->pquery("SELECT * FROM `vtiger_links` WHERE tabid = ? AND linktype = ? AND linklabel = ?;", array(getTabid('SalesOrder'), 'DETAILVIEWWIDGET', 'DetailViewBlockCommentWidget'));
if ($adb->num_rows($result) == 0) {
$modcommentsModuleInstance = Vtiger_Module::getInstance('ModComments');
if ($modcommentsModuleInstance && file_exists('modules/ModComments/ModComments.php')) {
include_once 'modules/ModComments/ModComments.php';
if (class_exists('ModComments')) {
ModComments::addWidgetTo(array('SalesOrder'));
}
}
}
$result = $adb->query("SELECT * FROM `vtiger_fieldmodulerel` WHERE module = 'HelpDesk' AND relmodule = 'Products'");
if ($adb->num_rows($result) == 0) {
$adb->query("insert into `vtiger_fieldmodulerel`(`fieldid`,`module`,`relmodule`,`status`,`sequence`) values ((SELECT fieldid FROM `vtiger_field` WHERE `columnname` = 'product_id' AND `tablename` = 'vtiger_troubletickets'),'HelpDesk','Products',NULL,1);");
}
$result = $adb->query("SELECT * FROM `vtiger_fieldmodulerel` WHERE module = 'HelpDesk' AND relmodule = 'Services'");
if ($adb->num_rows($result) == 0) {
$adb->query("insert into `vtiger_fieldmodulerel`(`fieldid`,`module`,`relmodule`,`status`,`sequence`) values ((SELECT fieldid FROM `vtiger_field` WHERE `columnname` = 'product_id' AND `tablename` = 'vtiger_troubletickets'),'HelpDesk','Services',NULL,2);");
}
$result = $adb->pquery("SELECT * FROM `vtiger_links` WHERE linklabel = ?", array('LIST_OF_LAST_UPDATED_RECORD'));
if ($adb->num_rows($result) == 0) {
$instanceModule = Vtiger_Module::getInstance('Home');
$instanceModule->addLink('DASHBOARDWIDGET', 'LIST_OF_LAST_UPDATED_RECORD', 'index.php?module=Home&view=ShowWidget&name=ListUpdatedRecord');
}
$result1 = $adb->pquery("SELECT fieldid FROM `vtiger_field` WHERE columnname = ? AND tablename = ?", array('parentid', 'vtiger_contactdetails'));
$result2 = $adb->pquery("SELECT * FROM `vtiger_fieldmodulerel` WHERE fieldid = ? AND relmodule = ?", array($adb->query_result($result1, 0, 'fieldid'), 'Vendors'));
if ($adb->num_rows($result2) == 0) {
$adb->query("insert into `vtiger_fieldmodulerel`(`fieldid`,`module`,`relmodule`) values (" . $adb->query_result($result1, 0, 'fieldid') . ",'Contacts','Vendors');");
}
$adb->pquery("UPDATE `vtiger_entityname` SET `searchcolumn` = ? WHERE `modulename` IN (?,?);", array('subject', 'RequirementCards', 'QuotesEnquires'));
$adb->pquery("UPDATE `vtiger_entityname` SET `searchcolumn` = ?, fieldname = ? WHERE `modulename` = ?;", array('holidaysentitlement_year,ossemployeesid', 'holidaysentitlement_year', 'HolidaysEntitlement'));
$adb->pquery("UPDATE `vtiger_entityname` SET fieldname = ? WHERE `modulename` = ?;", array('lastname', 'Leads'));
$result = $adb->pquery("SELECT * FROM `vtiger_links` WHERE tabid = ? AND linktype = ? AND linklabel = ?;", array(getTabid('Quotes'), 'DETAILVIEWWIDGET', 'DetailViewBlockCommentWidget'));
if ($adb->num_rows($result) == 0) {
$modcommentsModuleInstance = Vtiger_Module::getInstance('ModComments');
if ($modcommentsModuleInstance && file_exists('modules/ModComments/ModComments.php')) {
include_once 'modules/ModComments/ModComments.php';
if (class_exists('ModComments')) {
ModComments::addWidgetTo(array('Quotes'));
}
}
}
$modulename = 'Quotes';
$modcommentsModuleInstance = Vtiger_Module::getInstance('ModTracker');
if ($modcommentsModuleInstance && file_exists('modules/ModTracker/ModTracker.php')) {
include_once 'vtlib/Vtiger/Module.php';
include_once 'modules/ModTracker/ModTracker.php';
$tabid = Vtiger_Functions::getModuleId($modulename);
$moduleModTrackerInstance = new ModTracker();
if (!$moduleModTrackerInstance->isModulePresent($tabid)) {
$res = $adb->pquery("INSERT INTO vtiger_modtracker_tabs VALUES(?,?)", array($tabid, 1));
$moduleModTrackerInstance->updateCache($tabid, 1);
} else {
$updatevisibility = $adb->pquery("UPDATE vtiger_modtracker_tabs SET visible = 1 WHERE tabid = ?", array($tabid));
$moduleModTrackerInstance->updateCache($tabid, 1);
}
if (!$moduleModTrackerInstance->isModTrackerLinkPresent($tabid)) {
$moduleInstance = Vtiger_Module::getInstance($tabid);
$moduleInstance->addLink('DETAILVIEWBASIC', 'View History', "javascript:ModTrackerCommon.showhistory('\$RECORD\$')", '', '', array('path' => 'modules/ModTracker/ModTracker.php', 'class' => 'ModTracker', 'method' => 'isViewPermitted'));
}
}
$query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;";
$adb->pquery($query, array('Potentials', 'Contacts'));
$query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;";
$adb->pquery($query, array('Assets', 'Accounts'));
$query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;";
$adb->pquery($query, array('PBXManager', 'Leads'));
$query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;";
$adb->pquery($query, array(getTabid('Leads'), getTabid('PBXManager'), 'PBXManager'), true);
$adb->pquery("UPDATE `vtiger_calendar_user_activitytypes` SET `visible` = ? WHERE `id` > ? ;", array(0, 2));
$result = $adb->pquery("SELECT * FROM `vtiger_links` WHERE linklabel = ? AND linkicon = ? ; ", array('LBL_SHOW_ACCOUNT_HIERARCHY', 'icon-align-justify'));
if ($adb->num_rows($result) == 0) {
$adb->pquery("UPDATE `vtiger_links` SET `linkicon` = ? WHERE `linklabel`= ? ;", array('icon-align-justify', 'LBL_SHOW_ACCOUNT_HIERARCHY'));
$adb->pquery("UPDATE `vtiger_links` SET `linkicon` = ? WHERE `linklabel`= ? ;", array('icon-file', 'LBL_ADD_NOTE'));
}
$result1 = $adb->pquery("SELECT fieldid FROM `vtiger_field` WHERE columnname = ? AND tablename = ?", array('parent_id', 'vtiger_assets'));
$result2 = $adb->pquery("SELECT * FROM `vtiger_fieldmodulerel` WHERE fieldid = ? AND relmodule = ?", array($adb->query_result($result1, 0, 'fieldid'), 'Accounts'));
if ($adb->num_rows($result2) == 0) {
$adb->query("insert into `vtiger_fieldmodulerel`(`fieldid`,`module`,`relmodule`) values (" . $adb->query_result($result1, 0, 'fieldid') . ",'Assets','Accounts');");
}
$log->debug("Exiting VT620_to_YT::updateRecords() method ...");
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:101,代码来源:VT620_to_YT.php
示例14: enableModTracker
/**
* Enable ModTracker for the module
*/
public static function enableModTracker($moduleName)
{
include_once 'vtlib/Vtiger/Module.php';
include_once 'modules/ModTracker/ModTracker.php';
//Enable ModTracker for the module
$moduleInstance = Vtiger_Module::getInstance($moduleName);
ModTracker::enableTrackingForModule($moduleInstance->getId());
}
开发者ID:cin-system,项目名称:cinrepo,代码行数:11,代码来源:ClientAccount.php
示例15: 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') {
include_once 'vtlib/Vtiger/Module.php';
$myCustomEntity = CRMEntity::getInstance($moduleName);
$myCustomPrefix = "M_";
$sequenceStart = '1';
$myCustomEntity->setModuleSeqNumber("configure", $moduleName, $myCustomPrefix, $sequenceStart);
$displayLabel = 'OSSMailView';
$adb->query("UPDATE vtiger_tab SET customized=0 WHERE name='{$displayLabel}'");
$adb->pquery("INSERT INTO vtiger_ossmailscanner_config (conf_type,parameter,value) VALUES (?,?,?)", array('email_list', 'widget_limit', '10'));
$adb->pquery("INSERT INTO vtiger_ossmailscanner_config (conf_type,parameter,value) VALUES (?,?,?)", array('email_list', 'target', '_blank'));
$adb->pquery("INSERT INTO vtiger_ossmailscanner_config (conf_type,parameter,value) VALUES (?,?,?)", array('email_list', 'permissions', 'vtiger'));
include_once 'modules/ModTracker/ModTracker.php';
$tabid = Vtiger_Functions::getModuleId($moduleName);
$moduleModTrackerInstance = new ModTracker();
if (!$moduleModTrackerInstance->isModulePresent($tabid)) {
$res = $adb->pquery("INSERT INTO vtiger_modtracker_tabs VALUES(?,?)", array($tabid, 1));
$moduleModTrackerInstance->updateCache($tabid, 1);
} else {
$updatevisibility = $adb->pquery("UPDATE vtiger_modtracker_tabs SET visible = 1 WHERE tabid = ?", array($tabid));
$moduleModTrackerInstance->updateCache($tabid, 1);
}
if (!$moduleModTrackerInstance->isModTrackerLinkPresent($tabid)) {
$moduleInstance = Vtiger_Module::getInstance($tabid);
$moduleInstance->addLink('DETAILVIEWBASIC', 'View History', "javascript:ModTrackerCommon.showhistory('\$RECORD\$')", '', '', array('path' => 'modules/ModTracker/ModTracker.php', 'class' => 'ModTracker', 'method' => 'isViewPermitted'));
}
$this->add_relation();
$registerLink = true;
$Module = Vtiger_Module::getInstance($moduleName);
$user_id = Users_Record_Model::getCurrentUserModel()->get('user_name');
$adb->pquery("INSERT INTO vtiger_ossmails_logs (`action`, `info`, `user`) VALUES (?, ?, ?);", array('Action_InstallModule', $moduleName . ' ' . $Module->version, $user_id), false);
$this->turn_on($moduleName);
} else {
if ($eventType == 'module.disabled') {
$this->turn_off($moduleName);
$registerLink = false;
// TODO Handle actions when this module is disabled.
} else {
if ($eventType == 'module.enabled') {
$this->turn_on($moduleName);
$registerLink = true;
$this->add_relation();
// TODO Handle actions when this module is enabled.
} 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') {
$Module = Vtiger_Module::getInstance($moduleName);
$user_id = Users_Record_Model::getCurrentUserModel()->get('user_name');
$adb->pque
|
请发表评论