Automated merge from 19.0 to 20.0 by tool pullmerge.sh

This commit is contained in:
Laurent Destailleur 2026-07-23 16:26:25 +02:00
commit 9cfefbeafa
7 changed files with 17 additions and 7 deletions

View file

@ -341,7 +341,7 @@ if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.account_number = p." . $db->sanitize($accountancy_field_name) . " AND aa.fk_pcg_version = '" . $db->escape($pcgvercode) . "'";
}
if (!empty($searchCategoryProductList)) {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; // We'll need this table joined to the select in order to filter by categ
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; // We'll need this table joined to the select in order to filter by categ
}
$sql .= ' WHERE p.entity IN ('.getEntity('product').')';
if (strlen(trim($search_current_account))) {

View file

@ -137,7 +137,7 @@ if (GETPOST("delete")) {
$obj = $db->fetch_object($resql);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes";
$sql .= " WHERE entity = ".$conf->entity;
$sql .= " WHERE entity = ".((int) $conf->entity);
$sql .= " AND box_id = ".((int) $obj->rowid);
$resql = $db->query($sql);

View file

@ -3688,7 +3688,7 @@ class ContratLigne extends CommonObjectLine
if ($this->date_end > 0) {
$sql .= ",date_fin_validite";
}
$sql .= ") VALUES ($this->fk_contrat, '', '".$this->db->escape($this->description)."',";
$sql .= ") VALUES (".((int) $this->fk_contrat).", '', '".$this->db->escape($this->description)."',";
$sql .= ($this->fk_product > 0 ? $this->fk_product : "null").",";
$sql .= " '".$this->db->escape($this->qty)."',";
$sql .= " '".$this->db->escape($this->vat_src_code)."',";

View file

@ -280,7 +280,7 @@ class DiscountAbsolute extends CommonObject
$sql .= " multicurrency_amount_ht, multicurrency_amount_tva, multicurrency_amount_ttc,";
$sql .= " fk_facture_source, fk_invoice_supplier_source, multicurrency_code, multicurrency_tx";
$sql .= ")";
$sql .= " VALUES (".$conf->entity.", '".$this->db->idate($this->datec != '' ? $this->datec : dol_now())."', ".((int) $this->socid).", ".(empty($this->discount_type) ? 0 : intval($this->discount_type)).", ".((int) $userid).", '".$this->db->escape($this->description)."',";
$sql .= " VALUES (".((int) $conf->entity).", '".$this->db->idate($this->datec != '' ? $this->datec : dol_now())."', ".((int) $this->fk_soc).", ".(empty($this->discount_type) ? 0 : intval($this->discount_type)).", ".((int) $userid).", '".$this->db->escape($this->description)."',";
$sql .= " ".price2num($this->amount_ht).", ".price2num($this->amount_tva).", ".price2num($this->amount_ttc).", ".price2num($this->tva_tx).", '".$this->db->escape($this->vat_src_code)."',";
$sql .= " ".price2num($this->multicurrency_amount_ht).", ".price2num($this->multicurrency_amount_tva).", ".price2num($this->multicurrency_amount_ttc).", ";
$sql .= " ".($this->fk_facture_source ? ((int) $this->fk_facture_source) : "null").",";

View file

@ -2216,8 +2216,10 @@ class MoLine extends CommonObjectLine
$sqlwhere = array();
if (count($filter) > 0) {
foreach ($filter as $key => $value) {
if ($key == 't.rowid') {
if ($key == 't.rowid' || $key == 'fk_mo' || $key == 'origin_id') {
$sqlwhere[] = $key." = ".((int) $value);
} elseif ($key == 'origin_type') {
$sqlwhere[] = $key." = '".$this->db->escape($value)."'";
} elseif (strpos($key, 'date') !== false) {
$sqlwhere[] = $key." = '".$this->db->idate($value)."'";
} else {

View file

@ -159,7 +159,15 @@ if (empty($reshook)) {
$objectbomchildline->fetch($id_bom_line);
$TMoLines = $moline->fetchAll('DESC', 'rowid', '1', '', array('origin_id' => $id_bom_line));
// Find the consume line of the parent MO generated from this BOM line.
// The lookup must be scoped to the parent MO and use an exact match on origin_id/origin_type,
// otherwise the default 'origin_id LIKE %..%' filter can return an unrelated line (or none),
// which would let the child MO be created from the leftover parent POST data (duplicate MO).
$TMoLines = $moline->fetchAll('DESC', 'rowid', '1', '', array('fk_mo' => $mo_parent->id, 'origin_id' => $id_bom_line, 'origin_type' => 'bomline'));
if (empty($TMoLines)) {
continue;
}
foreach ($TMoLines as $tmpmoline) {
$_POST['fk_bom'] = $objectbomchildline->fk_bom_child;

View file

@ -95,7 +95,7 @@ class UserBankAccount extends Account
$now = dol_now();
$sql = "INSERT INTO ".$this->db->prefix()."user_rib (fk_user, datec)";
$sql .= " VALUES (".$this->userid.", '".$this->db->idate($now)."')";
$sql .= " VALUES (".((int) $this->userid).", '".$this->db->idate($now)."')";
$resql = $this->db->query($sql);
if ($resql) {
if ($this->db->affected_rows($resql)) {