FIX : We need to have a different default_ref_supplier for each new fourn invoice

This commit is contained in:
Gauthier PC portable 024 2022-03-30 10:01:17 +02:00
parent b7e7c95d2a
commit 6480877b99

View File

@ -274,6 +274,8 @@ if (empty($reshook)) {
$db->begin();
$default_ref_supplier=dol_print_date(dol_now(), '%Y%m%d%H%M%S');
foreach ($orders as $id_order) {
$cmd = new CommandeFournisseur($db);
if ($cmd->fetch($id_order) <= 0) {
@ -291,7 +293,7 @@ if (empty($reshook)) {
$objecttmp->fk_project = $cmd->fk_project;
$objecttmp->multicurrency_code = $cmd->multicurrency_code;
if (empty($createbills_onebythird)) {
$objecttmp->ref_supplier = !empty($cmd->ref_supplier) ? $cmd->ref_supplier : dol_print_date(dol_now(), '%Y%m%d%H%M%S');
$objecttmp->ref_supplier = !empty($cmd->ref_supplier) ? $cmd->ref_supplier : $default_ref_supplier+1;
}
$datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));