From 895f5452b4080aa2d0e3df037ea685d4415b3344 Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Wed, 11 Dec 2013 15:14:29 +0100 Subject: [PATCH] In some cases of improper use of the delete () function, the complete repertoire of propale objects, invoice or order was deleted. Ex in agefodd module: $obj_link=new Propal($db); $obj_link->id=$agf->propalid; $resultdel=$obj_link->delete($user); To prevent misuse of the function, the reference is not considered given --- htdocs/comm/propal/class/propal.class.php | 2 +- htdocs/commande/class/commande.class.php | 2 +- htdocs/compta/facture/class/facture.class.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index de67b9c78de..990af29d90f 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2056,7 +2056,7 @@ class Propal extends CommonObject { // We remove directory $ref = dol_sanitizeFileName($this->ref); - if ($conf->propal->dir_output) + if ($conf->propal->dir_output && !empty($this->ref)) { $dir = $conf->propal->dir_output . "/" . $ref ; $file = $dir . "/" . $ref . ".pdf"; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 27503790375..a2225b033b8 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2457,7 +2457,7 @@ class Commande extends CommonOrder // On efface le repertoire de pdf provisoire $comref = dol_sanitizeFileName($this->ref); - if ($conf->commande->dir_output) + if ($conf->commande->dir_output && !empty($this->ref)) { $dir = $conf->commande->dir_output . "/" . $comref ; $file = $conf->commande->dir_output . "/" . $comref . "/" . $comref . ".pdf"; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 461b3606cd6..80911290521 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1323,7 +1323,7 @@ class Facture extends CommonInvoice { // On efface le repertoire de pdf provisoire $ref = dol_sanitizeFileName($this->ref); - if ($conf->facture->dir_output) + if ($conf->facture->dir_output && !empty($this->ref)) { $dir = $conf->facture->dir_output . "/" . $ref; $file = $conf->facture->dir_output . "/" . $ref . "/" . $ref . ".pdf";