|
@@ -2597,6 +2597,138 @@ class Societe extends CommonObject
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * getTooltipContentArray
|
|
|
+ * @param array $params params to construct tooltip data
|
|
|
+ * @since v18
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
+ public function getTooltipContentArray($params)
|
|
|
+ {
|
|
|
+ global $conf, $langs, $user;
|
|
|
+
|
|
|
+ $langs->loadLangs(['companies', 'commercial']);
|
|
|
+
|
|
|
+ $datas = [];
|
|
|
+
|
|
|
+ $option = $params['option'] ?? '';
|
|
|
+ $name = $this->name;
|
|
|
+
|
|
|
+ if (!empty($this->name_alias) && empty($noaliasinname)) {
|
|
|
+ $name .= ' ('.$this->name_alias.')';
|
|
|
+ }
|
|
|
+ if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
|
|
+ return ['optimize' => $langs->trans("ShowCompany")];
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!empty($this->logo) && class_exists('Form')) {
|
|
|
+ $photo = '<div class="photointooltip floatright">';
|
|
|
+ $photo .= Form::showphoto('societe', $this, 0, 40, 0, 'photoref', 'mini', 0); // Important, we must force height so image will have height tags and if image is inside a tooltip, the tooltip manager can calculate height and position correctly the tooltip.
|
|
|
+ $photo .= '</div>';
|
|
|
+ $datas['photo'] = $photo;
|
|
|
+ } elseif (!empty($this->logo_squarred) && class_exists('Form')) {
|
|
|
+ /*$label.= '<div class="photointooltip">';
|
|
|
+ $label.= Form::showphoto('societe', $this, 0, 40, 0, 'photowithmargin', 'mini', 0); // Important, we must force height so image will have height tags and if image is inside a tooltip, the tooltip manager can calculate height and position correctly the tooltip.
|
|
|
+ $label.= '</div><div style="clear: both;"></div>';*/
|
|
|
+ }
|
|
|
+
|
|
|
+ $datas['divopen'] = '<div class="centpercent">';
|
|
|
+
|
|
|
+ if ($option == 'customer' || $option == 'compta' || $option == 'category') {
|
|
|
+ $datas['picto'] = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("Customer").'</u>';
|
|
|
+ } elseif ($option == 'prospect' && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) {
|
|
|
+ $datas['picto'] = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("Prospect").'</u>';
|
|
|
+ } elseif ($option == 'supplier' || $option == 'category_supplier') {
|
|
|
+ $datas['picto'] = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("Supplier").'</u>';
|
|
|
+ } elseif ($option == 'agenda') {
|
|
|
+ $datas['picto'] = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("ThirdParty").'</u>';
|
|
|
+ } elseif ($option == 'project') {
|
|
|
+ $datas['picto'] = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("ThirdParty").'</u>';
|
|
|
+ } elseif ($option == 'margin') {
|
|
|
+ $datas['picto'] = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("ThirdParty").'</u>';
|
|
|
+ } elseif ($option == 'contact') {
|
|
|
+ $datas['picto'] = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("ThirdParty").'</u>';
|
|
|
+ } elseif ($option == 'ban') {
|
|
|
+ $datas['picto'] = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("ThirdParty").'</u>';
|
|
|
+ }
|
|
|
+
|
|
|
+ // By default
|
|
|
+ if (empty($datas['picto'])) {
|
|
|
+ $datas['picto'] = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("ThirdParty").'</u>';
|
|
|
+ }
|
|
|
+ if (isset($this->status)) {
|
|
|
+ $datas['status'] = ' '.$this->getLibStatut(5);
|
|
|
+ }
|
|
|
+ if (isset($this->client) && isset($this->fournisseur)) {
|
|
|
+ $datas['type'] = ' ' . $this->getTypeUrl(1);
|
|
|
+ }
|
|
|
+ $datas['name'] = '<br><b>'.$langs->trans('Name').':</b> '.dol_escape_htmltag($this->name);
|
|
|
+ if (!empty($this->name_alias)) {
|
|
|
+ $datas['namealias'] = ' ('.dol_escape_htmltag($this->name_alias).')';
|
|
|
+ }
|
|
|
+ if (!empty($this->email)) {
|
|
|
+ $datas['email'] = '<br>'.img_picto('', 'email', 'class="pictofixedwidth"').$this->email;
|
|
|
+ }
|
|
|
+ if (!empty($this->url)) {
|
|
|
+ $datas['url'] = '<br>'.img_picto('', 'globe', 'class="pictofixedwidth"').$this->url;
|
|
|
+ }
|
|
|
+ if (!empty($this->phone) || !empty($this->fax)) {
|
|
|
+ $phonelist = array();
|
|
|
+ if ($this->phone) {
|
|
|
+ $phonelist[] = dol_print_phone($this->phone, $this->country_code, $this->id, 0, '', ' ', 'phone');
|
|
|
+ }
|
|
|
+ if ($this->fax) {
|
|
|
+ $phonelist[] = dol_print_phone($this->fax, $this->country_code, $this->id, 0, '', ' ', 'fax');
|
|
|
+ }
|
|
|
+ $datas['phonelist'] = '<br>'.implode(' ', $phonelist);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!empty($this->address)) {
|
|
|
+ $datas['address'] = '<br><b>'.$langs->trans("Address").':</b> '.dol_format_address($this, 1, ' ', $langs); // Address + country
|
|
|
+ } elseif (!empty($this->country_code)) {
|
|
|
+ $datas['address'] = '<br><b>'.$langs->trans('Country').':</b> '.$this->country_code;
|
|
|
+ }
|
|
|
+ if (!empty($this->tva_intra) || (!empty($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP) && strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'vatnumber') !== false)) {
|
|
|
+ $datas['vatintra'] = '<br><b>'.$langs->trans('VATIntra').':</b> '.dol_escape_htmltag($this->tva_intra);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!empty($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP)) {
|
|
|
+ if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid1') !== false && $langs->trans('ProfId1'.$this->country_code) != '-') {
|
|
|
+ $datas['profid1'] = '<br><b>'.$langs->trans('ProfId1'.$this->country_code).':</b> '.$this->idprof1;
|
|
|
+ }
|
|
|
+ if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid2') !== false && $langs->trans('ProfId2'.$this->country_code) != '-') {
|
|
|
+ $datas['profid2'] = '<br><b>'.$langs->trans('ProfId2'.$this->country_code).':</b> '.$this->idprof2;
|
|
|
+ }
|
|
|
+ if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid3') !== false && $langs->trans('ProfId3'.$this->country_code) != '-') {
|
|
|
+ $datas['profid3'] = '<br><b>'.$langs->trans('ProfId3'.$this->country_code).':</b> '.$this->idprof3;
|
|
|
+ }
|
|
|
+ if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid4') !== false && $langs->trans('ProfId4'.$this->country_code) != '-') {
|
|
|
+ $datas['profid4'] = '<br><b>'.$langs->trans('ProfId4'.$this->country_code).':</b> '.$this->idprof4;
|
|
|
+ }
|
|
|
+ if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid5') !== false && $langs->trans('ProfId5'.$this->country_code) != '-') {
|
|
|
+ $datas['profid5'] = '<br><b>'.$langs->trans('ProfId5'.$this->country_code).':</b> '.$this->idprof5;
|
|
|
+ }
|
|
|
+ if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid6') !== false && $langs->trans('ProfId6'.$this->country_code) != '-') {
|
|
|
+ $datas['profid6'] = '<br><b>'.$langs->trans('ProfId6'.$this->country_code).':</b> '.$this->idprof6;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!empty($this->code_client) && ($this->client == 1 || $this->client == 3)) {
|
|
|
+ $datas['customercode'] = '<br><b>'.$langs->trans('CustomerCode').':</b> '.$this->code_client;
|
|
|
+ }
|
|
|
+ if (!empty($this->code_fournisseur) && $this->fournisseur) {
|
|
|
+ $datas['suppliercode'] = '<br><b>'.$langs->trans('SupplierCode').':</b> '.$this->code_fournisseur;
|
|
|
+ }
|
|
|
+ if (isModEnabled('accounting') && ($this->client == 1 || $this->client == 3)) {
|
|
|
+ $datas['accountancycustomercode'] = '<br><b>'.$langs->trans('CustomerAccountancyCode').':</b> '.($this->code_compta ? $this->code_compta : $this->code_compta_client);
|
|
|
+ }
|
|
|
+ if (isModEnabled('accounting') && $this->fournisseur) {
|
|
|
+ $datas['accountancysuppliercode'] = '<br><b>'.$langs->trans('SupplierAccountancyCode').':</b> '.$this->code_compta_fournisseur;
|
|
|
+ }
|
|
|
+
|
|
|
+ $datas['divclose'] = '</div>';
|
|
|
+
|
|
|
+ return $datas;
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* Return a link on thirdparty (with picto)
|
|
@@ -2652,122 +2784,45 @@ class Societe extends CommonObject
|
|
|
$name .= ' ('.$this->name_alias.')';
|
|
|
}
|
|
|
|
|
|
- $result = ''; $label = ''; $label2 = '';
|
|
|
- $linkstart = ''; $linkend = '';
|
|
|
-
|
|
|
- if (!empty($this->logo) && class_exists('Form')) {
|
|
|
- $label .= '<div class="photointooltip floatright">';
|
|
|
- $label .= Form::showphoto('societe', $this, 0, 40, 0, 'photoref', 'mini', 0); // Important, we must force height so image will have height tags and if image is inside a tooltip, the tooltip manager can calculate height and position correctly the tooltip.
|
|
|
- $label .= '</div>';
|
|
|
- //$label .= '<div style="clear: both;"></div>';
|
|
|
- } elseif (!empty($this->logo_squarred) && class_exists('Form')) {
|
|
|
- /*$label.= '<div class="photointooltip">';
|
|
|
- $label.= Form::showphoto('societe', $this, 0, 40, 0, 'photowithmargin', 'mini', 0); // Important, we must force height so image will have height tags and if image is inside a tooltip, the tooltip manager can calculate height and position correctly the tooltip.
|
|
|
- $label.= '</div><div style="clear: both;"></div>';*/
|
|
|
+ $result = '';
|
|
|
+ $params = [
|
|
|
+ 'id' => $this->id,
|
|
|
+ 'objecttype' => $this->element,
|
|
|
+ 'option' => $option,
|
|
|
+ ];
|
|
|
+ $classfortooltip = 'classfortooltip';
|
|
|
+ $dataparams = '';
|
|
|
+ if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
|
|
|
+ $classfortooltip = 'classforajaxtooltip';
|
|
|
+ $dataparams = ' data-params='.json_encode($params);
|
|
|
+ // $label = $langs->trans('Loading');
|
|
|
}
|
|
|
-
|
|
|
- $label .= '<div class="centpercent">';
|
|
|
+ $label = implode($this->getTooltipContentArray($params));
|
|
|
+ $linkstart = '';
|
|
|
+ $linkend = '';
|
|
|
|
|
|
if ($option == 'customer' || $option == 'compta' || $option == 'category') {
|
|
|
- $label .= img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("Customer").'</u>';
|
|
|
$linkstart = '<a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$this->id;
|
|
|
} elseif ($option == 'prospect' && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) {
|
|
|
- $label .= img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("Prospect").'</u>';
|
|
|
$linkstart = '<a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$this->id;
|
|
|
} elseif ($option == 'supplier' || $option == 'category_supplier') {
|
|
|
- $label .= img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("Supplier").'</u>';
|
|
|
$linkstart = '<a href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$this->id;
|
|
|
} elseif ($option == 'agenda') {
|
|
|
- $label .= img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("ThirdParty").'</u>';
|
|
|
$linkstart = '<a href="'.DOL_URL_ROOT.'/societe/agenda.php?socid='.$this->id;
|
|
|
} elseif ($option == 'project') {
|
|
|
- $label .= img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("ThirdParty").'</u>';
|
|
|
$linkstart = '<a href="'.DOL_URL_ROOT.'/societe/project.php?socid='.$this->id;
|
|
|
} elseif ($option == 'margin') {
|
|
|
- $label .= img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("ThirdParty").'</u>';
|
|
|
$linkstart = '<a href="'.DOL_URL_ROOT.'/margin/tabs/thirdpartyMargins.php?socid='.$this->id.'&type=1';
|
|
|
} elseif ($option == 'contact') {
|
|
|
- $label .= img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("ThirdParty").'</u>';
|
|
|
$linkstart = '<a href="'.DOL_URL_ROOT.'/societe/contact.php?socid='.$this->id;
|
|
|
} elseif ($option == 'ban') {
|
|
|
- $label .= img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("ThirdParty").'</u>';
|
|
|
$linkstart = '<a href="'.DOL_URL_ROOT.'/societe/paymentmodes.php?socid='.$this->id;
|
|
|
}
|
|
|
|
|
|
// By default
|
|
|
if (empty($linkstart)) {
|
|
|
- $label .= img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("ThirdParty").'</u>';
|
|
|
$linkstart = '<a href="'.DOL_URL_ROOT.'/societe/card.php?socid='.$this->id;
|
|
|
}
|
|
|
- if (isset($this->status)) {
|
|
|
- $label .= ' '.$this->getLibStatut(5);
|
|
|
- }
|
|
|
- if (isset($this->client) && isset($this->fournisseur)) {
|
|
|
- $label .= ' ';
|
|
|
- $label .= $this->getTypeUrl(1);
|
|
|
- }
|
|
|
-
|
|
|
- $label .= '<br><b>'.$langs->trans('Name').':</b> '.dol_escape_htmltag($this->name);
|
|
|
- if (!empty($this->name_alias)) {
|
|
|
- $label .= ' ('.dol_escape_htmltag($this->name_alias).')';
|
|
|
- }
|
|
|
-
|
|
|
- if ($this->email) {
|
|
|
- $label .= '<br>'.img_picto('', 'email', 'class="pictofixedwidth"').$this->email;
|
|
|
- }
|
|
|
- if (!empty($this->phone) || !empty($this->fax)) {
|
|
|
- $phonelist = array();
|
|
|
- if ($this->phone) {
|
|
|
- $phonelist[] = dol_print_phone($this->phone, $this->country_code, $this->id, 0, '', ' ', 'phone');
|
|
|
- }
|
|
|
- if ($this->fax) {
|
|
|
- $phonelist[] = dol_print_phone($this->fax, $this->country_code, $this->id, 0, '', ' ', 'fax');
|
|
|
- }
|
|
|
- $label .= '<br>'.implode(' ', $phonelist);
|
|
|
- }
|
|
|
-
|
|
|
- if (!empty($this->address)) {
|
|
|
- $label2 .= '<br><b>'.$langs->trans("Address").':</b> '.dol_format_address($this, 1, ' ', $langs); // Address + country
|
|
|
- } elseif (!empty($this->country_code)) {
|
|
|
- $label2 .= '<br><b>'.$langs->trans('Country').':</b> '.$this->country_code;
|
|
|
- }
|
|
|
- if (!empty($this->tva_intra) || (!empty($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP) && strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'vatnumber') !== false)) {
|
|
|
- $label2 .= '<br><b>'.$langs->trans('VATIntra').':</b> '.dol_escape_htmltag($this->tva_intra);
|
|
|
- }
|
|
|
-
|
|
|
- if (!empty($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP)) {
|
|
|
- if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid1') !== false && $langs->trans('ProfId1'.$this->country_code) != '-') {
|
|
|
- $label2 .= '<br><b>'.$langs->trans('ProfId1'.$this->country_code).':</b> '.$this->idprof1;
|
|
|
- }
|
|
|
- if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid2') !== false && $langs->trans('ProfId2'.$this->country_code) != '-') {
|
|
|
- $label2 .= '<br><b>'.$langs->trans('ProfId2'.$this->country_code).':</b> '.$this->idprof2;
|
|
|
- }
|
|
|
- if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid3') !== false && $langs->trans('ProfId3'.$this->country_code) != '-') {
|
|
|
- $label2 .= '<br><b>'.$langs->trans('ProfId3'.$this->country_code).':</b> '.$this->idprof3;
|
|
|
- }
|
|
|
- if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid4') !== false && $langs->trans('ProfId4'.$this->country_code) != '-') {
|
|
|
- $label2 .= '<br><b>'.$langs->trans('ProfId4'.$this->country_code).':</b> '.$this->idprof4;
|
|
|
- }
|
|
|
- if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid5') !== false && $langs->trans('ProfId5'.$this->country_code) != '-') {
|
|
|
- $label2 .= '<br><b>'.$langs->trans('ProfId5'.$this->country_code).':</b> '.$this->idprof5;
|
|
|
- }
|
|
|
- if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid6') !== false && $langs->trans('ProfId6'.$this->country_code) != '-') {
|
|
|
- $label2 .= '<br><b>'.$langs->trans('ProfId6'.$this->country_code).':</b> '.$this->idprof6;
|
|
|
- }
|
|
|
- }
|
|
|
- if (!empty($this->code_client) && ($this->client == 1 || $this->client == 3)) {
|
|
|
- $label2 .= '<br><b>'.$langs->trans('CustomerCode').':</b> '.$this->code_client;
|
|
|
- }
|
|
|
- if (!empty($this->code_fournisseur) && $this->fournisseur) {
|
|
|
- $label2 .= '<br><b>'.$langs->trans('SupplierCode').':</b> '.$this->code_fournisseur;
|
|
|
- }
|
|
|
- if (isModEnabled('accounting') && ($this->client == 1 || $this->client == 3)) {
|
|
|
- $label2 .= '<br><b>'.$langs->trans('CustomerAccountancyCode').':</b> '.($this->code_compta ? $this->code_compta : $this->code_compta_client);
|
|
|
- }
|
|
|
- if (isModEnabled('accounting') && $this->fournisseur) {
|
|
|
- $label2 .= '<br><b>'.$langs->trans('SupplierAccountancyCode').':</b> '.$this->code_compta_fournisseur;
|
|
|
- }
|
|
|
- $label .= ($label2 ? '<br>'.$label2 : '').'</div>';
|
|
|
|
|
|
// Add type of canvas
|
|
|
$linkstart .= (!empty($this->canvas) ? '&canvas='.$this->canvas : '');
|
|
@@ -2788,7 +2843,7 @@ class Societe extends CommonObject
|
|
|
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
|
|
|
}
|
|
|
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
|
|
|
- $linkclose .= ' class="classfortooltip refurl valignmiddle"';
|
|
|
+ $linkclose .= $dataparams.' class="'.$classfortooltip.' refurl valignmiddle"';
|
|
|
$target_value = array('_self', '_blank', '_parent', '_top');
|
|
|
if (in_array($target, $target_value)) {
|
|
|
$linkclose .= ' target="'.dol_escape_htmltag($target).'"';
|
|
@@ -2807,7 +2862,7 @@ class Societe extends CommonObject
|
|
|
|
|
|
$result .= $linkstart;
|
|
|
if ($withpicto) {
|
|
|
- $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
|
|
|
+ $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1);
|
|
|
}
|
|
|
if ($withpicto != 2) {
|
|
|
$result .= dol_escape_htmltag($maxlen ? dol_trunc($name, $maxlen) : $name);
|