function handleEvent($eventName, $data) { $adb = PearDatabase::getInstance(); if ($eventName == 'vtiger.entity.aftersave') { $module = $data->getModuleName(); if ($module != "Users") { $labelInfo = Vtiger_Functions::computeCRMRecordLabels($module, $data->getId(), true); if (count($labelInfo) > 0) { $label = decode_html($labelInfo[$data->getId()]['name']); $search = decode_html($labelInfo[$data->getId()]['search']); $adb->pquery('UPDATE vtiger_crmentity SET label=?,searchlabel=? WHERE crmid=?', array($label, $search, $data->getId())); } } } }
function getEntityName($module, $ids_list, $compute = false) { if ($compute) { return Vtiger_Functions::computeCRMRecordLabels($module, $ids_list); } else { return Vtiger_Functions::getCRMRecordLabels($module, $ids_list); } }
function sanitizeInventoryValues($inventoryRow, $inventoryFields) { $inventoryEntries = []; foreach ($inventoryFields as $field) { $value = $inventoryRow[$field->getColumnName()]; if (in_array($field->getName(), ['Name', 'Reference'])) { $value = trim($value); if (!empty($value)) { $recordModule = Vtiger_Functions::getCRMRecordType($value); $displayValueArray = Vtiger_Functions::computeCRMRecordLabels($recordModule, $value); if (!empty($displayValueArray)) { foreach ($displayValueArray as $k => $v) { $displayValue = $v; } } if (!empty($recordModule) && !empty($displayValue)) { $value = $recordModule . '::::' . $displayValue; } else { $value = ''; } } else { $value = ''; } } else { $value = $field->getDisplayValue($value); } $inventoryEntries['inv_' . $field->getColumnName()] = $value; } return $inventoryEntries; }