setup($parentFieldArray, $vardef, $displayParams, $tabindex, false); $this->ss->left_delimiter = '{'; $this->ss->right_delimiter = '}'; $this->ss->assign('col',strtoupper($vardef['name'])); if(is_object($parentFieldArray) ){ if(!empty($parentFieldArray->currency_id)) { $this->ss->assign('currency_id',$parentFieldArray->currency_id); } } else if (!empty($parentFieldArray['CURRENCY_ID'])) { $this->ss->assign('currency_id',$parentFieldArray['CURRENCY_ID']); } else if (!empty($parentFieldArray['currency_id'])) { $this->ss->assign('currency_id',$parentFieldArray['currency_id']); } return $this->fetch($this->findTemplate('ListView')); } /** * @see SugarFieldBase::importSanitize() */ public function importSanitize( $value, $vardef, $focus, ImportFieldSanitize $settings ) { $value = str_replace($settings->currency_symbol,"",$value); return $settings->float($value,$vardef,$focus); } /** * format the currency field based on system locale values for currency * Note that this may be different from the precision specified in the vardefs. * @param string $rawfield value of the field * @param string $somewhere vardef for the field being processed * @return number formatted according to currency settings */ public function formatField($rawField, $vardef){ // for currency fields, use the user or system precision, not the precision in the vardef //this is achived by passing in $precision as null $precision = null; if ( $rawField === '' || $rawField === NULL ) { return ''; } return format_number($rawField,$precision,$precision); } }