From d8af59756d6ee86eca89fb4da2cb42e5304ffa68 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Mar 2013 10:11:43 +0100 Subject: [PATCH] New: Add function dolGetFirstLastname --- htdocs/compta/dons/index.php | 5 ++--- htdocs/compta/index.php | 6 +++--- htdocs/core/lib/functions.lib.php | 17 ++++++++++++++++- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/dons/index.php b/htdocs/compta/dons/index.php index 97e12b17ceb..13c4301dad5 100644 --- a/htdocs/compta/dons/index.php +++ b/htdocs/compta/dons/index.php @@ -146,8 +146,7 @@ $max=10; * Last modified donations */ -$sql = "SELECT c.rowid, c.ref, c.fk_statut, c.societe, c.nom,"; -$sql.= " tms as datem, amount"; +$sql = "SELECT c.rowid, c.ref, c.fk_statut, c.societe, c.lastname, c.firstname, c.tms as datem, c.amount"; $sql.= " FROM ".MAIN_DB_PREFIX."don as c"; $sql.= " WHERE c.entity = ".$conf->entity; //$sql.= " AND c.fk_statut > 2"; @@ -183,7 +182,7 @@ if ($resql) print ''; print $obj->societe; print ($obj->societe && $obj->nom?' / ':''); - print $obj->nom; + print dolGetFirstLastname($obj->nom,$obj->firstname); print ''; print ''; diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 7f541e1b8db..978109ff67e 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -372,7 +372,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) print ''; print ''; - print '
'; + print ''; $facturestatic->ref=$obj->facnumber; $facturestatic->id=$obj->rowid; $facturestatic->type=$obj->type; @@ -767,7 +767,7 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us $commandestatic->ref=$obj->ref; print ''; - print ''; print '
'; + print ''; print $commandestatic->getNomUrl(1); print ''; @@ -864,7 +864,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) print ''; print ''; - print '
'; + print ''; $facturestatic->ref=$obj->facnumber; $facturestatic->id=$obj->rowid; $facturestatic->type=$obj->type; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 52f4c03f1fa..817396f97fc 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1,7 +1,7 @@ * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2004 Christophe Combelles @@ -3638,6 +3638,21 @@ function get_date_range($date_start,$date_end,$format = '',$outputlangs='') return $out; } +/** + * Return firstname and lastname in correct order + * + * @param string $firstname Firstname + * @param string $lastname Lastname + * @return string Firstname + lastname or Lastname + firstname + */ +function dolGetFirstLastname($firstname,$lastname) +{ + global $conf; + if (empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)) return $firstname.' '.$lastname; + else return $lastname.' '.$firstname; +} + + /** * Set event message in dol_events session *