From 45d36d91343179d78f6b3ebbbd623f5400075f30 Mon Sep 17 00:00:00 2001 From: EpixFr Date: Wed, 7 Jul 2021 17:32:48 +0200 Subject: [PATCH 1/4] Ajout export compta iSuite Expert --- .../class/accountancyexport.class.php | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index f007208cf57..f1b76c2030b 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -59,6 +59,7 @@ class AccountancyExport public static $EXPORT_TYPE_LDCOMPTA10 = 120; public static $EXPORT_TYPE_GESTIMUMV3 = 130; public static $EXPORT_TYPE_GESTIMUMV5 = 135; + public static $EXPORT_TYPE_ISUITEEXPERT = 990; public static $EXPORT_TYPE_FEC = 1000; public static $EXPORT_TYPE_FEC2 = 1010; @@ -123,6 +124,7 @@ class AccountancyExport self::$EXPORT_TYPE_GESTIMUMV5 => $langs->trans('Modelcsv_Gestinum_v5'), self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'), self::$EXPORT_TYPE_FEC2 => $langs->trans('Modelcsv_FEC2'), + self::$EXPORT_TYPE_ISUITEEXPERT => 'Export iSuite Expert', ); ksort($listofexporttypes, SORT_NUMERIC); @@ -158,6 +160,7 @@ class AccountancyExport self::$EXPORT_TYPE_GESTIMUMV5 => 'gestimumv5', self::$EXPORT_TYPE_FEC => 'fec', self::$EXPORT_TYPE_FEC2 => 'fec2', + self::$EXPORT_TYPE_ISUITEEXPERT => 'isuiteexpert', ); return $formatcode[$type]; @@ -243,6 +246,10 @@ class AccountancyExport 'label' => $langs->trans('Modelcsv_FEC2'), 'ACCOUNTING_EXPORT_FORMAT' => 'txt', ), + self::$EXPORT_TYPE_ISUITEEXPERT => array( + 'label' => 'iSuite Expert', + 'ACCOUNTING_EXPORT_FORMAT' => 'csv', + ), ), 'cr'=> array( '1' => $langs->trans("Unix"), @@ -334,6 +341,9 @@ class AccountancyExport case self::$EXPORT_TYPE_FEC2: $this->exportFEC2($TData); break; + case self::$EXPORT_TYPE_ISUITEEXPERT : + $this->exportiSuiteExpert($TData); + break; default: $this->errors[] = $langs->trans('accountancy_error_modelnotfound'); break; @@ -1752,6 +1762,53 @@ class AccountancyExport } } + /** + * Export format : iSuite Expert + * + * by OpenSolus [https://opensolus.fr] + * + * @param array $objectLines data + * + * @return void + */ + public function exportiSuiteExpert($objectLines) + { + $this->separator = ';'; + $this->end_line = "\r\n"; + + + foreach ($objectLines as $line) { + $tab = array(); + + $date = dol_print_date($line->doc_date, '%d/%m/%Y'); + + $tab[] = $line->piece_num; + $tab[] = $date; + $tab[] = substr($date,6,4); + $tab[] = substr($date,3,2); + $tab[] = substr($date,0,2); + $tab[] = $line->doc_ref; + //Conversion de chaine UTF8 en Latin9 + $tab[] = mb_convert_encoding(str_replace(' - Compte auxiliaire','',$line->label_operation),"Windows-1252",'UTF-8'); + + //Création des comptes auxiliaire des clients + if (length_accountg($line->numero_compte)=='4110000') { + $tab[] = rtrim(length_accounta($line->subledger_account),"0"); + } else { + $tab[] = length_accountg($line->numero_compte); + } + $nom_client = explode(" - ",$line->label_operation); + $tab[] = mb_convert_encoding($nom_client[0],"Windows-1252",'UTF-8'); + $tab[] = price($line->debit); + $tab[] = price($line->credit); + $tab[] = price($line->montant); + $tab[] = $line->code_journal; + + $separator = $this->separator; + print implode($separator, $tab) . $this->end_line; + } + } + /** * trunc * From edfd40719b99d95a3ed9f1cadcac815b9f272a77 Mon Sep 17 00:00:00 2001 From: EpixFr Date: Wed, 7 Jul 2021 17:53:10 +0200 Subject: [PATCH 2/4] Gestion des longueurs des comptes variables --- htdocs/accountancy/class/accountancyexport.class.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index f1b76c2030b..c184ccd901a 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -1791,8 +1791,17 @@ class AccountancyExport //Conversion de chaine UTF8 en Latin9 $tab[] = mb_convert_encoding(str_replace(' - Compte auxiliaire','',$line->label_operation),"Windows-1252",'UTF-8'); + //Calcul de la longueur des numéros de comptes + $taille_numero = strlen(length_accountg($line->numero_compte)); + + //Création du numéro de client générique + $numero_cpt_client = '411'; + for ($i = 1; $i <= ($taille_numero - 3); $i++){ + $numero_cpt_client .= '0'; + } + //Création des comptes auxiliaire des clients - if (length_accountg($line->numero_compte)=='4110000') { + if (length_accountg($line->numero_compte) == $numero_cpt_client) { $tab[] = rtrim(length_accounta($line->subledger_account),"0"); } else { $tab[] = length_accountg($line->numero_compte); From 335c3029dc344a4a5c45b1580c244b6fc1aecf79 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 7 Jul 2021 15:55:07 +0000 Subject: [PATCH 3/4] Fixing style errors. --- .../class/accountancyexport.class.php | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index c184ccd901a..a35daa5a888 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -1765,7 +1765,7 @@ class AccountancyExport /** * Export format : iSuite Expert * - * by OpenSolus [https://opensolus.fr] + * by OpenSolus [https://opensolus.fr] * * @param array $objectLines data * @@ -1774,8 +1774,8 @@ class AccountancyExport public function exportiSuiteExpert($objectLines) { $this->separator = ';'; - $this->end_line = "\r\n"; - + $this->end_line = "\r\n"; + foreach ($objectLines as $line) { $tab = array(); @@ -1784,30 +1784,30 @@ class AccountancyExport $tab[] = $line->piece_num; $tab[] = $date; - $tab[] = substr($date,6,4); - $tab[] = substr($date,3,2); - $tab[] = substr($date,0,2); + $tab[] = substr($date, 6, 4); + $tab[] = substr($date, 3, 2); + $tab[] = substr($date, 0, 2); $tab[] = $line->doc_ref; //Conversion de chaine UTF8 en Latin9 - $tab[] = mb_convert_encoding(str_replace(' - Compte auxiliaire','',$line->label_operation),"Windows-1252",'UTF-8'); + $tab[] = mb_convert_encoding(str_replace(' - Compte auxiliaire', '', $line->label_operation), "Windows-1252", 'UTF-8'); //Calcul de la longueur des numéros de comptes $taille_numero = strlen(length_accountg($line->numero_compte)); //Création du numéro de client générique $numero_cpt_client = '411'; - for ($i = 1; $i <= ($taille_numero - 3); $i++){ + for ($i = 1; $i <= ($taille_numero - 3); $i++) { $numero_cpt_client .= '0'; } //Création des comptes auxiliaire des clients - if (length_accountg($line->numero_compte) == $numero_cpt_client) { - $tab[] = rtrim(length_accounta($line->subledger_account),"0"); + if (length_accountg($line->numero_compte) == $numero_cpt_client) { + $tab[] = rtrim(length_accounta($line->subledger_account), "0"); } else { $tab[] = length_accountg($line->numero_compte); } - $nom_client = explode(" - ",$line->label_operation); - $tab[] = mb_convert_encoding($nom_client[0],"Windows-1252",'UTF-8'); + $nom_client = explode(" - ", $line->label_operation); + $tab[] = mb_convert_encoding($nom_client[0], "Windows-1252", 'UTF-8'); $tab[] = price($line->debit); $tab[] = price($line->credit); $tab[] = price($line->montant); From fe20217bfea0b1c1fd364e08535cb969123e8416 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 8 Jul 2021 16:36:53 +0200 Subject: [PATCH 4/4] Update accountancyexport.class.php --- htdocs/accountancy/class/accountancyexport.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index a35daa5a888..0bd60445613 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -59,7 +59,8 @@ class AccountancyExport public static $EXPORT_TYPE_LDCOMPTA10 = 120; public static $EXPORT_TYPE_GESTIMUMV3 = 130; public static $EXPORT_TYPE_GESTIMUMV5 = 135; - public static $EXPORT_TYPE_ISUITEEXPERT = 990; + public static $EXPORT_TYPE_ISUITEEXPERT = 200; + // Generic FEC after that public static $EXPORT_TYPE_FEC = 1000; public static $EXPORT_TYPE_FEC2 = 1010;