From a8c891e647c79326170a65577b689ad573171325 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@users.sourceforge.net> Date: Wed, 23 Jun 2010 19:17:38 +0000 Subject: [PATCH] Add option MAIN_FIRSTNAME_NAME_POSITION --- ChangeLog | 3 ++- htdocs/adherents/class/adherent.class.php | 16 +++++++++++----- htdocs/adherents/cotisations.php | 2 +- htdocs/admin/ihm.php | 21 ++++++++++++++++++++- htdocs/contact/class/contact.class.php | 5 ++++- htdocs/langs/en_US/admin.lang | 1 + htdocs/langs/fr_FR/admin.lang | 2 ++ htdocs/lib/pdf.lib.php | 4 ++-- 8 files changed, 43 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 95b1b7a37ef..93d994e2727 100644 --- a/ChangeLog +++ b/ChangeLog @@ -37,7 +37,8 @@ For users: - New: Can now send supplier order by mail. - New: task #10076 : Show content of message in notification module. - New: Bank name available on invoice. -- New: IBAN value is called IFSC if country is India +- New: IBAN value is called IFSC if country is India. +- New: Add option to choose firstname-name or name-firstname. - Fix: Debug experimental module widthrawal. - Fix: Format number was wrong for ar_AR language. - Fix: Can change password if has only permission change password. diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 54b696cfdc5..cbf1b75afb8 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1214,7 +1214,7 @@ class Adherent extends CommonObject $insertid=$acct->addline($dateop, $operation, $label, $montant, $num_chq, '', $user, $emetteur_nom, $emetteur_banque); if ($insertid > 0) { - $inserturlid=$acct->add_url_line($insertid, $this->id, DOL_URL_ROOT.'/adherents/fiche.php?rowid=', $this->getFullname(), 'member'); + $inserturlid=$acct->add_url_line($insertid, $this->id, DOL_URL_ROOT.'/adherents/fiche.php?rowid=', $this->getFullname($langs), 'member'); if ($inserturlid > 0) { // Met a jour la table cotisation @@ -1709,12 +1709,18 @@ class Adherent extends CommonObject } /** - * \brief Retourne le nom complet de l'adherent - * \return string Nom complet + * \brief Return full name of member + * \return string Full name */ - function getFullname() + function getFullname($outputlangs) { - if ($this->nom && $this->prenom) return $this->nom.' '.$this->prenom; + global $conf; + + if ($this->nom && $this->prenom) + { + if (! empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)) return $this->nom.' '.$this->prenom; + else return $this->prenom.' '.$this->nom; + } if ($this->nom) return $this->nom; if ($this->prenom) return $this->prenom; return ''; diff --git a/htdocs/adherents/cotisations.php b/htdocs/adherents/cotisations.php index 6d21f15ced0..5eb1d713c39 100644 --- a/htdocs/adherents/cotisations.php +++ b/htdocs/adherents/cotisations.php @@ -104,7 +104,7 @@ if ($allowinsertbankafter && $_POST["action"] == '2bank' && $_POST["rowid"] !='' } else { - $inserturlid=$acct->add_url_line($insertid, $adherent->rowid, DOL_URL_ROOT.'/adherents/fiche.php?rowid=', $adherent->getFullname(), 'member'); + $inserturlid=$acct->add_url_line($insertid, $adherent->rowid, DOL_URL_ROOT.'/adherents/fiche.php?rowid=', $adherent->getFullname($langs), 'member'); // Met a jour la table cotisation $sql="UPDATE ".MAIN_DB_PREFIX."cotisation"; diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 760c4cda5fc..ed620f276ff 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -68,6 +68,7 @@ if (isset($_POST["action"]) && $_POST["action"] == 'update') dolibarr_set_const($db, "MAIN_USE_PREVIEW_TABS", $_POST["main_use_preview_tabs"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_START_WEEK", $_POST["MAIN_START_WEEK"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_SHOW_LOGO", $_POST["MAIN_SHOW_LOGO"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", $_POST["MAIN_FIRSTNAME_NAME_POSITION"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_THEME", $_POST["main_theme"],'chaine',0,'',$conf->entity); @@ -199,6 +200,15 @@ if (isset($_GET["action"]) && $_GET["action"] == 'edit') // Edit $var=!$var; print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("WeekStartOnDay").'</td><td>'; print $html->select_dayofweek((isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:'1'),'MAIN_START_WEEK',0); + print '</td>'; + print '<td width="20"> </td>'; + print '</tr>'; + + // Firstname/Name + $var=!$var; + print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("FirstnameNamePosition").'</td><td>'; + $array=array(0=>$langs->trans("Firstname").' '.$langs->trans("Name"),1=>$langs->trans("Name").' '.$langs->trans("Firstname")); + print $html->selectarray('MAIN_FIRSTNAME_NAME_POSITION',$array,(isset($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?$conf->global->MAIN_FIRSTNAME_NAME_POSITION:0)); print '</td>'; print '<td width="20"> </td>'; print '</tr>'; @@ -371,7 +381,16 @@ else // Show print '<td width="20"> </td>'; print '</tr>'; - print '</table><br>'; + // Firstname / Name position + $var=!$var; + print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("FirstnameNamePosition").'</td><td>'; + if (empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)) { print $langs->trans("Firstname").' '.$langs->trans("Name"); } + else { print $langs->trans("Name").' '.$langs->trans("Firstname"); } + print '</td>'; + print '<td width="20"> </td>'; + print '</tr>'; + + print '</table><br>'; // Themes diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 9cae4ad0175..77143ea6648 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -791,7 +791,7 @@ class Contact extends CommonObject * \param nameorder 0=Lastname+Firstname, 1=Firstname+Lastname * \return string String with full name */ - function getFullName($langs,$option=0,$nameorder=0) + function getFullName($langs,$option=0,$nameorder=-1) { $ret=''; if ($option && $this->civilite_id) @@ -800,6 +800,9 @@ class Contact extends CommonObject else $ret.=$this->civilite_id.' '; } + // If order not defined, we use the setup + if ($nameorder < 0) $nameorder=(! $conf->global->MAIN_FIRSTNAME_NAME_POSITION); + if ($nameorder) { if ($this->firstname) $ret.=$this->firstname; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 67f2e4c4326..c60624cbc4c 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -271,6 +271,7 @@ ListOfDirectories=List of OpenDocument templates directories ListOfDirectoriesForModelGenODT=List of directories contenaining templates files with OpenDocument format.<br><br>Put here full path of directories.<br>Add a carriage return between eah directory.<br>To add a directory of the GED module, add here <b>DOL_DATA_ROOT/ecm/yourdirectoryname</b>.<br><br>Files in those directories must end with <b>.odt</b>. NumberOfModelFilesFound=Number of ODT templates files found in those directories ExampleOfDirectoriesForModelGen=Examples of syntax:<br>c:\mydir<br>/home/mydir<br>DOL_DATA_ROOT/ecm/ecmdir +FirstnameNamePosition=Position of firstname/name # Modules Module0Name=Users & groups diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 270f8802954..6cc88585599 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -273,6 +273,8 @@ NumberOfModelFilesFound=Nombre de fichiers modèles ODT trouvés dans ce(s) rép ExampleOfDirectoriesForModelGen=Exemples de syntaxe:<br>c:\mydir<br>/home/mydir<br>DOL_DATA_ROOT/ecm/ecmdir FollowingSubstitutionKeysCanBeUsed=En plaçant les tags suivant dans le modèle, vous obtiendrez une subsitution avec la valeur personnalisée lors de la génération du document: FullListOnOnlineDocumentation=Liste complète des tags disponibles sur la documentation utilisateur du module Tiers sur le wiki http://wiki.dolibarr.org +FirstnameNamePosition=Ordre affichage prénom/nom + # Modules= undefined Module0Name= Utilisateurs & groupes Module0Desc= Gestion des utilisateurs et groupes diff --git a/htdocs/lib/pdf.lib.php b/htdocs/lib/pdf.lib.php index fb4aaac9770..a75d1be9c5b 100644 --- a/htdocs/lib/pdf.lib.php +++ b/htdocs/lib/pdf.lib.php @@ -1,5 +1,5 @@ <?php -/* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net> +/* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com> * @@ -69,7 +69,7 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target { if ($usecontact) { - $stringaddress.="\n".$outputlangs->convToOutputCharset($targetcontact->getFullName($outputlangs,1,1)); + $stringaddress.="\n".$outputlangs->convToOutputCharset($targetcontact->getFullName($outputlangs,1)); // Recipient properties $stringaddress.="\n".$outputlangs->convToOutputCharset($targetcontact->address); $stringaddress.="\n".$outputlangs->convToOutputCharset($targetcontact->cp) . " " . $outputlangs->convToOutputCharset($targetcontact->ville); -- GitLab