本文整理汇总了PHP中getInventoryModules函数的典型用法代码示例。如果您正苦于以下问题:PHP getInventoryModules函数的具体用法?PHP getInventoryModules怎么用?PHP getInventoryModules使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getInventoryModules函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getQueryByModuleField
public function getQueryByModuleField($sourceModule, $field, $record, $listQuery)
{
$bmqdivx = "sourceModule";
$zlolzuy = "sourceModule";
${${"GLOBALS"}["qrqojbhxesaz"]} = array("Leads", "Accounts", "HelpDesk", "Potentials");
if (${$bmqdivx} == "PriceBooks" && ${${"GLOBALS"}["tebjrruj"]} == "priceBookRelatedList" || in_array(${$zlolzuy}, ${${"GLOBALS"}["qrqojbhxesaz"]}) || in_array(${${"GLOBALS"}["smtqzdj"]}, getInventoryModules())) {
${${"GLOBALS"}["vdridpr"]} = " vtiger_service.discontinued = 1 ";
$csusxhsru = "field";
$hxsdmdnrcwm = "sourceModule";
$hxnvgeuqzxj = "supportedModulesList";
if (${$hxsdmdnrcwm} == "PriceBooks" && ${$csusxhsru} == "priceBookRelatedList") {
${${"GLOBALS"}["vdridpr"]} .= " AND vtiger_service.serviceid NOT IN (SELECT productid FROM vtiger_pricebookproductrel WHERE pricebookid = '{$record}') ";
} elseif (in_array(${${"GLOBALS"}["smtqzdj"]}, ${$hxnvgeuqzxj})) {
$hcfqbvtwpxs = "condition";
${$hcfqbvtwpxs} .= " AND vtiger_service.serviceid NOT IN (SELECT relcrmid FROM vtiger_crmentityrel WHERE crmid = '{$record}' UNION SELECT crmid FROM vtiger_crmentityrel WHERE relcrmid = '{$record}') ";
}
${${"GLOBALS"}["myxgfagm"]} = stripos(${${"GLOBALS"}["texkhgc"]}, "where");
if (${${"GLOBALS"}["myxgfagm"]}) {
${"GLOBALS"}["jstyvedywb"] = "overRideQuery";
${"GLOBALS"}["duyhsdq"] = "split";
${"GLOBALS"}["tarygvij"] = "condition";
$ahusbk = "listQuery";
$lxqmuyuxd = "split";
${${"GLOBALS"}["duyhsdq"]} = spliti("where", ${$ahusbk});
${${"GLOBALS"}["jstyvedywb"]} = ${${"GLOBALS"}["wdrbrwcxv"]}[0] . " WHERE " . ${$lxqmuyuxd}[1] . " AND " . ${${"GLOBALS"}["tarygvij"]};
} else {
$arzttzsxki = "overRideQuery";
${$arzttzsxki} = ${${"GLOBALS"}["texkhgc"]} . " WHERE " . ${${"GLOBALS"}["vdridpr"]};
}
return ${${"GLOBALS"}["mvklfvtelnt"]};
}
}
示例2: searchRecord
/**
* Function searches the records in the module, if parentId & parentModule
* is given then searches only those records related to them.
* @param <String> $searchValue - Search value
* @param <Integer> $parentId - parent recordId
* @param <String> $parentModule - parent module name
* @return <Array of Vtiger_Record_Model>
*/
public function searchRecord($searchValue, $parentId = false, $parentModule = false, $relatedModule = false)
{
if (!empty($searchValue) && empty($parentId) && empty($parentModule) && in_array($relatedModule, getInventoryModules())) {
$matchingRecords = Products_Record_Model::getSearchResult($searchValue, $this->getName());
} else {
return parent::searchRecord($searchValue);
}
return $matchingRecords;
}
示例3: applyChange
function applyChange()
{
if ($this->hasError()) {
$this->sendError();
}
if ($this->isApplied()) {
$this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
} else {
require_once 'modules/com_vtiger_workflow/VTTaskManager.inc';
$taskTypes = array();
$defaultModules = array('include' => getInventoryModules(), 'exclude' => array());
$taskType = array("name" => "ConvertInventoryModule", "label" => "ConvertInventoryModule", "classname" => "ConvertInventoryModule", "classpath" => "modules/com_vtiger_workflow/tasks/convert_inventorymodule.inc", "templatepath" => "com_vtiger_workflow/taskforms/convert_inventorymodule.tpl", "modules" => $defaultModules, "sourcemodule" => '');
VTTaskType::registerTaskType($taskType);
$this->sendMsg('Changeset ' . get_class($this) . ' applied!');
$this->markApplied();
}
$this->finishExecution();
}
示例4: applyChange
function applyChange()
{
global $adb;
if ($this->hasError()) {
$this->sendError();
}
if ($this->isApplied()) {
$this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
} else {
$imods = getInventoryModules();
foreach ($imods as $mod) {
$module = Vtiger_Module::getInstance($mod);
$module->enableTools(array('Import', 'Export'));
}
$this->sendMsg('Changeset ' . get_class($this) . ' applied!');
$this->markApplied();
}
$this->finishExecution();
}
示例5: getQueryByModuleField
/**
* Function to get list view query for popup window
* @param <String> $sourceModule Parent module
* @param <String> $field parent fieldname
* @param <Integer> $record parent id
* @param <String> $listQuery
* @return <String> Listview Query
*/
public function getQueryByModuleField($sourceModule, $field, $record, $listQuery)
{
$supportedModulesList = array('Leads', 'Accounts', 'HelpDesk', 'Potentials');
if ($sourceModule == 'PriceBooks' && $field == 'priceBookRelatedList' || in_array($sourceModule, $supportedModulesList) || in_array($sourceModule, getInventoryModules())) {
$condition = " vtiger_service.discontinued = 1 ";
if ($sourceModule == 'PriceBooks' && $field == 'priceBookRelatedList') {
$condition .= " AND vtiger_service.serviceid NOT IN (SELECT productid FROM vtiger_pricebookproductrel WHERE pricebookid = '{$record}') ";
} elseif (in_array($sourceModule, $supportedModulesList)) {
$condition .= " AND vtiger_service.serviceid NOT IN (SELECT relcrmid FROM vtiger_crmentityrel WHERE crmid = '{$record}' UNION SELECT crmid FROM vtiger_crmentityrel WHERE relcrmid = '{$record}') ";
}
$pos = stripos($listQuery, 'where');
if ($pos) {
$overRideQuery = $listQuery . ' AND ' . $condition;
} else {
$overRideQuery = $listQuery . ' WHERE ' . $condition;
}
return $overRideQuery;
}
}
示例6: getTableFieldList
protected function getTableFieldList($tableName)
{
$tableFieldList = array();
$factory = WebserviceField::fromArray($this->pearDB, array('tablename' => $tableName));
$dbTableFields = $factory->getTableFields();
foreach ($dbTableFields as $dbField) {
if ($dbField->primaryKey) {
if ($this->idColumn === null) {
$this->idColumn = $dbField->name;
} else {
throw new WebServiceException(WebServiceErrorCode::$UNKOWNENTITY, "Entity table with multi column primary key is not supported");
}
}
$field = $this->getFieldArrayFromDBField($dbField, $tableName);
if (preg_match('/tax\\d+/', $dbField->name) != 0) {
$taxLabel = $this->getTaxLabelFromName($dbField->name);
if (!empty($taxLabel)) {
$field['fieldlabel'] = $taxLabel;
}
}
$webserviceField = WebserviceField::fromArray($this->pearDB, $field);
$fieldDataType = $this->getFieldType($dbField, $tableName);
if ($fieldDataType === null) {
$fieldDataType = $this->getFieldDataTypeFromDBType($dbField->type);
}
$webserviceField->setFieldDataType($fieldDataType);
if (strcasecmp($fieldDataType, 'reference') === 0) {
if ($webserviceField->getFieldName() == 'parent_id') {
$webserviceField->setReferenceList(getInventoryModules());
} else {
$webserviceField->setReferenceList(array('Products', 'Services'));
}
}
array_push($tableFieldList, $webserviceField);
}
return $tableFieldList;
}
示例7: GetFirstSortByField
function GetFirstSortByField($reportid)
{
$adb = PearDatabase::getInstance();
$groupByField = "";
$sortFieldQuery = "SELECT * FROM vtiger_reportsortcol\n LEFT JOIN vtiger_reportgroupbycolumn ON (vtiger_reportsortcol.sortcolid = vtiger_reportgroupbycolumn.sortid and vtiger_reportsortcol.reportid = vtiger_reportgroupbycolumn.reportid)\n WHERE columnname!='none' and vtiger_reportsortcol.reportid=? ORDER By sortcolid";
$sortFieldResult = $adb->pquery($sortFieldQuery, array($reportid));
$inventoryModules = getInventoryModules();
if ($adb->num_rows($sortFieldResult) > 0) {
$fieldcolname = $adb->query_result($sortFieldResult, 0, 'columnname');
list($tablename, $colname, $module_field, $fieldname, $typeOfData) = explode(":", $fieldcolname);
list($modulename, $fieldlabel) = explode('__', $module_field, 2);
$groupByField = $module_field;
if ($typeOfData == "D") {
$groupCriteria = $adb->query_result($sortFieldResult, 0, 'dategroupbycriteria');
if (strtolower($groupCriteria) != 'none') {
if (in_array($groupCriteria, array_keys($this->groupByTimeParent))) {
$parentCriteria = $this->groupByTimeParent[$groupCriteria];
foreach ($parentCriteria as $criteria) {
$groupByCondition[] = $this->GetTimeCriteriaCondition($criteria, $groupByField);
}
}
$groupByCondition[] = $this->GetTimeCriteriaCondition($groupCriteria, $groupByField);
$groupByField = implode(", ", $groupByCondition);
}
} elseif (CheckFieldPermission($fieldname, $modulename) != 'true') {
if (!(in_array($modulename, $inventoryModules) && $fieldname == 'serviceid')) {
$groupByField = $tablename . "." . $colname;
}
}
}
return $groupByField;
}
示例8: getQueryColumnsList
function getQueryColumnsList($reportid, $outputformat = '')
{
// Have we initialized information already?
if ($this->_columnslist !== false) {
return $this->_columnslist;
}
global $adb;
global $modules;
global $log, $current_user, $current_language;
$ssql = "select vtiger_pdfmaker_relblockcol.* from vtiger_pdfmaker_relblocks ";
$ssql .= " left join vtiger_pdfmaker_relblockcol on vtiger_pdfmaker_relblockcol.relblockid = vtiger_pdfmaker_relblocks.relblockid";
$ssql .= " where vtiger_pdfmaker_relblocks.relblockid = ?";
$ssql .= " order by vtiger_pdfmaker_relblockcol.colid";
$result = $adb->pquery($ssql, array($reportid));
$permitted_fields = array();
while ($columnslistrow = $adb->fetch_array($result)) {
$fieldname = "";
$fieldcolname = $columnslistrow["columnname"];
list($tablename, $colname, $module_field, $fieldname, $single) = split(":", $fieldcolname);
list($module, $field) = split("_", $module_field, 2);
$inventory_fields = array('serviceid');
$inventory_modules = getInventoryModules();
require 'user_privileges/user_privileges_' . $current_user->id . '.php';
if (sizeof($permitted_fields[$module]) == 0 && $is_admin == false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1) {
$permitted_fields[$module] = $this->getaccesfield($module);
}
if (in_array($module, $inventory_modules)) {
if (!empty($permitted_fields)) {
foreach ($inventory_fields as $value) {
array_push($permitted_fields[$module], $value);
}
}
}
$selectedfields = explode(":", $fieldcolname);
if ($is_admin == false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && !in_array($selectedfields[3], $permitted_fields[$module])) {
//user has no access to this field, skip it.
continue;
}
$concatSql = getSqlForNameInDisplayFormat(array('first_name' => $selectedfields[0] . ".first_name", 'last_name' => $selectedfields[0] . ".last_name"), 'Users');
$querycolumns = $this->getEscapedColumns($selectedfields);
if (isset($module) && $module != "") {
$mod_strings = return_module_language($current_language, $module);
}
$targetTableName = $tablename;
$fieldname = $selectedfields[3];
$fieldlabel = trim(preg_replace("/{$module}/", " ", $selectedfields[2], 1));
$mod_arr = explode('_', $fieldlabel);
$fieldlabel = trim(str_replace("_", " ", $fieldlabel));
//modified code to support i18n issue
$fld_arr = explode(" ", $fieldlabel);
if ($mod_arr[0] == '') {
$mod = $module;
$mod_lbl = $this->getTranslatedString($module, $module);
//module
} else {
$mod = $mod_arr[0];
array_shift($fld_arr);
$mod_lbl = $this->getTranslatedString($fld_arr[0], $mod);
//module
}
$fld_lbl_str = implode(" ", $fld_arr);
$fld_lbl = $this->getTranslatedString($fld_lbl_str, $module);
//fieldlabel
$fieldlabel = $mod . "_" . $fieldname;
if ($selectedfields[0] == "vtiger_usersRel1" && $selectedfields[1] == 'user_name' && $selectedfields[2] == 'Quotes_Inventory_Manager') {
$columnslist[$fieldcolname] = "trim( {$concatSql} ) as " . $module . "_Inventory_Manager";
$this->queryPlanner->addTable($selectedfields[0]);
continue;
}
if (CheckFieldPermission($fieldname, $mod) != 'true' && $colname != "crmid" && (!in_array($fieldname, $inventory_fields) && in_array($module, $inventory_modules)) || empty($fieldname)) {
continue;
} else {
$this->labelMapping[$selectedfields[2]] = str_replace(" ", "_", $fieldlabel);
$header_label = $fieldlabel;
// To check if the field in the report is a custom field
// and if yes, get the label of this custom field freshly from the vtiger_field as it would have been changed.
// Asha - Reference ticket : #4906
if ($querycolumns == "") {
if ($selectedfields[4] == 'C') {
$field_label_data = split("_", $selectedfields[2]);
$module = $field_label_data[0];
if ($module != $this->primarymodule) {
$columnslist[$fieldcolname] = "case when (" . $selectedfields[0] . "." . $selectedfields[1] . "='1')then 'yes' else case when (vtiger_crmentity{$module}.crmid !='') then 'no' else '-' end end as '{$fieldlabel}'";
$this->queryPlanner->addTable("vtiger_crmentity{$module}");
} else {
$columnslist[$fieldcolname] = "case when (" . $selectedfields[0] . "." . $selectedfields[1] . "='1')then 'yes' else case when (vtiger_crmentity.crmid !='') then 'no' else '-' end end as '{$fieldlabel}'";
$this->queryPlanner->addTable("vtiger_crmentity{$module}");
}
} elseif ($selectedfields[0] == 'vtiger_activity' && $selectedfields[1] == 'status') {
$columnslist[$fieldcolname] = " case when (vtiger_activity.status not like '') then vtiger_activity.status else vtiger_activity.eventstatus end as Calendar_Status";
} elseif ($selectedfields[0] == 'vtiger_activity' && $selectedfields[1] == 'date_start') {
if ($module == 'Emails') {
$columnslist[$fieldcolname] = "cast(concat(vtiger_activity.date_start,' ',vtiger_activity.time_start) as DATE) as Emails_Date_Sent";
} else {
$columnslist[$fieldcolname] = "cast(concat(vtiger_activity.date_start,' ',vtiger_activity.time_start) AS DATETIME) AS Calendar_date_start";
}
} elseif (stristr($selectedfields[0], "vtiger_users") && $selectedfields[1] == 'user_name') {
$temp_module_from_tablename = str_replace("vtiger_users", "", $selectedfields[0]);
if ($module != $this->primarymodule) {
$condition = "and vtiger_crmentity" . $module . ".crmid!=''";
//.........这里部分代码省略.........
示例9: getExportQuery
/**
* Function that generates Export Query based on the mode
* @param Vtiger_Request $request
* @return <String> export query
*/
function getExportQuery(Vtiger_Request $request)
{
$currentUser = Users_Record_Model::getCurrentUserModel();
$mode = $request->getMode();
$cvId = $request->get('viewname');
$moduleName = $request->get('source_module');
$queryGenerator = new QueryGenerator($moduleName, $currentUser);
$queryGenerator->initForCustomViewById($cvId);
$fieldInstances = $this->moduleFieldInstances;
$accessiblePresenceValue = array(0, 2);
foreach ($fieldInstances as $field) {
// Check added as querygenerator is not checking this for admin users
$presence = $field->get('presence');
if (in_array($presence, $accessiblePresenceValue)) {
$fields[] = $field->getName();
}
}
$queryGenerator->setFields($fields);
$query = $queryGenerator->getQuery();
if (in_array($moduleName, getInventoryModules())) {
$query = $this->moduleInstance->getExportQuery($this->focus, $query);
}
$this->accessibleFields = $queryGenerator->getFields();
switch ($mode) {
case 'ExportAllData':
return $query;
break;
case 'ExportCurrentPage':
$pagingModel = new Vtiger_Paging_Model();
$limit = $pagingModel->getPageLimit();
$currentPage = $request->get('page');
if (empty($currentPage)) {
$currentPage = 1;
}
$currentPageStart = ($currentPage - 1) * $limit;
if ($currentPageStart < 0) {
$currentPageStart = 0;
}
$query .= ' LIMIT ' . $currentPageStart . ',' . $limit;
return $query;
break;
case 'ExportSelectedRecords':
$idList = $this->getRecordsListFromRequest($request);
$baseTable = $this->moduleInstance->get('basetable');
$baseTableColumnId = $this->moduleInstance->get('basetableid');
if (!empty($idList)) {
if (!empty($baseTable) && !empty($baseTableColumnId)) {
$idList = implode(',', $idList);
$query .= ' AND ' . $baseTable . '.' . $baseTableColumnId . ' IN (' . $idList . ')';
}
} else {
$query .= ' AND ' . $baseTable . '.' . $baseTableColumnId . ' NOT IN (' . implode(',', $request->get('excluded_ids')) . ')';
}
return $query;
break;
default:
return $query;
break;
}
}
示例10: getSelectClauseFields
function getSelectClauseFields($module, $moduleMeta, $user)
{
$moduleFieldNames = $moduleMeta->getModuleFields();
$inventoryModules = getInventoryModules();
if (in_array($module, $inventoryModules)) {
$fields = vtws_describe('LineItem', $user);
foreach ($fields['fields'] as $field) {
unset($moduleFieldNames[$field['name']]);
}
foreach ($moduleFieldNames as $field => $fieldObj) {
if (substr($field, 0, 5) == 'shtax') {
unset($moduleFieldNames[$field]);
}
}
}
return array_keys($moduleFieldNames);
}
示例11: transformForImport
public function transformForImport($fieldData, $moduleMeta, $fillDefault = true, $mergeMode = false)
{
$moduleFields = $moduleMeta->getModuleFields();
$defaultFieldValues = $this->getDefaultFieldValues($moduleMeta);
foreach ($fieldData as $fieldName => $fieldValue) {
$fieldInstance = $moduleFields[$fieldName];
if (!is_object($fieldInstance)) {
continue;
}
// specially for Inventory module import which has virtual item line fields
if ($fieldInstance->getFieldDataType() == 'owner') {
global $adb;
if (strpos($fieldValue, '::::') > 0) {
$fieldValueDetails = explode('::::', $fieldValue);
} else {
$fieldValueDetails = explode(':::', $fieldValue);
}
if (count($fieldValueDetails) == 2) {
$fieldValue = $fieldValueDetails[1];
}
if (count($fieldValueDetails) == 3) {
$user_qry = 'select vtiger_users.id from vtiger_users where ' . $fieldValueDetails[2] . ' = ?';
$res = $adb->pquery($user_qry, array($fieldValueDetails[1]));
$ownerId = 0;
if ($res and $adb->num_rows($res) > 0) {
$ownerId = $adb->query_result($res, 0, 'id');
}
} else {
$ownerId = getUserId_Ol($fieldValue);
if (empty($ownerId)) {
$ownerId = getGrpId($fieldValue);
}
}
if (empty($ownerId) && isset($defaultFieldValues[$fieldName])) {
$ownerId = $defaultFieldValues[$fieldName];
}
if (empty($ownerId) || !Import_Utils::hasAssignPrivilege($moduleMeta->getEntityName(), $ownerId)) {
$ownerId = $this->user->id;
}
$fieldData[$fieldName] = $ownerId;
} elseif ($fieldInstance->getFieldDataType() == 'reference') {
$entityId = false;
if (!empty($fieldValue)) {
if (strpos($fieldValue, '::::') > 0) {
$fieldValueDetails = explode('::::', $fieldValue);
} else {
$fieldValueDetails = explode(':::', $fieldValue);
}
if (count($fieldValueDetails) > 1) {
$referenceModuleName = trim($fieldValueDetails[0]);
$entityLabel = trim($fieldValueDetails[1]);
if (!empty($fieldValueDetails[2])) {
$entityId = getEntityId($referenceModuleName, $entityLabel, $fieldValueDetails[2]);
} else {
$entityId = getEntityId($referenceModuleName, $entityLabel);
}
} else {
$referencedModules = $fieldInstance->getReferenceList();
$entityLabel = $fieldValue;
foreach ($referencedModules as $referenceModule) {
$referenceModuleName = $referenceModule;
if ($referenceModule == 'Users') {
$referenceEntityId = getUserId_Ol($entityLabel);
if (empty($referenceEntityId) || !Import_Utils::hasAssignPrivilege($moduleMeta->getEntityName(), $referenceEntityId)) {
$referenceEntityId = $this->user->id;
}
} else {
$referenceEntityId = getEntityId($referenceModule, $entityLabel);
}
if ($referenceEntityId != 0) {
$entityId = $referenceEntityId;
break;
}
}
}
if ((empty($entityId) || $entityId == 0) && (!empty($referenceModuleName) and !in_array($referenceModuleName, getInventoryModules()))) {
if (isPermitted($referenceModuleName, 'EditView') == 'yes') {
$wsEntityIdInfo = $this->createEntityRecord($referenceModuleName, $entityLabel);
$wsEntityId = $wsEntityIdInfo['id'];
$entityIdComponents = vtws_getIdComponents($wsEntityId);
$entityId = $entityIdComponents[1];
}
}
$fieldData[$fieldName] = $entityId;
} else {
$referencedModules = $fieldInstance->getReferenceList();
if ($referencedModules[0] == 'Users') {
if (isset($defaultFieldValues[$fieldName])) {
$fieldData[$fieldName] = $defaultFieldValues[$fieldName];
}
if (empty($fieldData[$fieldName]) || !Import_Utils::hasAssignPrivilege($moduleMeta->getEntityName(), $fieldData[$fieldName])) {
$fieldData[$fieldName] = $this->user->id;
}
} else {
$fieldData[$fieldName] = '';
}
}
} elseif ($fieldInstance->getFieldDataType() == 'picklist') {
global $default_charset;
if (empty($fieldValue) && isset($defaultFieldValues[$fieldName])) {
//.........这里部分代码省略.........
示例12: getImportableFields
public function getImportableFields($moduleName)
{
$focus = CRMEntity::getInstance($moduleName);
if (method_exists($focus, 'getImportableFields')) {
$importableFields = $focus->getImportableFields();
} else {
// if we are merging, then selected merge fields must be in selectable fields, so we fill in the mergeFields
$mergeFields = array();
if (isset($_REQUEST['merge_type']) and !empty($_REQUEST['merge_fields'])) {
$json = vtlib_purify($_REQUEST['merge_fields']);
$mergeFields = json_decode($json);
}
$moduleFields = $this->getAccessibleFields($moduleName);
$importableFields = array();
foreach ($moduleFields as $fieldName => $fieldInstance) {
if ($this->isEditableField($fieldInstance) && ($fieldInstance->getTableName() != 'vtiger_crmentity' || $fieldInstance->getColumnName() != 'modifiedby') || $fieldInstance->getUIType() == '70' && $fieldName != 'modifiedtime' || in_array($fieldName, $mergeFields)) {
$importableFields[$fieldName] = $fieldInstance;
}
}
}
if (in_array($moduleName, getInventoryModules())) {
include_once 'include/fields/InventoryLineField.php';
$ilfields = new InventoryLineField();
$importableFields = array_merge($importableFields, $ilfields->getInventoryLineFieldsByObject());
}
return $importableFields;
}
示例13: getExportRecordIds
function getExportRecordIds($moduleName, $viewid, $input)
{
global $adb, $current_user, $list_max_entries_per_page;
$idstring = vtlib_purify($input['idstring']);
$export_data = vtlib_purify($input['export_data']);
if (in_array($moduleName, getInventoryModules()) && $export_data == 'currentpage') {
$queryGenerator = new QueryGenerator($moduleName, $current_user);
$queryGenerator->initForCustomViewById($viewid);
if ($input['query'] == 'true') {
$queryGenerator->addUserSearchConditions($input);
}
$queryGenerator->setFields(array('id'));
$query = $queryGenerator->getQuery();
$current_page = ListViewSession::getCurrentPage($moduleName, $viewid);
$limit_start_rec = ($current_page - 1) * $list_max_entries_per_page;
if ($limit_start_rec < 0) {
$limit_start_rec = 0;
}
$query .= ' LIMIT ' . $limit_start_rec . ',' . $list_max_entries_per_page;
$result = $adb->pquery($query, array());
$idstring = array();
$focus = CRMEntity::getInstance($moduleName);
for ($i = 0; $i < $adb->num_rows($result); $i++) {
$idstring[] = $adb->query_result($result, $i, $focus->table_index);
}
$idstring = implode(';', $idstring);
$export_data = 'selecteddata';
}
return $idstring . '#@@#' . $export_data;
}
示例14: showResult
public static function showResult($importInfo, $importStatusCount)
{
$moduleName = $importInfo['module'];
$ownerId = $importInfo['user_id'];
$viewer = new Vtiger_Viewer();
$viewer->assign('SKIPPED_RECORDS', $skippedRecords);
$viewer->assign('FOR_MODULE', $moduleName);
$viewer->assign('MODULE', 'Import');
$viewer->assign('OWNER_ID', $ownerId);
$viewer->assign('IMPORT_RESULT', $importStatusCount);
$viewer->assign('INVENTORY_MODULES', getInventoryModules());
$viewer->assign('MERGE_ENABLED', $importInfo['merge_type']);
$viewer->view('ImportResult.tpl', 'Import');
}
示例15: process
public function process(Vtiger_Request $request)
{
$viewer = $this->getViewer($request);
$moduleName = $request->get('source_module');
$module = $request->getModule();
$record = $request->get('record');
$duplicate = $request->get('duplicate');
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceForModule($moduleModel);
if (!empty($record)) {
$customViewModel = CustomView_Record_Model::getInstanceById($record);
$viewer->assign('MODE', 'edit');
} else {
$customViewModel = new CustomView_Record_Model();
$customViewModel->setModule($moduleName);
$viewer->assign('MODE', '');
}
$viewer->assign('ADVANCE_CRITERIA', $customViewModel->transformToNewAdvancedFilter());
$viewer->assign('CURRENTDATE', date('Y-n-j'));
$viewer->assign('DATE_FILTERS', Vtiger_Field_Model::getDateFilterTypes());
if ($moduleName == 'Calendar') {
$advanceFilterOpsByFieldType = Calendar_Field_Model::getAdvancedFilterOpsByFieldType();
} else {
$advanceFilterOpsByFieldType = Vtiger_Field_Model::getAdvancedFilterOpsByFieldType();
}
$viewer->assign('ADVANCED_FILTER_OPTIONS', Vtiger_Field_Model::getAdvancedFilterOptions());
$viewer->assign('ADVANCED_FILTER_OPTIONS_BY_TYPE', $advanceFilterOpsByFieldType);
$dateFilters = Vtiger_Field_Model::getDateFilterTypes();
foreach ($dateFilters as $comparatorKey => $comparatorInfo) {
$comparatorInfo['startdate'] = DateTimeField::convertToUserFormat($comparatorInfo['startdate']);
$comparatorInfo['enddate'] = DateTimeField::convertToUserFormat($comparatorInfo['enddate']);
$comparatorInfo['label'] = vtranslate($comparatorInfo['label'], $module);
$dateFilters[$comparatorKey] = $comparatorInfo;
}
$viewer->assign('DATE_FILTERS', $dateFilters);
$viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance);
$recordStructure = $recordStructureInstance->getStructure();
// for Inventory module we should now allow item details block
if (in_array($moduleName, getInventoryModules())) {
$itemsBlock = "LBL_ITEM_DETAILS";
unset($recordStructure[$itemsBlock]);
}
$viewer->assign('RECORD_STRUCTURE', $recordStructure);
// Added to show event module custom fields
if ($moduleName == 'Calendar') {
$relatedModuleName = 'Events';
$relatedModuleModel = Vtiger_Module_Model::getInstance($relatedModuleName);
$relatedRecordStructureInstance = Vtiger_RecordStructure_Model::getInstanceForModule($relatedModuleModel);
$eventBlocksFields = $relatedRecordStructureInstance->getStructure();
$viewer->assign('EVENT_RECORD_STRUCTURE_MODEL', $relatedRecordStructureInstance);
$viewer->assign('EVENT_RECORD_STRUCTURE', $eventBlocksFields);
}
$viewer->assign('CUSTOMVIEW_MODEL', $customViewModel);
if ($duplicate != '1') {
$viewer->assign('RECORD_ID', $record);
}
$viewer->assign('MODULE', $module);
$viewer->assign('SOURCE_MODULE', $moduleName);
$viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
if ($customViewModel->get('viewname') == 'All') {
$viewer->assign('CV_PRIVATE_VALUE', CustomView_Record_Model::CV_STATUS_DEFAULT);
} else {
$viewer->assign('CV_PRIVATE_VALUE', CustomView_Record_Model::CV_STATUS_PRIVATE);
}
$viewer->assign('CV_PENDING_VALUE', CustomView_Record_Model::CV_STATUS_PENDING);
$viewer->assign('CV_PUBLIC_VALUE', CustomView_Record_Model::CV_STATUS_PUBLIC);
$viewer->assign('MODULE_MODEL', $moduleModel);
echo $viewer->view('EditView.tpl', $module, true);
}