[ 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 class Inventory_RelationListView_Model extends Vtiger_RelationListView_Model { 12 13 public function getAddRelationLinks() { 14 $relationModel = $this->getRelationModel(); 15 $addLinkModel = array(); 16 17 if(!$relationModel->isAddActionSupported()) { 18 return $addLinkModel; 19 } 20 $relatedModel = $relationModel->getRelationModuleModel(); 21 22 if($relatedModel->get('label') == 'Calendar'){ 23 $addLinkList[] = array( 24 'linktype' => 'LISTVIEWBASIC', 25 'linklabel' => vtranslate('LBL_ADD_TASK'), 26 'linkurl' => $this->getCreateTaskRecordUrl(), 27 'linkicon' => '', 28 ); 29 }else{ 30 $addLinkList = array( 31 array( 32 'linktype' => 'LISTVIEWBASIC', 33 'linklabel' => vtranslate('LBL_ADD')." ".vtranslate($relatedModel->get('label')), 34 'linkurl' => $this->getCreateViewUrl(), 35 'linkicon' => '', 36 ) 37 ); 38 } 39 40 foreach($addLinkList as $addLink) { 41 $addLinkModel[] = Vtiger_Link_Model::getInstanceFromValues($addLink); 42 } 43 return $addLinkModel; 44 } 45 46 public function getCreateViewUrl(){ 47 $createViewUrl = parent::getCreateViewUrl(); 48 $currentUserModel = Users_Record_Model::getCurrentUserModel(); 49 $parentRecordModel = $this->getParentRecordModel(); 50 $currencyValue = $parentRecordModel->get('hdnGrandTotal'); 51 $parentRecordModelCurrencyId = $parentRecordModel->get('currency_id'); 52 53 if($parentRecordModelCurrencyId == $currentUserModel->get('currency_id')) { 54 $amount = CurrencyField::convertToUserFormat($currencyValue, null, true); 55 } else { 56 $baseCurrencyId = CurrencyField::getDBCurrencyId(); 57 $allCurrencies = getAllCurrencies(); 58 59 foreach ($allCurrencies as $currencyInfo) { 60 if ($parentRecordModelCurrencyId == $currencyInfo['currency_id']) { 61 $currencyValue = CurrencyField::convertToDollar($currencyValue, $currencyInfo['conversionrate']); 62 } 63 } 64 65 foreach ($allCurrencies as $currencyInfo) { 66 if ($baseCurrencyId == $currencyInfo['currency_id']) { 67 $currencyValue = CurrencyField::convertFromMasterCurrency($currencyValue, $currencyInfo['conversionrate']); 68 } 69 } 70 71 $amount = CurrencyField::convertToUserFormat($currencyValue); 72 } 73 74 return $createViewUrl.'&relatedcontact='.$parentRecordModel->get('contact_id'). 75 '&relatedorganization='. $parentRecordModel->get('account_id').'&amount='.$amount; 76 } 77 78 } 79 ?>
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 |