2
0
forked from Wavyzz/dolibarr

List of events show user firstname by default

This commit is contained in:
Laurent Destailleur
2018-12-23 01:28:36 +01:00
parent da3d1ab8b8
commit 35debd06fb
5 changed files with 19 additions and 14 deletions

View File

@@ -462,7 +462,7 @@ abstract class CommonObject
*
* @param Translate $langs Language object for translation of civility (used only if option is 1)
* @param int $option 0=No option, 1=Add civility
* @param int $nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname, 2=Firstname
* @param int $nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname, 2=Firstname, 3=Firstname if defined else lastname
* @param int $maxlen Maximum length
* @return string String with full name
*/

View File

@@ -249,7 +249,7 @@ class FormActions
if (! empty($action->userownerid))
{
$userstatic->fetch($action->userownerid); // TODO Introduce a cache on users fetched
print $userstatic->getNomUrl(-1, '', 0, 0, 16, 0, '', '');
print $userstatic->getNomUrl(-1, '', 0, 0, 16, 0, 'firstelselast', '');
}
print '</td>';
// Type

View File

@@ -1332,8 +1332,9 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
$sql.= " u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname";
if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql.= ", sp.lastname, sp.firstname";
elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql.= ", m.lastname, m.firstname";
elseif (is_object($filterobj) && get_class($filterobj) == 'Facture') $sql.= ", o.ref";
else $sql.= ", o.ref";
elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql.= ", o.ref";
elseif (is_object($filterobj) && get_class($filterobj) == 'Product') $sql.= ", o.ref";
elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') $sql.= ", o.ref";
$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_action";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id";
@@ -1634,8 +1635,8 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
//$out.=$userstatic->getLoginUrl(1);
if ($histo[$key]['userid'] > 0)
{
$userstatic->fetch($histo[$key]['userid']);
$out.=$userstatic->getNomUrl(-1);
$userstatic->fetch($histo[$key]['userid']); // TODO Introduce a cache on users fetched
$out.=$userstatic->getNomUrl(-1, '', 0, 0, 16, 0, 'firstelselast', '');
}
$out.='</td>';

View File

@@ -6274,7 +6274,7 @@ function get_date_range($date_start,$date_end,$format = '',$outputlangs='', $wit
*
* @param string $firstname Firstname
* @param string $lastname Lastname
* @param int $nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname, 2=Firstname
* @param int $nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname, 2=Firstname, 3=Firstname if defined else lastname
* @return string Firstname + lastname or Lastname + firstname
*/
function dolGetFirstLastname($firstname,$lastname,$nameorder=-1)
@@ -6284,15 +6284,19 @@ function dolGetFirstLastname($firstname,$lastname,$nameorder=-1)
$ret='';
// If order not defined, we use the setup
if ($nameorder < 0) $nameorder=(empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?1:0);
if ($nameorder && ((string) $nameorder != '2'))
if ($nameorder && $nameorder != 2 && $nameorder != 3)
{
$ret.=$firstname;
if ($firstname && $lastname) $ret.=' ';
$ret.=$lastname;
}
else if ($nameorder == 2)
else if ($nameorder == 2 || $nameorder == 3)
{
$ret.=$firstname;
if (empty($ret) && $nameorder == 3)
{
$ret.=$lastname;
}
}
else
{

View File

@@ -2243,7 +2243,7 @@ class User extends CommonObject
* @param integer $notooltip 1=Disable tooltip on picto and name
* @param int $maxlen Max length of visible user name
* @param int $hidethirdpartylogo Hide logo of thirdparty if user is external user
* @param string $mode ''=Show firstname and lastname, 'firstname'=Show only firstname, 'login'=Show login
* @param string $mode ''=Show firstname and lastname, 'firstname'=Show only firstname, 'firstelselast'=Show firstname or lastname if not defined, 'login'=Show login
* @param string $morecss Add more css on link
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
@@ -2360,7 +2360,7 @@ class User extends CommonObject
{
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result.='<div class="inline-block nopadding valignmiddle usertext'.((! isset($this->statut) || $this->statut)?'':' strikefordisabled').($morecss?' '.$morecss:'').'">';
if ($mode == 'login') $result.=dol_trunc($this->login, $maxlen);
else $result.=$this->getFullName($langs,'',($mode == 'firstname' ? 2 : -1),$maxlen);
else $result.=$this->getFullName($langs,'',($mode == 'firstelselast' ? 3 : ($mode == 'firstname' ? 2 : -1)),$maxlen);
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result.='</div>';
}
$result.=(($option == 'nolink')?'':$linkend);