From abc94a397a1f48b00ffa88b42f5412ef42496a4e Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 15 Aug 2021 11:12:14 +0200 Subject: [PATCH 1/5] FIX #18389 Accountancy - Bug on LDcompta10 export for supplier invoice --- htdocs/accountancy/class/accountancyexport.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 28446c09d47..1bb597d7187 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -1296,7 +1296,9 @@ class AccountancyExport /** * Export format : LD Compta version 10 & higher - * http://www.ldsysteme.fr/fileadmin/telechargement/np/ldcompta/Documentation/IntCptW10.pdf + * Last review for this format : 08-15-2021 Alexandre Spangaro (aspangaro@open-dsi.fr) + * + * Help : http://www.ldsysteme.fr/fileadmin/telechargement/np/ldcompta/Documentation/IntCptW10.pdf * * @param array $objectLines data * @@ -1460,7 +1462,7 @@ class AccountancyExport print $date_lim_reglement.$separator; // CNPI if ($line->doc_type == 'supplier_invoice') { - if (($line->debit - $line->credit) > 0) { + if (($line->debit - $line->credit) < 0) { $nature_piece = 'AF'; } else { $nature_piece = 'FF'; From b8da594c31415272969d708eb070a46dd3675f50 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 16 Aug 2021 05:47:25 +0200 Subject: [PATCH 2/5] Better fix --- htdocs/accountancy/class/accountancyexport.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 1bb597d7187..b7419e4602f 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -1462,13 +1462,13 @@ class AccountancyExport print $date_lim_reglement.$separator; // CNPI if ($line->doc_type == 'supplier_invoice') { - if (($line->debit - $line->credit) < 0) { + if (($line->amount) < 0) { $nature_piece = 'AF'; } else { $nature_piece = 'FF'; } } elseif ($line->doc_type == 'customer_invoice') { - if (($line->debit - $line->credit) < 0) { + if (($line->amount) < 0) { $nature_piece = 'AC'; } else { $nature_piece = 'FC'; From 091166baa7ac05431244a7b0a63114ef63d50190 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Aug 2021 01:03:07 +0200 Subject: [PATCH 3/5] Update accountancyexport.class.php --- htdocs/accountancy/class/accountancyexport.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index b7419e4602f..f5ef8114e7b 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -1462,14 +1462,14 @@ class AccountancyExport print $date_lim_reglement.$separator; // CNPI if ($line->doc_type == 'supplier_invoice') { - if (($line->amount) < 0) { + if (($line->amount) < 0) { // Currently, only the sign of amount allows to know the type of invoice (warning: not reliable). TODO Add column doc_type_long $nature_piece = 'AF'; } else { $nature_piece = 'FF'; } } elseif ($line->doc_type == 'customer_invoice') { if (($line->amount) < 0) { - $nature_piece = 'AC'; + $nature_piece = 'AC'; // Currently, only the sign of amount allows to know the type of invoice (warning: not reliable). TODO Add column doc_type_long } else { $nature_piece = 'FC'; } From 9b43327af08bd0296625ce7c23049ab574efc200 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Aug 2021 01:06:26 +0200 Subject: [PATCH 4/5] Update accountancyexport.class.php --- htdocs/accountancy/class/accountancyexport.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index f5ef8114e7b..bad25217139 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -1462,14 +1462,14 @@ class AccountancyExport print $date_lim_reglement.$separator; // CNPI if ($line->doc_type == 'supplier_invoice') { - if (($line->amount) < 0) { // Currently, only the sign of amount allows to know the type of invoice (warning: not reliable). TODO Add column doc_type_long + if (($line->amount) < 0) { // Currently, only the sign of amount allows to know the type of invoice (standard or credit note). Other solution is to analyse debit/credit/role of account. TODO Add column doc_type_long $nature_piece = 'AF'; } else { $nature_piece = 'FF'; } } elseif ($line->doc_type == 'customer_invoice') { if (($line->amount) < 0) { - $nature_piece = 'AC'; // Currently, only the sign of amount allows to know the type of invoice (warning: not reliable). TODO Add column doc_type_long + $nature_piece = 'AC'; // Currently, only the sign of amount allows to know the type of invoice (standard or credit note). Other solution is to analyse debit/credit/role of account. TODO Add column doc_type_long } else { $nature_piece = 'FC'; } From 15020c99e773d45e08a32e1655476d84af10c9bf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Aug 2021 01:08:18 +0200 Subject: [PATCH 5/5] Update accountancyexport.class.php --- htdocs/accountancy/class/accountancyexport.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index bad25217139..0c698c5059c 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -1462,14 +1462,14 @@ class AccountancyExport print $date_lim_reglement.$separator; // CNPI if ($line->doc_type == 'supplier_invoice') { - if (($line->amount) < 0) { // Currently, only the sign of amount allows to know the type of invoice (standard or credit note). Other solution is to analyse debit/credit/role of account. TODO Add column doc_type_long + if (($line->amount) < 0) { // Currently, only the sign of amount allows to know the type of invoice (standard or credit note). Other solution is to analyse debit/credit/role of account. TODO Add column doc_type_long or make amount mandatory with rule on sign. $nature_piece = 'AF'; } else { $nature_piece = 'FF'; } } elseif ($line->doc_type == 'customer_invoice') { if (($line->amount) < 0) { - $nature_piece = 'AC'; // Currently, only the sign of amount allows to know the type of invoice (standard or credit note). Other solution is to analyse debit/credit/role of account. TODO Add column doc_type_long + $nature_piece = 'AC'; // Currently, only the sign of amount allows to know the type of invoice (standard or credit note). Other solution is to analyse debit/credit/role of account. TODO Add column doc_type_long or make amount mandatory with rule on sign. } else { $nature_piece = 'FC'; }