add ajax tooltip on productlot
This commit is contained in:
parent
a501ae8961
commit
661c82473e
@ -46,10 +46,18 @@ class MouvementStock extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $product_id;
|
public $product_id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int ID warehouse
|
||||||
|
* @deprecated
|
||||||
|
* @see $warehouse_id
|
||||||
|
*/
|
||||||
|
public $entrepot_id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int ID warehouse
|
* @var int ID warehouse
|
||||||
*/
|
*/
|
||||||
public $warehouse_id;
|
public $warehouse_id;
|
||||||
|
|
||||||
public $qty;
|
public $qty;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -541,7 +549,7 @@ class MouvementStock extends CommonObject
|
|||||||
} elseif (empty($fk_product_stock)) {
|
} elseif (empty($fk_product_stock)) {
|
||||||
$fk_product_stock = $this->db->last_insert_id($this->db->prefix()."product_stock");
|
$fk_product_stock = $this->db->last_insert_id($this->db->prefix()."product_stock");
|
||||||
}
|
}
|
||||||
}
|
}entrepot_id
|
||||||
|
|
||||||
// Update detail of stock for the lot.
|
// Update detail of stock for the lot.
|
||||||
if (!$error && isModEnabled('productbatch') && $product->hasbatch() && !$skip_batch) {
|
if (!$error && isModEnabled('productbatch') && $product->hasbatch() && !$skip_batch) {
|
||||||
|
|||||||
@ -585,6 +585,34 @@ class Productlot 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(['stocks', 'productbatch']);
|
||||||
|
|
||||||
|
$datas = [];
|
||||||
|
$option = $params['option'] ?? '';
|
||||||
|
$datas['picto'] = img_picto('', $this->picto).' <u>'.$langs->trans("Batch").'</u>';
|
||||||
|
$datas['divopen'] = '<div width="100%">';
|
||||||
|
$datas['batch'] = '<b>'.$langs->trans('Batch').':</b> '.$this->batch;
|
||||||
|
if ($this->eatby && empty($conf->global->PRODUCT_DISABLE_EATBY)) {
|
||||||
|
$datas['eatby'] = '<br><b>'.$langs->trans('EatByDate').':</b> '.dol_print_date($this->eatby, 'day');
|
||||||
|
}
|
||||||
|
if ($this->sellby && empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
|
||||||
|
$datas['sellby'] = '<br><b>'.$langs->trans('SellByDate').':</b> '.dol_print_date($this->sellby, 'day');
|
||||||
|
}
|
||||||
|
$datas['divclose'] = '</div>';
|
||||||
|
|
||||||
|
return $datas;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a link to the a lot card (with optionaly the picto)
|
* Return a link to the a lot card (with optionaly the picto)
|
||||||
* Use this->id,this->lastname, this->firstname
|
* Use this->id,this->lastname, this->firstname
|
||||||
@ -629,13 +657,25 @@ class Productlot 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("ShowMyObject");
|
$label = $langs->trans("ShowMyObject");
|
||||||
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||||
}
|
}
|
||||||
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||||
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
|
$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
|
||||||
} else {
|
} else {
|
||||||
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
|
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
|
||||||
}
|
}
|
||||||
@ -654,7 +694,7 @@ class Productlot extends CommonObject
|
|||||||
|
|
||||||
$result .= $linkstart;
|
$result .= $linkstart;
|
||||||
if ($withpicto) {
|
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) {
|
if ($withpicto != 2) {
|
||||||
$result .= $this->batch;
|
$result .= $this->batch;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user