[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
1 <?php 2 /*+*********************************************************************************** 3 * The contents of this file are subject to the vtiger CRM Public License Version 1.0 4 * ("License"); You may not use this file except in compliance with the License 5 * The Original Code is: vtiger CRM Open Source 6 * The Initial Developer of the Original Code is vtiger. 7 * Portions created by vtiger are Copyright (C) vtiger. 8 * All Rights Reserved. 9 *************************************************************************************/ 10 /** 11 * Inventory Module Model Class 12 */ 13 class Inventory_Module_Model extends Vtiger_Module_Model { 14 15 /** 16 * Function to check whether the module is an entity type module or not 17 * @return <Boolean> true/false 18 */ 19 public function isQuickCreateSupported(){ 20 //SalesOrder module is not enabled for quick create 21 return false; 22 } 23 24 /** 25 * Function to check whether the module is summary view supported 26 * @return <Boolean> - true/false 27 */ 28 public function isSummaryViewSupported() { 29 return false; 30 } 31 32 static function getAllCurrencies() { 33 return getAllCurrencies(); 34 } 35 36 static function getAllProductTaxes() { 37 return getAllTaxes('available'); 38 } 39 40 static function getAllShippingTaxes() { 41 return getAllTaxes('available', 'sh'); 42 } 43 44 /** 45 * Function to get relation query for particular module with function name 46 * @param <record> $recordId 47 * @param <String> $functionName 48 * @param Vtiger_Module_Model $relatedModule 49 * @return <String> 50 */ 51 public function getRelationQuery($recordId, $functionName, $relatedModule) { 52 if ($functionName === 'get_activities') { 53 $userNameSql = getSqlForNameInDisplayFormat(array('first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'), 'Users'); 54 55 $query = "SELECT CASE WHEN (vtiger_users.user_name not like '') THEN $userNameSql ELSE vtiger_groups.groupname END AS user_name, 56 vtiger_crmentity.*, vtiger_activity.activitytype, vtiger_activity.subject, vtiger_activity.date_start, vtiger_activity.time_start, 57 vtiger_activity.recurringtype, vtiger_activity.due_date, vtiger_activity.time_end, vtiger_activity.visibility, vtiger_seactivityrel.crmid AS parent_id, 58 CASE WHEN (vtiger_activity.activitytype = 'Task') THEN (vtiger_activity.status) ELSE (vtiger_activity.eventstatus) END AS status 59 FROM vtiger_activity 60 INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_activity.activityid 61 LEFT JOIN vtiger_seactivityrel ON vtiger_seactivityrel.activityid = vtiger_activity.activityid 62 LEFT JOIN vtiger_cntactivityrel ON vtiger_cntactivityrel.activityid = vtiger_activity.activityid 63 LEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid 64 LEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid 65 WHERE vtiger_crmentity.deleted = 0 AND vtiger_activity.activitytype = 'Task' 66 AND vtiger_seactivityrel.crmid = ".$recordId; 67 68 $relatedModuleName = $relatedModule->getName(); 69 $query .= $this->getSpecificRelationQuery($relatedModuleName); 70 $nonAdminQuery = $this->getNonAdminAccessControlQueryForRelation($relatedModuleName); 71 if ($nonAdminQuery) { 72 $query = appendFromClauseToQuery($query, $nonAdminQuery); 73 } 74 } else { 75 $query = parent::getRelationQuery($recordId, $functionName, $relatedModule); 76 } 77 78 return $query; 79 } 80 81 /** 82 * Function returns export query 83 * @param <String> $where 84 * @return <String> export query 85 */ 86 public function getExportQuery($focus, $query) { 87 $baseTableName = $focus->table_name; 88 $splitQuery = spliti(' FROM ', $query); 89 $columnFields = explode(',', $splitQuery[0]); 90 foreach ($columnFields as $key => &$value) { 91 if($value == ' vtiger_inventoryproductrel.discount_amount'){ 92 $value = ' vtiger_inventoryproductrel.discount_amount AS item_discount_amount'; 93 } else if($value == ' vtiger_inventoryproductrel.discount_percent'){ 94 $value = ' vtiger_inventoryproductrel.discount_percent AS item_discount_percent'; 95 } else if($value == " $baseTableName.currency_id"){ 96 $value = ' vtiger_currency_info.currency_name AS currency_id'; 97 } 98 } 99 $joinSplit = spliti(' WHERE ',$splitQuery[1]); 100 $joinSplit[0] .= " LEFT JOIN vtiger_currency_info ON vtiger_currency_info.id = $baseTableName.currency_id"; 101 $splitQuery[1] = $joinSplit[0] . ' WHERE ' .$joinSplit[1]; 102 103 $query = implode(',', $columnFields).' FROM ' . $splitQuery[1]; 104 105 return $query; 106 } 107 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |