mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-05 17:18:13 +01:00
Fix missing where on rowid
This commit is contained in:
@@ -584,14 +584,14 @@ class Contrat extends CommonObject
|
|||||||
// Rename directory if dir was a temporary ref
|
// Rename directory if dir was a temporary ref
|
||||||
if (preg_match('/^[\(]?PROV/i', $this->ref)) {
|
if (preg_match('/^[\(]?PROV/i', $this->ref)) {
|
||||||
// Now we rename also files into index
|
// Now we rename also files into index
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref) + 1).")), filepath = 'contract/".$this->db->escape($this->newref)."'";
|
$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files SET filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref) + 1).")), filepath = 'contract/".$this->db->escape($this->newref)."'";
|
||||||
$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'contract/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
|
$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'contract/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
$error++;
|
$error++;
|
||||||
$this->error = $this->db->lasterror();
|
$this->error = $this->db->lasterror();
|
||||||
}
|
}
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'contract/".$this->db->escape($this->newref)."'";
|
$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files SET filepath = 'contract/".$this->db->escape($this->newref)."'";
|
||||||
$sql .= " WHERE filepath = 'contract/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
|
$sql .= " WHERE filepath = 'contract/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
@@ -1069,7 +1069,7 @@ class Contrat extends CommonObject
|
|||||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."contrat");
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."contrat");
|
||||||
|
|
||||||
// Load object modContract
|
// Load object modContract
|
||||||
$module = (getDolGlobalString('CONTRACT_ADDON') ? $conf->global->CONTRACT_ADDON : 'mod_contract_serpis');
|
$module = getDolGlobalString('CONTRACT_ADDON', 'mod_contract_serpis');
|
||||||
if (substr($module, 0, 13) == 'mod_contract_' && substr($module, -3) == 'php') {
|
if (substr($module, 0, 13) == 'mod_contract_' && substr($module, -3) == 'php') {
|
||||||
$module = substr($module, 0, dol_strlen($module) - 4);
|
$module = substr($module, 0, dol_strlen($module) - 4);
|
||||||
}
|
}
|
||||||
@@ -1763,7 +1763,7 @@ class Contrat extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet set description = '".$this->db->escape($desc)."'";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET description = '".$this->db->escape($desc)."'";
|
||||||
$sql .= ",subprice = ".((float) price2num($subprice));
|
$sql .= ",subprice = ".((float) price2num($subprice));
|
||||||
$sql .= ",remise_percent = ".((float) price2num($remise_percent));
|
$sql .= ",remise_percent = ".((float) price2num($remise_percent));
|
||||||
$sql .= ",qty = ".((float) $qty);
|
$sql .= ",qty = ".((float) $qty);
|
||||||
|
|||||||
@@ -118,6 +118,11 @@ abstract class CommonObject
|
|||||||
*/
|
*/
|
||||||
public $table_element;
|
public $table_element;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string Name of id column
|
||||||
|
*/
|
||||||
|
public $table_rowid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string Name of subtable line
|
* @var string Name of subtable line
|
||||||
*/
|
*/
|
||||||
@@ -6948,6 +6953,7 @@ abstract class CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set array $sqlColumnValues (SQL field name in extrafield table => value)
|
||||||
$sqlColumnValues = ['fk_object' => (int) $this->id]; // key-value pairs for the SQL INSERT or UPDATE query
|
$sqlColumnValues = ['fk_object' => (int) $this->id]; // key-value pairs for the SQL INSERT or UPDATE query
|
||||||
|
|
||||||
foreach ($new_array_options as $key => $newValue) {
|
foreach ($new_array_options as $key => $newValue) {
|
||||||
@@ -7049,6 +7055,7 @@ abstract class CommonObject
|
|||||||
if (!$error && !empty($this->fields['fk_user_modif'])) {
|
if (!$error && !empty($this->fields['fk_user_modif'])) {
|
||||||
$sql = "UPDATE ".$this->db->prefix().$this->table_element;
|
$sql = "UPDATE ".$this->db->prefix().$this->table_element;
|
||||||
$sql .= " SET fk_user_modif = ".(int) $user->id;
|
$sql .= " SET fk_user_modif = ".(int) $user->id;
|
||||||
|
$sql .= " WHERE ".(empty($this->table_rowid) ? 'rowid' : $this->db->sanitize($this->table_rowid))." = ".((int) $this->id);
|
||||||
$this->db->query($sql);
|
$this->db->query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7473,6 +7480,7 @@ abstract class CommonObject
|
|||||||
if (!$error && !empty($this->fields['fk_user_modif'])) {
|
if (!$error && !empty($this->fields['fk_user_modif'])) {
|
||||||
$sql = "UPDATE ".$this->db->prefix().$this->table_element;
|
$sql = "UPDATE ".$this->db->prefix().$this->table_element;
|
||||||
$sql .= " SET fk_user_modif = ".(int) $user->id;
|
$sql .= " SET fk_user_modif = ".(int) $user->id;
|
||||||
|
$sql .= " WHERE ".(empty($this->table_rowid) ? 'rowid' : $this->db->sanitize($this->table_rowid))." = ".((int) $this->id);
|
||||||
$this->db->query($sql);
|
$this->db->query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user