diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 483706fda4b..4c6de60ce16 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -739,8 +739,18 @@ class Commande extends CommonObject // Change socid if needed if (! empty($socid) && $socid != $object->socid) { - $object->socid = $socid; - // TODO clear delivery address, project linked, change product price if multi-prices + $socstatic = new Societe($this->db); + + if ($socstatic->fetch($socid)>0) + { + $object->socid = $socid; + $object->cond_reglement_id = $soc->cond_reglement_id; + $object->mode_reglement_id = $soc->mode_reglement_id; + $object->fk_project = ''; + $object->fk_delivery_address = ''; + } + + // TODO Change product price if multi-prices } $object->id=0; diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index a18789fef92..144e6719714 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -1498,7 +1498,7 @@ else $formquestion=array( //'text' => $langs->trans("ConfirmClone"), //array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), - //array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $html->select_company(GETPOST('socid'),'socid','(s.client=1 OR s.client=3)')) + array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $html->select_company(GETPOST('socid'),'socid','(s.client=1 OR s.client=3)')) ); // Paiement incomplet. On demande si motif = escompte ou autre $formconfirm=$html->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('CloneOrder'),$langs->trans('ConfirmCloneOrder',$object->ref),'confirm_clone',$formquestion,'yes',1);