From fddff4d1ca98bae787725681580e7db00ffff0f8 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Wed, 27 Oct 2021 15:59:27 +0200 Subject: [PATCH 1/3] TakePOS hooks improvements --- htdocs/takepos/index.php | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 2c4da0515f1..dede65df2d6 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -1121,15 +1121,26 @@ if ($resql) { } $hookmanager->initHooks(array('takeposfrontend')); -$reshook = $hookmanager->executeHooks('ActionButtons'); -if (!empty($reshook)) { - if (is_array($reshook) && !isset($reshook['title'])) { - foreach ($reshook as $reshook) { - $menus[$r++] = $reshook; - } - } else { - $menus[$r++] = $reshook; - } +$parameters = array('menus'=>$menus); +$reshook = $hookmanager->executeHooks('ActionButtons',$parameters); +if ($reshook == 0) { //add buttons + if (is_array($hookmanager->resArray) ) { + foreach ($hookmanager->resArray as $resArray) { + foreach ($resArray as $butmenu) { + $menus[$r++] = $butmenu; + } + } + } + elseif ($reshook == 1){ + $r = 0; //replace buttons + if (is_array($hookmanager->resArray) ) { + foreach ($hookmanager->resArray as $resArray) { + foreach ($resArray as $butmenu) { + $menus[$r++] = $butmenu; + } + } + } + } } if ($r % 3 == 2) { From b81d826f8824280ee63ffb500ea8559fc92c0950 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Wed, 27 Oct 2021 17:00:46 +0200 Subject: [PATCH 2/3] Fix travis --- htdocs/takepos/index.php | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index dede65df2d6..8f93dfca0bb 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -1122,25 +1122,25 @@ if ($resql) { $hookmanager->initHooks(array('takeposfrontend')); $parameters = array('menus'=>$menus); -$reshook = $hookmanager->executeHooks('ActionButtons',$parameters); +$reshook = $hookmanager->executeHooks('ActionButtons', $parameters); if ($reshook == 0) { //add buttons - if (is_array($hookmanager->resArray) ) { - foreach ($hookmanager->resArray as $resArray) { - foreach ($resArray as $butmenu) { - $menus[$r++] = $butmenu; - } - } - } - elseif ($reshook == 1){ - $r = 0; //replace buttons - if (is_array($hookmanager->resArray) ) { - foreach ($hookmanager->resArray as $resArray) { - foreach ($resArray as $butmenu) { - $menus[$r++] = $butmenu; - } - } - } - } + if (is_array($hookmanager->resArray) ) { + foreach ($hookmanager->resArray as $resArray) { + foreach ($resArray as $butmenu) { + $menus[$r++] = $butmenu; + } + } + } + elseif ($reshook == 1) { + $r = 0; //replace buttons + if (is_array($hookmanager->resArray) ) { + foreach ($hookmanager->resArray as $resArray) { + foreach ($resArray as $butmenu) { + $menus[$r++] = $butmenu; + } + } + } + } } if ($r % 3 == 2) { From 9cd6e7ac75f64c7cfd0daecf82dde23c333b5fda Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Wed, 27 Oct 2021 17:44:07 +0200 Subject: [PATCH 3/3] Fix travis --- htdocs/takepos/index.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 8f93dfca0bb..8271103cfb6 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -1130,8 +1130,7 @@ if ($reshook == 0) { //add buttons $menus[$r++] = $butmenu; } } - } - elseif ($reshook == 1) { + } elseif ($reshook == 1) { $r = 0; //replace buttons if (is_array($hookmanager->resArray) ) { foreach ($hookmanager->resArray as $resArray) {