From e8c26842653314fe585acd26022a58bc13b05601 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Wed, 24 Aug 2005 08:05:04 +0000 Subject: [PATCH] =?UTF-8?q?Positionnement=20pas=20d=E9faut=20du=20fourniss?= =?UTF-8?q?eur?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/telephonie/client/new.php | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/htdocs/telephonie/client/new.php b/htdocs/telephonie/client/new.php index 268395cba9c..4b208112023 100644 --- a/htdocs/telephonie/client/new.php +++ b/htdocs/telephonie/client/new.php @@ -56,6 +56,11 @@ if ($_POST["action"] == 'add') $verif = "ok"; $mesg = ''; + + $contact->name = $_POST["cnom"]; + $contact->firstname = $_POST["cprenom"]; + $contact->email = strtolower($_POST["cmail"]); + if (strlen(trim($_POST["nom"])) == 0) { $mesg = "Nom de société incorrect"; @@ -116,13 +121,20 @@ if ($_POST["action"] == 'add') if (strlen(trim($_POST["cmail"])) > 0 && $verif == 'ok') { - if (!ValidEmail(trim($_POST["cmail"])) && $verif == 'ok') + + if (strlen(trim($_POST["cnom"])) == 0 && $verif == 'ok') + { + $mesg = "Nom de contact manquant"; + $verif = "nok"; + } + + if (!ValidEmail(trim($contact->email)) && $verif == 'ok') { $mesg = "Email invalide"; $verif = "nok"; } - if (!check_mail(trim($_POST["cmail"])) && $verif == 'ok') + if (!check_mail(trim($contact->email)) && $verif == 'ok') { $mesg = "Email invalide (domaine invalide)"; $verif = "nok"; @@ -158,17 +170,16 @@ if ($_POST["action"] == 'add') if ($result == 0) { - + } else { + $mesg = nl2br($soc->error); $error++; } } - $contact->name = $_POST["cnom"]; - $contact->firstname = $_POST["cprenom"]; - $contact->email = $_POST["cmail"]; + if (!$error && $verif == "ok") { @@ -348,8 +359,8 @@ if ($user->rights->telephonie->ligne->creer) print "Contact\n"; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print "
'.$langs->trans('Name').'
'.$langs->trans('Firstname').'
'.$langs->trans('Name').'
'.$langs->trans('Firstname').'
'.$langs->trans('Mail').'
\n"; @@ -410,7 +421,10 @@ if ($user->rights->telephonie->ligne->creer) } $db->free($resql); } - $form->select_array("fournisseur",$ff,$ligne->fournisseur); + + $def =$ligne->fournisseur?$ligne->fournisseur:TELEPHONIE_FOURNISSEUR_DEFAUT_ID; + + $form->select_array("fournisseur",$ff,$def); print ''; print 'Fournisseur précédent';