Add option MAIN_FIRSTNAME_NAME_POSITION

This commit is contained in:
Laurent Destailleur 2010-06-23 19:17:38 +00:00
parent c7ce0f1c3f
commit a8c891e647
8 changed files with 43 additions and 11 deletions

View File

@ -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.

View File

@ -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 '';

View File

@ -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";

View File

@ -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">&nbsp;</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">&nbsp;</td>';
print '</tr>';
@ -371,7 +381,16 @@ else // Show
print '<td width="20">&nbsp;</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">&nbsp;</td>';
print '</tr>';
print '</table><br>';
// Themes

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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);