From 400c31def6d2615e80d7109089e6864a5a5986cf Mon Sep 17 00:00:00 2001 From: pat Date: Wed, 17 Dec 2025 10:40:31 +0100 Subject: [PATCH] FIX : action button panel display (partial) - simplify function which simulates navigating to the next/previous panel - call the hook only after all original buttons have been added - Remove button hiding at positions %3 == 2 depending on Dolibarr configuration --- htdocs/takepos/index.php | 43 ++++++++++++++-------------------------- 1 file changed, 15 insertions(+), 28 deletions(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 90271271790..978df3ba093 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -998,23 +998,12 @@ function DolibarrOpenDrawer() { }); } -function MoreActions(totalactions){ - if (pageactions==0){ - pageactions=1; - for (i = 0; i <= totalactions; i++){ - if (i<12) $("#action"+i).hide(); - else $("#action"+i).show(); - } +function MoreActions(totalactions) { + for (i = 0; i <= totalactions; i++) { + $("#action" + i).toggle(); } - else if (pageactions==1){ - pageactions=0; - for (i = 0; i <= totalactions; i++){ - if (i<12) $("#action"+i).show(); - else $("#action"+i).hide(); - } - } - - return true; + $("#actionnext").toggle(); + $("#actionprevious").toggle(); } function ControlCashOpening() @@ -1483,6 +1472,14 @@ if ($resql) { } } +if (getDolGlobalString('TAKEPOS_HIDE_HEAD_BAR')) { + $menus[$r++] = array('title' => '
'.$langs->trans("Logout").'
', 'action' => 'window.location.href=\''.DOL_URL_ROOT.'/user/logout.php?token='.newToken().'\';'); +} + +if (getDolGlobalString('TAKEPOS_WEIGHING_SCALE')) { + $menus[$r++] = array('title' => '
'.$langs->trans("WeighingScale").'
', 'action' => 'WeighingScale();'); +} + $parameters = array('menus' => $menus); $reshook = $hookmanager->executeHooks('ActionButtons', $parameters); if ($reshook == 0) { //add buttons @@ -1504,18 +1501,6 @@ if ($reshook == 0) { //add buttons } } -if ($r % 3 == 2) { - $menus[$r++] = array('title' => '', 'style' => 'visibility: hidden;'); -} - -if (getDolGlobalString('TAKEPOS_HIDE_HEAD_BAR')) { - $menus[$r++] = array('title' => '
'.$langs->trans("Logout").'
', 'action' => 'window.location.href=\''.DOL_URL_ROOT.'/user/logout.php?token='.newToken().'\';'); -} - -if (getDolGlobalString('TAKEPOS_WEIGHING_SCALE')) { - $menus[$r++] = array('title' => '
'.$langs->trans("WeighingScale").'
', 'action' => 'WeighingScale();'); -} - ?>
@@ -1543,9 +1528,11 @@ if (getDolGlobalString('TAKEPOS_WEIGHING_SCALE')) { $i++; if (count($menus) > 12 and $i == 12) { echo ''; + echo ''; echo ''; } elseif ($i > 12) { echo ''; + // TODO keep style but hide button } else { echo ''; }