From ad62062cd533c5409a2e1846d4e8447c4dbc60eb Mon Sep 17 00:00:00 2001 From: jpb Date: Mon, 5 Jul 2021 08:55:03 +0200 Subject: [PATCH 01/10] add filter --- htdocs/commande/list.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 73413d1070f..3acae2f8180 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -494,7 +494,7 @@ if ($search_billed != '' && $search_billed >= 0) { $sql .= ' AND c.facture = '.((int) $search_billed); } if ($search_status <> '') { - if ($search_status < 4 && $search_status > -3) { + if ($search_status < 4 && $search_status > -4) { if ($search_status == 1 && empty($conf->expedition->enabled)) { $sql .= ' AND c.fk_statut IN (1,2)'; // If module expedition disabled, we include order with status 'sending in process' into 'validated' } else { @@ -513,6 +513,12 @@ if ($search_status <> '') { //$sql.= ' AND c.facture = 0'; // invoice not created $sql .= ' AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))'; // validated, in process or closed but not billed } + if ($search_status == -4) // To bill + { + + $sql .= ' AND (c.fk_statut IN (1,2))'; // validated, in process + } + } if ($search_datecloture_start) { @@ -675,6 +681,9 @@ if ($resql) { if ($search_status == -3) { $title .= ' - '.$langs->trans('StatusOrderValidated').', '.(empty($conf->expedition->enabled) ? '' : $langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill'); } + if ($search_status == -4) { + $title .= ' - '.$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort"); + } $num = $db->num_rows($resql); @@ -1236,6 +1245,7 @@ if ($resql) { Commande::STATUS_SHIPMENTONPROCESS=>$langs->trans("StatusOrderSentShort"), Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"), -3=>$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort").'+'.$langs->trans("StatusOrderDelivered"), + -4=>$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort"), Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceledShort") ); print $form->selectarray('search_status', $liststatus, $search_status, -4, 0, 0, '', 0, 0, 0, '', 'maxwidth100', 1); From bcb06d5c909664e6195acc395bddb23357ba0824 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 5 Jul 2021 07:40:44 +0000 Subject: [PATCH 02/10] Fixing style errors. --- htdocs/commande/list.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 3acae2f8180..8971d942de6 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -513,12 +513,9 @@ if ($search_status <> '') { //$sql.= ' AND c.facture = 0'; // invoice not created $sql .= ' AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))'; // validated, in process or closed but not billed } - if ($search_status == -4) // To bill - { - + if ($search_status == -4) { // To bill $sql .= ' AND (c.fk_statut IN (1,2))'; // validated, in process } - } if ($search_datecloture_start) { From 1a919c9f2be724d0fdf31e52b216a7d214df6e90 Mon Sep 17 00:00:00 2001 From: jpb Date: Wed, 7 Jul 2021 08:35:31 +0200 Subject: [PATCH 03/10] change comment --- htdocs/commande/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 3acae2f8180..a0053f982de 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -513,7 +513,7 @@ if ($search_status <> '') { //$sql.= ' AND c.facture = 0'; // invoice not created $sql .= ' AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))'; // validated, in process or closed but not billed } - if ($search_status == -4) // To bill + if ($search_status == -4) // "To validate and in progress" { $sql .= ' AND (c.fk_statut IN (1,2))'; // validated, in process From 89ffa85290c17d05bcf61e2b45660224c4957108 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 7 Jul 2021 06:40:12 +0000 Subject: [PATCH 04/10] Fixing style errors. --- htdocs/commande/list.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 3c4cafd8a95..f8d4fdac1e2 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -514,8 +514,7 @@ if ($search_status <> '') { $sql .= ' AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))'; // validated, in process or closed but not billed } - if ($search_status == -4) // "To validate and in progress" - { + if ($search_status == -4) { // "To validate and in progress" $sql .= ' AND (c.fk_statut IN (1,2))'; // validated, in process } } From 45d36d91343179d78f6b3ebbbd623f5400075f30 Mon Sep 17 00:00:00 2001 From: EpixFr Date: Wed, 7 Jul 2021 17:32:48 +0200 Subject: [PATCH 05/10] 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 06/10] 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 07/10] 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 08/10] 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; From 2e44acbc810ed679d8d67d81499b9c07bd3da5b4 Mon Sep 17 00:00:00 2001 From: jpb Date: Thu, 8 Jul 2021 16:43:05 +0200 Subject: [PATCH 09/10] update comment --- htdocs/commande/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 3c4cafd8a95..281aedb96c8 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -514,7 +514,7 @@ if ($search_status <> '') { $sql .= ' AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))'; // validated, in process or closed but not billed } - if ($search_status == -4) // "To validate and in progress" + if ($search_status == -4) // "validate and in progress" { $sql .= ' AND (c.fk_statut IN (1,2))'; // validated, in process } From 327481dc78931f171f5735d2b84a5445628eaa16 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 8 Jul 2021 14:47:38 +0000 Subject: [PATCH 10/10] Fixing style errors. --- htdocs/commande/list.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index e704058f9b8..77eedcd3e34 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -515,8 +515,7 @@ if ($search_status <> '') { } - if ($search_status == -4) // "validate and in progress" - { + if ($search_status == -4) { // "validate and in progress" $sql .= ' AND (c.fk_statut IN (1,2))'; // validated, in process } }