From 1fbd763b8a0e1825ac831b322982dab18fd745fb Mon Sep 17 00:00:00 2001 From: Lucas Marcouiller <45882981+Hystepik@users.noreply.github.com> Date: Tue, 10 Jun 2025 14:24:26 +0200 Subject: [PATCH 1/8] Fix fatal error in v21 (#34389) --- .../fourn/class/fournisseur.facture.class.php | 801 ------------------ 1 file changed, 801 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index c35920ab478..c1005a729e2 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -3757,804 +3757,3 @@ class FactureFournisseur extends CommonInvoice } } } -<<<<<<< HEAD -======= - - - -/** - * Class to manage line invoices - */ -class SupplierInvoiceLine extends CommonObjectLine -{ - /** - * @var string ID to identify managed object - */ - public $element = 'facture_fourn_det'; - - /** - * @var string Name of table without prefix where object is stored - */ - public $table_element = 'facture_fourn_det'; - - /** - * @see CommonObjectLine - */ - public $parent_element = 'facture_fourn'; - - /** - * @see CommonObjectLine - */ - public $fk_parent_attribute = 'fk_facture_fourn'; - - /** - * @var static - */ - public $oldline; - - /** - * @deprecated - * @see $product_ref - */ - public $ref; - - /** - * Internal ref - * @var string - */ - public $product_ref; - - /** - * Supplier reference of price when we added the line. May have been changed after line was added. - * TODO Rename field ref to ref_supplier into table llx_facture_fourn_det and llx_commande_fournisseurdet and update fields into updateline - * @var string - */ - public $ref_supplier; - - /** - * Product description - * @var string - */ - public $product_desc; - - /** - * Unit price before taxes - * @var float - * @deprecated Use $subprice - * @see $subprice - */ - public $pu_ht; - - /** - * Unit price excluded taxes - * @var float - */ - public $subprice; - - /** - * Unit price included taxes - * @var float - */ - public $pu_ttc; - - - /** - * Id of the corresponding supplier invoice - * @var int - */ - public $fk_facture_fourn; - - /** - * This field may contains label of line (when invoice create from order) - * @var string - * @deprecated Use $product_label - */ - public $label; - - /** - * Description of the line - * @var string - * @deprecated Use $desc - */ - public $description; - - public $date_start; - public $date_end; - - /** - * @var int - */ - public $fk_code_ventilation; - - /** - * @var int<0,1> - */ - public $skip_update_total; // Skip update price total for special lines - - /** - * @var float Situation progress percentage - */ - public $situation_percent; - - /** - * @var int Previous situation line id reference - */ - public $fk_prev_id; - - /** - * VAT code - * @var string - */ - public $vat_src_code; - - /** - * VAT % - * @var float - */ - public $tva_tx; - - /** - * Local tax 1 % - * @var float - */ - public $localtax1_tx; - - /** - * Local tax 2 % - * @var float - */ - public $localtax2_tx; - - /** - * Quantity - * @var float - */ - public $qty; - - /** - * Percent of discount - * @var float - */ - public $remise_percent; - - /** - * Buying price value - * @var float - */ - public $pa_ht; - - /** - * Total amount without taxes - * @var float - */ - public $total_ht; - - /** - * Total amount with taxes - * @var float - */ - public $total_ttc; - - /** - * Total amount of taxes - * @var float - */ - public $total_tva; - - /** - * Total local tax 1 amount - * @var float - */ - public $total_localtax1; - - /** - * Total local tax 2 amount - * @var float - */ - public $total_localtax2; - - /** - * @var int ID - */ - public $fk_product; - - /** - * Type of the product. 0 for product 1 for service - * @var int - */ - public $product_type; - - /** - * Label of the product - * @var string - */ - public $product_label; - - /** - * List of cumulative options: - * Bit 0: 0 si TVA normal - 1 si TVA NPR - * Bit 1: 0 si ligne normal - 1 si bit discount (link to line into llx_remise_except) - * @var int - */ - public $info_bits; - - /** - * Link to line into llx_remise_except - * @var int - */ - public $fk_remise_except; - - /** - * @var int ID - */ - public $fk_parent_line; - - /** - * @var int special code - */ - public $special_code; - - /** - * @var int rank of line - */ - public $rang; - - /** - * Total local tax 1 amount - * @var float - */ - public $localtax1_type; - - /** - * Total local tax 2 amount - * @var float - */ - public $localtax2_type; - - - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - public function __construct($db) - { - $this->db = $db; - } - - /** - * Retrieves a supplier invoice line - * - * @param int $rowid Line id - * @return int Return integer <0 KO; 0 NOT FOUND; 1 OK - */ - public function fetch($rowid) - { - $sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description as line_desc, f.date_start, f.date_end, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.tva_tx'; - $sql .= ', f.localtax1_type, f.localtax2_type, f.localtax1_tx, f.localtax2_tx, f.total_localtax1, f.total_localtax2, f.fk_remise_except'; - $sql .= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_facture_fourn, f.fk_product, f.product_type, f.info_bits, f.rang, f.special_code, f.fk_parent_line, f.fk_unit'; - $sql .= ', p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.description as product_desc'; - $sql .= ', f.multicurrency_subprice, f.multicurrency_total_ht, f.multicurrency_total_tva, multicurrency_total_ttc'; - $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det as f'; - $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON f.fk_product = p.rowid'; - $sql .= ' WHERE f.rowid = '.((int) $rowid); - $sql .= ' ORDER BY f.rang, f.rowid'; - - $query = $this->db->query($sql); - - if (!$query) { - $this->errors[] = $this->db->error(); - return -1; - } - - if (!$this->db->num_rows($query)) { - return 0; - } - - $obj = $this->db->fetch_object($query); - - $this->id = $obj->rowid; - $this->rowid = $obj->rowid; - $this->fk_facture_fourn = $obj->fk_facture_fourn; - $this->description = $obj->line_desc; - $this->desc = $obj->line_desc; - - $this->date_start = $this->db->jdate($obj->date_start); - $this->date_end = $this->db->jdate($obj->date_end); - - $this->product_ref = $obj->product_ref; - $this->ref_supplier = $obj->ref_supplier; - $this->product_desc = $obj->product_desc; - - $this->subprice = $obj->pu_ht; - $this->pu_ht = $this->subprice; - $this->pu_ttc = $obj->pu_ttc; - $this->tva_tx = $obj->tva_tx; - $this->localtax1_tx = $obj->localtax1_tx; - $this->localtax2_tx = $obj->localtax2_tx; - $this->localtax1_type = $obj->localtax1_type; - $this->localtax2_type = $obj->localtax2_type; - - $this->qty = $obj->qty; - $this->remise_percent = $obj->remise_percent; - $this->fk_remise_except = $obj->fk_remise_except; - //$this->tva = $obj->total_tva; // deprecated - $this->total_ht = $obj->total_ht; - $this->total_tva = $obj->total_tva; - $this->total_localtax1 = $obj->total_localtax1; - $this->total_localtax2 = $obj->total_localtax2; - $this->total_ttc = $obj->total_ttc; - $this->fk_product = $obj->fk_product; - $this->product_type = $obj->product_type; - $this->product_label = $obj->product_label; - $this->label = $obj->product_label; - $this->info_bits = $obj->info_bits; - $this->fk_parent_line = $obj->fk_parent_line; - $this->special_code = $obj->special_code; - $this->rang = $obj->rang; - $this->fk_unit = $obj->fk_unit; - - $this->multicurrency_subprice = $obj->multicurrency_subprice; - $this->multicurrency_total_ht = $obj->multicurrency_total_ht; - $this->multicurrency_total_tva = $obj->multicurrency_total_tva; - $this->multicurrency_total_ttc = $obj->multicurrency_total_ttc; - - $this->fetch_optionals(); - - return 1; - } - - /** - * Deletes a line - * - * @param int $notrigger 1=Does not execute triggers, 0=execute triggers - * @return int 0 if KO, 1 if OK - */ - public function delete($notrigger = 0) - { - global $user; - - dol_syslog(get_class($this)."::deleteline rowid=".((int) $this->id), LOG_DEBUG); - - $error = 0; - - $this->db->begin(); - - if (!$notrigger) { - if ($this->call_trigger('LINEBILL_SUPPLIER_DELETE', $user) < 0) { - $error++; - } - } - - $this->deleteObjectLinked(); - - // Remove extrafields - if (!$error) { - $result = $this->deleteExtraFields(); - if ($result < 0) { - $error++; - dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR); - } - } - - if (!$error) { - // Supprime ligne - $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn_det '; - $sql .= " WHERE rowid = ".((int) $this->id); - dol_syslog(get_class($this)."::delete", LOG_DEBUG); - $resql = $this->db->query($sql); - if (!$resql) { - $error++; - $this->error = $this->db->lasterror(); - } - } - - if (!$error) { - $this->db->commit(); - return 1; - } else { - $this->db->rollback(); - return -1; - } - } - - /** - * Update a supplier invoice line - * - * @param int $notrigger Disable triggers - * @return int Return integer <0 if KO, >0 if OK - */ - public function update($notrigger = 0) - { - global $conf; - - $pu = price2num($this->subprice); - $qty = price2num($this->qty); - - // Check parameters - if (empty($this->qty)) { - $this->qty = 0; - } - - if ($this->product_type < 0) { - return -1; - } - - // Clean parameters - if (empty($this->remise_percent)) { - $this->remise_percent = 0; - } - if (empty($this->tva_tx)) { - $this->tva_tx = 0; - } - if (empty($this->localtax1_tx)) { - $this->localtax1_tx = 0; - } - if (empty($this->localtax2_tx)) { - $this->localtax2_tx = 0; - } - - if (empty($this->pa_ht)) { - $this->pa_ht = 0; - } - if (empty($this->multicurrency_subprice)) { - $this->multicurrency_subprice = 0; - } - if (empty($this->multicurrency_total_ht)) { - $this->multicurrency_total_ht = 0; - } - if (empty($this->multicurrency_total_tva)) { - $this->multicurrency_total_tva = 0; - } - if (empty($this->multicurrency_total_ttc)) { - $this->multicurrency_total_ttc = 0; - } - - $fk_product = (int) $this->fk_product; - $fk_unit = (int) $this->fk_unit; - - $this->db->begin(); - - $sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det SET"; - $sql .= " description = '".$this->db->escape(empty($this->description) ? $this->desc : $this->description)."'"; - $sql .= ", ref = '".$this->db->escape($this->ref_supplier ? $this->ref_supplier : $this->ref)."'"; - $sql .= ", date_start = ".($this->date_start != '' ? "'".$this->db->idate($this->date_start)."'" : "null"); - $sql .= ", date_end = ".($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : "null"); - $sql .= ", pu_ht = ".price2num($this->subprice); - $sql .= ", pu_ttc = ".price2num($this->pu_ttc); - $sql .= ", qty = ".price2num($this->qty); - $sql .= ", remise_percent = ".price2num($this->remise_percent); - if ($this->fk_remise_except > 0) { - $sql .= ", fk_remise_except=".((int) $this->fk_remise_except); - } else { - $sql .= ", fk_remise_except=null"; - } - $sql .= ", vat_src_code = '".$this->db->escape(empty($this->vat_src_code) ? '' : $this->vat_src_code)."'"; - $sql .= ", tva_tx = ".price2num($this->tva_tx); - $sql .= ", localtax1_tx = ".price2num($this->localtax1_tx); - $sql .= ", localtax2_tx = ".price2num($this->localtax2_tx); - $sql .= ", localtax1_type = '".$this->db->escape($this->localtax1_type)."'"; - $sql .= ", localtax2_type = '".$this->db->escape($this->localtax2_type)."'"; - $sql .= ", total_ht = ".price2num($this->total_ht); - $sql .= ", tva= ".price2num($this->total_tva); - $sql .= ", total_localtax1= ".price2num($this->total_localtax1); - $sql .= ", total_localtax2= ".price2num($this->total_localtax2); - $sql .= ", total_ttc = ".price2num($this->total_ttc); - $sql .= ", fk_product = ".($fk_product > 0 ? (int) $fk_product : 'null'); - $sql .= ", product_type = ".((int) $this->product_type); - $sql .= ", info_bits = ".((int) $this->info_bits); - $sql .= ", fk_unit = ".($fk_unit > 0 ? (int) $fk_unit : 'null'); - - if (!empty($this->rang)) { - $sql .= ", rang=".((int) $this->rang); - } - - // Multicurrency - $sql .= " , multicurrency_subprice=".price2num($this->multicurrency_subprice); - $sql .= " , multicurrency_total_ht=".price2num($this->multicurrency_total_ht); - $sql .= " , multicurrency_total_tva=".price2num($this->multicurrency_total_tva); - $sql .= " , multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc); - - $sql .= " WHERE rowid = ".((int) $this->id); - - dol_syslog(get_class($this)."::update", LOG_DEBUG); - $resql = $this->db->query($sql); - - if (!$resql) { - $this->db->rollback(); - $this->error = $this->db->lasterror(); - return -1; - } - - $this->rowid = $this->id; - $error = 0; - - if (!$error) { - $result = $this->insertExtraFields(); - if ($result < 0) { - $error++; - } - } - - if (!$error && !$notrigger) { - global $langs, $user; - - // Call trigger - if ($this->call_trigger('LINEBILL_SUPPLIER_MODIFY', $user) < 0) { - $this->db->rollback(); - return -1; - } - // End call triggers - } - - if ($error) { - $this->db->rollback(); - return -1; - } - - $this->db->commit(); - return 1; - } - - /** - * Insert line into database - * - * @param int $notrigger 1 no triggers - * @param int $noerrorifdiscountalreadylinked 1=Do not make error if lines is linked to a discount and discount already linked to another - * @return int Return integer <0 if KO, >0 if OK - */ - public function insert($notrigger = 0, $noerrorifdiscountalreadylinked = 0) - { - global $user, $langs; - - $error = 0; - - dol_syslog(get_class($this)."::insert rang=".$this->rang, LOG_DEBUG); - - // Clean parameters - $this->desc = trim($this->desc); - if (empty($this->tva_tx)) { - $this->tva_tx = 0; - } - if (empty($this->localtax1_tx)) { - $this->localtax1_tx = 0; - } - if (empty($this->localtax2_tx)) { - $this->localtax2_tx = 0; - } - if (empty($this->localtax1_type)) { - $this->localtax1_type = 0.0; - } - if (empty($this->localtax2_type)) { - $this->localtax2_type = 0.0; - } - if (empty($this->total_tva)) { - $this->total_tva = 0; - } - if (empty($this->total_localtax1)) { - $this->total_localtax1 = 0; - } - if (empty($this->total_localtax2)) { - $this->total_localtax2 = 0; - } - if (empty($this->rang)) { - $this->rang = 0; - } - if (empty($this->remise_percent)) { - $this->remise_percent = 0; - } - if (empty($this->info_bits)) { - $this->info_bits = 0; - } - if (empty($this->subprice)) { - $this->subprice = 0; - } - if (empty($this->special_code)) { - $this->special_code = 0; - } - if (empty($this->fk_parent_line)) { - $this->fk_parent_line = 0; - } - if (!isset($this->situation_percent) || $this->situation_percent > 100 || (string) $this->situation_percent == '') { - $this->situation_percent = 100; - } - - if (empty($this->pa_ht)) { - $this->pa_ht = 0; - } - if (empty($this->multicurrency_subprice)) { - $this->multicurrency_subprice = 0; - } - if (empty($this->multicurrency_total_ht)) { - $this->multicurrency_total_ht = 0; - } - if (empty($this->multicurrency_total_tva)) { - $this->multicurrency_total_tva = 0; - } - if (empty($this->multicurrency_total_ttc)) { - $this->multicurrency_total_ttc = 0; - } - - - // Check parameters - if ($this->product_type < 0) { - $this->error = 'ErrorProductTypeMustBe0orMore'; - return -1; - } - if (!empty($this->fk_product) && $this->fk_product > 0) { - // Check product exists - $result = Product::isExistingObject('product', $this->fk_product); - if ($result <= 0) { - $this->error = 'ErrorProductIdDoesNotExists'; - return -1; - } - } - - $this->db->begin(); - - // Insertion dans base de la ligne - $sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element; - $sql .= ' (fk_facture_fourn, fk_parent_line, label, description, ref, qty,'; - $sql .= ' vat_src_code, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,'; - $sql .= ' fk_product, product_type, remise_percent, fk_remise_except, pu_ht, pu_ttc,'; - $sql .= ' date_start, date_end, fk_code_ventilation, rang, special_code,'; - $sql .= ' info_bits, total_ht, tva, total_ttc, total_localtax1, total_localtax2, fk_unit'; - $sql .= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc'; - $sql .= ')'; - $sql .= " VALUES (".$this->fk_facture_fourn.","; - $sql .= " ".($this->fk_parent_line > 0 ? "'".$this->db->escape($this->fk_parent_line)."'" : "null").","; - $product_label - = !empty($this->product_label) - ? $this->product_label : - (!empty($this->label) ? $this->label : null); - $sql .= " ".(!empty($product_label) ? "'".$this->db->escape($product_label)."'" : "null").","; - $sql .= " '".$this->db->escape($this->desc ? $this->desc : $this->description)."',"; - $sql .= " '".$this->db->escape($this->ref_supplier)."',"; - $sql .= " ".price2num($this->qty).","; - - $sql .= " ".(empty($this->vat_src_code) ? "''" : "'".$this->db->escape($this->vat_src_code)."'").","; - $sql .= " ".price2num($this->tva_tx).","; - $sql .= " ".price2num($this->localtax1_tx).","; - $sql .= " ".price2num($this->localtax2_tx).","; - $sql .= " '".$this->db->escape($this->localtax1_type)."',"; - $sql .= " '".$this->db->escape($this->localtax2_type)."',"; - $sql .= ' '.((!empty($this->fk_product) && $this->fk_product > 0) ? $this->fk_product : "null").','; - $sql .= " ".((int) $this->product_type).","; - $sql .= " ".price2num($this->remise_percent).","; - $sql .= ' '.(!empty($this->fk_remise_except) ? ((int) $this->fk_remise_except) : "null").','; - $sql .= " ".price2num($this->subprice).","; - $sql .= " ".(!empty($this->qty) ? price2num($this->total_ttc / $this->qty) : price2num($this->total_ttc)).","; - $sql .= " ".(!empty($this->date_start) ? "'".$this->db->idate($this->date_start)."'" : "null").","; - $sql .= " ".(!empty($this->date_end) ? "'".$this->db->idate($this->date_end)."'" : "null").","; - $sql .= ' '.(!empty($this->fk_code_ventilation) ? $this->fk_code_ventilation : 0).','; - $sql .= ' '.((int) $this->rang).','; - $sql .= ' '.((int) $this->special_code).','; - $sql .= " ".((int) $this->info_bits).","; - $sql .= " ".price2num($this->total_ht).","; - $sql .= " ".price2num($this->total_tva).","; - $sql .= " ".price2num($this->total_ttc).","; - $sql .= " ".price2num($this->total_localtax1).","; - $sql .= " ".price2num($this->total_localtax2); - $sql .= ", ".(!$this->fk_unit ? 'NULL' : $this->fk_unit); - $sql .= ", ".(int) $this->fk_multicurrency; - $sql .= ", '".$this->db->escape($this->multicurrency_code)."'"; - $sql .= ", ".price2num($this->multicurrency_subprice); - $sql .= ", ".price2num($this->multicurrency_total_ht); - $sql .= ", ".price2num($this->multicurrency_total_tva); - $sql .= ", ".price2num($this->multicurrency_total_ttc); - $sql .= ')'; - - $resql = $this->db->query($sql); - if ($resql) { - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element); - $this->rowid = $this->id; // backward compatibility - - if (!$error) { - $result = $this->insertExtraFields(); - if ($result < 0) { - $error++; - } - } - - // Si fk_remise_except defini, on lie la remise a la facture - // ce qui la flague comme "consommee". - if ($this->fk_remise_except) { - $discount = new DiscountAbsolute($this->db); - $result = $discount->fetch($this->fk_remise_except); - if ($result >= 0) { - // Check if discount was found - if ($result > 0) { - // Check if discount not already affected to another invoice - if ($discount->fk_facture_line > 0) { - if (empty($noerrorifdiscountalreadylinked)) { - $this->error = $langs->trans("ErrorDiscountAlreadyUsed", $discount->id); - dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR); - $this->db->rollback(); - return -3; - } - } else { - $result = $discount->link_to_invoice($this->id, 0); - if ($result < 0) { - $this->error = $discount->error; - dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR); - $this->db->rollback(); - return -3; - } - } - } else { - $this->error = $langs->trans("ErrorADiscountThatHasBeenRemovedIsIncluded"); - dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR); - $this->db->rollback(); - return -3; - } - } else { - $this->error = $discount->error; - dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR); - $this->db->rollback(); - return -3; - } - } - - if (!$error && !$notrigger) { - // Call trigger - $result = $this->call_trigger('LINEBILL_SUPPLIER_CREATE', $user); - if ($result < 0) { - $this->db->rollback(); - return -2; - } - // End call triggers - } - - if (!$error) { - $this->db->commit(); - return $this->id; - } - - foreach ($this->errors as $errmsg) { - dol_syslog(get_class($this)."::insert ".$errmsg, LOG_ERR); - $this->error .= ($this->error ? ', '.$errmsg : $errmsg); - } - - $this->db->rollback(); - return -1 * $error; - } else { - $this->error = $this->db->error(); - $this->db->rollback(); - return -2; - } - } - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Mise a jour de l'objet ligne de commande en base - * - * @return int Return integer <0 si ko, >0 si ok - */ - public function update_total() - { - // phpcs:enable - $this->db->begin(); - - // Mise a jour ligne en base - $sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det SET"; - $sql .= " total_ht = ".price2num($this->total_ht); - $sql .= ", tva= ".price2num($this->total_tva); - $sql .= ", total_localtax1 = ".price2num($this->total_localtax1); - $sql .= ", total_localtax2 = ".price2num($this->total_localtax2); - $sql .= ", total_ttc = ".price2num($this->total_ttc); - $sql .= " WHERE rowid = ".((int) $this->id); - - dol_syslog("FactureFournisseurLigne.class.php::update_total", LOG_DEBUG); - - $resql = $this->db->query($sql); - if ($resql) { - $this->db->commit(); - return 1; - } else { - $this->error = $this->db->error(); - $this->db->rollback(); - return -2; - } - } -} ->>>>>>> branch '20.0' of git@github.com:Dolibarr/dolibarr.git From 84fd8d0cdc5c118b6fc15ff1a5bbd0edfce41fdd Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Tue, 10 Jun 2025 18:33:56 +0200 Subject: [PATCH 2/8] Fix CI --- htdocs/fourn/class/fournisseur.facture-rec.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index 23661b37f47..7c4e7075d18 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -2064,4 +2064,3 @@ class FactureFournisseurRec extends CommonInvoice } } } - From 10fbaf0c33e72254d1496c9366cca61142f4573c Mon Sep 17 00:00:00 2001 From: Lucas Marcouiller <45882981+Hystepik@users.noreply.github.com> Date: Thu, 12 Jun 2025 12:49:54 +0200 Subject: [PATCH 3/8] Fix bad display of type vet select + database save (#34384) * Fix bad display of type vet select + database save * Fix CI * Fix by removing empty value * remove unused condition --- htdocs/admin/dict.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 08f4a5ce8d0..e80ac1b0276 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -2916,7 +2916,7 @@ function dictFieldList($fieldlist, $obj = null, $tabname = '', $context = '') } elseif ($value == 'type_vat') { // VAT type 0: all, 1: sell, 2: purchase print ''; - print $form->selectarray($value, $type_vatList, (empty($obj->{$value}) ? '' : $obj->{$value}), 1); + print $form->selectarray($value, $type_vatList, (empty($obj->{$value}) ? '0' : $obj->{$value})); print ''; } elseif ($value == 'localtax1_type' || $value == 'localtax2_type') { // Le type de taxe locale From d9ab84d0873076519d29cb7e89100d6bfe3d8f9d Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 13 Jun 2025 00:17:03 +0200 Subject: [PATCH 4/8] FIX Accountancy - Problem with constant ACCOUNTANCY_COMBO_FOR_AUX (#34414) * FIX Accountancy - Problem with constant ACCOUNTANCY_COMBO_FOR_AUX * Fix placeholder --- htdocs/accountancy/bookkeeping/balance.php | 14 +++++++++++--- htdocs/accountancy/bookkeeping/listbyaccount.php | 14 +++++++++++--- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index fa1c7c1447d..3adc47ed6df 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -1,7 +1,7 @@ * Copyright (C) 2016 Florian Henry - * Copyright (C) 2016-2024 Alexandre Spangaro + * Copyright (C) 2016-2025 Alexandre Spangaro * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2024 MDW * @@ -378,13 +378,21 @@ if ($action != 'export_csv') { // Accountancy account $moreforfilter .= $langs->trans('AccountAccounting').': '; if ($type == 'sub') { - $moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), 'maxwidth200'); + if (getDolGlobalString('ACCOUNTANCY_COMBO_FOR_AUX')) { + $moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), 'maxwidth200'); + } else { + $moreforfilter .= ''; + } } else { $moreforfilter .= $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), array(), 1, 1, 'maxwidth200', 'accounts'); } $moreforfilter .= ' '; if ($type == 'sub') { - $moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), 'maxwidth200'); + if (getDolGlobalString('ACCOUNTANCY_COMBO_FOR_AUX')) { + $moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), 'maxwidth200'); + } else { + $moreforfilter .= ''; + } } else { $moreforfilter .= $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), array(), 1, 1, 'maxwidth200', 'accounts'); } diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 6ec0fb9c3e1..72b4a535c33 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -2,7 +2,7 @@ /* Copyright (C) 2016 Neil Orley * Copyright (C) 2013-2016 Olivier Geffroy * Copyright (C) 2013-2020 Florian Henry - * Copyright (C) 2013-2024 Alexandre Spangaro + * Copyright (C) 2013-2025 Alexandre Spangaro * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2024 MDW * @@ -801,13 +801,21 @@ $moreforfilter .= '
'; $moreforfilter .= $langs->trans('AccountAccounting').': '; $moreforfilter .= '
'; if ($type == 'sub') { - $moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), 'maxwidth200'); + if (getDolGlobalString('ACCOUNTANCY_COMBO_FOR_AUX')) { + $moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), 'maxwidth200'); + } else { + $moreforfilter .= ''; + } } else { $moreforfilter .= $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), array(), 1, 1, 'maxwidth200'); } $moreforfilter .= ' '; if ($type == 'sub') { - $moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), 'maxwidth200'); + if (getDolGlobalString('ACCOUNTANCY_COMBO_FOR_AUX')) { + $moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), 'maxwidth200'); + } else { + $moreforfilter .= ''; + } } else { $moreforfilter .= $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), array(), 1, 1, 'maxwidth200'); } From 621fb30b3700ef3390a972d48afb61cee7b9e03c Mon Sep 17 00:00:00 2001 From: atm-jonathan <146709163+atm-jonathan@users.noreply.github.com> Date: Fri, 13 Jun 2025 00:19:29 +0200 Subject: [PATCH 5/8] FIX encoding issues with underscores in mb_convert_encoding functionality (#34411) Co-authored-by: x --- htdocs/emailcollector/class/emailcollector.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 9775ebc758b..16bc75c56c8 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -868,11 +868,13 @@ class EmailCollector extends CommonObject if (function_exists('mb_convert_encoding')) { // change spaces by entropy because mb_convert fail with spaces $str = preg_replace("/ /", "xxxSPACExxx", $str); // the replacement string must be valid in utf7 so _ can't be used + $str = preg_replace("/_/", "xxxUNDERSCORExxx", $str); // encode underscore to avoid encoding issues with mb_convert $str = preg_replace("/\[Gmail\]/", "xxxGMAILxxx", $str); // the replacement string must be valid in utf7 so _ can't be used // if mb_convert work if ($str = mb_convert_encoding($str, "UTF-7")) { // change characters $str = preg_replace("/\+A/", "&A", $str); + $str = preg_replace("/xxxUNDERSCORExxx/", "_", $str); // change to spaces again $str = preg_replace("/xxxSPACExxx/", " ", $str); // change to [Gmail] again From f7145389d6bdc9fba9dbda9c05cb829be3a21021 Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Fri, 13 Jun 2025 11:57:55 +0200 Subject: [PATCH 6/8] fix: warning use undeclared varialble (#34435) --- htdocs/compta/bank/releve.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index 5c0c75649f4..72a60ce02b5 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -352,9 +352,9 @@ if (empty($numref)) { $massactionbutton = $form->selectMassAction('', $arrayofmassactions); $morehtml = ''; - if ($action != 'addline' && $action != 'reconcile') { - $morehtml .= $buttonreconcile; - } + // if ($action != 'addline' && $action != 'reconcile') { + // $morehtml .= $buttonreconcile; + // } print '
'; print ''; From 5d2ac22cbd517b83b3c7a5ed0f52817565c81299 Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Fri, 13 Jun 2025 15:20:54 +0200 Subject: [PATCH 7/8] fix: php 8 warning on expense report validation when multi-lang (#34443) * fix: edge cas * fix: expense report generation can failed with multilang setting * fix: expense report generation can failed with multilang setting --- htdocs/expensereport/card.php | 76 ++++++++++++++++++++++++++++++----- 1 file changed, 66 insertions(+), 10 deletions(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index b6068054f08..c05b44f7123 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -403,7 +403,12 @@ if (empty($reshook)) { $newlang = GETPOST('lang_id', 'aZ09'); } if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) { - $newlang = $object->thirdparty->default_lang; + $user = new User($db); + $user->fetch($object->fk_user_author); + $newlang = $user->lang; + } + if (empty($newlang)) { + $newlang = $langs; } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); @@ -520,7 +525,12 @@ if (empty($reshook)) { $newlang = GETPOST('lang_id', 'aZ09'); } if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) { - $newlang = $object->thirdparty->default_lang; + $user = new User($db); + $user->fetch($object->fk_user_author); + $newlang = $user->lang; + } + if (empty($newlang)) { + $newlang = $langs; } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); @@ -632,7 +642,12 @@ if (empty($reshook)) { $newlang = GETPOST('lang_id', 'aZ09'); } if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) { - $newlang = $object->thirdparty->default_lang; + $user = new User($db); + $user->fetch($object->fk_user_author); + $newlang = $user->lang; + } + if (empty($newlang)) { + $newlang = $langs; } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); @@ -748,7 +763,12 @@ if (empty($reshook)) { $newlang = GETPOST('lang_id', 'aZ09'); } if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) { - $newlang = $object->thirdparty->default_lang; + $user = new User($db); + $user->fetch($object->fk_user_author); + $newlang = $user->lang; + } + if (empty($newlang)) { + $newlang = $langs; } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); @@ -864,7 +884,12 @@ if (empty($reshook)) { $newlang = GETPOST('lang_id', 'aZ09'); } if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) { - $newlang = $object->thirdparty->default_lang; + $user = new User($db); + $user->fetch($object->fk_user_author); + $newlang = $user->lang; + } + if (empty($newlang)) { + $newlang = $langs; } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); @@ -978,7 +1003,12 @@ if (empty($reshook)) { $newlang = GETPOST('lang_id', 'aZ09'); } if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) { - $newlang = $object->thirdparty->default_lang; + $user = new User($db); + $user->fetch($object->fk_user_author); + $newlang = $user->lang; + } + if (empty($newlang)) { + $newlang = $langs; } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); @@ -1017,7 +1047,12 @@ if (empty($reshook)) { $newlang = GETPOST('lang_id', 'aZ09'); } if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) { - $newlang = $object->thirdparty->default_lang; + $user = new User($db); + $user->fetch($object->fk_user_author); + $newlang = $user->lang; + } + if (empty($newlang)) { + $newlang = $langs; } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); @@ -1046,7 +1081,12 @@ if (empty($reshook)) { $newlang = GETPOST('lang_id', 'aZ09'); } if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) { - $newlang = $object->thirdparty->default_lang; + $user = new User($db); + $user->fetch($object->fk_user_author); + $newlang = $user->lang; + } + if (empty($newlang)) { + $newlang = $langs; } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); @@ -1226,6 +1266,9 @@ if (empty($reshook)) { $user->fetch($object->fk_user_author); $newlang = $user->lang; } + if (empty($newlang)) { + $newlang = $langs; + } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); @@ -1277,7 +1320,15 @@ if (empty($reshook)) { $newlang = GETPOST('lang_id', 'aZ09'); } if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) { - $newlang = $object->thirdparty->default_lang; + $user = new User($db); + $user->fetch($object->fk_user_author); + $newlang = $user->lang; + } + if (empty($newlang)) { + $newlang = $langs; + } + if (empty($newlang)) { + $newlang = $langs; } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); @@ -1374,7 +1425,12 @@ if (empty($reshook)) { $newlang = GETPOST('lang_id', 'aZ09'); } if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) { - $newlang = $object->thirdparty->default_lang; + $user = new User($db); + $user->fetch($object->fk_user_author); + $newlang = $user->lang; + } + if (empty($newlang)) { + $newlang = $langs; } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); From cbc2cf506300888939d701b56430315cc01455ff Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Fri, 13 Jun 2025 16:12:30 +0200 Subject: [PATCH 8/8] Fix : thirdparty type was not set on creation form (#34451) --- htdocs/categories/viewcat.php | 2 +- htdocs/comm/propal/card.php | 2 +- htdocs/commande/card.php | 2 +- htdocs/compta/facture/card.php | 2 +- htdocs/contrat/card.php | 2 +- htdocs/don/card.php | 2 +- htdocs/fichinter/card.php | 2 +- htdocs/projet/card.php | 2 +- htdocs/societe/card.php | 6 +++--- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index fcef409cc55..59073acc49c 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -625,7 +625,7 @@ if ($type == Categorie::TYPE_CUSTOMER) { $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($socs); $nbtotalofrecords = ''; - $newcardbutton = dolGetButtonTitle($langs->trans("AddThirdParty"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/societe/card.php?action=create&client=3&custcats[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->hasRight('societe', 'creer')); + $newcardbutton = dolGetButtonTitle($langs->trans("AddThirdParty"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/societe/card.php?action=create&customer=3&custcats[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->hasRight('societe', 'creer')); // @phan-suppress-next-line PhanPluginSuspiciousParamOrder print_barre_liste($langs->trans("Customers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'companies', 0, $newcardbutton, '', $limit); diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index d8f2acc9403..8872c60bba7 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2061,7 +2061,7 @@ if ($action == 'create') { }); '; } - print ' '; + print ' '; print ''; } print ''."\n"; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index fa693ac941a..646560bd120 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1986,7 +1986,7 @@ if ($action == 'create' && $usercancreate) { }); '; } - print ' '; + print ' '; print ''; } print ''."\n"; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index ba163b13ac1..188f97adf23 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3520,7 +3520,7 @@ if ($action == 'create') { '; } if (!GETPOSTINT('fac_rec')) { - print ' '; + print ' '; } print ''; print ''."\n"; diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index c7c42dd9738..aa19bd50f14 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1256,7 +1256,7 @@ if ($action == 'create') { print ''; print img_picto('', 'company', 'class="pictofixedwidth"'); print $form->select_company('', 'socid', '', 'SelectThirdParty', 1, 0, array(), 0, 'minwidth300 widthcentpercentminusxx maxwidth500'); - print ' '; + print ' '; print ''; } print ''."\n"; diff --git a/htdocs/don/card.php b/htdocs/don/card.php index 9299590121d..f3ec69a7a1a 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -435,7 +435,7 @@ if ($action == 'create') { }); '; } - print ' '; + print ' '; print ''; } print ''."\n"; diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 07311a5ca20..5375c3a1831 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1151,7 +1151,7 @@ if ($action == 'create') { print ''; print ''; print '
'.$langs->trans("ThirdParty").''; print $form->select_company('', 'socid', '', 'SelectThirdParty', 1, 0, array(), 0, 'minwidth300'); - print ' '; + print ' '; print '
'; diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 52becef087e..fe29990b889 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -813,7 +813,7 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) { print $text; } if (!GETPOSTISSET('backtopage')) { - $url = '/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create'); + $url = '/societe/card.php?action=create&customer=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create'); $newbutton = ''; // TODO @LDR Implement this if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index aaed24400c4..861caa5e7e1 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1484,9 +1484,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio break; } - $selectedprospect = ((GETPOSTISSET('prospect') || $action == 'create') ? GETPOSTINT('prospect') : $selectedprospect); - $selectedcustomer = ((GETPOSTISSET('customer') || $action == 'create') ? GETPOSTINT('customer') : $selectedcustomer); - $selectedsupplier = ((GETPOSTISSET('supplier') || $action == 'create') ? GETPOSTINT('supplier') : $object->fournisseur); + $selectedprospect = ((GETPOSTISSET('prospect') && $action == 'create') ? GETPOSTINT('prospect') : $selectedprospect); + $selectedcustomer = ((GETPOSTISSET('customer') && $action == 'create') ? GETPOSTINT('customer') : $selectedcustomer); + $selectedsupplier = ((GETPOSTISSET('supplier') && $action == 'create') ? GETPOSTINT('supplier') : $object->fournisseur); print ''; if ($conf->browser->layout != 'phone') {