diff --git a/htdocs/core/class/html.formmargin.class.php b/htdocs/core/class/html.formmargin.class.php index e2e32669595..fdc36ef21c3 100644 --- a/htdocs/core/class/html.formmargin.class.php +++ b/htdocs/core/class/html.formmargin.class.php @@ -211,7 +211,7 @@ class FormMargin */ public function displayMarginInfos($object, $force_price = false) { - global $langs, $conf, $user, $hookmanager; + global $langs, $user, $hookmanager; global $action; if (!empty($user->socid)) { @@ -224,50 +224,53 @@ class FormMargin $marginInfo = $this->getMarginInfosArray($object, $force_price); + print '' . "\n"; + $parameters = array('marginInfo' => &$marginInfo); $reshook = $hookmanager->executeHooks('displayMarginInfos', $parameters, $object, $action); if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } elseif (empty($reshook)) { - if (getDolGlobalString('MARGIN_ADD_SHOWHIDE_BUTTON')) { - print $langs->trans('ShowMarginInfos') . ' '; - $hidemargininfos = preg_replace('/[^a-zA-Z0-9_\-]/', '', $_COOKIE['DOLUSER_MARGININFO_HIDE_SHOW']) ?? ''; // Clean cookie - print '' . img_picto($langs->trans("Disabled"), 'switch_off') . ''; - print '' . img_picto($langs->trans("Enabled"), 'switch_on') . ''; + $hidemargininfos = preg_replace('/[^a-zA-Z0-9_\-]/', '', $_COOKIE['DOLUSER_MARGININFO_HIDE_SHOW']) ?? ''; // Clean cookie - print ''; + $buttonToShowHideMargin = ''; + $buttonToShowHideMargin .= img_picto($langs->trans("ShowMarginInfos"), 'switch_off', '', 0, 0, 0, '', 'size15x'); + $buttonToShowHideMargin .= ''; + $buttonToShowHideMargin .= ''; + $buttonToShowHideMargin .= img_picto($langs->trans("Hide"), 'switch_on_grey', '', 0, 0, 0, '', 'size15x opacitymedium'); + $buttonToShowHideMargin .= ''; + + $buttonToShowHideMargin .= ''; - print '' . "\n"; print '
'; print ''; print ''; - print ''; - print ''; + print ''; + print ''; if (getDolGlobalString('MARGIN_TYPE') == "1") { - print ''; + print ''; } else { - print ''; + print ''; } - print ''; + print ''; if (getDolGlobalString('DISPLAY_MARGIN_RATES')) { - print ''; + print ''; } if (getDolGlobalString('DISPLAY_MARK_RATES')) { - print ''; + print ''; } print ''; if (isModEnabled("product")) { //if ($marginInfo['margin_on_products'] != 0 && $marginInfo['margin_on_services'] != 0) { - print ''; + print ''; print ''; print ''; print ''; @@ -282,7 +285,7 @@ class FormMargin } if (isModEnabled("service")) { - print ''; + print ''; print ''; print ''; print ''; @@ -297,7 +300,7 @@ class FormMargin } if (isModEnabled("product") && isModEnabled("service")) { - print ''; + print ''; print ''; print ''; print ''; @@ -310,7 +313,7 @@ class FormMargin } print ''; } - print $hookmanager->resPrint; + print $hookmanager->resPrint; print '
' . $langs->trans('Margins') . '' . $langs->trans('SellingPrice') . '' . $langs->trans('Margins') . ' ' . $buttonToShowHideMargin . '' . $langs->trans('SellingPrice') . '' . $langs->trans('BuyingPrice') . '' . $langs->trans('BuyingPrice') . '' . $langs->trans('CostPrice') . '' . $langs->trans('CostPrice') . '' . $langs->trans('Margin') . '' . $langs->trans('Margin') . '' . $langs->trans('MarginRate') . '' . $langs->trans('MarginRate') . '' . $langs->trans('MarkRate') . '' . $langs->trans('MarkRate') . '
' . $langs->trans('MarginOnProducts') . '' . price($marginInfo['pv_products']) . '' . price($marginInfo['pa_products']) . '
' . $langs->trans('MarginOnServices') . '' . price($marginInfo['pv_services']) . '' . price($marginInfo['pa_services']) . '
' . $langs->trans('TotalMargin') . '' . price($marginInfo['pv_total']) . '' . price($marginInfo['pa_total']) . '
'; print '
'; } elseif ($reshook > 0) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9f6f53be514..37cc17e74fa 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5045,7 +5045,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0, $srco 'off', 'on', 'order', 'paiment', 'paragraph', 'play', 'pdf', 'phone', 'phoning', 'phoning_mobile', 'phoning_fax', 'playdisabled', 'previous', 'poll', 'pos', 'printer', 'product', 'propal', 'proposal', 'puce', 'stock', 'resize', 'service', 'stats', - 'security', 'setup', 'share-alt', 'sign-out', 'split', 'stripe', 'stripe-s', 'switch_off', 'switch_on', 'switch_on_warning', 'switch_on_red', 'tools', 'unlink', 'uparrow', 'user', 'user-tie', 'vcard', 'wrench', + 'security', 'setup', 'share-alt', 'sign-out', 'split', 'stripe', 'stripe-s', 'switch_off', 'switch_on', 'switch_on_grey', 'switch_on_warning', 'switch_on_red', 'tools', 'unlink', 'uparrow', 'user', 'user-tie', 'vcard', 'wrench', 'github', 'google', 'jabber', 'microsoft', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp', 'generic', 'home', 'hrm', 'members', 'products', 'invoicing', 'partnership', 'payment', 'payment_vat', 'pencil-ruler', 'pictoconfirm', 'preview', 'project', 'projectpub', 'projecttask', 'question', 'refresh', 'region', @@ -5094,7 +5094,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0, $srco 'member' => 'user-alt', 'meeting' => 'chalkboard-teacher', 'mrp' => 'cubes', 'next' => 'arrow-alt-circle-right', 'trip' => 'wallet', 'expensereport' => 'wallet', 'group' => 'users', 'movement' => 'people-carry', 'sign-out' => 'sign-out-alt', - 'switch_off' => 'toggle-off', 'switch_on' => 'toggle-on', 'switch_on_warning' => 'toggle-on', 'switch_on_red' => 'toggle-on', 'check' => 'check', 'bookmark' => 'star', + 'switch_off' => 'toggle-off', 'switch_on' => 'toggle-on', 'switch_on_grey' => 'toggle-on', 'switch_on_warning' => 'toggle-on', 'switch_on_red' => 'toggle-on', 'check' => 'check', 'bookmark' => 'star', 'bank' => 'university', 'close_title' => 'times', 'delete' => 'trash', 'filter' => 'filter', 'list-alt' => 'list-alt', 'calendarlist' => 'bars', 'calendar' => 'calendar-alt', 'calendarmonth' => 'calendar-alt', 'calendarweek' => 'calendar-week', 'calendarday' => 'calendar-day', 'calendarperuser' => 'table', 'intervention' => 'ambulance', 'invoice' => 'file-invoice-dollar', 'order' => 'file-invoice', @@ -5165,7 +5165,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0, $srco // Define $marginleftonlyshort $arrayconvpictotomarginleftonly = array( 'bank', 'check', 'delete', 'generic', 'grip', 'grip_title', 'jabber', - 'grip_title', 'grip', 'listlight', 'note', 'on', 'off', 'playdisabled', 'printer', 'resize', 'sign-out', 'stats', 'switch_on', 'switch_on_red', 'switch_off', + 'grip_title', 'grip', 'listlight', 'note', 'on', 'off', 'playdisabled', 'printer', 'resize', 'sign-out', 'stats', 'switch_on', 'switch_on_grey', 'switch_on_red', 'switch_off', 'uparrow', '1uparrow', '1downarrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected' ); if (!array_key_exists($pictowithouttext, $arrayconvpictotomarginleftonly)) {