new: add hook for displayMarginInfos
This commit is contained in:
parent
9b9b63c794
commit
d48df1d2c3
@ -201,7 +201,7 @@ class FormMargin
|
|||||||
*/
|
*/
|
||||||
public function displayMarginInfos($object, $force_price = false)
|
public function displayMarginInfos($object, $force_price = false)
|
||||||
{
|
{
|
||||||
global $langs, $conf, $user;
|
global $langs, $conf, $user, $hookmanager;
|
||||||
|
|
||||||
if (!empty($user->socid)) {
|
if (!empty($user->socid)) {
|
||||||
return;
|
return;
|
||||||
@ -213,6 +213,11 @@ class FormMargin
|
|||||||
|
|
||||||
$marginInfo = $this->getMarginInfosArray($object, $force_price);
|
$marginInfo = $this->getMarginInfosArray($object, $force_price);
|
||||||
|
|
||||||
|
$parameters=array('marginInfo'=>$marginInfo);
|
||||||
|
$reshook = $hookmanager->executeHooks('displayMarginInfos', $parameters, $object, $action);
|
||||||
|
if ($reshook < 0) {
|
||||||
|
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
} elseif (empty($reshook)) {
|
||||||
if (!empty($conf->global->MARGIN_ADD_SHOWHIDE_BUTTON)) { // TODO Warning this feature rely on an external js file that may be removed. Using native js function document.cookie should be better
|
if (!empty($conf->global->MARGIN_ADD_SHOWHIDE_BUTTON)) { // TODO Warning this feature rely on an external js file that may be removed. Using native js function document.cookie should be better
|
||||||
print $langs->trans('ShowMarginInfos') . ' : ';
|
print $langs->trans('ShowMarginInfos') . ' : ';
|
||||||
$hidemargininfos = preg_replace('/[^a-zA-Z0-9_\-]/', '', $_COOKIE['DOLUSER_MARGININFO_HIDE_SHOW']); // Clean cookie
|
$hidemargininfos = preg_replace('/[^a-zA-Z0-9_\-]/', '', $_COOKIE['DOLUSER_MARGININFO_HIDE_SHOW']); // Clean cookie
|
||||||
@ -294,7 +299,11 @@ class FormMargin
|
|||||||
}
|
}
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
print $hookmanager->resPrint;
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
} elseif ($reshook > 0) {
|
||||||
|
print $hookmanager->resPrint;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user