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 = ''; $result = '';
$label = '';
$linkstart = ''; $linkstart = '';
$linkend = ''; $linkend = '';
$classfortooltip = 'classfortooltip';
if (!empty($this->photo)) { $dataparams = '';
$label .= '<div class="photointooltip floatright">'; $params = [
$label .= Form::showphoto('memberphoto', $this, 80, 0, 0, 'photoref photowithmargin photologintooltip', 'small', 0, 1); 'id' => $this->id,
$label .= '</div>'; 'objecttype' => $this->element,
//$label .= '<div style="clear: both;"></div>'; 'option' => $option,
];
if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
$classfortooltip = 'classforajaxtooltip';
$dataparams = ' data-params='.json_encode($params);
// $label = $langs->trans('Loading');
} }
$label = implode($this->getTooltipContentArray($params));
$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>';
$url = DOL_URL_ROOT.'/adherents/card.php?rowid='.((int) $this->id); $url = DOL_URL_ROOT.'/adherents/card.php?rowid='.((int) $this->id);
if ($option == 'subscription') { if ($option == 'subscription') {
@ -2365,18 +2353,6 @@ class Adherent extends CommonObject
$linkstart .= '<a href="'.$url.'"'; $linkstart .= '<a href="'.$url.'"';
$linkclose = ""; $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($notooltip)) {
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
$langs->load("users"); $langs->load("users");

View File

@ -724,29 +724,24 @@ class AdherentType extends CommonObject
global $langs; global $langs;
$result = ''; $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 = ''; $option = '';
$url = DOL_URL_ROOT.'/adherents/type.php?rowid='.((int) $this->id);
$classfortooltip = 'classfortooltip'; $classfortooltip = 'classfortooltip';
$dataparams = ''; $dataparams = '';
if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
$params = [ $params = [
'id' => $this->id, 'id' => $this->id,
'objecttype' => $this->element, 'objecttype' => $this->element,
'option' => $option, 'option' => $option,
]; ];
if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
$classfortooltip = 'classforajaxtooltip'; $classfortooltip = 'classforajaxtooltip';
$dataparams = ' data-params='.json_encode($params); $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') { if ($option != 'nolink') {
// Add param to save lastsearch_values or not // Add param to save lastsearch_values or not
$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);