From 828da5f83cd297437a60b0d3f88d29c5c87d2214 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 8 Jan 2023 15:33:12 +0100 Subject: [PATCH] Fix php 8 errors --- htdocs/margin/agentMargins.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index f89cc60736d..e68576edd81 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -49,6 +49,11 @@ $pagenext = $page + 1; if (!$sortorder) { $sortorder = "ASC"; } +if ($user->rights->margins->read->all) { + $agentid = GETPOST('agentid', 'int'); +} else { + $agentid = $user->id; +} if (!$sortfield) { if ($agentid > 0) { $sortfield = "s.nom"; @@ -74,11 +79,6 @@ if (!empty($enddatemonth)) { } // Security check -if ($user->rights->margins->read->all) { - $agentid = GETPOST('agentid', 'int'); -} else { - $agentid = $user->id; -} $result = restrictedArea($user, 'margins'); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context @@ -317,7 +317,8 @@ if ($result) { $sortfield = 'name'; } $group_list = dol_sort_array($group_list, $sortfield, $sortorder); - + $cumul_achat = 0; + $cumul_vente = 0; foreach ($group_list as $group_id => $group_array) { $pa = $group_array['buying_price']; $pv = $group_array['selling_price'];