From cdcf76261d5f469229a56d800501e9a21f4fb9cb Mon Sep 17 00:00:00 2001 From: Charles Delachapelle Evarisk Date: Thu, 29 Aug 2024 15:28:06 +0200 Subject: [PATCH] #36 [Hook] fix: function not available in v18 dolibarr --- class/actions_priseo.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/class/actions_priseo.class.php b/class/actions_priseo.class.php index 1d53ec5..458e7e4 100644 --- a/class/actions_priseo.class.php +++ b/class/actions_priseo.class.php @@ -126,8 +126,10 @@ public function completeTabsHead(array $parameters): int require_once __DIR__ . '/competitorprice.class.php'; $competitorPrice = new CompetitorPrice($this->db); - $competitorPrices = $competitorPrice->getCountOfItemsLinkedByObjectID($parameters['object']->id, 'status >= 0 AND fk_product', $competitorPrice->table_element); - $parameters['head'][$headKey][1] .= '' . (max($competitorPrices, 0)) . ''; + $competitorPrices = $competitorPrice->fetchAll('', '', 0, 0, ['customsql' => 't.status >= 0 AND t.fk_product = ' . $parameters['object']->id]); + if (is_array($competitorPrices) && !empty($competitorPrices)) { + $parameters['head'][$headKey][1] .= '' . count($competitorPrices) . ''; + } } } }