mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Fix bad delete of lines into llx_ecm_files
This commit is contained in:
parent
20321d67da
commit
7659bba97a
|
|
@ -3160,6 +3160,7 @@ class Propal extends CommonObject
|
|||
// Delete record into ECM index and physically
|
||||
if (!$error) {
|
||||
$res = $this->deleteEcmFiles(0); // Deleting files physically is done later with the dol_delete_dir_recursive
|
||||
$res = $this->deleteEcmFiles(1); // Deleting files physically is done later with the dol_delete_dir_recursive
|
||||
if (!$res) {
|
||||
$error++;
|
||||
}
|
||||
|
|
@ -3182,7 +3183,7 @@ class Propal extends CommonObject
|
|||
}
|
||||
}
|
||||
if (file_exists($dir)) {
|
||||
$res = @dol_delete_dir_recursive($dir);
|
||||
$res = @dol_delete_dir_recursive($dir); // delete files physically + into ecm tables
|
||||
if (!$res) {
|
||||
$this->error = 'ErrorFailToDeleteDir';
|
||||
$this->errors[] = $this->error;
|
||||
|
|
|
|||
|
|
@ -3507,6 +3507,7 @@ class Commande extends CommonOrder
|
|||
// Delete record into ECM index and physically
|
||||
if (!$error) {
|
||||
$res = $this->deleteEcmFiles(0); // Deleting files physically is done later with the dol_delete_dir_recursive
|
||||
$res = $this->deleteEcmFiles(1); // Deleting files physically is done later with the dol_delete_dir_recursive
|
||||
if (!$res) {
|
||||
$error++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2866,7 +2866,8 @@ class Facture extends CommonInvoice
|
|||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
// Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive
|
||||
$this->deleteEcmFiles();
|
||||
$this->deleteEcmFiles(0); // Deleting files physically is done later with the dol_delete_dir_recursive
|
||||
$this->deleteEcmFiles(1); // Deleting files physically is done later with the dol_delete_dir_recursive
|
||||
|
||||
// On efface le repertoire de pdf provisoire
|
||||
$ref = dol_sanitizeFileName($this->ref);
|
||||
|
|
|
|||
|
|
@ -10417,16 +10417,26 @@ abstract class CommonObject
|
|||
$element = 'fournisseur/commande';
|
||||
break;
|
||||
case 'invoice_supplier':
|
||||
// Special cases that need to use get_exdir to get real dir of object
|
||||
// In future, all object should use this to define path of documents.
|
||||
$element = 'fournisseur/facture/'.get_exdir($this->id, 2, 0, 1, $this, 'invoice_supplier');
|
||||
break;
|
||||
case 'shipping':
|
||||
$element = 'expedition/sending';
|
||||
break;
|
||||
case 'task':
|
||||
case 'project_task':
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
||||
|
||||
$project_result = $this->fetch_projet();
|
||||
if ($project_result >= 0) {
|
||||
$element = 'projet/'.dol_sanitizeFileName($object->project->ref).'/';
|
||||
}
|
||||
default:
|
||||
$element = $this->element;
|
||||
}
|
||||
|
||||
// Delete ecm_files extrafields
|
||||
// Delete ecm_files_extrafields with mode 0 (using name)
|
||||
$sql = "DELETE FROM ".$this->db->prefix()."ecm_files_extrafields WHERE fk_object IN (";
|
||||
$sql .= " SELECT rowid FROM ".$this->db->prefix()."ecm_files WHERE filename LIKE '".$this->db->escape($this->ref)."%'";
|
||||
$sql .= " AND filepath = '".$this->db->escape($element)."/".$this->db->escape($this->ref)."' AND entity = ".((int) $conf->entity); // No need of getEntity here
|
||||
|
|
@ -10438,7 +10448,7 @@ abstract class CommonObject
|
|||
return false;
|
||||
}
|
||||
|
||||
// Delete ecm_files
|
||||
// Delete ecm_files with mode 0 (using name)
|
||||
$sql = "DELETE FROM ".$this->db->prefix()."ecm_files";
|
||||
$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%'";
|
||||
$sql .= " AND filepath = '".$this->db->escape($element)."/".$this->db->escape($this->ref)."' AND entity = ".((int) $conf->entity); // No need of getEntity here
|
||||
|
|
|
|||
|
|
@ -1500,7 +1500,8 @@ class Expedition extends CommonObject
|
|||
$this->db->commit();
|
||||
|
||||
// Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive
|
||||
$this->deleteEcmFiles();
|
||||
$this->deleteEcmFiles(0); // Deleting files physically is done later with the dol_delete_dir_recursive
|
||||
$this->deleteEcmFiles(1); // Deleting files physically is done later with the dol_delete_dir_recursive
|
||||
|
||||
// We delete PDFs
|
||||
$ref = dol_sanitizeFileName($this->ref);
|
||||
|
|
|
|||
|
|
@ -1196,6 +1196,7 @@ class ExpenseReport extends CommonObject
|
|||
// Delete record into ECM index and physically
|
||||
if (!$error) {
|
||||
$res = $this->deleteEcmFiles(0); // Deleting files physically is done later with the dol_delete_dir_recursive
|
||||
$res = $this->deleteEcmFiles(1); // Deleting files physically is done later with the dol_delete_dir_recursive
|
||||
if (!$res) {
|
||||
$error++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1116,7 +1116,8 @@ class Fichinter extends CommonObject
|
|||
|
||||
if (!$error) {
|
||||
// Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive
|
||||
$this->deleteEcmFiles();
|
||||
$this->deleteEcmFiles(0); // Deleting files physically is done later with the dol_delete_dir_recursive
|
||||
$this->deleteEcmFiles(1); // Deleting files physically is done later with the dol_delete_dir_recursive
|
||||
|
||||
// Remove directory with files
|
||||
$fichinterref = dol_sanitizeFileName($this->ref);
|
||||
|
|
|
|||
|
|
@ -2331,7 +2331,8 @@ class CommandeFournisseur extends CommonOrder
|
|||
|
||||
if (!$error) {
|
||||
// Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive
|
||||
$this->deleteEcmFiles();
|
||||
$this->deleteEcmFiles(0); // Deleting files physically is done later with the dol_delete_dir_recursive
|
||||
$this->deleteEcmFiles(1); // Deleting files physically is done later with the dol_delete_dir_recursive
|
||||
|
||||
// We remove directory
|
||||
$ref = dol_sanitizeFileName($this->ref);
|
||||
|
|
|
|||
|
|
@ -1122,7 +1122,7 @@ class FactureFournisseur extends CommonInvoice
|
|||
*/
|
||||
public function update($user = null, $notrigger = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
global $langs;
|
||||
$error = 0;
|
||||
|
||||
// Clean parameters
|
||||
|
|
@ -1153,9 +1153,6 @@ class FactureFournisseur extends CommonInvoice
|
|||
if (isset($this->label)) {
|
||||
$this->label = trim($this->label);
|
||||
}
|
||||
if (isset($this->libelle)) {
|
||||
$this->libelle = trim($this->libelle); // deprecated
|
||||
}
|
||||
if (isset($this->paye)) {
|
||||
$this->paye = trim($this->paye);
|
||||
}
|
||||
|
|
@ -1414,7 +1411,7 @@ class FactureFournisseur extends CommonInvoice
|
|||
*/
|
||||
public function delete(User $user, $notrigger = 0)
|
||||
{
|
||||
global $langs, $conf;
|
||||
global $conf;
|
||||
|
||||
$rowid = $this->id;
|
||||
|
||||
|
|
@ -1492,7 +1489,8 @@ class FactureFournisseur extends CommonInvoice
|
|||
|
||||
if (!$error) {
|
||||
// Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive
|
||||
$this->deleteEcmFiles();
|
||||
$this->deleteEcmFiles(0); // Deleting files physically is done later with the dol_delete_dir_recursive
|
||||
$this->deleteEcmFiles(1); // Deleting files physically is done later with the dol_delete_dir_recursive
|
||||
|
||||
// We remove directory
|
||||
if ($conf->fournisseur->facture->dir_output) {
|
||||
|
|
|
|||
|
|
@ -1547,6 +1547,7 @@ class Product extends CommonObject
|
|||
// Delete record into ECM index and physically
|
||||
if (!$error) {
|
||||
$res = $this->deleteEcmFiles(0); // Deleting files physically is done later with the dol_delete_dir_recursive
|
||||
$res = $this->deleteEcmFiles(1); // Deleting files physically is done later with the dol_delete_dir_recursive
|
||||
if (!$res) {
|
||||
$error++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2030,7 +2030,8 @@ class SupplierProposal extends CommonObject
|
|||
|
||||
if (!$error) {
|
||||
// Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive
|
||||
$this->deleteEcmFiles();
|
||||
$this->deleteEcmFiles(0); // Deleting files physically is done later with the dol_delete_dir_recursive
|
||||
$this->deleteEcmFiles(1); // Deleting files physically is done later with the dol_delete_dir_recursive
|
||||
|
||||
// We remove directory
|
||||
$ref = dol_sanitizeFileName($this->ref);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user