Better support for option MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN (on by

default).
This commit is contained in:
Laurent Destailleur 2016-07-28 19:02:23 +02:00
parent 00118610bb
commit 9ca7f2cb66
12 changed files with 186 additions and 186 deletions

View File

@ -376,31 +376,6 @@ if (empty($reshook))
$error++; $error++;
} }
// Now we create same links to contact than the ones found on origin object
if (! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN))
{
$originforcontact = $object->origin;
$originidforcontact = $object->origin_id;
if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order
{
$originforcontact=$srcobject->origin;
$originidforcontact=$srcobject->origin_id;
}
$sqlcontact = "SELECT code, fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc";
$sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'";
$resqlcontact = $db->query($sqlcontact);
if ($resqlcontact)
{
while($objcontact = $db->fetch_object($resqlcontact))
{
//print $objcontact->code.'-'.$objcontact->fk_socpeople."\n";
$object->add_contact($objcontact->fk_socpeople, $objcontact->code);
}
}
else dol_print_error($resqlcontact);
}
// Hooks // Hooks
$parameters = array('objFrom' => $srcobject); $parameters = array('objFrom' => $srcobject);
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been $reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been

View File

@ -879,53 +879,49 @@ class Commande extends CommonOrder
$error++; $error++;
} }
// TODO mutualiser if (! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN))
if ($origin == 'propal' && $origin_id)
{ {
// On recupere les differents contact interne et externe $originforcontact = $origin;
$prop = new Propal($this->db); $originidforcontact = $origin_id;
$prop->fetch($origin_id); if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order
// We get ids of sales representatives of proposal
$this->userid = $prop->getIdcontact('internal', 'SALESREPFOLL');
if ($this->userid)
{ {
//On passe le commercial suivi propale en commercial suivi commande require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php';
$this->add_contact($this->userid[0], 'SALESREPFOLL', 'internal'); $exp = new Expedition($db);
$exp->fetch($origin_id);
$exp->fetchObjectLinked();
if (count($exp->linkedObjectsIds['commande']) > 0)
{
foreach ($exp->linkedObjectsIds['commande'] as $key => $value)
{
$originforcontact = 'commande';
$originidforcontact = $value->id;
break; // We take first one
}
}
} }
// We get ids of customer follower of proposal $sqlcontact = "SELECT ctc.code, ctc.source, ec.fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc";
$this->contactid = $prop->getIdcontact('external', 'CUSTOMER'); $sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'";
if ($this->contactid) $resqlcontact = $this->db->query($sqlcontact);
if ($resqlcontact)
{ {
//On passe le contact client suivi propale en contact client suivi commande while($objcontact = $this->db->fetch_object($resqlcontact))
$this->add_contact($this->contactid[0], 'CUSTOMER', 'external'); {
//print $objcontact->code.'-'.$objcontact->source.'-'.$objcontact->fk_socpeople."\n";
$this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object
} }
} }
else dol_print_error($resqlcontact);
}
} }
} }
} }
if (! $error) if (! $error)
{ {
//$action='create';
// Actions on extra fields (by external module or standard code)
// TODO le hook fait double emploi avec le trigger !!
/*$hookmanager->initHooks(array('orderdao'));
$parameters=array('socid'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{*/
$result=$this->insertExtraFields(); $result=$this->insertExtraFields();
if ($result < 0) $error++; if ($result < 0) $error++;
/* }
}
else if ($reshook < 0) $error++;*/
} }
if (! $error && ! $notrigger) if (! $error && ! $notrigger)

View File

@ -864,7 +864,7 @@ if (empty($reshook))
} }
} }
// Standard invoice or Deposit invoice created from a Predefined template invoice // Standard invoice or Deposit invoice, created from a Predefined template invoice
if (($_POST['type'] == Facture::TYPE_STANDARD || $_POST['type'] == Facture::TYPE_DEPOSIT) && GETPOST('fac_rec') > 0) if (($_POST['type'] == Facture::TYPE_STANDARD || $_POST['type'] == Facture::TYPE_DEPOSIT) && GETPOST('fac_rec') > 0)
{ {
$dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); $dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
@ -904,6 +904,7 @@ if (empty($reshook))
$object->fac_rec = GETPOST('fac_rec'); $object->fac_rec = GETPOST('fac_rec');
$id = $object->create($user); $id = $object->create($user);
var_dump('ggg');
} }
} }
@ -1011,7 +1012,7 @@ if (empty($reshook))
$object->linked_objects = array_merge($object->linked_objects, $_POST['other_linked_objects']); $object->linked_objects = array_merge($object->linked_objects, $_POST['other_linked_objects']);
} }
$id = $object->create($user); $id = $object->create($user); // This include class to add_object_linked() and add add_contact()
if ($id > 0) if ($id > 0)
{ {
@ -1184,31 +1185,6 @@ if (empty($reshook))
} }
} }
// Now we create same links to contact than the ones found on origin object
if (! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN))
{
$originforcontact = $object->origin;
$originidforcontact = $object->origin_id;
if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order
{
$originforcontact=$srcobject->origin;
$originidforcontact=$srcobject->origin_id;
}
$sqlcontact = "SELECT code, fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc";
$sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'";
$resqlcontact = $db->query($sqlcontact);
if ($resqlcontact)
{
while($objcontact = $db->fetch_object($resqlcontact))
{
//print $objcontact->code.'-'.$objcontact->fk_socpeople."\n";
$object->add_contact($objcontact->fk_socpeople, $objcontact->code);
}
}
else dol_print_error($resqlcontact);
}
// Hooks // Hooks
$parameters = array('objFrom' => $srcobject); $parameters = array('objFrom' => $srcobject);
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been $reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been

View File

@ -408,31 +408,41 @@ class Facture extends CommonInvoice
$error++; $error++;
} }
// TODO mutualiser if (! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN))
if ($origin == 'commande')
{ {
// On recupere les differents contact interne et externe $originforcontact = $origin;
$order = new Commande($this->db); $originidforcontact = $origin_id;
$order->id = $origin_id; if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order
// On recupere le commercial suivi propale
$this->userid = $order->getIdcontact('internal', 'SALESREPFOLL');
if ($this->userid)
{ {
//On passe le commercial suivi commande en commercial suivi paiement require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php';
$this->add_contact($this->userid[0], 'SALESREPFOLL', 'internal'); $exp = new Expedition($db);
$exp->fetch($origin_id);
$exp->fetchObjectLinked();
if (count($exp->linkedObjectsIds['commande']) > 0)
{
foreach ($exp->linkedObjectsIds['commande'] as $key => $value)
{
$originforcontact = 'commande';
$originidforcontact = $value->id;
break; // We take first one
}
}
} }
// On recupere le contact client facturation commande $sqlcontact = "SELECT ctc.code, ctc.source, ec.fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc";
$this->contactid = $order->getIdcontact('external', 'BILLING'); $sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'";
if ($this->contactid) $resqlcontact = $this->db->query($sqlcontact);
if ($resqlcontact)
{ {
//On passe le contact client facturation commande en contact client facturation while($objcontact = $this->db->fetch_object($resqlcontact))
$this->add_contact($this->contactid[0], 'BILLING', 'external'); {
//print $objcontact->code.'-'.$objcontact->source.'-'.$objcontact->fk_socpeople."\n";
$this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object
} }
} }
else dol_print_error($resqlcontact);
}
} }
} }
@ -595,21 +605,22 @@ class Facture extends CommonInvoice
// Actions on extra fields (by external module or standard code) // Actions on extra fields (by external module or standard code)
// TODO le hook fait double emploi avec le trigger !! // TODO le hook fait double emploi avec le trigger !!
/*
$hookmanager->initHooks(array('invoicedao')); $hookmanager->initHooks(array('invoicedao'));
$parameters=array('invoiceid'=>$this->id); $parameters=array('invoiceid'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook)) if (empty($reshook))
{ {
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{*/
if (! $error)
{ {
$result=$this->insertExtraFields(); $result=$this->insertExtraFields();
if ($result < 0) if ($result < 0) $error++;
{
$error++;
} }
/*}
} }
} else if ($reshook < 0) $error++;*/
else if ($reshook < 0) $error++;
// Call trigger // Call trigger
$result=$this->call_trigger('BILL_CREATE',$user); $result=$this->call_trigger('BILL_CREATE',$user);

View File

@ -368,31 +368,6 @@ if (empty($reshook))
$error++; $error++;
} }
// Now we create same links to contact than the ones found on origin object
if (! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN))
{
$originforcontact = $object->origin;
$originidforcontact = $object->origin_id;
if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order
{
$originforcontact=$srcobject->origin;
$originidforcontact=$srcobject->origin_id;
}
$sqlcontact = "SELECT code, fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc";
$sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'";
$resqlcontact = $db->query($sqlcontact);
if ($resqlcontact)
{
while($objcontact = $db->fetch_object($resqlcontact))
{
//print $objcontact->code.'-'.$objcontact->fk_socpeople."\n";
$object->add_contact($objcontact->fk_socpeople, $objcontact->code);
}
}
else dol_print_error($resqlcontact);
}
// Hooks // Hooks
$parameters = array('objFrom' => $srcobject); $parameters = array('objFrom' => $srcobject);
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been $reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been

View File

@ -957,15 +957,6 @@ class Contrat extends CommonObject
} }
} }
// Insert contacts commerciaux ('SALESREPSIGN','contrat')
$result=$this->add_contact($this->commercial_signature_id,'SALESREPSIGN','internal');
if ($result < 0) $error++;
// Insert contacts commerciaux ('SALESREPFOLL','contrat')
$result=$this->add_contact($this->commercial_suivi_id,'SALESREPFOLL','internal');
if ($result < 0) $error++;
if (! $error) if (! $error)
{ {
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
@ -978,6 +969,75 @@ class Contrat extends CommonObject
} }
} }
// Insert contacts commerciaux ('SALESREPSIGN','contrat')
if (! $error)
{
$result=$this->add_contact($this->commercial_signature_id,'SALESREPSIGN','internal');
if ($result < 0) $error++;
}
// Insert contacts commerciaux ('SALESREPFOLL','contrat')
if (! $error)
{
$result=$this->add_contact($this->commercial_suivi_id,'SALESREPFOLL','internal');
if ($result < 0) $error++;
}
if (! $error)
{
// Add object linked
if (is_array($this->linked_objects) && ! empty($this->linked_objects))
{
foreach($this->linked_objects as $origin => $origin_id)
{
$ret = $this->add_object_linked($origin, $origin_id);
if (! $ret)
{
dol_print_error($this->db);
$error++;
}
if (! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN))
{
$originforcontact = $origin;
$originidforcontact = $origin_id;
if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order
{
require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php';
$exp = new Expedition($db);
$exp->fetch($origin_id);
$exp->fetchObjectLinked();
if (count($exp->linkedObjectsIds['commande']) > 0)
{
foreach ($exp->linkedObjectsIds['commande'] as $key => $value)
{
$originforcontact = 'commande';
$originidforcontact = $value->id;
break; // We take first one
}
}
}
$sqlcontact = "SELECT ctc.code, ctc.source, ec.fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc";
$sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'";
$resqlcontact = $this->db->query($sqlcontact);
if ($resqlcontact)
{
while($objcontact = $this->db->fetch_object($resqlcontact))
{
if ($objcontact->source == 'internal' && in_array($objcontact->code, array('SALESREPSIGN', 'SALESREPFOLL'))) continue; // ignore this, already forced previously
//print $objcontact->code.'-'.$objcontact->source.'-'.$objcontact->fk_socpeople."\n";
$this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object
}
}
else dol_print_error($resqlcontact);
}
}
}
}
if (! $error) if (! $error)
{ {
// Call trigger // Call trigger
@ -987,19 +1047,12 @@ class Contrat extends CommonObject
if (! $error) if (! $error)
{ {
// Add linked object
if (! $error && $this->origin && $this->origin_id)
{
$ret = $this->add_object_linked();
if (! $ret) dol_print_error($this->db);
}
$this->db->commit(); $this->db->commit();
return $this->id; return $this->id;
} }
else else
{ {
dol_syslog(get_class($this)."::create - 30 - ".$this->error, LOG_ERR); dol_syslog(get_class($this)."::create - 30 - ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -3; return -3;
} }
@ -1008,7 +1061,6 @@ class Contrat extends CommonObject
{ {
$this->error="Failed to add contact"; $this->error="Failed to add contact";
dol_syslog(get_class($this)."::create - 20 - ".$this->error, LOG_ERR); dol_syslog(get_class($this)."::create - 20 - ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -2; return -2;
} }

View File

@ -156,7 +156,7 @@ if ($id > 0 || ! empty($ref))
else print $langs->trans("CompanyHasNoRelativeDiscount"); else print $langs->trans("CompanyHasNoRelativeDiscount");
$absolute_discount=$object->thirdparty->getAvailableDiscounts(); $absolute_discount=$object->thirdparty->getAvailableDiscounts();
print '. '; print '. ';
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->currency)); if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->trans("Currency".$conf->currency));
else print $langs->trans("CompanyHasNoAbsoluteDiscount"); else print $langs->trans("CompanyHasNoAbsoluteDiscount");
print '.'; print '.';
print '</td></tr>'; print '</td></tr>';

View File

@ -541,7 +541,7 @@ abstract class CommonObject
* Add a link between element $this->element and a contact * Add a link between element $this->element and a contact
* *
* @param int $fk_socpeople Id of thirdparty contact (if source = 'external') or id of user (if souce = 'internal') to link * @param int $fk_socpeople Id of thirdparty contact (if source = 'external') or id of user (if souce = 'internal') to link
* @param int $type_contact Type of contact (code or id). Must be if or code found into table llx_c_type_contact. For example: SALESREPFOLL * @param int $type_contact Type of contact (code or id). Must be id or code found into table llx_c_type_contact. For example: SALESREPFOLL
* @param string $source external=Contact extern (llx_socpeople), internal=Contact intern (llx_user) * @param string $source external=Contact extern (llx_socpeople), internal=Contact intern (llx_user)
* @param int $notrigger Disable all triggers * @param int $notrigger Disable all triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
@ -551,7 +551,7 @@ abstract class CommonObject
global $user,$langs; global $user,$langs;
dol_syslog(get_class($this)."::add_contact $fk_socpeople, $type_contact, $source"); dol_syslog(get_class($this)."::add_contact $fk_socpeople, $type_contact, $source, $notrigger");
// Check parameters // Check parameters
if ($fk_socpeople <= 0) if ($fk_socpeople <= 0)
@ -587,10 +587,17 @@ abstract class CommonObject
if ($resql) if ($resql)
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$id_type_contact=$obj->rowid; if ($obj) $id_type_contact=$obj->rowid;
} }
} }
if ($id_type_contact == 0)
{
$this->error='CODE_NOT_VALID_FOR_THIS_ELEMENT';
dol_syslog("CODE_NOT_VALID_FOR_THIS_ELEMENT");
return -3;
}
$datecreate = dol_now(); $datecreate = dol_now();
$this->db->begin(); $this->db->begin();
@ -602,7 +609,6 @@ abstract class CommonObject
$sql.= "'".$this->db->idate($datecreate)."'"; $sql.= "'".$this->db->idate($datecreate)."'";
$sql.= ", 4, '". $id_type_contact . "' "; $sql.= ", 4, '". $id_type_contact . "' ";
$sql.= ")"; $sql.= ")";
dol_syslog(get_class($this)."::add_contact", LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)

View File

@ -481,6 +481,9 @@ class Conf
// Default max file size for upload // Default max file size for upload
$this->maxfilesize = (empty($this->global->MAIN_UPLOAD_DOC) ? 0 : $this->global->MAIN_UPLOAD_DOC * 1024); $this->maxfilesize = (empty($this->global->MAIN_UPLOAD_DOC) ? 0 : $this->global->MAIN_UPLOAD_DOC * 1024);
// By default, we propagate contacts
if (! isset($this->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN)) $this->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN='*'; // Can be also '*' or '^(BILLING|SHIPPING|CUSTOMER|.*)$' (regex not yet implemented)
// Define list of limited modules // Define list of limited modules
if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='user,supplier_proposal,facture,categorie,commande,fournisseur,contact,propal,projet,contrat,societe,ficheinter,expedition,agenda,adherent'; // '' means 'all'. Note that contact is added here as it should be a module later. if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='user,supplier_proposal,facture,categorie,commande,fournisseur,contact,propal,projet,contrat,societe,ficheinter,expedition,agenda,adherent'; // '' means 'all'. Note that contact is added here as it should be a module later.

View File

@ -830,6 +830,9 @@ div.ficheaddleft {
div.ficheaddleft tr.liste_titre:first-child td table.nobordernopadding td { div.ficheaddleft tr.liste_titre:first-child td table.nobordernopadding td {
padding: 0 0 0 0; padding: 0 0 0 0;
} }
div.nopadding {
padding: 0 !important;
}
.containercenter { .containercenter {
display : table; display : table;

View File

@ -866,9 +866,12 @@ div.ficheaddleft {
} }
/* For table into table into card */ /* For table into table into card */
div.ficheaddleft tr.liste_titre:first-child td table.nobordernopadding td { div.ficheaddleft tr.liste_titre:first-child td table.nobordernopadding td, div.nopadding {
padding: 0 0 0 0; padding: 0 0 0 0;
} }
div.nopadding {
padding: 0 !important;
}
table.noborder tr.liste_titre td { table.noborder tr.liste_titre td {
padding: 3px !important; padding: 3px !important;

View File

@ -2032,13 +2032,13 @@ class User extends CommonObject
{ {
$paddafterimage=''; $paddafterimage='';
if (abs($withpictoimg) == 1) $paddafterimage='style="padding-right: 3px;"'; if (abs($withpictoimg) == 1) $paddafterimage='style="padding-right: 3px;"';
if ($withpictoimg > 0) $picto='<div class="inline-block valignmiddle'.($morecss?' userimg'.$morecss:'').'">'.img_object('', 'user', $paddafterimage.' '.($notooltip?'':'class="classfortooltip"')).'</div>'; if ($withpictoimg > 0) $picto='<div class="inline-block nopadding valignmiddle'.($morecss?' userimg'.$morecss:'').'">'.img_object('', 'user', $paddafterimage.' '.($notooltip?'':'class="classfortooltip"')).'</div>';
else $picto='<div class="inline-block valignmiddle'.($morecss?' userimg'.$morecss:'').'"'.($paddafterimage?' '.$paddafterimage:'').'>'.Form::showphoto('userphoto', $this, 0, 0, 0, 'loginphoto', 'mini', 0, 1).'</div>'; else $picto='<div class="inline-block nopadding valignmiddle'.($morecss?' userimg'.$morecss:'').'"'.($paddafterimage?' '.$paddafterimage:'').'>'.Form::showphoto('userphoto', $this, 0, 0, 0, 'loginphoto', 'mini', 0, 1).'</div>';
$result.=$picto; $result.=$picto;
} }
if (abs($withpictoimg) != 2) if (abs($withpictoimg) != 2)
{ {
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result.='<div class="inline-block valignmiddle'.((! isset($this->statut) || $this->statut)?'':' strikefordisabled').($morecss?' usertext'.$morecss:'').'">'; if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result.='<div class="inline-block nopadding valignmiddle'.((! isset($this->statut) || $this->statut)?'':' strikefordisabled').($morecss?' usertext'.$morecss:'').'">';
if ($mode == 'login') $result.=dol_trunc($this->login, $maxlen); 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 == 'firstname' ? 2 : -1),$maxlen);
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result.='</div>'; if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result.='</div>';