diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 4420950af30..8746999e00b 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1121,24 +1121,20 @@ class BOM extends CommonObject } $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 = img_picto('', $this->picto).' '.$langs->trans("BillOfMaterials").''; - if (isset($this->status)) { - $label .= ' '.$this->getLibStatut(5); - } - $label .= '
'; - $label .= ''.$langs->trans('Ref').': '.$this->ref; - if (isset($this->label)) { - $label .= '
'.$langs->trans('Label').': '.$this->label; - } - if (!empty($this->fk_product) && $this->fk_product > 0) { - include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; - $product = new Product($db); - $resultFetch = $product->fetch($this->fk_product); - if ($resultFetch > 0) { - $label .= "
".$langs->trans("Product").': '.$product->ref.' - '.$product->label; - } - } + $label = implode($this->getTooltipContentArray($params)); $url = DOL_URL_ROOT.'/bom/bom_card.php?id='.$this->id; @@ -1155,18 +1151,6 @@ class BOM extends CommonObject } $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)) { $label = $langs->trans("ShowBillOfMaterials"); diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index f57bca581bd..592b0204983 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1605,7 +1605,7 @@ class Categorie extends CommonObject */ public function getTooltipContentArray($params) { - global $conf, $langs, $user; + global $langs; $datas = []; @@ -1629,7 +1629,19 @@ class Categorie extends CommonObject global $langs, $hookmanager; $result = ''; - $label = $langs->trans("ShowCategory").': '.($this->ref ? $this->ref : $this->label); + $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 = implode($this->getTooltipContentArray($params)); // Check contrast with background and correct text color $forced_color = 'categtextwhite'; @@ -1638,18 +1650,6 @@ class Categorie extends CommonObject $forced_color = 'categtextblack'; } } - $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'); - } $link = ''; $linkend = ''; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index d0e9a2200f3..b44d22da312 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -133,6 +133,11 @@ class Contact extends CommonObject public $civility_code; public $civility; + /** + * @var string gender + */ + public $gender; + /** * @var int egroupware_id */ @@ -193,6 +198,11 @@ class Contact extends CommonObject public $socid; // both socid and fk_soc are used public $fk_soc; // both socid and fk_soc are used + /** + * @var string thirdparty name + */ + public $socname; + /** * @var int 0=inactive, 1=active */ @@ -206,6 +216,14 @@ class Contact extends CommonObject */ public $email; + /** + * Email + * @var string + * @deprecated + * @see $email + */ + public $mail; + /** * URL * @var string @@ -1045,12 +1063,12 @@ class Contact extends CommonObject $this->country_id = $obj->country_id; $this->country_code = $obj->country_id ? $obj->country_code : ''; - $this->country = $obj->country_id ? ($langs->trans('Country'.$obj->country_code) != 'Country'.$obj->country_code ? $langs->transnoentities('Country'.$obj->country_code) : $obj->country) : ''; + $this->country = $obj->country_id ? ($langs->trans('Country'.$obj->country_code) != 'Country'.$obj->country_code ? $langs->transnoentities('Country'.$obj->country_code) : $obj->country) : ''; - $this->fk_soc = $obj->fk_soc; // Both fk_soc and socid are used - $this->socid = $obj->fk_soc; // Both fk_soc and socid are used - $this->socname = $obj->socname; - $this->poste = $obj->poste; + $this->fk_soc = $obj->fk_soc; // Both fk_soc and socid are used + $this->socid = $obj->fk_soc; // Both fk_soc and socid are used + $this->socname = $obj->socname; + $this->poste = $obj->poste; $this->statut = $obj->statut; $this->fk_prospectlevel = $obj->fk_prospectlevel; @@ -1066,22 +1084,22 @@ class Contact extends CommonObject $this->phone_perso = trim($obj->phone_perso); $this->phone_mobile = trim($obj->phone_mobile); - $this->email = $obj->email; + $this->email = $obj->email; $this->socialnetworks = ($obj->socialnetworks ? (array) json_decode($obj->socialnetworks, true) : array()); - $this->photo = $obj->photo; - $this->priv = $obj->priv; - $this->mail = $obj->email; + $this->photo = $obj->photo; + $this->priv = $obj->priv; + $this->mail = $obj->email; $this->birthday = $this->db->jdate($obj->birthday); - $this->note = $obj->note_private; // deprecated - $this->note_private = $obj->note_private; + $this->note = $obj->note_private; // deprecated + $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; - $this->default_lang = $obj->default_lang; + $this->default_lang = $obj->default_lang; $this->user_id = $obj->user_id; - $this->user_login = $obj->user_login; + $this->user_login = $obj->user_login; $this->canvas = $obj->canvas; - $this->import_key = $obj->import_key; + $this->import_key = $obj->import_key; // Define gender according to civility $this->setGenderFromCivility(); @@ -1468,35 +1486,19 @@ class Contact extends CommonObject global $conf, $langs, $hookmanager; $result = ''; - $label = ''; - if (!empty($this->photo) && class_exists('Form')) { - $label .= '
'; - $label .= Form::showphoto('contact', $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 .= '
'; - //$label .= '
'; + $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 .= img_picto('', $this->picto).' '.$langs->trans("Contact").''; - $label .= ' '.$this->getLibStatut(4); - $label .= '
'.$langs->trans("Name").': '.$this->getFullName($langs); - //if ($this->civility_id) $label.= '
' . $langs->trans("Civility") . ': '.$this->civility_id; // TODO Translate cibilty_id code - if (!empty($this->poste)) { - $label .= '
'.$langs->trans("Poste").': '.$this->poste; - } - $label .= '
'.$langs->trans("EMail").': '.$this->email; - $phonelist = array(); - $country_code = empty($this->country_code) ? '': $this->country_code; - if ($this->phone_pro) { - $phonelist[] = dol_print_phone($this->phone_pro, $country_code, $this->id, 0, '', ' ', 'phone'); - } - if ($this->phone_mobile) { - $phonelist[] = dol_print_phone($this->phone_mobile, $country_code, $this->id, 0, '', ' ', 'mobile'); - } - if ($this->phone_perso) { - $phonelist[] = dol_print_phone($this->phone_perso, $country_code, $this->id, 0, '', ' ', 'phone'); - } - $label .= '
'.$langs->trans("Phone").': '.implode(' ', $phonelist); - $label .= '
'.$langs->trans("Address").': '.dol_format_address($this, 1, ' ', $langs); + $label = implode($this->getTooltipContentArray($params)); $url = DOL_URL_ROOT.'/contact/card.php?id='.$this->id; @@ -1514,18 +1516,6 @@ class Contact extends CommonObject $url .= $moreparam; $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)) { $label = $langs->trans("ShowContact");