From a6284c2f3598db3003bf857b3153a016d25122bb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 16 Jul 2005 00:52:29 +0000 Subject: [PATCH] =?UTF-8?q?New:=20La=20foncton=20export=20contact=20vCard?= =?UTF-8?q?=20est=20mis=20via=20un=20lien=20sur=20onglet=20Import-Export?= =?UTF-8?q?=20afin=20de=20pr=E9parer=20ajout=20d'autres=20exports=20ou=20o?= =?UTF-8?q?utils=20de=20syncro.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/contact/exportimport.php | 108 ++++++++++++++++++++++++++++++ htdocs/contact/fiche.php | 95 +++++++++++++------------- htdocs/contact/info.php | 4 +- htdocs/contact/perso.php | 40 +++++++---- htdocs/contact/vcard.php | 33 +++++---- htdocs/langs/en_US/companies.lang | 4 +- htdocs/langs/fr_FR/companies.lang | 4 +- 7 files changed, 209 insertions(+), 79 deletions(-) create mode 100644 htdocs/contact/exportimport.php diff --git a/htdocs/contact/exportimport.php b/htdocs/contact/exportimport.php new file mode 100644 index 00000000000..5a9a126f95c --- /dev/null +++ b/htdocs/contact/exportimport.php @@ -0,0 +1,108 @@ + + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + */ + +/** + \file htdocs/contact/exportimport.php + \ingroup societe + \brief Onglet exports-imports d'un contact + \version $Revision$ +*/ + +require("./pre.inc.php"); +require("../contact.class.php"); + +$langs->load("companies"); + + +/* + * + * + */ + +llxHeader(); + +$form = new Form($db); + +$contact = new Contact($db); +$contact->fetch($_GET["id"], $user); + + +$h=0; + +$head[$h][0] = DOL_URL_ROOT.'/contact/fiche.php?id='.$_GET["id"]; +$head[$h][1] = $langs->trans("General"); +$h++; + +$head[$h][0] = DOL_URL_ROOT.'/contact/perso.php?id='.$_GET["id"]; +$head[$h][1] = $langs->trans("PersonalInformations"); +$h++; + +$head[$h][0] = DOL_URL_ROOT.'/contact/exportimport.php?id='.$_GET["id"]; +$head[$h][1] = $langs->trans("ExportImport"); +$hselected=$h; +$h++; + +$head[$h][0] = DOL_URL_ROOT.'/contact/info.php?id='.$_GET["id"]; +$head[$h][1] = $langs->trans("Info"); +$h++; + +dolibarr_fiche_head($head, $hselected, $langs->trans("Contact").": ".$contact->firstname.' '.$contact->name); + + +/* + * Fiche en mode visu + */ +print ''; + +if ($contact->socid > 0) +{ + $objsoc = new Societe($db); + $objsoc->fetch($contact->socid); + + print ''; +} + +print ''; + +print ''; +print ''; + +print '
'.$langs->trans("Company").''.$objsoc->nom_url.'
'.$langs->trans("UserTitle").''; +print $contact->civilite_id; +print '
'.$langs->trans("Lastname").''.$contact->name.''.$langs->trans("Firstname").''.$contact->firstname.'
'; + +print ''; + +print '
'; + +print $langs->trans("ExportCardToFormat").': '; +print ''; +print img_file($langs->trans("VCard")).' '; +print $langs->trans("VCard"); +print ''; + + + + +$db->close(); + +llxFooter('$Date$ - $Revision$'); +?> diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index 1fd3257bdef..2ef0a2ed9f1 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -186,8 +186,8 @@ if ($_GET["id"] > 0) $head[$h][1] = $langs->trans("PersonalInformations"); $h++; - $head[$h][0] = DOL_URL_ROOT.'/contact/vcard.php?id='.$_GET["id"]; - $head[$h][1] = $langs->trans("VCard"); + $head[$h][0] = DOL_URL_ROOT.'/contact/exportimport.php?id='.$_GET["id"]; + $head[$h][1] = $langs->trans("ExportImport"); $h++; $head[$h][0] = DOL_URL_ROOT.'/contact/info.php?id='.$_GET["id"]; @@ -236,44 +236,44 @@ if ($_GET["action"] == 'create') print ''; } else { - print ''.$langs->trans("Company").''; - print $form->select_societes('','socid'); + print ''.$langs->trans("Company").''; + print $form->select_societes('','socid',''); print ''; } - print ''.$langs->trans("UserTitle").''; + print ''.$langs->trans("UserTitle").''; print $form->select_civilite($obj->civilite); print ''; - print ''.$langs->trans("Lastname").''; - print ''.$langs->trans("Firstname").''; + print ''.$langs->trans("Lastname").''; + print ''.$langs->trans("Firstname").''; - print 'Tel Pro'; print 'Poste/Fonction'; - print 'Tel Perso'; - print ''.$langs->trans("Address").''; - print 'Portable'; - print ''.$langs->trans("Zip").' / '.$langs->trans("Town").' '; print ''; - print ''.$langs->trans("Fax").''; - print ''.$langs->trans("Email").''; + print 'Tel Pro'; + print 'Tel Perso'; - print 'Jabberid'; + print ''.$langs->trans("Fax").''; + print 'Portable'; - print ''.$langs->trans("Note").''; + print ''.$langs->trans("Email").''; - print ''.$langs->trans("BillingContact").''; + print 'Jabberid'; + + print ''.$langs->trans("Note").''; + + print ''.$langs->trans("BillingContact").''; print $form->selectyesno("facturation",$contact->facturation); print ''; - print ''; + print ''; print "
"; print ""; @@ -298,46 +298,45 @@ elseif ($_GET["action"] == 'edit') $objsoc = new Societe($db); $objsoc->fetch($contact->socid); - print ''.$langs->trans("Company").''.$objsoc->nom_url.''; + print ''.$langs->trans("Company").''.$objsoc->nom_url.''; } - print ''.$langs->trans("UserTitle").''; + print ''.$langs->trans("UserTitle").''; print $form->select_civilite($contact->civilite_id); print ''; - print ''.$langs->trans("Lastname").''; - print ''.$langs->trans("Firstname").''; + print ''.$langs->trans("Lastname").''; + print ''.$langs->trans("Firstname").''; - print 'Tel Pro'; - print 'Poste/Fonction'; - - print 'Tel Perso'; + print 'Poste/Fonction'; print ''.$langs->trans("Address").''; - print 'Portable'; - print ''.$langs->trans("Zip").' / '.$langs->trans("Town").' '; print ''; + print 'Tel Pro'; + print 'Tel Perso'; + print 'Portable'; print ''.$langs->trans("Fax").''; - print ''.$langs->trans("EMail").''; - print 'Jabberid'; + print ''.$langs->trans("EMail").''; - print ''.$langs->trans("Note").''; + print 'Jabberid'; + + print ''.$langs->trans("Note").''; print ''; - print ''.$langs->trans("BillingContact").''; + print ''.$langs->trans("BillingContact").''; print $form->selectyesno("facturation",$contact->facturation); print ''; - print ''; + print ''; print "
"; print ""; @@ -356,34 +355,32 @@ else $objsoc = new Societe($db); $objsoc->fetch($contact->socid); - print ''.$langs->trans("Company").''.$objsoc->nom_url.''; + print ''.$langs->trans("Company").''.$objsoc->nom_url.''; } - print ''.$langs->trans("UserTitle").''; + print ''.$langs->trans("UserTitle").''; //TODO Aller chercher le libellé de la civilite a partir de l'id $contact->civilite_id //print 'Titre : '.$contact->civilite."
"; print $contact->civilite_id; print ''; - print ''.$langs->trans("Lastname").''.$contact->name.''; - print ''.$langs->trans("Firstname").''.$contact->firstname.''; - - print 'Tel Pro'.$contact->phone_pro.''; + print ''.$langs->trans("Lastname").''.$contact->name.''; + print ''.$langs->trans("Firstname").''.$contact->firstname.''; print 'Poste/Fonction'.$contact->poste.''; - print 'Tel Perso'.$contact->phone_perso.''; - - print ''.$langs->trans("Address").''.$contact->address.''; - - print 'Portable'.$contact->phone_mobile.''; + print ''.$langs->trans("Address").''.$contact->address.''; print ''.$langs->trans("Zip").' / '.$langs->trans("Town").''.$contact->cp.' '; - print $contact->ville.''; + print $contact->ville.''; + print 'Tel Pro'.$contact->phone_pro.''; + print 'Tel Perso'.$contact->phone_perso.''; + + print 'Portable'.$contact->phone_mobile.''; print ''.$langs->trans("Fax").''.$contact->fax.''; - print ''.$langs->trans("EMail").''; + print ''.$langs->trans("EMail").''; if ($contact->email && ! ValidEmail($contact->email)) { print '
'.$langs->trans("ErrorBadEMail",$contact->email)."
"; @@ -394,13 +391,13 @@ else } print ''; - print 'Jabberid'.$contact->jabberid.''; + print 'Jabberid'.$contact->jabberid.''; - print ''.$langs->trans("Note").''; + print ''.$langs->trans("Note").''; print nl2br($contact->note); print ''; - print ''.$langs->trans("BillingContact").''; + print ''.$langs->trans("BillingContact").''; print $langs->trans($yesno[$contact->facturation]); print ''; diff --git a/htdocs/contact/info.php b/htdocs/contact/info.php index ecb0378d29b..de25c976e19 100644 --- a/htdocs/contact/info.php +++ b/htdocs/contact/info.php @@ -49,8 +49,8 @@ $head[$h][0] = DOL_URL_ROOT.'/contact/perso.php?id='.$_GET["id"]; $head[$h][1] = $langs->trans("PersonalInformations"); $h++; -$head[$h][0] = DOL_URL_ROOT.'/contact/vcard.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("VCard"); +$head[$h][0] = DOL_URL_ROOT.'/contact/exportimport.php?id='.$_GET["id"]; +$head[$h][1] = $langs->trans("ExportImport"); $h++; $head[$h][0] = DOL_URL_ROOT.'/contact/info.php?id='.$_GET["id"]; diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php index dc97d201ff1..90d1fea0781 100644 --- a/htdocs/contact/perso.php +++ b/htdocs/contact/perso.php @@ -56,6 +56,7 @@ if ($_POST["action"] == 'update') $result = $contact->update_perso($_POST["contactid"], $user); } + /* * * @@ -63,6 +64,8 @@ if ($_POST["action"] == 'update') llxHeader(); +$form = new Form($db); + $contact = new Contact($db); $contact->fetch($_GET["id"], $user); @@ -78,8 +81,8 @@ $head[$h][1] = $langs->trans("PersonalInformations"); $hselected=$h; $h++; -$head[$h][0] = DOL_URL_ROOT.'/contact/vcard.php?id='.$_GET["id"]; -$head[$h][1] = $langs->trans("VCard"); +$head[$h][0] = DOL_URL_ROOT.'/contact/exportimport.php?id='.$_GET["id"]; +$head[$h][1] = $langs->trans("ExportImport"); $h++; $head[$h][0] = DOL_URL_ROOT.'/contact/info.php?id='.$_GET["id"]; @@ -106,10 +109,16 @@ if ($_GET["action"] == 'edit') $objsoc = new Societe($db); $objsoc->fetch($contact->socid); - print ''.$langs->trans("Company").''.$objsoc->nom_url.''; + print ''.$langs->trans("Company").''.$objsoc->nom_url.''; } - print ''.$langs->trans("Name").''.$contact->name.' '.$contact->firstname .''; + print ''.$langs->trans("UserTitle").''; + print $contact->civilite_id; + print ''; + + print ''.$langs->trans("Lastname").''.$contact->nom.''; + print ''.$langs->trans("Firstname").''.$contact->prenom.''; + print ''.$langs->trans("Birthday").''; $html=new Form($db); @@ -121,7 +130,7 @@ if ($_GET["action"] == 'edit') } print ''; - print ''.$langs->trans("Alert").': '; + print ''.$langs->trans("Alert").': '; if ($contact->birthday_alert) { print ''; @@ -132,8 +141,8 @@ if ($_GET["action"] == 'edit') } print ''; - print ''; - print "
"; + print ''; + print ""; print ""; } @@ -149,13 +158,18 @@ else $objsoc = new Societe($db); $objsoc->fetch($contact->socid); - print ''.$langs->trans("Company").''.$objsoc->nom_url.''; + print ''.$langs->trans("Company").''.$objsoc->nom_url.''; } - print ''.$langs->trans("Name").''.$contact->name.' '.$contact->firstname .''; + print ''.$langs->trans("UserTitle").''; + print $contact->civilite_id; + print ''; + + print ''.$langs->trans("Lastname").''.$contact->name.''; + print ''.$langs->trans("Firstname").''.$contact->firstname.''; if ($contact->birthday && $contact->birthday > 0) { - print ''.$langs->trans("Birthdate").''.dolibarr_print_date($contact->birthday); + print ''.$langs->trans("Birthdate").''.dolibarr_print_date($contact->birthday); if ($contact->birthday_alert) print ' (alerte anniversaire active)'; @@ -163,7 +177,7 @@ else print ' (alerte anniversaire inactive)'; } else { - print ''.$langs->trans("Birthday").''.$langs->trans("Unknown").""; + print ''.$langs->trans("Birthday").''.$langs->trans("Unknown").""; } print ""; @@ -171,15 +185,17 @@ else print ""; + // Barre d'actions if ($user->societe_id == 0) { print '
'; - print ''.$langs->trans('Edit').''; + print ''.$langs->trans('Edit').''; print "
"; } + } $db->close(); diff --git a/htdocs/contact/vcard.php b/htdocs/contact/vcard.php index b8569e426f8..792fc45b755 100644 --- a/htdocs/contact/vcard.php +++ b/htdocs/contact/vcard.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004 Laurent Destailleur +/* Copyright (C) 2004 Rodolphe Quiedeville + * Copyright (C) 2004-2005 Laurent Destailleur * * 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 @@ -21,7 +21,7 @@ * */ -/*! +/** \file htdocs/contact/vcard.php \ingroup societe \brief Onglet vcard d'un contact @@ -32,38 +32,43 @@ require("./pre.inc.php"); require("../contact.class.php"); require (DOL_DOCUMENT_ROOT."/lib/vcard/vcard.class.php"); -/* - * - * - */ + $contact = new Contact($db); $contact->fetch($_GET["id"]); + +// On crée car la VCard + $v = new vCard(); $v->setName($contact->name, $contact->firstname, "", ""); $v->setPhoneNumber($contact->phone_perso, "PREF;HOME;VOICE"); -if ($contact->birthday) - $v->setBirthday($contact->birthday); +if ($contact->birthday) $v->setBirthday($contact->birthday); // TODO finir le support des adresses dans les contacts - $v->setAddress("", "", $contact->address, $contact->ville, "", $contact->cp, $contact->pays); + $v->setEmail($contact->email); + //$v->setNote("You can take some notes here.\r\nMultiple lines are supported via \\r\\n."); //$v->setURL("http://www.thomas-mustermann.de", "WORK"); -$output = $v->getVCard(); -$filename = $v->getFileName(); +$db->close(); + + +// Renvoi VCard au navigateur + +$output = $v->getVCard(); + +$filename = sanitize_string(ereg_replace('^%20','',$v->getFileName())); Header("Content-Disposition: attachment; filename=$filename"); Header("Content-Length: ".strlen($output)); Header("Connection: close"); Header("Content-Type: text/x-vCard; name=$filename"); -echo $output; +print $output; -$db->close(); ?> diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index bc646a0fe19..f67f475091d 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -94,4 +94,6 @@ NbOfAttachedFiles=Number of attached files AttachANewFile=Attach a new file FileWasRemoved=Files was removed NoRIB=No RIB defined -NoParentCompany=None \ No newline at end of file +NoParentCompany=None +ExportImport=Import-Export +ExportCardToFormat=Export card to format \ No newline at end of file diff --git a/htdocs/langs/fr_FR/companies.lang b/htdocs/langs/fr_FR/companies.lang index 3c79263df84..a0b7277eb1d 100644 --- a/htdocs/langs/fr_FR/companies.lang +++ b/htdocs/langs/fr_FR/companies.lang @@ -94,4 +94,6 @@ NbOfAttachedFiles=Nombre de fichiers joints AttachANewFile=Joindre un nouveau fichier FileWasRemoved=Le fichier a été supprimé NoRIB=Aucun RIB défini -NoParentCompany=Aucune \ No newline at end of file +NoParentCompany=Aucune +ExportImport=Import-Export +ExportCardToFormat=Exporter fiche au format \ No newline at end of file