FIX On object validation, ecm index are not updated for uploaded files

This commit is contained in:
Laurent Destailleur
2023-10-31 19:28:11 +01:00
parent f36e8b935c
commit 127de7e7d8
36 changed files with 227 additions and 3 deletions

View File

@@ -580,6 +580,12 @@ class Commande extends CommonOrder
if (!$resql) {
$error++; $this->error = $this->db->lasterror();
}
$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'commande/".$this->db->escape($this->newref)."'";
$sql .= " WHERE filepath = 'commande/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->error = $this->db->lasterror();
}
// We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
$oldref = dol_sanitizeFileName($this->ref);