Merge pull request #20485 from atm-gauthier/FIX_ref_supplier_on_bill_several_fourn_orders_case
FIX : ref_client doesn't exists on supplier invoice, then ref_fourn needs to have a default value when we want to bill several supplier orders
This commit is contained in:
commit
4e81de2a4a
@ -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,8 @@ if (empty($reshook)) {
|
||||
$objecttmp->fk_project = $cmd->fk_project;
|
||||
$objecttmp->multicurrency_code = $cmd->multicurrency_code;
|
||||
if (empty($createbills_onebythird)) {
|
||||
$objecttmp->ref_client = $cmd->ref_client;
|
||||
$objecttmp->ref_supplier = !empty($cmd->ref_supplier) ? $cmd->ref_supplier : $default_ref_supplier;
|
||||
$default_ref_supplier+=1;
|
||||
}
|
||||
|
||||
$datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user