diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index a2dec4fb492..d156525f2b9 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -579,7 +579,7 @@ class AccountancyExport /** * Export format : Quadratus (Format ASCII) * Format since 2015 compatible QuadraCOMPTA - * Last review for this format : 2023/01/28 Alexandre Spangaro (aspangaro@open-dsi.fr) + * Last review for this format : 2023/09/16 Alexandre Spangaro (aspangaro@open-dsi.fr) * * Help : https://docplayer.fr/20769649-Fichier-d-entree-ascii-dans-quadracompta.html * In QuadraCompta | Use menu : "Outils" > "Suivi des dossiers" > "Import ASCII(Compta)" @@ -599,10 +599,17 @@ class AccountancyExport foreach ($TData as $data) { // Clean some data $data->doc_ref = dol_string_unaccent($data->doc_ref); + + $data->label_operation = str_replace(array("\t", "\n", "\r"), " ", $data->label_operation); + $data->label_operation = str_replace(array("- ", "…", "..."), "", $data->label_operation); $data->label_operation = dol_string_unaccent($data->label_operation); + $data->numero_compte = dol_string_unaccent($data->numero_compte); $data->label_compte = dol_string_unaccent($data->label_compte); $data->subledger_account = dol_string_unaccent($data->subledger_account); + + $data->subledger_label = dol_string_unaccent($data->subledger_label); + $data->subledger_label = str_replace(array("- ", "…", "..."), "", $data->subledger_label); $data->subledger_label = dol_string_unaccent($data->subledger_label); $code_compta = $data->numero_compte; @@ -618,11 +625,11 @@ class AccountancyExport $Tab['lib_compte'] = str_pad(self::trunc($data->subledger_label, 30), 30); if ($data->doc_type == 'customer_invoice') { - $Tab['lib_alpha'] = strtoupper(str_pad('C'.self::trunc($data->subledger_label, 6), 6)); + $Tab['lib_alpha'] = strtoupper(str_pad('C'.self::trunc($data->subledger_label, 6), 7)); $Tab['filler'] = str_repeat(' ', 52); $Tab['coll_compte'] = str_pad(self::trunc($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, 8), 8); } elseif ($data->doc_type == 'supplier_invoice') { - $Tab['lib_alpha'] = strtoupper(str_pad('F'.self::trunc($data->subledger_label, 6), 6)); + $Tab['lib_alpha'] = strtoupper(str_pad('F'.self::trunc($data->subledger_label, 6), 7)); $Tab['filler'] = str_repeat(' ', 52); $Tab['coll_compte'] = str_pad(self::trunc($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, 8), 8); } else { diff --git a/htdocs/commande/class/commandestats.class.php b/htdocs/commande/class/commandestats.class.php index 3070f82c98d..0cde736eb9c 100644 --- a/htdocs/commande/class/commandestats.class.php +++ b/htdocs/commande/class/commandestats.class.php @@ -243,13 +243,14 @@ class CommandeStats extends Stats global $user; $sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg"; - $sql .= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product"; + $sql .= " FROM ".$this->from; + $sql .= " INNER JOIN ".$this->from_line." ON c.rowid = tl.fk_commande "; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."product as product ON tl.fk_product = product.rowid"; if (empty($user->rights->societe->client->voir) && !$user->socid) { $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } $sql .= $this->join; $sql .= " WHERE ".$this->where; - $sql .= " AND c.rowid = tl.fk_commande AND tl.fk_product = product.rowid"; $sql .= " AND c.date_commande BETWEEN '".$this->db->idate(dol_get_first_day($year, 1, false))."' AND '".$this->db->idate(dol_get_last_day($year, 12, false))."'"; $sql .= " GROUP BY product.ref"; $sql .= $this->db->order('nb', 'DESC'); diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 15e237903a2..e1c15cc033a 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1672,6 +1672,7 @@ class Contact extends CommonObject // Desactive utilisateur $sql = "UPDATE ".MAIN_DB_PREFIX."socpeople"; $sql .= " SET statut = ".((int) $this->statut); + $sql .= ", fk_user_modif = ".((int) $user->id); $sql .= " WHERE rowid = ".((int) $this->id); $result = $this->db->query($sql); diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 70729f5c9dc..d66b81aeb0e 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -399,7 +399,7 @@ class modSociete extends DolibarrModules 'c.statut'=>"Status", 's.rowid'=>"Numeric", 's.nom'=>"Text", 's.status'=>"Status", 's.code_client'=>"Text", 's.code_fournisseur'=>"Text", 's.code_compta'=>"Text", 's.code_compta_fournisseur'=>"Text", - 's.client'=>"Text", 's.fournisseur'=>"Text", + 's.client'=>"Numeric", 's.fournisseur'=>"Numeric", 's.address'=>"Text", 's.zip'=>"Text", 's.town'=>"Text", 's.phone'=>"Text", 's.email'=>"Text", 't.libelle'=>"Text", 'c.entity'=>'List:entity:label:rowid', diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 7848b2c43d0..7592012c83a 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -3984,10 +3984,17 @@ class CommandeFournisseurLigne extends CommonOrderLine return -1; } - $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commande_fournisseurdet WHERE rowid=".((int) $this->id); + $sql1 = 'UPDATE '.MAIN_DB_PREFIX."commandedet SET fk_commandefourndet = NULL WHERE rowid=".((int) $this->id); + $resql = $this->db->query($sql1); + if (!$resql) { + $this->db->rollback(); + return -1; + } + + $sql2 = 'DELETE FROM '.MAIN_DB_PREFIX."commande_fournisseurdet WHERE rowid=".((int) $this->id); dol_syslog(__METHOD__, LOG_DEBUG); - $resql = $this->db->query($sql); + $resql = $this->db->query($sql2); if ($resql) { if (!$notrigger) { // Call trigger