ajout du choix d'un contact par défaut

This commit is contained in:
Regis Houssin 2006-06-30 14:55:02 +00:00
parent 3adb4316e2
commit ce37ea8d9b
2 changed files with 31 additions and 7 deletions

View File

@ -116,6 +116,13 @@ if ($_GET["action"] == 'create')
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
/*
* Contact de la propale
*/
print "<tr><td>".$langs->trans("DefaultContact")."</td><td colspan=\"2\">\n";
$html->select_contacts($soc->id,$setcontact,'contactidp',1);
print '</td></tr>';
// Ligne info remises tiers // Ligne info remises tiers
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="2">'; print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="2">';
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client); if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
@ -217,13 +224,6 @@ if ($_GET["action"] == 'create')
print '</td></tr>'; print '</td></tr>';
} }
/*
* Contact de la propale
*/
print "<tr><td>".$langs->trans("DefaultContact")."</td><td colspan=\"2\">\n";
$html->select_contacts($soc->id,$setcontact,'contactidp',1);
print '</td></tr>';
// Model // Model
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans("DefaultModel").'</td>'; print '<td>'.$langs->trans("DefaultModel").'</td>';

View File

@ -102,6 +102,7 @@ if ($_POST['action'] == 'add' && $user->rights->commande->creer)
$commande->mode_reglement_id = $_POST['mode_reglement_id']; $commande->mode_reglement_id = $_POST['mode_reglement_id'];
$commande->date_livraison = $datelivraison; $commande->date_livraison = $datelivraison;
$commande->adresse_livraison_id = $_POST['adresse_livraison_id']; $commande->adresse_livraison_id = $_POST['adresse_livraison_id'];
$commande->contactid = $_POST['contactidp'];
$commande->fetch_client(); $commande->fetch_client();
@ -124,6 +125,22 @@ if ($_POST['action'] == 'add' && $user->rights->commande->creer)
} }
else 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 = '<div class="error">'.$langs->trans("ErrorFailedToAddContact").'</div>';
$error=1;
}
}
$_GET['id'] = $commande->id; $_GET['id'] = $commande->id;
$action = ''; $action = '';
} }
@ -629,6 +646,13 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer)
print '<tr><td>'.$langs->trans('Customer').'</td><td>'.$soc->getNomUrl(1).'</td>'; print '<tr><td>'.$langs->trans('Customer').'</td><td>'.$soc->getNomUrl(1).'</td>';
print '</tr>'; print '</tr>';
/*
* Contact de la propale
*/
print "<tr><td>".$langs->trans("DefaultContact")."</td><td colspan=\"2\">\n";
$html->select_contacts($soc->id,$setcontact,'contactidp',1);
print '</td></tr>';
// Ligne info remises tiers // Ligne info remises tiers
print '<tr><td>'.$langs->trans('Discounts').'</td><td>'; print '<tr><td>'.$langs->trans('Discounts').'</td><td>';
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client); if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);