本文整理汇总了PHP中CRMEntity::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP CRMEntity::getInstance方法的具体用法?PHP CRMEntity::getInstance怎么用?PHP CRMEntity::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRMEntity
的用法示例。
在下文中一共展示了CRMEntity::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generate
function generate(Vtiger_Request $xxx0b)
{
global $xxx22, $xxx23, $xxx24, $xxx25, $xxx26, $xxx27, $xxx28, $xxx29;
$xxx0c = new PDFMaker_PDFMaker_Model();
$xxx0d = $xxx0b->getAll();
$xxx0e = PearDatabase::getInstance();
$xxx0f = "site_URL";
$xxx10 = "vtiger_current_version";
$xxx11 = vglobal($xxx10);
$xxx12 = vglobal($xxx0f);
$xxx13 = $xxx0b->get('relmodule');
$xxx14 = CRMEntity::getInstance($xxx13);
$xxx15 = $xxx0b->get('record');
$xxx16 = $xxx0b->get('mode');
$xxx17 = $xxx0b->get('language');
$xxx18 = $xxx0b->get('type');
$xxx19 = "";
$xxx1a = $xxx0c->GetPreparedMPDF($xxx19, $xxx15, $xxx13, $xxx17);
$xxx19->Output('cache/' . $xxx1a . '.pdf');
@$xxx27();
$xxx25('Content-Type: application/pdf');
$xxx25("Content-length: " . $xxx22("./cache/{$xxx1a}.pdf"));
$xxx25("Cache-Control: private");
$xxx25("Content-Disposition: attachment; filename={$xxx1a}.pdf");
$xxx25("Content-Description: PHP Generated Data");
echo $xxx23($xxx24("./cache/{$xxx1a}.pdf", "r"), $xxx22("./cache/{$xxx1a}.pdf"));
@$xxx29("cache/{$xxx1a}.pdf");
}
示例2: handleEvent
function handleEvent($eventName, $data)
{
if ($eventName == 'vtiger.entity.beforesave') {
// Entity is about to be saved, take required action
}
if ($eventName == 'vtiger.entity.aftersave') {
$db = PearDatabase::getInstance();
$relatedToId = $data->get('related_to');
if ($relatedToId) {
$moduleName = getSalesEntityType($relatedToId);
$focus = CRMEntity::getInstance($moduleName);
$focus->retrieve_entity_info($relatedToId, $moduleName);
$focus->id = $relatedToId;
$fromPortal = $data->get('from_portal');
if ($fromPortal) {
$focus->column_fields['from_portal'] = $fromPortal;
}
$entityData = VTEntityData::fromCRMEntity($focus);
$wfs = new VTWorkflowManager($db);
$relatedToEventHandler = new VTWorkflowEventHandler();
$relatedToEventHandler->workflows = $wfs->getWorkflowsForModuleSupportingComments($entityData->getModuleName());
$wsId = vtws_getWebserviceEntityId($entityData->getModuleName(), $entityData->getId());
$fromPortal = $entityData->get('from_portal');
$util = new VTWorkflowUtils();
$entityCache = new VTEntityCache($util->adminUser());
$entityCacheData = $entityCache->forId($wsId);
$entityCacheData->set('from_portal', $fromPortal);
$entityCache->cache[$wsId] = $entityCacheData;
$relatedToEventHandler->handleEvent($eventName, $entityData, $entityCache);
$util->revertUser();
}
}
}
示例3: vtlib_handler
/**
* Invoked when special actions are performed on the module.
* @param String Module name
* @param String Event Type
*/
function vtlib_handler($moduleName, $eventType)
{
$adb = PearDatabase::getInstance();
if ($eventType == 'module.postinstall') {
$ModuleInstance = CRMEntity::getInstance('NewOrders');
$ModuleInstance->setModuleSeqNumber("configure", 'NewOrders', 'NO', '1');
$adb->pquery('UPDATE vtiger_tab SET customized=0 WHERE name=?', array('NewOrders'));
// TODO Handle actions after this module is installed.
} 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.
}
}
}
}
}
}
示例4: render
public static function render($userInputObject, $user)
{
global $list_max_entries_per_page;
$adb = PearDatabase::getInstance();
$viewer = new Import_UI_Viewer();
$ownerId = $userInputObject->get('foruser');
$owner = new Users();
$owner->id = $ownerId;
$owner->retrieve_entity_info($ownerId, 'Users');
if (!is_admin($user) && $user->id != $owner->id) {
$viewer->display('OperationNotPermitted.tpl', 'Vtiger');
exit;
}
$userDBTableName = Import_Utils::getDbTableName($owner);
$moduleName = $userInputObject->get('module');
$moduleMeta = self::getModuleMeta($moduleName, $user);
$result = $adb->query('SELECT recordid FROM ' . $userDBTableName . ' WHERE status is NOT NULL AND recordid IS NOT NULL');
$noOfRecords = $adb->num_rows($result);
$importedRecordIds = array();
for ($i = 0; $i < $noOfRecords; ++$i) {
$importedRecordIds[] = $adb->query_result($result, $i, 'recordid');
}
if (count($importedRecordIds) == 0) {
$importedRecordIds[] = 0;
}
$focus = CRMEntity::getInstance($moduleName);
$queryGenerator = new QueryGenerator($moduleName, $user);
$customView = new CustomView($moduleName);
$viewId = $customView->getViewIdByName('All', $moduleName);
$queryGenerator->initForCustomViewById($viewId);
$list_query = $queryGenerator->getQuery();
// Fetch only last imported records
$list_query .= ' AND ' . $focus->table_name . '.' . $focus->table_index . ' IN (' . implode(',', $importedRecordIds) . ')';
if (PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false) === true) {
$count_result = $adb->query(mkCountQuery($list_query));
$noofrows = $adb->query_result($count_result, 0, "count");
} else {
$noofrows = null;
}
$start = ListViewSession::getRequestCurrentPage($moduleName, $list_query, $viewId, false);
$navigation_array = VT_getSimpleNavigationValues($start, $list_max_entries_per_page, $noofrows);
$limit_start_rec = ($start - 1) * $list_max_entries_per_page;
$list_result = $adb->pquery($list_query . " LIMIT {$limit_start_rec}, {$list_max_entries_per_page}", array());
$recordListRangeMsg = getRecordRangeMessage($list_result, $limit_start_rec, $noofrows);
$viewer->assign('recordListRange', $recordListRangeMsg);
$controller = new ListViewController($adb, $user, $queryGenerator);
$listview_header = $controller->getListViewHeader($focus, $moduleName, $url_string, $sorder, $order_by, true);
$listview_entries = $controller->getListViewEntries($focus, $moduleName, $list_result, $navigation_array, true);
$viewer->assign('CURRENT_PAGE', $start);
$viewer->assign('LISTHEADER', $listview_header);
$viewer->assign('LISTENTITY', $listview_entries);
$viewer->assign('FOR_MODULE', $moduleName);
$viewer->assign('FOR_USER', $ownerId);
$isAjax = $userInputObject->get('ajax');
if (!empty($isAjax)) {
echo $viewer->fetch('ListViewEntries.tpl');
} else {
$viewer->display('ImportListView.tpl');
}
}
示例5: getRelationQuery
/**
* Function to get relation query for particular module with function name
* @param <record> $recordId
* @param <String> $functionName
* @param Vtiger_Module_Model $relatedModule
* @return <String>
*/
public function getRelationQuery($recordId, $functionName, $relatedModule)
{
if ($functionName === 'get_activities') {
$focus = CRMEntity::getInstance($this->getName());
$focus->id = $recordId;
$entityIds = $focus->getRelatedContactsIds();
$entityIds = implode(',', $entityIds);
$userNameSql = getSqlForNameInDisplayFormat(array('first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'), 'Users');
$query = "SELECT CASE WHEN (vtiger_users.user_name not like '') THEN {$userNameSql} ELSE vtiger_groups.groupname END AS user_name,\n\t\t\t\t\t\tvtiger_crmentity.*, vtiger_activity.activitytype, vtiger_activity.subject, vtiger_activity.date_start, vtiger_activity.time_start,\n\t\t\t\t\t\tvtiger_activity.recurringtype, vtiger_activity.due_date, vtiger_activity.time_end, vtiger_activity.visibility, vtiger_seactivityrel.crmid AS parent_id,\n\t\t\t\t\t\tCASE WHEN (vtiger_activity.activitytype = 'Task') THEN (vtiger_activity.status) ELSE (vtiger_activity.eventstatus) END AS status\n\t\t\t\t\t\tFROM vtiger_activity\n\t\t\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_activity.activityid\n\t\t\t\t\t\tLEFT JOIN vtiger_seactivityrel ON vtiger_seactivityrel.activityid = vtiger_activity.activityid\n\t\t\t\t\t\tLEFT JOIN vtiger_cntactivityrel ON vtiger_cntactivityrel.activityid = vtiger_activity.activityid\n\t\t\t\t\t\tLEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid\n\t\t\t\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\t\t\t\t\tWHERE vtiger_crmentity.deleted = 0 AND vtiger_activity.activitytype <> 'Emails'\n\t\t\t\t\t\t\t\tAND (vtiger_seactivityrel.crmid = " . $recordId;
if ($entityIds) {
$query .= " OR vtiger_cntactivityrel.contactid IN (" . $entityIds . "))";
} else {
$query .= ")";
}
$relatedModuleName = $relatedModule->getName();
$query .= $this->getSpecificRelationQuery($relatedModuleName);
$nonAdminQuery = $this->getNonAdminAccessControlQueryForRelation($relatedModuleName);
if ($nonAdminQuery) {
$query = appendFromClauseToQuery($query, $nonAdminQuery);
}
// There could be more than one contact for an activity.
$query .= ' GROUP BY vtiger_activity.activityid';
} else {
$query = parent::getRelationQuery($recordId, $functionName, $relatedModule);
}
return $query;
}
示例6: 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)
{
global $adb;
if ($event_type == 'module.postinstall') {
$ModuleInstance = CRMEntity::getInstance($modulename);
$ModuleInstance->setModuleSeqNumber("configure", $modulename, '', '1');
$Instance = Vtiger_Module::getInstance($modulename);
$nModule = Vtiger_Module::getInstance('Accounts');
if ($nModule) {
$nModule->setRelatedList($Instance, $modulename, array('add'), 'get_dependents_list');
}
$Instance = Vtiger_Module::getInstance($modulename);
$nModule = Vtiger_Module::getInstance('Invoice');
if ($nModule) {
$nModule->setRelatedList($Instance, $modulename, 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('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') {
}
}
}
}
}
}
}
示例7: beforeGetTaskform
public function beforeGetTaskform($viewer)
{
global $adb;
if (!\Workflow\VtUtils::existTable("vtiger_wf_customnumbering")) {
echo "Create table vtiger_wf_confirmation_user ... ok<br>";
$adb->query("CREATE TABLE IF NOT EXISTS `vtiger_wf_customnumbering` (\r\n `serie` varchar(24) NOT NULL,\r\n `prefix` varchar(16) NOT NULL,\r\n `current` int(10) unsigned NOT NULL,\r\n `length` tinyint(4) NOT NULL,\r\n PRIMARY KEY (`serie`)\r\n ) ENGINE=InnoDB;");
}
$crmidColObj = CRMEntity::getInstance($this->getModuleName());
$viewer->assign('crmidCol', $crmidColObj->table_index);
$moduleName = $this->getModuleName();
$fields = VtUtils::getFieldsWithBlocksForModule($moduleName, false);
$selectedId = $this->get('field');
if ($selectedId === -1 || empty($selectedId)) {
$sql = 'SELECT * FROM vtiger_field WHERE uitype = 4 AND tabid = ' . getTabid($moduleName);
$result = $adb->query($sql);
$selectedId = $adb->query_result($result, 0, 'fieldname');
$this->set('field', $selectedId);
}
$sql = 'SELECT * FROM vtiger_wf_customnumbering';
$result = $adb->query($sql);
$series = array();
while ($row = $adb->fetchByAssoc($result)) {
$series[$row['serie']] = $row;
}
if (isset($series[$this->get('serie')])) {
$viewer->assign('lockFields', true);
}
$viewer->assign('series', $series);
$viewer->assign('fields', $fields);
/* Insert here source code to create custom configurations pages */
}
示例8: getQuery
/**
* Function returns the Query for the relationhips
* @param <Vtiger_Record_Model> $recordModel
* @param type $actions
* @return <String>
*/
public function getQuery($recordModel, $actions = false)
{
$parentModuleModel = $this->getParentModuleModel();
$relatedModuleModel = $this->getRelationModuleModel();
$relatedModuleName = $relatedModuleModel->get('name');
$parentModuleName = $parentModuleModel->get('name');
$functionName = $this->get('name');
$focus = CRMEntity::getInstance($parentModuleName);
$focus->id = $recordModel->getId();
if (method_exists($parentModuleModel, $functionName)) {
$query = $parentModuleModel->{$functionName}($recordModel, $relatedModuleModel);
} else {
$result = $focus->{$functionName}($recordModel->getId(), $parentModuleModel->getId(), $relatedModuleModel->getId(), $actions);
$query = $result['query'];
}
//modify query if any module has summary fields, those fields we are displayed in related list of that module
$relatedListFields = $relatedModuleModel->getConfigureRelatedListFields();
if (count($relatedListFields) > 0) {
$currentUser = Users_Record_Model::getCurrentUserModel();
$queryGenerator = new QueryGenerator($relatedModuleName, $currentUser);
$queryGenerator->setFields($relatedListFields);
$selectColumnSql = $queryGenerator->getSelectClauseColumnSQL();
$newQuery = spliti('FROM', $query);
$selectColumnSql = 'SELECT DISTINCT vtiger_crmentity.crmid,' . $selectColumnSql;
}
if ($functionName == ('get_pricebook_products' || 'get_pricebook_services')) {
$selectColumnSql = $selectColumnSql . ', vtiger_pricebookproductrel.listprice';
}
$query = $selectColumnSql . ' FROM ' . $newQuery[1];
return $query;
}
示例9: 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)
{
global $adb;
if ($event_type == 'module.postinstall') {
$ModuleInstance = CRMEntity::getInstance($modulename);
$ModuleInstance->setModuleSeqNumber("configure", $modulename, 'UO', '1');
include_once 'vtlib/Vtiger/Module.php';
$moduleInstance = Vtiger_Module::getInstance($modulename);
$docelowy_Module = Vtiger_Module::getInstance('Accounts');
$docelowy_Module->setRelatedList($moduleInstance, 'OSSOutsourcedServices', array('ADD'), 'get_dependents_list');
$docelowy_Module = Vtiger_Module::getInstance('Leads');
$docelowy_Module->setRelatedList($moduleInstance, 'OSSOutsourcedServices', array('ADD'), 'get_dependents_list');
$docelowy_Module = Vtiger_Module::getInstance('Potentials');
$docelowy_Module->setRelatedList($moduleInstance, 'OSSOutsourcedServices', array('ADD'), 'get_dependents_list');
} 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') {
}
}
}
}
}
}
}
示例10: vtlib_handler
/**
* Invoked when special actions are performed on the module.
* @param String Module name
* @param String Event Type
*/
function vtlib_handler($moduleName, $eventType)
{
$adb = PearDatabase::getInstance();
if ($eventType == 'module.postinstall') {
include_once 'vtlib/Vtiger/Module.php';
$moduleInstance = CRMEntity::getInstance('HolidaysEntitlement');
$moduleInstance->setModuleSeqNumber("configure", 'HolidaysEntitlement', 'HE', '1');
$adb->pquery('UPDATE vtiger_tab SET customized=0 WHERE name=?', array('HolidaysEntitlement'));
$moduleInstance = Vtiger_Module::getInstance('HolidaysEntitlement');
$targetModule = Vtiger_Module::getInstance('OSSEmployees');
$targetModule->setRelatedList($moduleInstance, 'HolidaysEntitlement', array('ADD'), 'get_dependents_list');
} 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.
}
}
}
}
}
}
示例11: setUp
protected function setUp()
{
global $adb, $phpUnitLeadId;
${"GLOBALS"}["vqinqhvudy"] = "sql";
${"GLOBALS"}["omirinrsle"] = "sql";
${${"GLOBALS"}["omirinrsle"]} = "SELECT leadid FROM\n vtiger_leaddetails\n LEFT JOIN vtiger_crmentity ON(vtiger_crmentity.crmid = vtiger_leaddetails.leadid)\n WHERE firstname = 'PHPUNIT' AND lastname = 'PHPUNIT' AND deleted = 0";
${${"GLOBALS"}["dlfzmzsoafs"]} = $adb->query(${${"GLOBALS"}["vqinqhvudy"]});
if ($adb->num_rows(${${"GLOBALS"}["dlfzmzsoafs"]}) > 0) {
$pcbcvlo = "result";
${${"GLOBALS"}["odcnybklnoz"]} = $adb->query_result(${$pcbcvlo}, 0, "leadid");
} else {
$zgdgywgjnie = "document";
${"GLOBALS"}["fbjylokbk"] = "result";
${$zgdgywgjnie} = CRMEntity::getInstance("Leads");
$document->column_fields["firstname"] = "PHPUNIT";
$document->column_fields["lastname"] = "PHPUNIT";
$qxhkyg = "sql";
$document->column_fields["annualrevenue"] = "1000";
$document->column_fields["cf_654"] = 1;
$document->column_fields["assigned_user_id"] = 1;
$elbiflyj = "sql";
$document->save("Leads");
${$elbiflyj} = "SELECT leadid FROM\n vtiger_leaddetails\n LEFT JOIN vtiger_crmentity ON(vtiger_crmentity.crmid = vtiger_leaddetails.leadid)\n WHERE firstname = 'PHPUNIT' AND lastname = 'PHPUNIT' AND deleted = 0";
$adb->query(${$qxhkyg});
${${"GLOBALS"}["odcnybklnoz"]} = $adb->query_result(${${"GLOBALS"}["fbjylokbk"]}, 0, "leadid");
}
VTEntity::setUser(VtUtils::getAdminUser());
print "\nMySuite::setUp()";
}
示例12: handleEvent
function handleEvent($eventName, $entityData)
{
if (in_array($eventName, ['vtiger.entity.link.after', 'vtiger.entity.unlink.after'])) {
$fields = Vtiger_MultiReferenceValue_UIType::getFieldsByModules($entityData['sourceModule'], $entityData['destinationModule']);
foreach ($fields as $field) {
$fieldModel = new Vtiger_Field_Model();
$fieldModel->initialize($field);
$UITypeModel = $fieldModel->getUITypeModel();
if ($eventName == 'vtiger.entity.link.after') {
$UITypeModel->addValue($entityData['CRMEntity'], $entityData['sourceRecordId'], $entityData['destinationRecordId']);
} elseif ($eventName == 'vtiger.entity.unlink.after') {
$UITypeModel->removeValue(CRMEntity::getInstance($entityData['sourceModule']), $entityData['sourceRecordId'], $entityData['destinationRecordId']);
}
}
} else {
if ($eventName == 'vtiger.entity.aftersave.final') {
$db = PearDatabase::getInstance();
$moduleName = $entityData->getModuleName();
$modules = Vtiger_MultiReferenceValue_UIType::getRelatedModules($moduleName);
foreach ($modules as $module) {
$db->insert('s_yf_multireference', ['source_module' => $module, 'dest_module' => $moduleName, 'lastid' => $entityData->getId(), 'type' => 1]);
}
}
}
}
示例13: 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)
{
$registerLink = false;
$displayLabel = 'Time Control';
global $adb, $log;
if ($event_type == 'module.postinstall') {
$tabid = getTabid($modulename);
$adb->query("UPDATE `vtiger_field` SET `summaryfield` = '1' WHERE `tabid` = {$tabid} AND `columnname` IN ('name','osstimecontrol_no','osstimecontrol_status','smownerid','date_start','time_start','time_end','due_date','sum_time','platnosc');", true);
$ModuleInstance = CRMEntity::getInstance($modulename);
$ModuleInstance->setModuleSeqNumber("configure", $modulename, 'TC', '1');
include_once 'vtlib/Vtiger/Module.php';
$moduleInstance = Vtiger_Module::getInstance($modulename);
$docelowy_Module = Vtiger_Module::getInstance('Accounts');
$docelowy_Module->setRelatedList($moduleInstance, 'OSSTimeControl', array('add'), 'get_dependents_list');
$docelowy_Module = Vtiger_Module::getInstance('HelpDesk');
$docelowy_Module->setRelatedList($moduleInstance, 'OSSTimeControl', array('add'), 'get_dependents_list');
$docelowy_Module = Vtiger_Module::getInstance('Project');
$docelowy_Module->setRelatedList($moduleInstance, 'OSSTimeControl', array('add'), 'get_dependents_list');
$docelowy_Module = Vtiger_Module::getInstance('ProjectTask');
$docelowy_Module->setRelatedList($moduleInstance, 'OSSTimeControl', array('add'), 'get_dependents_list');
$docelowy_Module = Vtiger_Module::getInstance('ServiceContracts');
$docelowy_Module->setRelatedList($moduleInstance, 'OSSTimeControl', array('add'), 'get_dependents_list');
$docelowy_Module = Vtiger_Module::getInstance('Assets');
$docelowy_Module->setRelatedList($moduleInstance, 'OSSTimeControl', array('add'), 'get_dependents_list');
$docelowy_Module = Vtiger_Module::getInstance('SalesOrder');
$docelowy_Module->setRelatedList($moduleInstance, 'OSSTimeControl', array('add'), 'get_dependents_list');
$docelowy_Module = Vtiger_Module::getInstance('Potentials');
$docelowy_Module->setRelatedList($moduleInstance, 'OSSTimeControl', array('add'), 'get_dependents_list');
$docelowy_Module = Vtiger_Module::getInstance('Quotes');
$docelowy_Module->setRelatedList($moduleInstance, 'OSSTimeControl', array('add'), 'get_dependents_list');
$docelowy_Module = Vtiger_Module::getInstance('Leads');
$docelowy_Module->setRelatedList($moduleInstance, 'OSSTimeControl', 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('OSSTimeControl'));
}
}
} 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') {
}
}
}
}
}
}
}
示例14: process
function process(Mobile_API_Request $request)
{
$response = new Mobile_API_Response();
$username = $request->get('username');
$password = $request->get('password');
$current_user = CRMEntity::getInstance('Users');
$current_user->column_fields['user_name'] = $username;
if (vtlib_isModuleActive('Mobile') === false) {
$response->setError(1501, 'Service not available');
return $response;
}
if (!$current_user->doLogin($password)) {
$response->setError(1210, 'Authentication Failed');
} else {
// Start session now
$sessionid = Mobile_API_Session::init();
if ($sessionid === false) {
echo "Session init failed {$sessionid}\n";
}
$current_user->id = $current_user->retrieve_user_id($username);
$current_user->retrieveCurrentUserInfoFromFile($current_user->id);
$this->setActiveUser($current_user);
$result = array();
$result['login'] = array('userid' => $current_user->id, 'crm_tz' => DateTimeField::getDBTimeZone(), 'user_tz' => $current_user->time_zone, 'user_currency' => $current_user->currency_code, 'session' => $sessionid, 'vtiger_version' => Mobile_WS_Utils::getVtigerVersion(), 'date_format' => $current_user->date_format, 'mobile_module_version' => Mobile_WS_Utils::getVersion());
$response->setResult($result);
$this->postProcess($response);
}
return $response;
}
示例15: sendsms
/**
* Send SMS (Creates SMS Entity record, links it with related CRM record and triggers provider to send sms)
*
* @param String $message
* @param Array $tonumbers
* @param Integer $ownerid User id to assign the SMS record
* @param mixed $linktoids List of CRM record id to link SMS record
* @param String $linktoModule Modulename of CRM record to link with (if not provided lookup it will be calculated)
*/
static function sendsms($message, $tonumbers, $ownerid = false, $linktoids = false, $linktoModule = false)
{
global $current_user, $adb;
if ($ownerid === false) {
if (isset($current_user) && !empty($current_user)) {
$ownerid = $current_user->id;
} else {
$ownerid = 1;
}
}
$moduleName = 'SMSNotifier';
$focus = CRMEntity::getInstance($moduleName);
$focus->column_fields['message'] = $message;
$focus->column_fields['assigned_user_id'] = $ownerid;
$focus->save($moduleName);
if ($linktoids !== false) {
if ($linktoModule !== false) {
$focus->save_related_module($moduleName, $focus->id, $linktoModule, $linktoids);
} else {
// Link modulename not provided (linktoids can belong to mix of module so determine proper modulename)
$linkidsetypes = $adb->pquery("SELECT setype,crmid FROM vtiger_crmentity WHERE crmid IN (" . generateQuestionMarks($linktoids) . ")", array($linktoids));
if ($linkidsetypes && $adb->num_rows($linkidsetypes)) {
while ($linkidsetypesrow = $adb->fetch_array($linkidsetypes)) {
$focus->save_related_module($moduleName, $focus->id, $linkidsetypesrow['setype'], $linkidsetypesrow['crmid']);
}
}
}
}
$responses = self::fireSendSMS($message, $tonumbers);
$focus->processFireSendSMSResponse($responses);
}