diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 14bca386018..13bf93e2de4 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8819,7 +8819,7 @@ abstract class CommonObject } } } else { - $this->{$field} = $obj->{$field}; + $this->{$field} = !empty($obj->{$field}) ? $obj->{$field} : null; } } diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 287327f2a6a..ce35470d484 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1974,10 +1974,10 @@ if ($action == 'create') { $objectsrc->fetch_optionals(); $object->array_options = $objectsrc->array_options; } else { - $cond_reglement_id = $societe->cond_reglement_supplier_id; - $mode_reglement_id = $societe->mode_reglement_supplier_id; - $transport_mode_id = $societe->transport_mode_supplier_id; - $fk_account = $societe->fk_account; + $cond_reglement_id = !empty($societe->cond_reglement_supplier_id) ? $societe->cond_reglement_supplier_id : 0; + $mode_reglement_id = !empty($societe->mode_reglement_supplier_id) ? $societe->mode_reglement_supplier_id : 0; + $transport_mode_id = !empty($societe->transport_mode_supplier_id) ? $societe->transport_mode_supplier_id : 0; + $fk_account = !empty($societe->fk_account) ? $societe->fk_account : 0; $datetmp = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); $dateinvoice = ($datetmp == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $datetmp); $datetmp = dol_mktime(12, 0, 0, GETPOST('echmonth', 'int'), GETPOST('echday', 'int'), GETPOST('echyear', 'int')); @@ -2004,7 +2004,7 @@ if ($action == 'create') { print '