diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index da35f9acabd..25feada995e 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -279,7 +279,7 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer) if ($propalid) { - $sql = 'SELECT s.nom, s.prefix_comm, s.idp, p.price, p.remise, p.remise_percent, p.tva, p.total, p.ref, p.fk_cond_reglement, fk_mode_reglement, '.$db->pdate('p.datep').' as dp, c.id as statut, c.label as lst'; + $sql = 'SELECT s.nom, s.prefix_comm, s.idp, p.price, p.remise, p.remise_percent, p.tva, p.total, p.ref, p.fk_cond_reglement, p.fk_mode_reglement, '.$db->pdate('p.datep').' as dp, c.id as statut, c.label as lst'; $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'propal as p, '.MAIN_DB_PREFIX.'c_propalst as c'; $sql .= ' WHERE p.fk_soc = s.idp AND p.fk_statut = c.id'; $sql .= ' AND p.rowid = '.$propalid; @@ -300,6 +300,17 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer) $soc = new Societe($db); $soc->fetch($obj->idp); + + if ($propalid) + { + $cond_reglement_id = $obj->fk_cond_reglement; + $mode_reglement_id = $obj->fk_mode_reglement; + } + else + { + $cond_reglement_id = $soc->cond_reglement; + $mode_reglement_id = $soc->mode_reglement; + } $nbrow=4; if ($conf->projet->enabled) $nbrow++; @@ -332,12 +343,12 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer) // Conditions de réglement print ''.$langs->trans('PaymentConditions').''; - $html->select_conditions_paiements($soc->cond_reglement,'cond_reglement_id'); + $html->select_conditions_paiements($cond_reglement_id,'cond_reglement_id'); print ''; // Mode de réglement print ''.$langs->trans('PaymentMode').''; - $html->select_types_paiements($soc->mode_reglement,'mode_reglement_id'); + $html->select_types_paiements($mode_reglement_id,'mode_reglement_id'); print ''; if ($conf->projet->enabled)