avoid to delete directory if ref is empty (#38877)
* avoid to delete directory * Update contrat.class.php * Update expedition.class.php * Update fournisseur.commande.class.php * Update fournisseur.facture.class.php * Update project.class.php
This commit is contained in:
parent
ccc2701529
commit
c86264053e
6 changed files with 7 additions and 7 deletions
|
|
@ -1276,7 +1276,7 @@ class Contrat extends CommonObject
|
|||
if (!$error) {
|
||||
// We remove directory
|
||||
$ref = dol_sanitizeFileName($this->ref);
|
||||
if ($conf->contrat->dir_output) {
|
||||
if ($conf->contrat->dir_output && !empty($ref)) {
|
||||
$dir = $conf->contrat->multidir_output[$this->entity]."/".$ref;
|
||||
if (file_exists($dir)) {
|
||||
$res = @dol_delete_dir_recursive($dir);
|
||||
|
|
|
|||
|
|
@ -1508,7 +1508,7 @@ class Expedition extends CommonObject
|
|||
|
||||
// We delete PDFs
|
||||
$ref = dol_sanitizeFileName($this->ref);
|
||||
if (!empty($conf->expedition->dir_output)) {
|
||||
if (!empty($conf->expedition->dir_output) && !empty($ref)) {
|
||||
$dir = $conf->expedition->dir_output.'/sending/'.$ref;
|
||||
$file = $dir.'/'.$ref.'.pdf';
|
||||
if (file_exists($file)) {
|
||||
|
|
|
|||
|
|
@ -1085,7 +1085,7 @@ class Fichinter extends CommonObject
|
|||
|
||||
// Remove directory with files
|
||||
$fichinterref = dol_sanitizeFileName($this->ref);
|
||||
if ($conf->ficheinter->dir_output) {
|
||||
if ($conf->ficheinter->dir_output && !empty($fichinterref)) {
|
||||
$dir = $conf->ficheinter->dir_output."/".$fichinterref;
|
||||
$file = $conf->ficheinter->dir_output."/".$fichinterref."/".$fichinterref.".pdf";
|
||||
if (file_exists($file)) {
|
||||
|
|
|
|||
|
|
@ -2377,7 +2377,7 @@ class CommandeFournisseur extends CommonOrder
|
|||
|
||||
// We remove directory
|
||||
$ref = dol_sanitizeFileName($this->ref);
|
||||
if ($conf->fournisseur->commande->dir_output) {
|
||||
if ($conf->fournisseur->commande->dir_output && !empty($ref)) {
|
||||
$dir = $conf->fournisseur->commande->dir_output."/".$ref;
|
||||
$file = $dir."/".$ref.".pdf";
|
||||
if (file_exists($file)) {
|
||||
|
|
|
|||
|
|
@ -1527,10 +1527,10 @@ class FactureFournisseur extends CommonInvoice
|
|||
$this->deleteEcmFiles();
|
||||
|
||||
// We remove directory
|
||||
if ($conf->fournisseur->facture->dir_output) {
|
||||
$ref = dol_sanitizeFileName($this->ref);
|
||||
if ($conf->fournisseur->facture->dir_output && !empty($ref)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$ref = dol_sanitizeFileName($this->ref);
|
||||
$dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id, 2, 0, 0, $this, 'invoice_supplier').$ref;
|
||||
$file = $dir."/".$ref.".pdf";
|
||||
if (file_exists($file)) {
|
||||
|
|
|
|||
|
|
@ -997,7 +997,7 @@ class Project extends CommonObject
|
|||
if (empty($error)) {
|
||||
// We remove directory
|
||||
$projectref = dol_sanitizeFileName($this->ref);
|
||||
if ($conf->project->dir_output) {
|
||||
if ($conf->project->dir_output && !empty($projectref)) {
|
||||
$dir = $conf->project->dir_output."/".$projectref;
|
||||
if (file_exists($dir)) {
|
||||
$res = @dol_delete_dir_recursive($dir);
|
||||
|
|
|
|||
Loading…
Reference in a new issue