From 0aa6694c95e28d27d233d3b4ff430db3952398bf Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 29 Jul 2012 15:47:24 +0200 Subject: [PATCH] Fix: broken event message --- htdocs/adherents/document.php | 4 +++- htdocs/admin/mails.php | 2 ++ htdocs/admin/tools/dolibarr_export.php | 5 ++++- htdocs/admin/tools/export.php | 7 +++++-- htdocs/comm/action/document.php | 13 ++++++++----- htdocs/comm/propal.php | 4 +++- htdocs/comm/propal/document.php | 16 ++++++++-------- htdocs/commande/document.php | 4 +++- htdocs/commande/fiche.php | 5 ++++- htdocs/compta/facture.php | 5 ++++- htdocs/compta/facture/document.php | 4 +++- htdocs/compta/sociales/document.php | 4 +++- htdocs/contrat/document.php | 4 +++- htdocs/core/lib/files.lib.php | 5 +++++ htdocs/document.php | 4 +++- htdocs/ecm/docmine.php | 4 +++- htdocs/ecm/docother.php | 4 +++- htdocs/ecm/index.php | 4 +++- htdocs/fichinter/document.php | 4 +++- htdocs/fichinter/fiche.php | 4 +++- htdocs/fourn/commande/document.php | 4 +++- htdocs/fourn/commande/fiche.php | 4 +++- htdocs/fourn/facture/document.php | 4 +++- htdocs/fourn/facture/fiche.php | 4 +++- htdocs/product/document.php | 4 +++- htdocs/projet/document.php | 4 +++- htdocs/projet/fiche.php | 4 +++- htdocs/projet/tasks/document.php | 4 +++- htdocs/societe/document.php | 4 +++- htdocs/societe/soc.php | 4 +++- 30 files changed, 106 insertions(+), 40 deletions(-) diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php index 83e8cd88faf..7c40de27240 100644 --- a/htdocs/adherents/document.php +++ b/htdocs/adherents/document.php @@ -112,7 +112,9 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') { $langs->load("other"); $file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). - dol_delete_file($file); + $ret=dol_delete_file($file); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); exit; } diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 42492974a1e..52b655d55a5 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -148,6 +148,8 @@ if (! empty($_POST['removedfile']) || ! empty($_POST['removedfilehtml'])) $result = dol_delete_file($pathtodelete,1); if ($result >= 0) { + setEventMessage($langs->trans("FileWasRemoved"), $filetodelete); + include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'); $formmail = new FormMail($db); $formmail->remove_attached_files($keytodelete); diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index b23032f4807..2fc0c5c81d0 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -49,7 +49,10 @@ if (! $user->admin) accessforbidden(); if ($action == 'delete') { - dol_delete_file($conf->admin->dir_output.'/backup/'.GETPOST('urlfile'),1); + $file=$conf->admin->dir_output.'/backup/'.GETPOST('urlfile'); + $ret=dol_delete_file($file, 1); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); $action=''; } diff --git a/htdocs/admin/tools/export.php b/htdocs/admin/tools/export.php index fe686d85bd1..3c37b128dfd 100644 --- a/htdocs/admin/tools/export.php +++ b/htdocs/admin/tools/export.php @@ -58,8 +58,11 @@ if ($file && ! $what) if ($action == 'delete') { - dol_delete_file($conf->admin->dir_output.'/backup/'.GETPOST('urlfile'),1); - $action=''; + $file=$conf->admin->dir_output.'/backup/'.GETPOST('urlfile'); + $ret=dol_delete_file($file, 1); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); + $action=''; } diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index 70914d5d357..ca050dbd115 100755 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -40,8 +40,8 @@ $langs->load("commercial"); $langs->load("other"); $langs->load("bills"); -if (isset($_GET["error"])) $error=$_GET["error"]; $objectid = GETPOST('id','int'); +$action=GETPOST('action','alpha'); // Security check if ($user->societe_id > 0) @@ -66,7 +66,7 @@ if (! $sortfield) $sortfield="name"; /* * Action envoie fichier */ -if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) +if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) { // Creation repertoire si n'existe pas $upload_dir = $conf->agenda->dir_output.'/'.dol_sanitizeFileName($objectid); @@ -109,11 +109,14 @@ if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) /* * Efface fichier */ -if ($_GET["action"] == 'delete') +if ($action == 'delete') { $upload_dir = $conf->agenda->dir_output.'/'.dol_sanitizeFileName($objectid); - $file = $upload_dir . '/' . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). - dol_delete_file($file); + $file = $upload_dir . '/' . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). + $ret=dol_delete_file($file); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); + $action=''; } diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index d40b4c8d40b..4bd659601e0 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -913,7 +913,9 @@ else if ($action == 'remove_file' && $user->rights->propale->creer) $langs->load("other"); $upload_dir = $conf->propal->dir_output; $file = $upload_dir . '/' . GETPOST('file'); - dol_delete_file($file,0,0,0,$object); + $ret=dol_delete_file($file,0,0,0,$object); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); } } diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index c07282596ba..9b6b6bff336 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -93,22 +93,22 @@ if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) // Used on menu or for setup page for example $imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs"); } - $mesg = '
'.$langs->trans("FileTransferComplete").'
'; + setEventMessage($langs->trans("FileTransferComplete")); } else { $langs->load("errors"); if ($resupload < 0) // Unknown error { - $mesg = '
'.$langs->trans("ErrorFileNotUploaded").'
'; + setEventMessage($langs->trans("ErrorFileNotUploaded"), 'errors'); } else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus { - $mesg = '
'.$langs->trans("ErrorFileIsInfectedWithAVirus").'
'; + setEventMessage($langs->trans("ErrorFileIsInfectedWithAVirus"), 'errors'); } else // Known error { - $mesg = '
'.$langs->trans($resupload).'
'; + setEventMessage($langs->trans($resupload), 'errors'); } } } @@ -124,7 +124,9 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') $upload_dir = $conf->propal->dir_output . "/" . dol_sanitizeFileName($object->ref); $file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). - dol_delete_file($file,0,0,0,$object); + $ret=dol_delete_file($file,0,0,0,$object); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); exit; } @@ -186,11 +188,9 @@ if ($object->id > 0) print ''; - dol_htmloutput_mesg($mesg,$mesgs); - /* * Confirmation suppression fichier - */ + */ if ($action == 'delete') { $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&urlfile='.urlencode(GETPOST("urlfile")), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index a4014a6fa17..14560f448d7 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -121,7 +121,9 @@ else if ($action == 'confirm_deletefile' && $confirm == 'yes') $upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($object->ref); $file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). - dol_delete_file($file,0,0,0,$object); + $ret=dol_delete_file($file,0,0,0,$object); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); exit; } diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 3470eeeee1d..937e4a17790 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -1004,7 +1004,10 @@ else if ($action == 'remove_file') $langs->load("other"); $upload_dir = $conf->commande->dir_output; $file = $upload_dir . '/' . GETPOST('file'); - dol_delete_file($file,0,0,0,$object); + $ret=dol_delete_file($file,0,0,0,$object); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); + $action=''; } } diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 12d26ccf9bd..799fe8281d0 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1563,7 +1563,10 @@ else if ($action == 'remove_file') $langs->load("other"); $upload_dir = $conf->facture->dir_output; $file = $upload_dir . '/' . GETPOST('file'); - dol_delete_file($file,0,0,0,$object); + $ret=dol_delete_file($file,0,0,0,$object); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); + $action=''; } } diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index 35397aea1f7..1cada1c24f4 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -124,7 +124,9 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') $upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($object->ref); $file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). - dol_delete_file($file,0,0,0,$object); + $ret=dol_delete_file($file,0,0,0,$object); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); exit; } diff --git a/htdocs/compta/sociales/document.php b/htdocs/compta/sociales/document.php index 8050f3ba77e..591c253eb7f 100644 --- a/htdocs/compta/sociales/document.php +++ b/htdocs/compta/sociales/document.php @@ -128,7 +128,9 @@ if ($object->id) if ($action == 'delete') { $file = $upload_dir . '/' . GETPOST("urlfile"); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). - $result=dol_delete_file($file); + $ret=dol_delete_file($file); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); } $head=tax_prepare_head($object, $user); diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index f58f4d879f1..f8320c50fc2 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -121,7 +121,9 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') $langs->load("other"); $file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). - $ret=dol_delete_file($file,0,0,0,$object); + $ret=dol_delete_file($file,0,0,0,$object); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit; } diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 1fda6c56670..ef52e32d72f 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1006,6 +1006,11 @@ function dol_remove_file_process($filenb,$donotupdatesession=0,$donotdeletefile= else $result=0; if ($result >= 0) { + if (empty($donotdeletefile)) + { + $langs->load("other"); + setEventMessage($langs->trans("FileWasRemoved",$filetodelete)); + } if (empty($donotupdatesession)) { include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'); diff --git a/htdocs/document.php b/htdocs/document.php index 429ae2c53e8..a509bc3bd7c 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -499,7 +499,9 @@ if ($action == 'remove_file') // Remove a file exit; } - dol_delete_file($original_file); + $ret=dol_delete_file($original_file); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); dol_syslog("document.php back to ".urldecode($urlsource), LOG_DEBUG); diff --git a/htdocs/ecm/docmine.php b/htdocs/ecm/docmine.php index c5a98c23f31..ce83ab4a07a 100644 --- a/htdocs/ecm/docmine.php +++ b/htdocs/ecm/docmine.php @@ -110,7 +110,9 @@ if (GETPOST('action') == 'confirm_deletefile' && GETPOST('confirm') == 'yes') { $langs->load("other"); $file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). - $result=dol_delete_file($file); + $ret=dol_delete_file($file); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); $result=$ecmdir->changeNbOfFiles('-'); } diff --git a/htdocs/ecm/docother.php b/htdocs/ecm/docother.php index ca679993b22..47ca6920299 100644 --- a/htdocs/ecm/docother.php +++ b/htdocs/ecm/docother.php @@ -80,7 +80,9 @@ if ($_POST['action'] == 'confirm_deletefile' && $_POST['confirm'] == 'yes') { $langs->load("other"); $file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). - dol_delete_file($file); + $ret=dol_delete_file($file); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); } diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php index 4e78670c400..50617eadc70 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -165,7 +165,9 @@ if ($action == 'confirm_deletefile') $upload_dir = $conf->ecm->dir_output.'/'.$relativepath; $file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). - $result=dol_delete_file($file); + $ret=dol_delete_file($file); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); $result=$ecmdir->changeNbOfFiles('-'); diff --git a/htdocs/fichinter/document.php b/htdocs/fichinter/document.php index cd423cc7f68..3d2cc264909 100644 --- a/htdocs/fichinter/document.php +++ b/htdocs/fichinter/document.php @@ -120,7 +120,9 @@ else if ($action == 'confirm_deletefile' && $confirm == 'yes') $object->fetch_thirdparty(); $file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). - dol_delete_file($file,0,0,0,$object); + $ret=dol_delete_file($file,0,0,0,$object); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); exit; } diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index df699cba865..67319fa2b61 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -212,7 +212,9 @@ else if ($action == 'remove_file') $langs->load("other"); $upload_dir = $conf->ficheinter->dir_output; $file = $upload_dir . '/' . GETPOST('file'); - dol_delete_file($file,0,0,0,$object); + $ret=dol_delete_file($file,0,0,0,$object); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); } } diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php index c37fc310a6b..514318db01c 100644 --- a/htdocs/fourn/commande/document.php +++ b/htdocs/fourn/commande/document.php @@ -121,7 +121,9 @@ else if ($action == 'confirm_deletefile' && $confirm == 'yes') $langs->load("other"); $file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). - dol_delete_file($file,0,0,0,$object); + $ret=dol_delete_file($file,0,0,0,$object); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); exit; } diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 0572da65ca0..68f138d311f 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -614,7 +614,9 @@ else if ($action == 'remove_file' && $user->rights->fournisseur->commande->creer $langs->load("other"); $upload_dir = $conf->fournisseur->commande->dir_output; $file = $upload_dir . '/' . GETPOST('file'); - dol_delete_file($file,0,0,0,$object); + $ret=dol_delete_file($file,0,0,0,$object); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); } } diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php index 7de4ac0652c..b0306de50c1 100644 --- a/htdocs/fourn/facture/document.php +++ b/htdocs/fourn/facture/document.php @@ -123,7 +123,9 @@ if ($action=='delete') $upload_dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($facture->id,2).$ref; $file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). - dol_delete_file($file); + $ret=dol_delete_file($file); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); } } diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index dee76961f64..d11dfd57d68 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -829,7 +829,9 @@ elseif ($action == 'remove_file') { $upload_dir = $conf->fournisseur->facture->dir_output . "/"; $file = $upload_dir . '/' . GETPOST('file'); - dol_delete_file($file); + $ret=dol_delete_file($file); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); } } diff --git a/htdocs/product/document.php b/htdocs/product/document.php index 059843ab439..1f469b24574 100755 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -128,7 +128,9 @@ if ($object->id) if ($action=='delete') { $file = $upload_dir . '/' . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). - $result=dol_delete_file($file); + $ret=dol_delete_file($file); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); } $head=product_prepare_head($object, $user); diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index 653e0009b7b..f10616aeb75 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -114,7 +114,9 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->projet->s $langs->load("other"); $upload_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->ref); $file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). - dol_delete_file($file,0,0,0,$object); + $ret=dol_delete_file($file,0,0,0,$object); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit; } diff --git a/htdocs/projet/fiche.php b/htdocs/projet/fiche.php index be8d437dc53..0c72a4601bb 100644 --- a/htdocs/projet/fiche.php +++ b/htdocs/projet/fiche.php @@ -251,7 +251,9 @@ if ($action == 'remove_file' && $user->rights->projet->creer) $langs->load("other"); $upload_dir = $conf->projet->dir_output . "/"; $file = $upload_dir . '/' . GETPOST('file'); - dol_delete_file($file); + $ret=dol_delete_file($file); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); } } diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index 50f12148314..418e23d7033 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -111,7 +111,9 @@ if ($action=='delete') { $langs->load("other"); $file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). - dol_delete_file($file); + $ret=dol_delete_file($file); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); exit; } diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index bc63741bac1..1359215a979 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -123,7 +123,9 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') { $file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). - dol_delete_file($file,0,0,0,$object); + $ret=dol_delete_file($file,0,0,0,$object); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit; } diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index f77c4b65f79..5368a4341f8 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -462,7 +462,9 @@ if (empty($reshook)) $langs->load("other"); $upload_dir = $conf->societe->dir_output; $file = $upload_dir . '/' . GETPOST('file'); - dol_delete_file($file,0,0,0,$object); + $ret=dol_delete_file($file,0,0,0,$object); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); } } }