From ce37ea8d9b29d38394a47f6a4e072497a9982496 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 30 Jun 2006 14:55:02 +0000 Subject: [PATCH] =?UTF-8?q?ajout=20du=20choix=20d'un=20contact=20par=20d?= =?UTF-8?q?=E9faut?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/comm/addpropal.php | 14 +++++++------- htdocs/commande/fiche.php | 24 ++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/htdocs/comm/addpropal.php b/htdocs/comm/addpropal.php index fa9f5de6091..52ae082fc4c 100644 --- a/htdocs/comm/addpropal.php +++ b/htdocs/comm/addpropal.php @@ -115,6 +115,13 @@ if ($_GET["action"] == 'create') print ''; print ''; print ''; + + /* + * Contact de la propale + */ + print "".$langs->trans("DefaultContact")."\n"; + $html->select_contacts($soc->id,$setcontact,'contactidp',1); + print ''; // Ligne info remises tiers print ''.$langs->trans('Discounts').''; @@ -217,13 +224,6 @@ if ($_GET["action"] == 'create') print ''; } - /* - * Contact de la propale - */ - print "".$langs->trans("DefaultContact")."\n"; - $html->select_contacts($soc->id,$setcontact,'contactidp',1); - print ''; - // Model print ''; print ''.$langs->trans("DefaultModel").''; diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index c461e88d451..b05e76dec22 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -102,6 +102,7 @@ if ($_POST['action'] == 'add' && $user->rights->commande->creer) $commande->mode_reglement_id = $_POST['mode_reglement_id']; $commande->date_livraison = $datelivraison; $commande->adresse_livraison_id = $_POST['adresse_livraison_id']; + $commande->contactid = $_POST['contactidp']; $commande->fetch_client(); @@ -124,6 +125,22 @@ if ($_POST['action'] == 'add' && $user->rights->commande->creer) } else { + // Insertion contact par defaut si défini + if ($_POST["contactidp"]) + { + $result=$commande->add_contact($_POST["contactidp"],'CUSTOMER','external'); + + if ($result > 0) + { + $error=0; + } + else + { + $msg = '
'.$langs->trans("ErrorFailedToAddContact").'
'; + $error=1; + } + } + $_GET['id'] = $commande->id; $action = ''; } @@ -628,6 +645,13 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer) // Client print ''.$langs->trans('Customer').''.$soc->getNomUrl(1).''; print ''; + + /* + * Contact de la propale + */ + print "".$langs->trans("DefaultContact")."\n"; + $html->select_contacts($soc->id,$setcontact,'contactidp',1); + print ''; // Ligne info remises tiers print ''.$langs->trans('Discounts').'';