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 '
| '.$langs->trans("WeekStartOnDay").' | ';
print $html->select_dayofweek((isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:'1'),'MAIN_START_WEEK',0);
+ print ' | ';
+ print ' | ';
+ print '
';
+
+ // Firstname/Name
+ $var=!$var;
+ print '| '.$langs->trans("FirstnameNamePosition").' | ';
+ $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 ' | ';
print ' | ';
print '
';
@@ -371,7 +381,16 @@ else // Show
print ' | ';
print '';
- print '
';
+ // Firstname / Name position
+ $var=!$var;
+ print '| '.$langs->trans("FirstnameNamePosition").' | ';
+ if (empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)) { print $langs->trans("Firstname").' '.$langs->trans("Name"); }
+ else { print $langs->trans("Name").' '.$langs->trans("Firstname"); }
+ print ' | ';
+ print ' | ';
+ print '
';
+
+ print '
';
// 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.
Put here full path of directories.
Add a carriage return between eah directory.
To add a directory of the GED module, add here DOL_DATA_ROOT/ecm/yourdirectoryname.
Files in those directories must end with .odt.
NumberOfModelFilesFound=Number of ODT templates files found in those directories
ExampleOfDirectoriesForModelGen=Examples of syntax:
c:\mydir
/home/mydir
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:
c:\mydir
/home/mydir
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 @@
+/* Copyright (C) 2006-2010 Laurent Destailleur
* Copyright (C) 2006 Rodolphe Quiedeville
* Copyright (C) 2007 Patrick Raguin
*
@@ -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);