From beadb19fea2844c9e5e55c0c227237514d5c7688 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Mon, 8 Aug 2016 15:31:06 +0200 Subject: [PATCH] fix list --- htdocs/accountancy/customer/index.php | 10 +++------- htdocs/accountancy/customer/list.php | 2 +- htdocs/accountancy/supplier/index.php | 12 +++--------- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 9a4b1d2e2f0..4df2c68243a 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -196,11 +196,10 @@ $sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label"; dol_syslog("htdocs/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG); $resql = $db->query($sql); if ($resql) { - $i = 0; $num = $db->num_rows($resql); - while ( $i < $num ) { - $row = $db->fetch_row($resql); + while ( $row = $db->fetch_row($resql)) { + $var = ! $var; print '' . length_accountg($row[0]) . ''; print '' . $row[1] . ''; @@ -210,7 +209,6 @@ if ($resql) { print '' . price($row[13]) . ''; print '' . price($row[14]) . ''; print ''; - $i ++; } $db->free($resql); } else { @@ -246,9 +244,7 @@ if ($resql) { $i = 0; $num = $db->num_rows($resql); - while ( $i < $num ) { - $row = $db->fetch_row($resql); - + while ($row = $db->fetch_row($resql)) { print '' . $row[0] . ''; for($i = 1; $i <= 12; $i ++) { print '' . price($row[$i]) . ''; diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index db73fe7e947..0c1a4d1eb6b 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -185,7 +185,7 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_sell = aa.account_number"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version"; $sql .= " WHERE f.fk_statut > 0"; -$sql .= " AND fk_code_ventilation <= 0"; +$sql .= " AND l.fk_code_ventilation <= 0"; $sql .= " AND product_type <= 2"; $sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_sell ='')"; diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index bbef2a6dcc0..9dd5bd1e1d7 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -181,12 +181,10 @@ $sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label"; dol_syslog('/accountancy/supplier/index.php:: sql=' . $sql); $resql = $db->query($sql); if ($resql) { - $i = 0; $num = $db->num_rows($resql); - while ( $i < $num ) { + while ( $row = $db->fetch_row($resql)) { - $row = $db->fetch_row($resql); $var = ! $var; print '' . length_accountg($row[0]) . ''; print '' . $row[1] . ''; @@ -196,7 +194,6 @@ if ($resql) { print '' . price($row[13]) . ''; print '' . price($row[14]) . ''; print ''; - $i ++; } $db->free($resql); } else { @@ -230,11 +227,10 @@ if (! empty($conf->multicompany->enabled)) { dol_syslog('/accountancy/supplier/index.php:: sql=' . $sql); $resql = $db->query($sql); if ($resql) { - $i = 0; $num = $db->num_rows($resql); - while ( $i < $num ) { - $row = $db->fetch_row($resql); + while ( $row = $db->fetch_row($resql)) { + print '' . $row[0] . ''; for($i = 1; $i <= 12; $i ++) { @@ -242,8 +238,6 @@ if ($resql) { } print '' . price($row[13]) . ''; print ''; - - $i ++; } $db->free($resql);