clean code

This commit is contained in:
Frédéric FRANCE 2023-02-06 21:14:24 +01:00
parent a224d7c824
commit 1b9f8d46b0
2 changed files with 22 additions and 51 deletions

View File

@ -2319,33 +2319,21 @@ class Adherent extends CommonObject
}
$result = '';
$label = '';
$linkstart = '';
$linkend = '';
if (!empty($this->photo)) {
$label .= '<div class="photointooltip floatright">';
$label .= Form::showphoto('memberphoto', $this, 80, 0, 0, 'photoref photowithmargin photologintooltip', 'small', 0, 1);
$label .= '</div>';
//$label .= '<div style="clear: both;"></div>';
$classfortooltip = 'classfortooltip';
$dataparams = '';
$params = [
'id' => $this->id,
'objecttype' => $this->element,
'option' => $option,
];
if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
$classfortooltip = 'classforajaxtooltip';
$dataparams = ' data-params='.json_encode($params);
// $label = $langs->trans('Loading');
}
$label .= '<div class="centpercent">';
$label .= img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("Member").'</u>';
$label .= ' '.$this->getLibStatut(4);
if (!empty($this->ref)) {
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
}
if (!empty($this->login)) {
$label .= '<br><b>'.$langs->trans('Login').':</b> '.$this->login;
}
if (!empty($this->firstname) || !empty($this->lastname)) {
$label .= '<br><b>'.$langs->trans('Name').':</b> '.$this->getFullName($langs);
}
if (!empty($this->company)) {
$label .= '<br><b>'.$langs->trans('Company').':</b> '.$this->company;
}
$label .= '</div>';
$label = implode($this->getTooltipContentArray($params));
$url = DOL_URL_ROOT.'/adherents/card.php?rowid='.((int) $this->id);
if ($option == 'subscription') {
@ -2365,18 +2353,6 @@ class Adherent extends CommonObject
$linkstart .= '<a href="'.$url.'"';
$linkclose = "";
$classfortooltip = 'classfortooltip';
$dataparams = '';
if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
$params = [
'id' => $this->id,
'objecttype' => $this->element,
'option' => $option,
];
$classfortooltip = 'classforajaxtooltip';
$dataparams = ' data-params='.json_encode($params);
// $label = $langs->trans('Loading');
}
if (empty($notooltip)) {
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
$langs->load("users");

View File

@ -724,29 +724,24 @@ class AdherentType extends CommonObject
global $langs;
$result = '';
$label = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("MemberType").'</u>';
$label .= ' '.$this->getLibStatut(4);
$label .= '<br>'.$langs->trans("Label").': '.$this->label;
if (isset($this->subscription)) {
$label .= '<br>'.$langs->trans("SubscriptionRequired").': '.yn($this->subscription);
}
$option = '';
$url = DOL_URL_ROOT.'/adherents/type.php?rowid='.((int) $this->id);
$classfortooltip = 'classfortooltip';
$dataparams = '';
$params = [
'id' => $this->id,
'objecttype' => $this->element,
'option' => $option,
];
if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
$params = [
'id' => $this->id,
'objecttype' => $this->element,
'option' => $option,
];
$classfortooltip = 'classforajaxtooltip';
$dataparams = ' data-params='.json_encode($params);
$label = $langs->trans('Loading');
// $label = $langs->trans('Loading');
}
$label = implode($this->getTooltipContentArray($params));
$url = DOL_URL_ROOT.'/adherents/type.php?rowid='.((int) $this->id);
if ($option != 'nolink') {
// Add param to save lastsearch_values or not
$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);