mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04: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);
|
// 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
|
* @param $name
|
||||||
*
|
*
|
||||||
|
@ -114,7 +114,7 @@ class InvoiceTransformer extends BaseTransformer
|
|||||||
$invoice_data,
|
$invoice_data,
|
||||||
'invoice.custom_surcharge4'
|
'invoice.custom_surcharge4'
|
||||||
),
|
),
|
||||||
'exchange_rate' => $this->getFloat(
|
'exchange_rate' => $this->getFloatOrOne(
|
||||||
$invoice_data,
|
$invoice_data,
|
||||||
'invoice.exchange_rate'
|
'invoice.exchange_rate'
|
||||||
),
|
),
|
||||||
|
@ -114,7 +114,7 @@ class QuoteTransformer extends BaseTransformer
|
|||||||
$quote_data,
|
$quote_data,
|
||||||
'quote.custom_surcharge4'
|
'quote.custom_surcharge4'
|
||||||
),
|
),
|
||||||
'exchange_rate' => $this->getFloat(
|
'exchange_rate' => $this->getFloatOrOne(
|
||||||
$quote_data,
|
$quote_data,
|
||||||
'quote.exchange_rate'
|
'quote.exchange_rate'
|
||||||
),
|
),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user