[ 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 Vtiger_Currency_UIType extends Vtiger_Base_UIType { 12 13 /** 14 * Function to get the Template name for the current UI Type object 15 * @return <String> - Template Name 16 */ 17 public function getTemplateName() { 18 return 'uitypes/Currency.tpl'; 19 } 20 21 /** 22 * Function to get the Display Value, for the current field type with given DB Insert Value 23 * @param <Object> $value 24 * @return <Object> 25 */ 26 public function getDisplayValue($value) { 27 $uiType = $this->get('field')->get('uitype'); 28 if ($value) { 29 if ($uiType == 72) { 30 // Some of the currency fields like Unit Price, Totoal , Sub-total - doesn't need currency conversion during save 31 $value = CurrencyField::convertToUserFormat($value, null, true); 32 } else { 33 $value = CurrencyField::convertToUserFormat($value); 34 } 35 return $value; 36 } 37 return null; 38 } 39 40 /** 41 * Function to get the Value of the field in the format, the user provides it on Save 42 * @param <Object> $value 43 * @return <Object> 44 */ 45 public function getUserRequestValue($value) { 46 return $this->getDisplayValue($value); 47 } 48 49 /** 50 * Function to get the DB Insert Value, for the current field type with given User Value 51 * @param <Object> $value 52 * @return <Object> 53 */ 54 public function getDBInsertValue($value) { 55 $uiType = $this->get('field')->get('uitype'); 56 if($uiType == 72) { 57 return self::convertToDBFormat($value,null,true); 58 }else { 59 return self::convertToDBFormat($value); 60 } 61 } 62 63 /** 64 * Function to transform display value for currency field 65 * @param $value 66 * @param Current User 67 * @param <Boolean> Skip Conversion 68 * @return converted user format value 69 */ 70 public static function transformDisplayValue($value, $user=null, $skipConversion=false) { 71 return CurrencyField::convertToUserFormat($value, $user, $skipConversion); 72 } 73 74 /** 75 * Function converts User currency format to database format 76 * @param <Object> $value - Currency value 77 * @param <User Object> $user 78 * @param <Boolean> $skipConversion 79 */ 80 public static function convertToDBFormat($value, $user=null, $skipConversion=false) { 81 return CurrencyField::convertToDBFormat($value, $user, $skipConversion); 82 } 83 84 /** 85 * Function to get the display value in edit view 86 * @param <String> $value 87 * @return <String> 88 */ 89 public function getEditViewDisplayValue($value) { 90 if(!empty($value)) 91 return $this->getDisplayValue($value); 92 return $value; 93 } 94 }
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 |