diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index 52b25725bc4..b10203ec1d2 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -417,7 +417,7 @@ if ($_socid > 0) print ''.$langs->trans("Firstname").' '.$langs->trans("LastName").''; print ''.$langs->trans("Poste").''.$langs->trans("Tel").''; print ''.$langs->trans("Fax").''.$langs->trans("EMail").''; - print "".$langs->trans("AddContact").""; + print "id."&action=create\">".$langs->trans("AddContact").""; print ' '; print ""; diff --git a/htdocs/lib/functions.inc.php b/htdocs/lib/functions.inc.php index 74ae33cf54f..318501d4017 100644 --- a/htdocs/lib/functions.inc.php +++ b/htdocs/lib/functions.inc.php @@ -4,6 +4,7 @@ * Copyright (C) 2004 Laurent Destailleur * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier + * Copyright (C) 2004 Christophe Combelles * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -256,23 +257,47 @@ function dolibarr_print_object_info($object) /*! \brief Formatage du telephone - \param phone numéro de telephone à formater + \param phone numéro de telephone à formater \return phone numéro de téléphone formaté - \remarks net tient pas en compte le format belge 02/211 34 83 + \remarks ne tient pas en compte le format belge 02/211 34 83 + \remarks formattage automatique des numero non formates + \remarks ajouté la prise en charge les numéros de 7, 9, 11 et 12 chiffres */ function dolibarr_print_phone($phone) { - if (strlen(trim($phone)) == 10) - { - return substr($phone,0,2)." ".substr($phone,2,2)." ".substr($phone,4,2)." ".substr($phone,6,2)." ".substr($phone,8,2); - } - else - { - return $phone; - } +     if (strstr($phone, ' ')) return $phone; +     if (strlen(trim($phone)) == 10) +     { +       return substr($phone,0,2)." ".substr($phone,2,2)." +".substr($phone,4,2)." ".substr($phone,6,2)." ".substr($phone,8,2); +     } +     elseif (strlen(trim($phone)) == 7) +     { +       return substr($phone,0,3)." ".substr($phone,3,2)." ".substr($phone,5,2); +     } +     elseif (strlen(trim($phone)) == 9) +     { +       return substr($phone,0,2)." ".substr($phone,2,3)." +".substr($phone,5,2)." ".substr($phone,7,2); +     } +     elseif (strlen(trim($phone)) == 11) +     { +       return substr($phone,0,3)." ".substr($phone,3,2)." +".substr($phone,5,2)." ".substr($phone,7,2)." ".substr($phone,9,2); +     } +     elseif (strlen(trim($phone)) == 12) +     { +       return substr($phone,0,4)." ".substr($phone,4,2)." +".substr($phone,6,2)." ".substr($phone,8,2)." ".substr($phone,10,2); +     } +     else +     { +       return $phone; +     } } + /*! \brief Affiche logo dédié aux actions */