From 5139954365489c3d7e65a7525a27d094944b8ab3 Mon Sep 17 00:00:00 2001 From: Regis Houssin <regis.houssin@capnetworks.com> Date: Thu, 4 Jun 2015 16:39:39 +0200 Subject: [PATCH] Fix: add filter in "dol_most_recent_files" for avoid conflict with option "Save file on server with name "FA0700034_Original filename"" --- htdocs/comm/propal.php | 4 ++-- htdocs/commande/card.php | 4 ++-- htdocs/compta/facture.php | 4 ++-- htdocs/expedition/card.php | 4 ++-- htdocs/fichinter/card.php | 4 ++-- htdocs/fourn/commande/card.php | 4 ++-- htdocs/fourn/facture/card.php | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index a0ef8878d1f..38e485ae563 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -2194,7 +2194,7 @@ if ($action == 'create') $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/')); + $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/').'\.([a-z0-9])+$'); $file = $fileparams ['fullname']; // Define output language @@ -2219,7 +2219,7 @@ if ($action == 'create') dol_print_error($db, $result); exit(); } - $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/')); + $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/').'\.([a-z0-9])+$'); $file = $fileparams ['fullname']; } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index e6be7a8d74b..e932a9eb499 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2285,7 +2285,7 @@ if ($action == 'create' && $user->rights->commande->creer) { $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/')); + $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/').'\.([a-z0-9])+$'); $file = $fileparams ['fullname']; // Define output language @@ -2310,7 +2310,7 @@ if ($action == 'create' && $user->rights->commande->creer) { dol_print_error($db, $result); exit(); } - $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/')); + $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/').'\.([a-z0-9])+$'); $file = $fileparams ['fullname']; } diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index e247863a015..86e027034b0 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -3561,7 +3561,7 @@ if ($action == 'create') $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/')); + $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/').'\.([a-z0-9])+$'); $file = $fileparams ['fullname']; // Define output language @@ -3586,7 +3586,7 @@ if ($action == 'create') dol_print_error($db, $result); exit(); } - $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/')); + $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/').'\.([a-z0-9])+$'); $file = $fileparams ['fullname']; } diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 7187506db14..d072e9978a3 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1621,7 +1621,7 @@ else if ($id || $ref) { $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->expedition->dir_output . '/sending/' . $ref, preg_quote($ref,'/')); + $fileparams = dol_most_recent_file($conf->expedition->dir_output . '/sending/' . $ref, preg_quote($ref, '/').'\.([a-z0-9])+$'); $file=$fileparams['fullname']; // Define output language @@ -1648,7 +1648,7 @@ else if ($id || $ref) dol_print_error($db,$result); exit; } - $fileparams = dol_most_recent_file($conf->expedition->dir_output . '/sending/' . $ref, preg_quote($ref,'/')); + $fileparams = dol_most_recent_file($conf->expedition->dir_output . '/sending/' . $ref, preg_quote($ref, '/').'\.([a-z0-9])+$'); $file=$fileparams['fullname']; } diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index f5fcd076709..19616ba8fa0 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1732,7 +1732,7 @@ else if ($id > 0 || ! empty($ref)) { $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->ficheinter->dir_output . '/' . $ref, preg_quote($ref,'/')); + $fileparams = dol_most_recent_file($conf->ficheinter->dir_output . '/' . $ref, preg_quote($ref, '/').'\.([a-z0-9])+$'); $file=$fileparams['fullname']; // Define output language @@ -1759,7 +1759,7 @@ else if ($id > 0 || ! empty($ref)) dol_print_error($db,$result); exit; } - $fileparams = dol_most_recent_file($conf->ficheinter->dir_output . '/' . $ref, preg_quote($ref,'/')); + $fileparams = dol_most_recent_file($conf->ficheinter->dir_output . '/' . $ref, preg_quote($ref, '/').'\.([a-z0-9])+$'); $file=$fileparams['fullname']; } diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index a6ac9c42b56..b886ed55d88 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1920,7 +1920,7 @@ elseif (! empty($object->id)) { $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->fournisseur->commande->dir_output . '/' . $ref, preg_quote($ref,'/')); + $fileparams = dol_most_recent_file($conf->fournisseur->commande->dir_output . '/' . $ref, preg_quote($ref, '/').'\.([a-z0-9])+$'); $file=$fileparams['fullname']; // Define output language @@ -1947,7 +1947,7 @@ elseif (! empty($object->id)) dol_print_error($db,$result); exit; } - $fileparams = dol_most_recent_file($conf->fournisseur->commande->dir_output . '/' . $ref, preg_quote($ref,'/')); + $fileparams = dol_most_recent_file($conf->fournisseur->commande->dir_output . '/' . $ref, preg_quote($ref, '/').'\.([a-z0-9])+$'); $file=$fileparams['fullname']; } diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 54ef660f6aa..947db69fda5 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2396,7 +2396,7 @@ else { $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref, preg_quote($ref,'/')); + $fileparams = dol_most_recent_file($conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref, preg_quote($ref, '/').'\.([a-z0-9])+$'); $file=$fileparams['fullname']; // Define output language @@ -2423,7 +2423,7 @@ else dol_print_error($db,$result); exit; } - $fileparams = dol_most_recent_file($conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref, preg_quote($ref,'/')); + $fileparams = dol_most_recent_file($conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref, preg_quote($ref, '/').'\.([a-z0-9])+$'); $file=$fileparams['fullname']; } -- GitLab