better fix with this->entity thanks to regis (#28331)

* better fix with this->entity thanks to regis

* Update fichinter.class.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
Eric 2024-02-21 17:06:05 +01:00 committed by GitHub
parent 75ad2e82fd
commit 6defdcd018
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -575,7 +575,7 @@ class Fichinter extends CommonObject
$sql .= ", date_valid = '".$this->db->idate($now)."'";
$sql .= ", fk_user_valid = ".((int) $user->id);
$sql .= " WHERE rowid = ".((int) $this->id);
$sql .= " AND entity IN (".getEntity('intervention').")";
$sql .= " AND entity = ".((int) $this->entity);
$sql .= " AND fk_statut = 0";
@ -604,7 +604,7 @@ class Fichinter extends CommonObject
// 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 = 'ficheinter/".$this->db->escape($this->newref)."'";
$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'ficheinter/".$this->db->escape($this->ref)."' and entity IN (".getEntity('intervention').")";
$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'ficheinter/".$this->db->escape($this->ref)."' and entity = ".((int) $this->entity);
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->error = $this->db->lasterror();