本文整理汇总了PHP中getSalesEntityType函数的典型用法代码示例。如果您正苦于以下问题:PHP getSalesEntityType函数的具体用法?PHP getSalesEntityType怎么用?PHP getSalesEntityType使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getSalesEntityType函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: process
public function process(Vtiger_Request $request)
{
$recordId = $request->get('record');
$modules = $request->get('modules');
$assignId = $request->get('assigned_user_id');
$currentUser = Users_Record_Model::getCurrentUserModel();
$entityValues = array();
$entityValues['transferRelatedRecordsTo'] = $request->get('transferModule');
//■権限なぜか、エラーになるので権限を固定するinouchi
//$entityValues['assignedTo'] = vtws_getWebserviceEntityId(vtws_getOwnerType($assignId), $assignId);
$entityValues['assignedTo'] = vtws_getWebserviceEntityId(vtws_getOwnerType(1), 1);
$entityValues['leadId'] = vtws_getWebserviceEntityId($request->getModule(), $recordId);
$recordModel = Vtiger_Record_Model::getInstanceById($recordId, $request->getModule());
$convertLeadFields = $recordModel->getConvertLeadFields();
$availableModules = array('Accounts', 'Contacts', 'Potentials');
foreach ($availableModules as $module) {
if (vtlib_isModuleActive($module) && in_array($module, $modules)) {
$entityValues['entities'][$module]['create'] = true;
$entityValues['entities'][$module]['name'] = $module;
foreach ($convertLeadFields[$module] as $fieldModel) {
$fieldName = $fieldModel->getName();
$fieldValue = $request->get($fieldName);
//Potential Amount Field value converting into DB format
if ($fieldModel->getFieldDataType() === 'currency') {
$fieldValue = Vtiger_Currency_UIType::convertToDBFormat($fieldValue);
} elseif ($fieldModel->getFieldDataType() === 'date') {
$fieldValue = DateTimeField::convertToDBFormat($fieldValue);
} elseif ($fieldModel->getFieldDataType() === 'reference' && $fieldValue) {
$ids = vtws_getIdComponents($fieldValue);
if (count($ids) === 1) {
$fieldValue = vtws_getWebserviceEntityId(getSalesEntityType($fieldValue), $fieldValue);
}
}
$entityValues['entities'][$module][$fieldName] = $fieldValue;
}
}
}
try {
$result = vtws_convertlead($entityValues, $currentUser);
} catch (Exception $e) {
$this->showError($request, $e);
exit;
}
if (!empty($result['Accounts'])) {
$accountIdComponents = vtws_getIdComponents($result['Accounts']);
$accountId = $accountIdComponents[1];
}
if (!empty($result['Contacts'])) {
$contactIdComponents = vtws_getIdComponents($result['Contacts']);
$contactId = $contactIdComponents[1];
}
if (!empty($accountId)) {
header("Location: index.php?view=Detail&module=Accounts&record={$accountId}");
} elseif (!empty($contactId)) {
header("Location: index.php?view=Detail&module=Contacts&record={$contactId}");
} else {
$this->showError($request);
exit;
}
}
开发者ID:cin-system,项目名称:cinrepo,代码行数:60,代码来源:SaveConvertLead.php
示例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();
}
}
}
开发者ID:cannking,项目名称:vtigercrm-debug,代码行数:33,代码来源:ModCommentsHandler.php
示例3: retrieve
public function retrieve($id)
{
global $adb, $default_charset, $site_URL;
$ids = vtws_getIdComponents($id);
$elemid = $ids[1];
$doc = parent::retrieve($id);
// Add relations
$relsrs = $adb->pquery("SELECT crmid FROM vtiger_senotesrel where notesid=?", array($elemid));
$rels = array();
while ($rl = $adb->fetch_array($relsrs)) {
$rels[] = $this->vtyiicpng_getWSEntityId(getSalesEntityType($rl['crmid'])) . $rl['crmid'];
}
$doc['relations'] = $rels;
if ($doc['filelocationtype'] == 'I') {
// Add direct download link
$relatt = $adb->pquery("SELECT attachmentsid FROM vtiger_seattachmentsrel WHERE crmid=?", array($elemid));
if ($relatt and $adb->num_rows($relatt) == 1) {
$fileid = $adb->query_result($relatt, 0, 0);
$attrs = $adb->pquery("SELECT * FROM vtiger_attachments WHERE attachmentsid = ?", array($fileid));
if ($attrs and $adb->num_rows($attrs) == 1) {
$name = @$adb->query_result($attrs, 0, "name");
$filepath = @$adb->query_result($attrs, 0, "path");
$name = html_entity_decode($name, ENT_QUOTES, $default_charset);
$doc['_downloadurl'] = $site_URL . "/" . $filepath . $fileid . "_" . $name;
}
}
}
return $doc;
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:29,代码来源:VtigerDocumentOperation.php
示例4: getReferenceModule
/**
* Function to get the Display Value, for the current field type with given DB Insert Value
* @param <Object> $value
* @return <Object>
*/
public function getReferenceModule($value)
{
$fieldModel = $this->get('field');
$referenceModuleList = $fieldModel->getReferenceList();
$referenceEntityType = getSalesEntityType($value);
if (in_array($referenceEntityType, $referenceModuleList)) {
return Vtiger_Module_Model::getInstance($referenceEntityType);
} elseif (in_array('Users', $referenceModuleList)) {
return Vtiger_Module_Model::getInstance('Users');
}
return null;
}
开发者ID:rcrrich,项目名称:YetiForceCRM,代码行数:17,代码来源:Reference.php
示例5: updateContactAssignedTo
function updateContactAssignedTo($entity)
{
global $adb, $default_charset, $log;
list($acc, $acc_id) = explode('x', $entity->data['id']);
// separate webservice ID
if (getSalesEntityType($acc_id) == 'Accounts') {
list($usr, $usr_id) = explode('x', $entity->data['assigned_user_id']);
$query = 'update vtiger_crmentity set smownerid=? where crmid in (select contactid from vtiger_contactdetails where accountid=?)';
$params = array($usr_id, $acc_id);
$adb->pquery($query, $params);
}
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:12,代码来源:updateContactAssignedTo.php
示例6: getReferenceModule
/**
* Function to get the Display Value, for the current field type with given DB Insert Value
* @param <Object> $value
* @return <Object>
*/
public function getReferenceModule($value)
{
global $log;
$log->debug("Entering ./uitypes/Reference.php::getReferenceModule");
$fieldModel = $this->get('field');
$referenceModuleList = $fieldModel->getReferenceList();
$referenceEntityType = getSalesEntityType($value);
if (in_array($referenceEntityType, $referenceModuleList)) {
return Vtiger_Module_Model::getInstance($referenceEntityType);
} elseif (in_array('Users', $referenceModuleList)) {
return Vtiger_Module_Model::getInstance('Users');
}
return null;
}
开发者ID:cin-system,项目名称:cinrepo,代码行数:19,代码来源:Reference.php
示例7: duplicaterec
function duplicaterec($currentModule, $record_id, $bmapname)
{
global $adb, $current_user;
$focus = CRMEntity::getInstance($currentModule);
$focus->retrieve_entity_info($record_id, $currentModule);
// Retrieve relations map
//$bmapname = 'BusinessMapping_'.$currentModule.'_DuplicateRelations';
$cbMapid = GlobalVariable::getVariable('BusinessMapping_' . $bmapname, cbMap::getMapIdByName($bmapname));
if ($cbMapid) {
$cbMap = cbMap::getMapByID($cbMapid);
$maped_relations = $cbMap->DuplicateRelations()->getRelatedModules();
}
// Duplicate Records that this Record is dependent of
if ($cbMapid && $cbMap->DuplicateRelations()->DuplicateDirectRelations()) {
$invmods = getInventoryModules();
foreach ($focus->column_fields as $fieldname => $value) {
$sql = 'SELECT * FROM vtiger_field WHERE columnname = ? AND uitype IN (10,50,51,57,58,59,73,68,76,75,81,78,80)';
$result = $adb->pquery($sql, array($fieldname));
if ($adb->num_rows($result) == 1 && !empty($value)) {
$module = getSalesEntityType($value);
if (in_array($module, $invmods)) {
continue;
}
// we can't duplicate these
$handler = vtws_getModuleHandlerFromName($module, $current_user);
$meta = $handler->getMeta();
$entity = CRMEntity::getInstance($module);
$entity->mode = '';
$entity->retrieve_entity_info($value, $module);
$entity->column_fields = DataTransform::sanitizeRetrieveEntityInfo($entity->column_fields, $meta);
$entity->save($module);
$focus->column_fields[$fieldname] = $entity->id;
}
}
}
$handler = vtws_getModuleHandlerFromName($currentModule, $current_user);
$meta = $handler->getMeta();
$focus->column_fields = DataTransform::sanitizeRetrieveEntityInfo($focus->column_fields, $meta);
$focus->saveentity($currentModule);
// no workflows for this one => so we don't reenter this process
$new_record_id = $focus->id;
$curr_tab_id = gettabid($currentModule);
$related_list = get_related_lists($curr_tab_id, $maped_relations);
dup_related_lists($new_record_id, $currentModule, $related_list, $record_id, $maped_relations);
$dependents_list = get_dependent_lists($curr_tab_id);
$dependent_tables = get_dependent_tables($dependents_list, $currentModule);
dup_dependent_rec($record_id, $currentModule, $new_record_id, $dependent_tables, $maped_relations);
return $new_record_id;
}
开发者ID:kduqi,项目名称:corebos,代码行数:49,代码来源:duplicate.php
示例8: getEmail
function getEmail($relid)
{
global $adb;
$email = '';
if (!empty($relid)) {
$relModule = getSalesEntityType($relid);
if ($relModule == "Contacts") {
$res = $adb->pquery("SELECT email FROM vtiger_contactdetails WHERE contactid = ?", array($relid));
$email = $adb->query_result($res, 0, 'email');
} else {
$res = $adb->pquery("SELECT email1 FROM vtiger_account WHERE accountid = ?", array($relid));
$email = $adb->query_result($res, 0, 'email1');
}
}
return $email;
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:16,代码来源:evcbrcHandler.php
示例9: buildDocumentModel
function buildDocumentModel() {
global $app_strings;
try {
$model = parent::buildDocumentModel();
$this->generateEntityModel($this->focus, 'Potentials', 'potential_', $model);
if ($this->focusColumnValue('related_to'))
$setype = getSalesEntityType($this->focusColumnValue('related_to'));
$account = new Accounts();
$contact = new Contacts();
if ($setype == 'Accounts')
$account->retrieve_entity_info($this->focusColumnValue('related_to'), $setype);
elseif ($setype == 'Contacts')
$contact->retrieve_entity_info($this->focusColumnValue('related_to'), $setype);
$this->generateEntityModel($account, 'Accounts', 'account_', $model);
$this->generateEntityModel($contact, 'Contacts', 'contact_', $model);
$this->generateUi10Models($model);
$this->generateRelatedListModels($model);
$model->set('potential_no', $this->focusColumnValue('potential_no'));
$model->set('potential_owner', getUserFullName($this->focusColumnValue('assigned_user_id')));
return $model;
} catch (Exception $e) {
echo '<meta charset="utf-8" />';
if($e->getMessage() == $app_strings['LBL_RECORD_DELETE']) {
echo $app_strings['LBL_RECORD_INCORRECT'];
echo '<br><br>';
} else {
echo $e->getMessage();
echo '<br><br>';
}
return null;
}
}
开发者ID:Wasage,项目名称:werpa,代码行数:42,代码来源:PotentialsPDFController.php
示例10: processMap
/**
* $arguments[0] origin column_fields array
* $arguments[1] target column_fields array
*/
function processMap($arguments)
{
global $adb, $current_user;
$mapping = $this->convertMap2Array();
$ofields = $arguments[0];
if (!empty($ofields['record_id'])) {
$setype = getSalesEntityType($ofields['record_id']);
$wsidrs = $adb->pquery('SELECT id FROM vtiger_ws_entity WHERE name=?', array($setype));
$entityId = $adb->query_result($wsidrs, 0, 0) . 'x' . $ofields['record_id'];
}
$tfields = $arguments[1];
foreach ($mapping['fields'] as $targetfield => $sourcefields) {
$value = '';
$delim = isset($sourcefields['delimiter']) ? $sourcefields['delimiter'] : '';
foreach ($sourcefields['merge'] as $pos => $fieldinfo) {
$idx = array_keys($fieldinfo);
if (strtoupper($idx[0]) == 'CONST') {
$const = array_pop($fieldinfo);
$value .= $const . $delim;
} elseif (strtoupper($idx[0]) == 'EXPRESSION') {
$testexpression = array_pop($fieldinfo);
$parser = new VTExpressionParser(new VTExpressionSpaceFilter(new VTExpressionTokenizer($testexpression)));
$expression = $parser->expression();
$exprEvaluater = new VTFieldExpressionEvaluater($expression);
if (empty($ofields['record_id'])) {
$exprEvaluation = $exprEvaluater->evaluate(false);
} else {
$entity = new VTWorkflowEntity($current_user, $entityId);
$exprEvaluation = $exprEvaluater->evaluate($entity);
}
$value .= $exprEvaluation . $delim;
} else {
$fieldname = array_pop($fieldinfo);
$value .= $ofields[$fieldname] . $delim;
}
}
$value = rtrim($value, $delim);
$tfields[$targetfield] = $value;
}
return $tfields;
}
开发者ID:kduqi,项目名称:corebos,代码行数:45,代码来源:Mapping.php
示例11: startCall
function startCall()
{
global $current_user, $adb, $log;
require_once 'include/utils/utils.php';
require_once 'modules/PBXManager/utils/AsteriskClass.php';
require_once 'modules/PBXManager/AsteriskUtils.php';
$id = $current_user->id;
$number = $_REQUEST['number'];
$record = $_REQUEST['recordid'];
$result = $adb->query("select * from vtiger_asteriskextensions where userid=" . $current_user->id);
$extension = $adb->query_result($result, 0, "asterisk_extension");
$data = getAsteriskInfo($adb);
if (!empty($data)) {
$server = $data['server'];
$port = $data['port'];
$username = $data['username'];
$password = $data['password'];
$version = $data['version'];
$errno = $errstr = NULL;
$sock = fsockopen($server, $port, $errno, $errstr, 1);
stream_set_blocking($sock, false);
if ($sock === false) {
echo "Socket cannot be created due to error: {$errno}: {$errstr}\n";
$log->debug("Socket cannot be created due to error: {$errno}: {$errstr}\n");
exit(0);
}
$asterisk = new Asterisk($sock, $server, $port);
loginUser($username, $password, $asterisk);
$asterisk->transfer($extension, $number);
$callerModule = getSalesEntityType($record);
$entityNames = getEntityName($callerModule, array($record));
$callerName = $entityNames[$record];
$callerInfo = array('id' => $record, 'module' => $callerModule, 'name' => $callerName);
//adds to pbx manager
addToCallHistory($extension, $extension, $number, "outgoing", $adb, $callerInfo);
// add to the records activity history
addOutgoingcallHistory($current_user, $extension, $record, $adb);
}
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:39,代码来源:StartCall.php
示例12: getRelatedRecords
function getRelatedRecords($id, $module, $relatedModule, $queryParameters, $user)
{
global $adb, $currentModule, $log, $current_user;
// TODO To be integrated with PearDatabase
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
// END
// pickup meta data of related module
$webserviceObject = VtigerWebserviceObject::fromName($adb, $relatedModule);
$handlerPath = $webserviceObject->getHandlerPath();
$handlerClass = $webserviceObject->getHandlerClass();
if ($relatedModule == 'Products' and $module != 'Products') {
$srvwebserviceObject = VtigerWebserviceObject::fromName($adb, 'Services');
$srvhandlerPath = $srvwebserviceObject->getHandlerPath();
$srvhandlerClass = $srvwebserviceObject->getHandlerClass();
require_once $srvhandlerPath;
$srvhandler = new $srvhandlerClass($srvwebserviceObject, $user, $adb, $log);
$srvmeta = $srvhandler->getMeta();
}
require_once $handlerPath;
$handler = new $handlerClass($webserviceObject, $user, $adb, $log);
$meta = $handler->getMeta();
$query = __getRLQuery($id, $module, $relatedModule, $queryParameters, $user);
$result = $adb->pquery($query, array());
$records = array();
// Return results
while ($row = $adb->fetch_array($result)) {
if (($module == 'HelpDesk' or $module == 'Faq') and $relatedModule == 'ModComments') {
$records[] = $row;
} else {
if (isset($row['id']) and getSalesEntityType($row['id']) == 'Services') {
$records[] = DataTransform::sanitizeData($row, $srvmeta);
} else {
$records[] = DataTransform::sanitizeData($row, $meta);
}
}
}
return array('records' => $records);
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:38,代码来源:GetRelatedRecords.php
示例13: process
//.........这里部分代码省略.........
$referenceArray = array('Contacts', 'Accounts', 'Leads');
for ($j = 0; $j < count($referenceArray); $j++) {
$val = $referenceArray[$j];
if (!empty($relatedtos) && is_array($relatedtos)) {
for ($i = 0; $i < count($relatedtos); $i++) {
if ($i == count($relatedtos) - 1) {
$relateto = vtws_getIdComponents($relatedtos[$i]['record']);
$parentIds = $relateto[1] . "@1";
} elseif ($relatedtos[$i]['module'] == $val) {
$relateto = vtws_getIdComponents($relatedtos[$i]['record']);
$parentIds = $relateto[1] . "@1";
break;
}
}
}
if (isset($parentIds)) {
break;
}
}
if ($parentIds == '') {
if (count($relatedtos) > 0) {
$relateto = vtws_getIdComponents($relatedtos[0]['record']);
$parentIds = $relateto[1] . "@1";
break;
}
}
$cc_string = rtrim($request->get('cc'), ',');
$bcc_string = rtrim($request->get('bcc'), ',');
$subject = $request->get('subject');
$body = $request->get('body');
//Restrict this for users module
if ($relateto[1] != NULL && $relateto[0] != '19') {
$entityId = $relateto[1];
$parent_module = getSalesEntityType($entityId);
$description = getMergedDescription($body, $entityId, $parent_module);
} else {
if ($relateto[0] == '19') {
$parentIds = $relateto[1] . '@-1';
}
$description = $body;
}
$fromEmail = $connector->getFromEmailAddress();
$userFullName = getFullNameFromArray('Users', $current_user->column_fields);
$userId = $current_user->id;
$mailer = new Vtiger_Mailer();
$mailer->IsHTML(true);
$mailer->ConfigSenderInfo($fromEmail, $userFullName, $current_user->email1);
$mailer->Subject = $subject;
$mailer->Body = $description;
$mailer->addSignature($userId);
if ($mailer->Signature != '') {
$mailer->Body .= $mailer->Signature;
}
$ccs = empty($cc_string) ? array() : explode(',', $cc_string);
$bccs = empty($bcc_string) ? array() : explode(',', $bcc_string);
$emailId = $request->get('emailid');
$attachments = $connector->getAttachmentDetails($emailId);
$mailer->AddAddress($to);
foreach ($ccs as $cc) {
$mailer->AddCC($cc);
}
foreach ($bccs as $bcc) {
$mailer->AddBCC($bcc);
}
global $root_directory;
if (is_array($attachments)) {
开发者ID:nouphet,项目名称:vtigercrm-6.0.0-ja,代码行数:67,代码来源:Mail.php
示例14: getRelatedToEntity
function getRelatedToEntity($module, $list_result, $rset)
{
global $log;
$log->debug("Entering getRelatedToEntity(" . $module . "," . $list_result . "," . $rset . ") method ...");
global $adb;
$seid = $adb->query_result($list_result, $rset, "relatedto");
$action = "DetailView";
if (isset($seid) && $seid != '') {
$parent_module = $parent_module = getSalesEntityType($seid);
if ($parent_module == 'Accounts') {
$numrows = $adb->num_rows($evt_result);
$parent_module = $adb->query_result($evt_result, 0, 'setype');
$parent_id = $adb->query_result($evt_result, 0, 'crmid');
if ($numrows > 1) {
$parent_module = 'Multiple';
$parent_name = $app_strings['LBL_MULTIPLE'];
}
//Raju -- Ends
$parent_query = "SELECT accountname FROM vtiger_account WHERE accountid=?";
$parent_result = $adb->pquery($parent_query, array($seid));
$parent_name = $adb->query_result($parent_result, 0, "accountname");
}
if ($parent_module == 'Leads') {
$parent_query = "SELECT firstname,lastname FROM vtiger_leaddetails WHERE leadid=?";
$parent_result = $adb->pquery($parent_query, array($seid));
$parent_name = getFullNameFromQResult($parent_result, 0, "Leads");
}
if ($parent_module == 'Potentials') {
$parent_query = "SELECT potentialname FROM vtiger_potential WHERE potentialid=?";
$parent_result = $adb->pquery($parent_query, array($seid));
$parent_name = $adb->query_result($parent_result, 0, "potentialname");
}
if ($parent_module == 'Products') {
$parent_query = "SELECT productname FROM vtiger_products WHERE productid=?";
$parent_result = $adb->pquery($parent_query, array($seid));
$parent_name = $adb->query_result($parent_result, 0, "productname");
}
if ($parent_module == 'PurchaseOrder') {
$parent_query = "SELECT subject FROM vtiger_purchaseorder WHERE purchaseorderid=?";
$parent_result = $adb->pquery($parent_query, array($seid));
$parent_name = $adb->query_result($parent_result, 0, "subject");
}
if ($parent_module == 'SalesOrder') {
$parent_query = "SELECT subject FROM vtiger_salesorder WHERE salesorderid=?";
$parent_result = $adb->pquery($parent_query, array($seid));
$parent_name = $adb->query_result($parent_result, 0, "subject");
}
if ($parent_module == 'Invoice') {
$parent_query = "SELECT subject FROM vtiger_invoice WHERE invoiceid=?";
$parent_result = $adb->pquery($parent_query, array($seid));
$parent_name = $adb->query_result($parent_result, 0, "subject");
}
$parent_value = "<a href='index.php?module=" . $parent_module . "&action=" . $action . "&record=" . $seid . "'>" . $parent_name . "</a>";
} else {
$parent_value = '';
}
$log->debug("Exiting getRelatedToEntity method ...");
return $parent_value;
}
开发者ID:latechdirect,项目名称:vtiger,代码行数:59,代码来源:ListViewUtils.php
示例15: sanitizeValues
/**
* this function takes in an array of values for an user and sanitizes it for export
* @param array $arr - the array of values
*/
function sanitizeValues($arr)
{
$db = PearDatabase::getInstance();
$currentUser = Users_Record_Model::getCurrentUserModel();
$roleid = $currentUser->get('roleid');
if (empty($this->fieldArray)) {
$this->fieldArray = $this->moduleFieldInstances;
foreach ($this->fieldArray as $fieldName => $fieldObj) {
//In database we have same column name in two tables. - inventory modules only
if ($fieldObj->get('table') == 'vtiger_inventoryproductrel' && ($fieldName == 'discount_amount' || $fieldName == 'discount_percent')) {
$fieldName = 'item_' . $fieldName;
$this->fieldArray[$fieldName] = $fieldObj;
} else {
$columnName = $fieldObj->get('column');
$this->fieldArray[$columnName] = $fieldObj;
}
}
}
$moduleName = $this->moduleInstance->getName();
foreach ($arr as $fieldName => &$value) {
if (isset($this->fieldArray[$fieldName])) {
$fieldInfo = $this->fieldArray[$fieldName];
} else {
unset($arr[$fieldName]);
continue;
}
$value = trim(decode_html($value), "\"");
$uitype = $fieldInfo->get('uitype');
$fieldname = $fieldInfo->get('name');
if (!$this->fieldDataTypeCache[$fieldName]) {
$this->fieldDataTypeCache[$fieldName] = $fieldInfo->getFieldDataType();
}
$type = $this->fieldDataTypeCache[$fieldName];
if ($fieldname != 'hdnTaxType' && ($uitype == 15 || $uitype == 16 || $uitype == 33)) {
if (empty($this->picklistValues[$fieldname])) {
$this->picklistValues[$fieldname] = $this->fieldArray[$fieldname]->getPicklistValues();
}
// If the value being exported is accessible to current user
// or the picklist is multiselect type.
if ($uitype == 33 || $uitype == 16 || array_key_exists($value, $this->picklistValues[$fieldname])) {
// NOTE: multipicklist (uitype=33) values will be concatenated with |# delim
$value = trim($value);
} else {
$value = '';
}
} elseif ($uitype == 52 || $type == 'owner') {
$value = Vtiger_Util_Helper::getOwnerName($value);
} elseif ($type == 'reference') {
$value = trim($value);
if (!empty($value)) {
$parent_module = getSalesEntityType($value);
$displayValueArray = getEntityName($parent_module, $value);
if (!empty($displayValueArray)) {
foreach ($displayValueArray as $k => $v) {
$displayValue = $v;
}
}
if (!empty($parent_module) && !empty($displayValue)) {
$value = $parent_module . "::::" . $displayValue;
} else {
$value = "";
}
} else {
$value = '';
}
} elseif ($uitype == 72 || $uitype == 71) {
$value = CurrencyField::convertToUserFormat($value, null, true, true);
} elseif ($uitype == 7 && $fieldInfo->get('typeofdata') == 'N~O' || $uitype == 9) {
$value = decimalFormat($value);
} else {
if ($type == 'date' || $type == 'datetime') {
$value = DateTimeField::convertToUserFormat($value);
}
}
if ($moduleName == 'Documents' && $fieldname == 'description') {
$value = strip_tags($value);
$value = str_replace(' ', '', $value);
array_push($new_arr, $value);
}
}
return $arr;
}
开发者ID:cannking,项目名称:vtigercrm-debug,代码行数:86,代码来源:ExportData.php
示例16: get_contacts
/** Returns a list of the associated contacts
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc..
* All Rights Reserved..
*/
function get_contacts($id, $cur_tab_id, $rel_tab_id, $actions = false)
{
global $adb, $log, $singlepane_view, $currentModule, $current_user;
$log->debug("Entering get_contacts(" . $id . ") method ...");
$this_module = $currentModule;
$related_module = vtlib_getModuleNameById($rel_tab_id);
require_once "modules/{$related_module}/{$related_module}.php";
$other = new $related_module();
vtlib_setup_modulevars($related_module, $other);
$singular_modname = vtlib_toSingular($related_module);
$parenttab = getParentTab();
if ($singlepane_view == 'true') {
$returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id;
} else {
$returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id;
}
$button = '';
$search_string = '&fromPotential=true&acc_id=';
// leave it empty for compatibility
$relrs = $adb->pquery('select related_to from vtiger_potential where potentialid=?', array($id));
if ($relrs and $adb->num_rows($relrs) == 1) {
$relatedid = $adb->query_result($relrs, 0, 0);
$reltype = getSalesEntityType($relatedid);
if ($reltype == 'Accounts') {
$search_string = '&fromPotential=true&acc_id=' . $relatedid;
} elseif ($reltype == 'Contacts') {
$relrs = $adb->pquery('select accountid from vtiger_contactdetails where contactid=?', array($relatedid));
if ($relrs and $adb->num_rows($relrs) == 1) {
$relatedid = $adb->query_result($relrs, 0, 0);
if (!empty($relatedid)) {
$search_string = '&fromPotential=true&acc_id=' . $relatedid;
}
}
}
}
if ($actions) {
if (is_string($actions)) {
$actions = explode(',', strtoupper($actions));
}
if (in_array('SELECT', $actions) && isPermitted($related_module, 4, '') == 'yes') {
$button .= "<input title='" . getTranslatedString('LBL_SELECT') . " " . getTranslatedString($related_module) . "' class='crmbutton small edit' type='button' onclick=\"return window.open('index.php?module={$related_module}&return_module={$currentModule}&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid={$id}&parenttab={$parenttab}{$search_string}','test','width=640,height=602,resizable=0,scrollbars=0');\" value='" . getTranslatedString('LBL_SELECT') . " " . getTranslatedString($related_module) . "'> ";
}
if (in_array('ADD', $actions) && isPermitted($related_module, 1, '') == 'yes') {
$button .= "<input title='" . getTranslatedString('LBL_ADD_NEW') . " " . getTranslatedString($singular_modname) . "' class='crmbutton small create'" . " onclick='this.form.action.value=\"EditView\";this.form.module.value=\"{$related_module}\"' type='submit' name='button'" . " value='" . getTranslatedString('LBL_ADD_NEW') . " " . getTranslatedString($singular_modname) . "'> ";
}
}
$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,
vtiger_contactdetails.accountid,vtiger_potential.potentialid, vtiger_potential.potentialname, vtiger_contactdetails.contactid,
vtiger_contactdetails.lastname, vtiger_contactdetails.firstname, vtiger_contactdetails.title, vtiger_contactdetails.department,
vtiger_contactdetails.email, vtiger_contactdetails.phone, vtiger_crmentity.crmid, vtiger_crmentity.smownerid,
vtiger_crmentity.modifiedtime , vtiger_account.accountname from vtiger_potential
inner join vtiger_contpotentialrel on vtiger_contpotentialrel.potentialid = vtiger_potential.potentialid
inner join vtiger_contactdetails on vtiger_contpotentialrel.contactid = vtiger_contactdetails.contactid
inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_contactdetails.contactid
left join vtiger_account on vtiger_account.accountid = vtiger_contactdetails.accountid
left join vtiger_groups on vtiger_groups.groupid=vtiger_crmentity.smownerid
left join vtiger_users on vtiger_crmentity.smownerid=vtiger_users.id
where vtiger_potential.potentialid = ' . $id . ' and vtiger_crmentity.deleted=0';
$return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset);
if ($return_value == null) {
$return_value = array();
}
$return_value['CUSTOM_BUTTON'] = $button;
$log->debug("Exiting get_contacts method ...");
return $return_value;
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:71,代码来源:Potentials.php
示例17: getAssociatedProducts
// Reset the value w.r.t SalesOrder Selected
$currencyid = $so_focus->column_fields['currency_id'];
$rate = $so_focus->column_fields['conversion_rate'];
//Added to display the SO's associated products -- when we select SO in New Invoice page
if (isset($_REQUEST['salesorder_id']) && $_REQUEST['salesorder_id'] != '') {
$associated_prod = getAssociatedProducts("SalesOrder", $so_focus, $focus->column_fields['salesorder_id']);
}
$smarty->assign("SALESORDER_ID", $focus->column_fields['salesorder_id']);
$smarty->assign("ASSOCIATEDPRODUCTS", $associated_prod);
$smarty->assign("MODE", $so_focus->mode);
$smarty->assign("AVAILABLE_PRODUCTS", 'true');
} elseif (isset($_REQUEST['convertmode']) && $_REQUEST['convertmode'] == 'potentoinvoice') {
$focus->mode = '';
$_REQUEST['opportunity_id'] = $_REQUEST['return_id'];
$relpot = $adb->query_result($adb->pquery('select related_to from vtiger_potential where potentialid=?', array($_REQUEST['return_id'])), 0, 0);
$reltype = getSalesEntityType($relpot);
if ($reltype == 'Accounts') {
$_REQUEST['account_id'] = $relpot;
} else {
$_REQUEST['contact_id'] = $relpot;
}
}
}
if ($isduplicate == 'true') {
$smarty->assign('DUPLICATE_FROM', $focus->id);
$INVOICE_associated_prod = getAssociatedProducts($currentModule, $focus);
$inventory_cur_info = getInventoryCurrencyInfo($currentModule, $focus->id);
$currencyid = $inventory_cur_info['currency_id'];
$focus->id = '';
$focus->mode = '';
}
开发者ID:kikojover,项目名称:corebos,代码行数:31,代码来源:EditView.php
示例18: get_project_tickets
function get_project_tickets($id, $module, $customerid, $sessionid)
{
require_once 'modules/HelpDesk/HelpDesk.php';
require_once 'include/utils/UserInfoUtil.php';
$adb = PearDatabase::getInstance();
$log = vglobal('log');
$log->debug("Entering customer portal function get_project_tickets ..");
$check = checkModuleActive($module);
if ($check == false) {
return array("#MODULE INACTIVE#");
}
if (!validateSession($customerid, $sessionid)) {
return null;
}
$user = new Users();
$userid = getPortalUserid();
$current_user = $user->retrieveCurrentUserInfoFromFile($userid);
$focus = new HelpDesk();
$focus->filterInactiveFields('HelpDesk');
$TicketsfieldVisibilityByColumn = array();
$fields_list = array();
foreach ($focus->list_fields as $fieldlabel => $values) {
foreach ($values as $table => $fieldname) {
|
请发表评论