clean code
This commit is contained in:
parent
1b9f8d46b0
commit
dc15349e83
@ -1121,24 +1121,20 @@ class BOM extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
$result = '';
|
$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).' <u class="paddingrightonly">'.$langs->trans("BillOfMaterials").'</u>';
|
$label = implode($this->getTooltipContentArray($params));
|
||||||
if (isset($this->status)) {
|
|
||||||
$label .= ' '.$this->getLibStatut(5);
|
|
||||||
}
|
|
||||||
$label .= '<br>';
|
|
||||||
$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
|
|
||||||
if (isset($this->label)) {
|
|
||||||
$label .= '<br><b>'.$langs->trans('Label').':</b> '.$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 .= "<br><b>".$langs->trans("Product").'</b>: '.$product->ref.' - '.$product->label;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$url = DOL_URL_ROOT.'/bom/bom_card.php?id='.$this->id;
|
$url = DOL_URL_ROOT.'/bom/bom_card.php?id='.$this->id;
|
||||||
@ -1155,18 +1151,6 @@ class BOM extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
$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)) {
|
||||||
$label = $langs->trans("ShowBillOfMaterials");
|
$label = $langs->trans("ShowBillOfMaterials");
|
||||||
|
|||||||
@ -1605,7 +1605,7 @@ class Categorie extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function getTooltipContentArray($params)
|
public function getTooltipContentArray($params)
|
||||||
{
|
{
|
||||||
global $conf, $langs, $user;
|
global $langs;
|
||||||
|
|
||||||
$datas = [];
|
$datas = [];
|
||||||
|
|
||||||
@ -1629,7 +1629,19 @@ class Categorie extends CommonObject
|
|||||||
global $langs, $hookmanager;
|
global $langs, $hookmanager;
|
||||||
|
|
||||||
$result = '';
|
$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
|
// Check contrast with background and correct text color
|
||||||
$forced_color = 'categtextwhite';
|
$forced_color = 'categtextwhite';
|
||||||
@ -1638,18 +1650,6 @@ class Categorie extends CommonObject
|
|||||||
$forced_color = 'categtextblack';
|
$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 = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$this->id.'&type='.$this->type.$moreparam.'&backtopage='.urlencode($_SERVER['PHP_SELF'].($moreparam ? '?'.$moreparam : ''));
|
$link = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$this->id.'&type='.$this->type.$moreparam.'&backtopage='.urlencode($_SERVER['PHP_SELF'].($moreparam ? '?'.$moreparam : ''));
|
||||||
$link .= '"'.$dataparams.' title="'.dol_escape_htmltag($label, 1).'" class="'.$classfortooltip.' '.$forced_color.'">';
|
$link .= '"'.$dataparams.' title="'.dol_escape_htmltag($label, 1).'" class="'.$classfortooltip.' '.$forced_color.'">';
|
||||||
$linkend = '</a>';
|
$linkend = '</a>';
|
||||||
|
|||||||
@ -133,6 +133,11 @@ class Contact extends CommonObject
|
|||||||
public $civility_code;
|
public $civility_code;
|
||||||
public $civility;
|
public $civility;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string gender
|
||||||
|
*/
|
||||||
|
public $gender;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int egroupware_id
|
* @var int egroupware_id
|
||||||
*/
|
*/
|
||||||
@ -193,6 +198,11 @@ class Contact extends CommonObject
|
|||||||
public $socid; // both socid and fk_soc are used
|
public $socid; // both socid and fk_soc are used
|
||||||
public $fk_soc; // 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
|
* @var int 0=inactive, 1=active
|
||||||
*/
|
*/
|
||||||
@ -206,6 +216,14 @@ class Contact extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $email;
|
public $email;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Email
|
||||||
|
* @var string
|
||||||
|
* @deprecated
|
||||||
|
* @see $email
|
||||||
|
*/
|
||||||
|
public $mail;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URL
|
* URL
|
||||||
* @var string
|
* @var string
|
||||||
@ -1468,35 +1486,19 @@ class Contact extends CommonObject
|
|||||||
global $conf, $langs, $hookmanager;
|
global $conf, $langs, $hookmanager;
|
||||||
|
|
||||||
$result = '';
|
$result = '';
|
||||||
$label = '';
|
$params = [
|
||||||
if (!empty($this->photo) && class_exists('Form')) {
|
'id' => $this->id,
|
||||||
$label .= '<div class="photointooltip floatright">';
|
'objecttype' => $this->element,
|
||||||
$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.
|
'option' => $option,
|
||||||
$label .= '</div>';
|
];
|
||||||
//$label .= '<div style="clear: both;"></div>';
|
$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));
|
||||||
$label .= img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("Contact").'</u>';
|
|
||||||
$label .= ' '.$this->getLibStatut(4);
|
|
||||||
$label .= '<br><b>'.$langs->trans("Name").':</b> '.$this->getFullName($langs);
|
|
||||||
//if ($this->civility_id) $label.= '<br><b>' . $langs->trans("Civility") . ':</b> '.$this->civility_id; // TODO Translate cibilty_id code
|
|
||||||
if (!empty($this->poste)) {
|
|
||||||
$label .= '<br><b>'.$langs->trans("Poste").':</b> '.$this->poste;
|
|
||||||
}
|
|
||||||
$label .= '<br><b>'.$langs->trans("EMail").':</b> '.$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 .= '<br><b>'.$langs->trans("Phone").':</b> '.implode(' ', $phonelist);
|
|
||||||
$label .= '<br><b>'.$langs->trans("Address").':</b> '.dol_format_address($this, 1, ' ', $langs);
|
|
||||||
|
|
||||||
$url = DOL_URL_ROOT.'/contact/card.php?id='.$this->id;
|
$url = DOL_URL_ROOT.'/contact/card.php?id='.$this->id;
|
||||||
|
|
||||||
@ -1514,18 +1516,6 @@ class Contact extends CommonObject
|
|||||||
$url .= $moreparam;
|
$url .= $moreparam;
|
||||||
|
|
||||||
$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)) {
|
||||||
$label = $langs->trans("ShowContact");
|
$label = $langs->trans("ShowContact");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user