From e80436469f9034882a4351a0b8a00ddc4629af4c Mon Sep 17 00:00:00 2001 From: Lionel VESSILLER Date: Thu, 25 Apr 2019 16:05:12 +0200 Subject: [PATCH] Fix default payment condition and method --- htdocs/fourn/commande/orderstoinvoice.php | 25 +++++++++++++---------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/htdocs/fourn/commande/orderstoinvoice.php b/htdocs/fourn/commande/orderstoinvoice.php index 4b9511ce0df..093e0fd331b 100644 --- a/htdocs/fourn/commande/orderstoinvoice.php +++ b/htdocs/fourn/commande/orderstoinvoice.php @@ -298,11 +298,23 @@ if ($action == 'create' && !$error) { if ($socid) $res = $soc->fetch($socid); if ($res) { - $cond_reglement_id = $soc->cond_reglement_id; - $mode_reglement_id = $soc->mode_reglement_id; + $cond_reglement_id = $soc->cond_reglement_supplier_id; + $mode_reglement_id = $soc->mode_reglement_supplier_id; } $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE) ? - 1 : ''; + $objectsrc = new CommandeFournisseur($db); + $listoforders = array(); + foreach ($selected as $sel) { + $result = $objectsrc->fetch($sel); + if ($result > 0) { + $listoforders[] = $objectsrc->ref; + } + + if (empty($cond_reglement_id)) $cond_reglement_id = $objectsrc->cond_reglement_id; + if (empty($mode_reglement_id)) $mode_reglement_id = $objectsrc->mode_reglement_id; + } + print '
'; print ''; print ''; @@ -350,15 +362,6 @@ if ($action == 'create' && !$error) { print ''; } - $objectsrc = new CommandeFournisseur($db); - $listoforders = array (); - foreach ($selected as $sel) { - $result = $objectsrc->fetch($sel); - if ($result > 0) { - $listoforders[] = $objectsrc->ref; - } - } - // Other attributes $parameters = array ( 'objectsrc' => $objectsrc,