New: use dolGetFirstLastname() everywher we should.
This commit is contained in:
parent
34fed3e430
commit
5bc66318c2
@ -181,7 +181,7 @@ if (! empty($conf->global->MAIN_MODULE_NOTIFICATION))
|
||||
$var=!$var;
|
||||
if (!$obj->fk_societe)
|
||||
{
|
||||
$username= $obj->firstname.' '.$obj->lastname;
|
||||
$username=dolGetFirstLastname($obj->firstname,$obj->lastname);
|
||||
$internalusers[$obj->rowid] = $username;
|
||||
}
|
||||
|
||||
@ -254,7 +254,7 @@ if ($resql)
|
||||
$var=!$var;
|
||||
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td>'.$obj->firstname." ".$obj->lastname.'</td>';
|
||||
print '<td>'.dolGetFirstLastname($obj->firstname,$obj->lastname).'</td>';
|
||||
$label=($langs->trans("Notify_".$obj->code)!="Notify_".$obj->code?$langs->trans("Notify_".$obj->code):$obj->label);
|
||||
print '<td>'.$label.'</td>';
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=deletenotif&notif='.$obj->rowid.'">'.img_delete().'</a></td>';
|
||||
|
||||
@ -948,7 +948,7 @@ class ActionComm extends CommonObject
|
||||
$event['startdate']=$datestart;
|
||||
$event['duration']=$duration; // Not required with type 'journal'
|
||||
$event['enddate']=$dateend; // Not required with type 'journal'
|
||||
$event['author']=$obj->firstname.($obj->lastname?" ".$obj->lastname:"");
|
||||
$event['author']=dolGetFirstLastname($obj->firstname, $obj->lastname);
|
||||
$event['priority']=$obj->priority;
|
||||
$event['fulldayevent']=$obj->fulldayevent;
|
||||
$event['location']=$obj->location;
|
||||
|
||||
@ -486,7 +486,7 @@ if ($showbirthday)
|
||||
$event->datep=dol_mktime(0,0,0,$datearray['mon'],$datearray['mday'],$year,true); // For full day events, date are also GMT but they wont but converted during output
|
||||
$event->datef=$event->datep;
|
||||
$event->type_code='BIRTHDAY';
|
||||
$event->libelle=$langs->trans("Birthday").' '.$obj->firstname.' '.$obj->lastname;
|
||||
$event->libelle=$langs->trans("Birthday").' '.dolGetFirstLastname($obj->firstname,$obj->lastname);
|
||||
$event->percentage=100;
|
||||
$event->fulldayevent=true;
|
||||
|
||||
|
||||
@ -209,7 +209,7 @@ if ($action == 'sendallconfirmed' && $confirm == 'yes')
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
// sendto en RFC2822
|
||||
$sendto = str_replace(',',' ',$obj->firstname." ".$obj->lastname)." <".$obj->email.">";
|
||||
$sendto = str_replace(',',' ',dolGetFirstLastname($obj->firstname, $obj->lastname))." <".$obj->email.">";
|
||||
|
||||
// Make substitutions on topic and body. From (AA=YY;BB=CC;...) we keep YY, CC, ...
|
||||
$other=explode(';',$obj->other);
|
||||
|
||||
@ -540,7 +540,7 @@ class BonPrelevement extends CommonObject
|
||||
$this->method_trans = $method;
|
||||
$langs->load('withdrawals');
|
||||
$subject = $langs->trans("InfoTransSubject", $this->ref);
|
||||
$message = $langs->trans("InfoTransMessage", $this->ref, $user->firstname, $user->lastname);
|
||||
$message = $langs->trans("InfoTransMessage", $this->ref, dolGetFirstLastname($user->firstname, $user->lastname));
|
||||
$message .=$langs->trans("InfoTransData", price($this->amount), $this->methodes_trans[$this->method_trans], dol_print_date($date,'day'));
|
||||
|
||||
// TODO Call trigger to create a notification using notification module
|
||||
|
||||
@ -73,21 +73,8 @@ abstract class CommonObject
|
||||
else $ret.=$this->civilite_id.' ';
|
||||
}
|
||||
|
||||
// If order not defined, we use the setup
|
||||
if ($nameorder < 0) $nameorder=(empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION));
|
||||
$ret.=dolGetFirstLastname($firstname, $lastname, $nameorder);
|
||||
|
||||
if ($nameorder)
|
||||
{
|
||||
$ret.=$firstname;
|
||||
if ($firstname && $lastname) $ret.=' ';
|
||||
$ret.=$lastname;
|
||||
}
|
||||
else
|
||||
{
|
||||
$ret.=$lastname;
|
||||
if ($firstname && $lastname) $ret.=' ';
|
||||
$ret.=$firstname;
|
||||
}
|
||||
return dol_trunc($ret,$maxlen);
|
||||
}
|
||||
|
||||
|
||||
@ -3643,13 +3643,29 @@ function get_date_range($date_start,$date_end,$format = '',$outputlangs='')
|
||||
*
|
||||
* @param string $firstname Firstname
|
||||
* @param string $lastname Lastname
|
||||
* @param int $nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname
|
||||
* @return string Firstname + lastname or Lastname + firstname
|
||||
*/
|
||||
function dolGetFirstLastname($firstname,$lastname)
|
||||
function dolGetFirstLastname($firstname,$lastname,$nameorder=-1)
|
||||
{
|
||||
global $conf;
|
||||
if (empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)) return $firstname.' '.$lastname;
|
||||
else return $lastname.' '.$firstname;
|
||||
|
||||
$ret='';
|
||||
// If order not defined, we use the setup
|
||||
if ($nameorder < 0) $nameorder=(empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION));
|
||||
if ($nameorder)
|
||||
{
|
||||
$ret.=$firstname;
|
||||
if ($firstname && $lastname) $ret.=' ';
|
||||
$ret.=$lastname;
|
||||
}
|
||||
else
|
||||
{
|
||||
$ret.=$lastname;
|
||||
if ($firstname && $lastname) $ret.=' ';
|
||||
$ret.=$firstname;
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -319,7 +319,7 @@ if ($action == 'confirm_send')
|
||||
}
|
||||
|
||||
$message.= "\n";
|
||||
$message.= "- ".$langs->transnoentitiesnoconv("Name")." : ".$expediteur->firstname." ".$expediteur->lastname."\n";
|
||||
$message.= "- ".$langs->transnoentitiesnoconv("Name")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n";
|
||||
$message.= "- ".$langs->transnoentitiesnoconv("Period")." : ".dol_print_date($cp->date_debut,'day')." ".$langs->transnoentitiesnoconv("To")." ".dol_print_date($cp->date_fin,'day')."\n";
|
||||
$message.= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/fiche.php?id=".$cp->rowid."\n\n";
|
||||
$message.= "\n";
|
||||
@ -400,7 +400,7 @@ if($action == 'confirm_valid')
|
||||
$message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",\n";
|
||||
$message.= "\n";
|
||||
$message.= "Votre demande de congés payés du ".dol_print_date($cp->date_debut,'day')." au ".dol_print_date($cp->date_fin,'day')." vient d'être validée!\n";
|
||||
$message.= "- ".$langs->transnoentitiesnoconv("ValidatedBy")." : ".$expediteur->firstname." ".$expediteur->lastname."\n";
|
||||
$message.= "- ".$langs->transnoentitiesnoconv("ValidatedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n";
|
||||
$message.= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/fiche.php?id=".$cp->rowid."\n\n";
|
||||
$message.= "\n";
|
||||
|
||||
@ -469,7 +469,7 @@ if ($action == 'confirm_refuse')
|
||||
$message.= "\n";
|
||||
$message.= "Votre demande de congés payés ".dol_print_date($cp->date_debut,'day')." ".$langs->transnoentitiesnoconv("To")." ".dol_print_date($cp->date_fin,'day')." vient d'être refusée pour le motif suivant :\n";
|
||||
$message.= $_POST['detail_refuse']."\n\n";
|
||||
$message.= "- ".$langs->transnoentitiesnoconv("ModifiedBy")." : ".$expediteur->firstname." ".$expediteur->lastname."\n";
|
||||
$message.= "- ".$langs->transnoentitiesnoconv("ModifiedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n";
|
||||
$message.= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/fiche.php?id=".$cp->rowid."\n\n";
|
||||
$message.= "\n";
|
||||
|
||||
@ -539,7 +539,7 @@ if ($action == 'confirm_cancel' && $_GET['confirm'] == 'yes')
|
||||
$message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",\n";
|
||||
$message.= "\n";
|
||||
$message.= "Votre demande de congés ".dol_print_date($cp->date_debut,'day')." ".$langs->transnoentitiesnoconv("To")." ".dol_print_date($cp->date_fin,'day')." va été annulée.\n";
|
||||
$message.= "- ".$langs->transnoentitiesnoconv("ModifiedBy")." : ".$expediteur->firstname." ".$expediteur->lastname."\n";
|
||||
$message.= "- ".$langs->transnoentitiesnoconv("ModifiedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n";
|
||||
$message.= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/fiche.php?id=".$cp->rowid."\n\n";
|
||||
$message.= "\n";
|
||||
|
||||
|
||||
@ -176,7 +176,7 @@ class MailmanSpip
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
|
||||
$mdpass=dol_hash($object->pass);
|
||||
$htpass=crypt($object->pass,makesalt());
|
||||
$query = "INSERT INTO spip_auteurs (nom, email, login, pass, htpass, alea_futur, statut) VALUES(\"".$object->firstname." ".$object->lastname."\",\"".$object->email."\",\"".$object->login."\",\"$mdpass\",\"$htpass\",FLOOR(32000*RAND()),\"1comite\")";
|
||||
$query = "INSERT INTO spip_auteurs (nom, email, login, pass, htpass, alea_futur, statut) VALUES(\"".dolGetFirstLastname($object->firstname,$object->lastname)."\",\"".$object->email."\",\"".$object->login."\",\"$mdpass\",\"$htpass\",FLOOR(32000*RAND()),\"1comite\")";
|
||||
|
||||
$result = $mydb->query($query);
|
||||
|
||||
|
||||
@ -81,10 +81,10 @@ if ($resql)
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
$var=!$var;
|
||||
print "<TR $bc[$var]>";
|
||||
print "<tr ".$bc[$var].">";
|
||||
if ($objp->public)
|
||||
{
|
||||
print "<td>".$objp->firstname." ".$objp->lastname." ".$objp->societe."</td>\n";
|
||||
print "<td>".dolGetFirstLastname($objp->firstname, $objp->lastname)." ".$objp->societe."</td>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -140,7 +140,7 @@ if ($result)
|
||||
$objp = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td><a href="public_card.php?id='.$objp->rowid.'">'.$objp->firstname.' '.$objp->lastname.($objp->societe?' / '.$objp->societe:'').'</a></td>'."\n";
|
||||
print '<td><a href="public_card.php?id='.$objp->rowid.'">'.dolGetFirstLastname($obj->firstname, $obj->lastname).($objp->societe?' / '.$objp->societe:'').'</a></td>'."\n";
|
||||
//print "<td>$objp->naiss</td>\n"; // est-ce nécessaire ??
|
||||
print '<td>'.$objp->email.'</td>'."\n";
|
||||
print '<td>'.$objp->zip.'</td>'."\n";
|
||||
|
||||
@ -1616,7 +1616,7 @@ class Societe extends CommonObject
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($mode == 'email') $property=$obj->email;
|
||||
else if ($mode == 'mobile') $property=$obj->phone_mobile;
|
||||
$contact_property[$obj->rowid] = trim($obj->firstname." ".$obj->lastname)." <".$property.">";
|
||||
$contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname,$obj->lastname))." <".$property.">";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
@ -1649,7 +1649,7 @@ class Societe extends CommonObject
|
||||
while ($i < $nump)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$contacts[$obj->rowid] = $obj->firstname." ".$obj->lastname;
|
||||
$contacts[$obj->rowid] = dolGetFirstLastname($obj->firstname,$obj->lastname);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
@ -1685,7 +1685,7 @@ class Societe extends CommonObject
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
if ($mode == 'email') $contact_property = "$obj->firstname $obj->lastname <$obj->email>";
|
||||
if ($mode == 'email') $contact_property = dolGetFirstLastname($obj->firstname, $obj->lastname)." <".$obj->email.">";
|
||||
else if ($mode == 'mobile') $contact_property = $obj->phone_mobile;
|
||||
}
|
||||
return $contact_property;
|
||||
|
||||
@ -188,7 +188,7 @@ if ($_GET["socid"])
|
||||
|
||||
print '<a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->rowid.'">';
|
||||
print img_object($langs->trans("ShowUser"),"user").' ';
|
||||
print $obj->firstname." " .$obj->lastname."\n";
|
||||
print dolGetFirstLastname($obj->firstname, $obj->lastname)."\n";
|
||||
print '</a> ';
|
||||
if ($user->rights->societe->creer)
|
||||
{
|
||||
@ -254,7 +254,7 @@ if ($_GET["socid"])
|
||||
print "<tr $bc[$var]><td>";
|
||||
print '<a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->rowid.'">';
|
||||
print img_object($langs->trans("ShowUser"),"user").' ';
|
||||
print $obj->firstname." " .$obj->lastname."\n";
|
||||
print dolGetFirstLastname($obj->firstname, $obj->lastname)."\n";
|
||||
print '</a>';
|
||||
print '</td><td>'.$obj->login.'</td>';
|
||||
print '<td><a href="commerciaux.php?socid='.$_GET["socid"].'&commid='.$obj->rowid.'">'.$langs->trans("Add").'</a></td>';
|
||||
|
||||
@ -93,9 +93,9 @@ if ($result)
|
||||
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
print "<td><a href=\"fiche.php?socid=".$obj->socid."\">$obj->nom</A></td>\n";
|
||||
print "<td>".$obj->firstname." ".$obj->lastname."</td>\n";
|
||||
print "<tr ".$bc[$var].">";
|
||||
print "<td><a href=\"fiche.php?socid=".$obj->socid."\">".$obj->nom."</a></td>\n";
|
||||
print "<td>".dolGetFirstLastname($obj->firstname, $obj->lastname)."</td>\n";
|
||||
print "<td>".$obj->titre."</td>\n";
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
@ -108,7 +108,7 @@ else
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
?>
|
||||
|
||||
@ -120,7 +120,7 @@ if ($resql)
|
||||
$obj2 = $db->fetch_object($resql);
|
||||
|
||||
// sendto en RFC2822
|
||||
$sendto = str_replace(',',' ',$obj2->firstname." ".$obj2->lastname) ." <".$obj2->email.">";
|
||||
$sendto = str_replace(',',' ',dolGetFirstLastname($obj2->firstname, $obj2->lastname)) ." <".$obj2->email.">";
|
||||
|
||||
// Make subtsitutions on topic and body
|
||||
$other=explode(';',$obj2->other);
|
||||
|
||||
@ -127,7 +127,7 @@ if ($resql)
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
// sendto en RFC2822
|
||||
$sendto = str_replace(',',' ',$obj->firstname." ".$obj->lastname) ." <".$obj->email.">";
|
||||
$sendto = str_replace(',',' ',dolGetFirstLastname($obj->firstname, $obj->lastname) ." <".$obj->email.">";
|
||||
|
||||
// Make subtsitutions on topic and body
|
||||
$other=explode(';',$obj->other);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user