mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-12 22:22:32 +01:00
checks for importing exchange rates
This commit is contained in:
parent
9bfaee5c1f
commit
6c3049f5cb
@ -319,6 +319,21 @@ class BaseTransformer
|
||||
// return Number::parseFloat($number);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* @param $field
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getFloatOrOne($data, $field)
|
||||
{
|
||||
if (array_key_exists($field, $data))
|
||||
return Number::parseStringFloat($data[$field]) > 0 ? Number::parseStringFloat($data[$field]) : 1;
|
||||
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
*
|
||||
|
@ -114,7 +114,7 @@ class InvoiceTransformer extends BaseTransformer
|
||||
$invoice_data,
|
||||
'invoice.custom_surcharge4'
|
||||
),
|
||||
'exchange_rate' => $this->getFloat(
|
||||
'exchange_rate' => $this->getFloatOrOne(
|
||||
$invoice_data,
|
||||
'invoice.exchange_rate'
|
||||
),
|
||||
|
@ -114,7 +114,7 @@ class QuoteTransformer extends BaseTransformer
|
||||
$quote_data,
|
||||
'quote.custom_surcharge4'
|
||||
),
|
||||
'exchange_rate' => $this->getFloat(
|
||||
'exchange_rate' => $this->getFloatOrOne(
|
||||
$quote_data,
|
||||
'quote.exchange_rate'
|
||||
),
|
||||
|
Loading…
Reference in New Issue
Block a user