Fix substitution var __AMOUNT_TEXT__
This commit is contained in:
parent
eedaca1476
commit
155fa43dc6
@ -6504,10 +6504,14 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
|
|||||||
}
|
}
|
||||||
if (empty($exclude) || !in_array('objectamount', $exclude))
|
if (empty($exclude) || !in_array('objectamount', $exclude))
|
||||||
{
|
{
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/functionsnumtoword.lib.php';
|
||||||
|
|
||||||
$substitutionarray['__DATE_YMD__'] = is_object($object) ? (isset($object->date) ? dol_print_date($object->date, 'day', 0, $outputlangs) : null) : '';
|
$substitutionarray['__DATE_YMD__'] = is_object($object) ? (isset($object->date) ? dol_print_date($object->date, 'day', 0, $outputlangs) : null) : '';
|
||||||
$substitutionarray['__DATE_DUE_YMD__'] = is_object($object) ? (isset($object->date_lim_reglement) ? dol_print_date($object->date_lim_reglement, 'day', 0, $outputlangs) : null) : '';
|
$substitutionarray['__DATE_DUE_YMD__'] = is_object($object) ? (isset($object->date_lim_reglement) ? dol_print_date($object->date_lim_reglement, 'day', 0, $outputlangs) : null) : '';
|
||||||
|
|
||||||
$substitutionarray['__AMOUNT__'] = is_object($object) ? $object->total_ttc : '';
|
$substitutionarray['__AMOUNT__'] = is_object($object) ? $object->total_ttc : '';
|
||||||
|
$substitutionarray['__AMOUNT_TEXT__'] = is_object($object) ? dol_convertToWord($object->total_ttc, $outputlangs, '', true) : '';
|
||||||
|
$substitutionarray['__AMOUNT_TEXTCURRENCY__'] = is_object($object) ? dol_convertToWord($object->total_ttc, $outputlangs, $conf->currency, true) : '';
|
||||||
$substitutionarray['__AMOUNT_EXCL_TAX__'] = is_object($object) ? $object->total_ht : '';
|
$substitutionarray['__AMOUNT_EXCL_TAX__'] = is_object($object) ? $object->total_ht : '';
|
||||||
$substitutionarray['__AMOUNT_VAT__'] = is_object($object) ? (isset($object->total_vat) ? $object->total_vat : $object->total_tva) : '';
|
$substitutionarray['__AMOUNT_VAT__'] = is_object($object) ? (isset($object->total_vat) ? $object->total_vat : $object->total_tva) : '';
|
||||||
if ($onlykey != 2 || $mysoc->useLocalTax(1)) $substitutionarray['__AMOUNT_TAX2__'] = is_object($object) ? $object->total_localtax1 : '';
|
if ($onlykey != 2 || $mysoc->useLocalTax(1)) $substitutionarray['__AMOUNT_TAX2__'] = is_object($object) ? $object->total_localtax1 : '';
|
||||||
@ -6519,7 +6523,10 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
|
|||||||
if ($onlykey != 2 || $mysoc->useLocalTax(1)) $substitutionarray['__AMOUNT_TAX2_FORMATED__'] = is_object($object) ? ($object->total_localtax1 ? price($object->total_localtax1, 0, $outputlangs, 0, 0, -1, $conf->currency) : null) : '';
|
if ($onlykey != 2 || $mysoc->useLocalTax(1)) $substitutionarray['__AMOUNT_TAX2_FORMATED__'] = is_object($object) ? ($object->total_localtax1 ? price($object->total_localtax1, 0, $outputlangs, 0, 0, -1, $conf->currency) : null) : '';
|
||||||
if ($onlykey != 2 || $mysoc->useLocalTax(2)) $substitutionarray['__AMOUNT_TAX3_FORMATED__'] = is_object($object) ? ($object->total_localtax2 ? price($object->total_localtax2, 0, $outputlangs, 0, 0, -1, $conf->currency) : null) : '';
|
if ($onlykey != 2 || $mysoc->useLocalTax(2)) $substitutionarray['__AMOUNT_TAX3_FORMATED__'] = is_object($object) ? ($object->total_localtax2 ? price($object->total_localtax2, 0, $outputlangs, 0, 0, -1, $conf->currency) : null) : '';
|
||||||
|
|
||||||
// TODO Add keys for foreign multicurrency
|
$substitutionarray['__AMOUNT_MULTICURRENCY__'] = is_object($object) ? $object->multicurrency_total_ttc : '';
|
||||||
|
$substitutionarray['__AMOUNT_MULTICURRENCY_TEXT__'] = is_object($object) ? dol_convertToWord($object->multicurrency_total_ttc, $outputlangs, '', true) : '';
|
||||||
|
$substitutionarray['__AMOUNT_MULTICURRENCY_TEXTCURRENCY__'] = is_object($object) ? dol_convertToWord($object->multicurrency_total_ttc, $outputlangs, $object->multicurrency_code, true) : '';
|
||||||
|
// TODO Add other keys for foreign multicurrency
|
||||||
|
|
||||||
// For backward compatibility
|
// For backward compatibility
|
||||||
if ($onlykey != 2)
|
if ($onlykey != 2)
|
||||||
|
|||||||
@ -29,11 +29,11 @@
|
|||||||
*
|
*
|
||||||
* @param float $num Number to convert (must be a numeric value, like reported by price2num())
|
* @param float $num Number to convert (must be a numeric value, like reported by price2num())
|
||||||
* @param Translate $langs Language
|
* @param Translate $langs Language
|
||||||
* @param boolean $currency 0=number to translate | 1=currency to translate
|
* @param string $currency ''=number to translate | 'XX'=currency code to use into text
|
||||||
* @param boolean $centimes 0=no cents/centimes | 1=there is cents/centimes to translate
|
* @param boolean $centimes false=no cents/centimes | true=there is cents/centimes
|
||||||
* @return string|false Text of the number
|
* @return string|false Text of the number
|
||||||
*/
|
*/
|
||||||
function dol_convertToWord($num, $langs, $currency = false, $centimes = false)
|
function dol_convertToWord($num, $langs, $currency = '', $centimes = false)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
@ -48,9 +48,9 @@ function dol_convertToWord($num, $langs, $currency = false, $centimes = false)
|
|||||||
|
|
||||||
if (!empty($conf->global->MAIN_MODULE_NUMBERWORDS)) {
|
if (!empty($conf->global->MAIN_MODULE_NUMBERWORDS)) {
|
||||||
if ($currency) {
|
if ($currency) {
|
||||||
$type = 1;
|
$type = '1';
|
||||||
} else {
|
} else {
|
||||||
$type = 0;
|
$type = '0';
|
||||||
}
|
}
|
||||||
|
|
||||||
$concatWords = $langs->getLabelFromNumber($num, $type);
|
$concatWords = $langs->getLabelFromNumber($num, $type);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user