mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-23 18:01:36 +01:00
Merge branch '9.0' of git@github.com:Dolibarr/dolibarr.git into 10.0
Conflicts: htdocs/accountancy/class/accountancyexport.class.php htdocs/core/lib/functions2.lib.php
This commit is contained in:
@@ -32,6 +32,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manage the different format accountancy export
|
* Manage the different format accountancy export
|
||||||
@@ -687,9 +688,9 @@ class AccountancyExport
|
|||||||
print $end_line;
|
print $end_line;
|
||||||
|
|
||||||
foreach ($objectLines as $line) {
|
foreach ($objectLines as $line) {
|
||||||
$date_creation = dol_print_date($line->date_creation, '%d%m%Y');
|
$date_creation = dol_print_date($line->date_creation, '%Y%m%d');
|
||||||
$date_doc = dol_print_date($line->doc_date, '%d%m%Y');
|
$date_doc = dol_print_date($line->doc_date, '%Y%m%d');
|
||||||
$date_valid = dol_print_date($line->date_validated, '%d%m%Y');
|
$date_valid = dol_print_date($line->date_validated, '%Y%m%d');
|
||||||
|
|
||||||
// FEC:JournalCode
|
// FEC:JournalCode
|
||||||
print $line->code_journal . $separator;
|
print $line->code_journal . $separator;
|
||||||
@@ -725,10 +726,10 @@ class AccountancyExport
|
|||||||
print $line->label_operation . $separator;
|
print $line->label_operation . $separator;
|
||||||
|
|
||||||
// FEC:Debit
|
// FEC:Debit
|
||||||
print price2num($line->debit) . $separator;
|
print price2fec($line->debit) . $separator;
|
||||||
|
|
||||||
// FEC:Credit
|
// FEC:Credit
|
||||||
print price2num($line->credit) . $separator;
|
print price2fec($line->credit) . $separator;
|
||||||
|
|
||||||
// FEC:EcritureLet
|
// FEC:EcritureLet
|
||||||
print $line->lettering_code . $separator;
|
print $line->lettering_code . $separator;
|
||||||
|
|||||||
@@ -4520,7 +4520,6 @@ function price2num($amount, $rounding = '', $alreadysqlnb = 0)
|
|||||||
return $amount;
|
return $amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Output a dimension with best unit
|
* Output a dimension with best unit
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -2541,3 +2541,32 @@ function convertBackOfficeMediasLinksToPublicLinks($notetoshow)
|
|||||||
$notetoshow=preg_replace('/src="[a-zA-Z0-9_\/\-\.]*(viewimage\.php\?modulepart=medias[^"]*)"/', 'src="'.$urlwithroot.'/\1"', $notetoshow);
|
$notetoshow=preg_replace('/src="[a-zA-Z0-9_\/\-\.]*(viewimage\.php\?modulepart=medias[^"]*)"/', 'src="'.$urlwithroot.'/\1"', $notetoshow);
|
||||||
return $notetoshow;
|
return $notetoshow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to format a value into a defined format for French administration (no thousand separator & decimal separator force to ',' with two decimals)
|
||||||
|
* Function used into accountancy FEC export
|
||||||
|
*
|
||||||
|
* @param float $amount Amount to format
|
||||||
|
* @return string Chain with formatted upright
|
||||||
|
* @see price2num() Format a numeric into a price for FEC files
|
||||||
|
*/
|
||||||
|
function price2fec($amount)
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
// Clean parameters
|
||||||
|
if (empty($amount)) $amount=0; // To have a numeric value if amount not defined or = ''
|
||||||
|
$amount = (is_numeric($amount) ? $amount : 0); // Check if amount is numeric, for example, an error occured when amount value = o (letter) instead 0 (number)
|
||||||
|
|
||||||
|
// Output decimal number by default
|
||||||
|
$nbdecimal = (empty($conf->global->ACCOUNTING_FEC_DECIMAL_LENGTH) ? 2 : $conf->global->ACCOUNTING_FEC_DECIMAL_LENGTH);
|
||||||
|
|
||||||
|
// Output separators by default
|
||||||
|
$dec = (empty($conf->global->ACCOUNTING_FEC_DECIMAL_SEPARATOR) ? ',' : $conf->global->ACCOUNTING_FEC_DECIMAL_SEPARATOR);
|
||||||
|
$thousand = (empty($conf->global->ACCOUNTING_FEC_THOUSAND_SEPARATOR) ? '' : $conf->global->ACCOUNTING_FEC_THOUSAND_SEPARATOR);
|
||||||
|
|
||||||
|
// Format number
|
||||||
|
$output = number_format($amount, $nbdecimal, $dec, $thousand);
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user