From a64723ea74308edf3740d83fd90c341af177f178 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 29 Jul 2012 16:11:52 +0200 Subject: [PATCH] Fix: replace with new event message system --- htdocs/adherents/document.php | 16 ++++++------- htdocs/admin/mails.php | 8 +++---- htdocs/admin/security_other.php | 6 ++--- htdocs/admin/tools/dolibarr_export.php | 4 ++-- htdocs/admin/tools/export.php | 8 +++---- htdocs/comm/action/document.php | 18 +++++++-------- htdocs/comm/propal.php | 16 ++++++------- htdocs/commande/document.php | 14 +++++------ htdocs/commande/fiche.php | 6 ++--- htdocs/compta/facture.php | 6 ++--- htdocs/compta/facture/document.php | 14 +++++------ htdocs/compta/sociales/document.php | 17 +++++--------- htdocs/contrat/document.php | 14 +++++------ htdocs/ecm/docmine.php | 10 ++++---- htdocs/ecm/docother.php | 10 ++++---- htdocs/ecm/index.php | 10 ++++---- htdocs/fichinter/document.php | 14 +++++------ htdocs/fichinter/fiche.php | 4 ++-- htdocs/fourn/commande/document.php | 14 +++++------ htdocs/fourn/commande/fiche.php | 4 ++-- htdocs/fourn/facture/document.php | 16 +++++-------- htdocs/fourn/facture/fiche.php | 4 ++-- htdocs/ftp/index.php | 6 ++--- htdocs/product/document.php | 32 +++++++++++++------------- htdocs/projet/document.php | 15 +++++------- htdocs/projet/fiche.php | 4 ++-- htdocs/projet/tasks/document.php | 14 +++++------ htdocs/societe/document.php | 14 +++++------ htdocs/societe/soc.php | 4 ++-- 29 files changed, 147 insertions(+), 175 deletions(-) diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php index 7c40de27240..2fb69913ace 100644 --- a/htdocs/adherents/document.php +++ b/htdocs/adherents/document.php @@ -68,7 +68,7 @@ $upload_dir = $conf->adherent->dir_output . "/" . get_exdir($id,2,0,1) . '/' . $ */ // Envoie fichier -if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) +if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) { require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); @@ -86,22 +86,22 @@ if ($_POST["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'); } } } @@ -139,7 +139,9 @@ if ($id > 0) /* * Affichage onglets */ - if ($conf->notification->enabled) $langs->load("mails"); + if (! empty($conf->notification->enabled)) + $langs->load("mails"); + $head = member_prepare_head($member); $form=new Form($db); @@ -210,8 +212,6 @@ if ($id > 0) print ''; - dol_htmloutput_mesg($mesg,$mesgs); - /* * Confirmation suppression fichier */ diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 52b655d55a5..06438f3ef90 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -89,7 +89,7 @@ if (GETPOST('addfile') || GETPOST('addfilehtml')) $resupload=dol_move_uploaded_file($_FILES['addedfile']['tmp_name'], $upload_dir . "/" . $_FILES['addedfile']['name'], 1, 0, $_FILES['addedfile']['error']); if (is_numeric($resupload) && $resupload > 0) { - $mesg = '
'.$langs->trans("FileTransferComplete").'
'; + setEventMessage($langs->trans("FileTransferComplete")); include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'); $formmail = new FormMail($db); @@ -100,15 +100,15 @@ if (GETPOST('addfile') || GETPOST('addfilehtml')) $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'); } } } diff --git a/htdocs/admin/security_other.php b/htdocs/admin/security_other.php index 90d22c46def..0ff71e128c0 100644 --- a/htdocs/admin/security_other.php +++ b/htdocs/admin/security_other.php @@ -50,7 +50,7 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) if (is_numeric($resupload) && $resupload > 0) { - $mesg = '
'.$langs->trans("FileTransferComplete").'
'; + setEventMessage($langs->trans("FileTransferComplete")); include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'); $formmail = new FormMail($db); @@ -61,7 +61,7 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) $langs->load("errors"); if ($resupload < 0) // Unknown error { - $mesg = '
'.$langs->trans("ErrorFileNotUploaded").'
'; + setEventMessage($langs->trans("ErrorFileNotUploaded"), 'errors'); } else if (preg_match('/ErrorFileIsInfectedWithAVirus.(.*)/',$resupload,$reg)) // Files infected by a virus { @@ -71,7 +71,7 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) } else // Known error { - $mesg = '
'.$langs->trans($resupload).'
'; + setEventMessage($langs->trans($resupload), 'errors'); } } } diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 2fc0c5c81d0..e7442679c4d 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -50,8 +50,8 @@ if (! $user->admin) accessforbidden(); if ($action == 'delete') { $file=$conf->admin->dir_output.'/backup/'.GETPOST('urlfile'); - $ret=dol_delete_file($file, 1); - if ($ret) setEventMessage($langs->trans("FileWasRemoved", 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 3c37b128dfd..602f57d2e36 100644 --- a/htdocs/admin/tools/export.php +++ b/htdocs/admin/tools/export.php @@ -58,10 +58,10 @@ if ($file && ! $what) if ($action == 'delete') { - $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'); + $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 ca050dbd115..38728043e6c 100755 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -85,22 +85,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'); } } } @@ -112,10 +112,10 @@ if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) 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). - $ret=dol_delete_file($file); - if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); - else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); + $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=''; } @@ -291,8 +291,6 @@ if ($objectid > 0) print ''; - if ($mesg) { print $mesg."
"; } - // Affiche formulaire upload $formfile=new FormFile($db); diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 4bd659601e0..a64a166d7af 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -272,12 +272,12 @@ else if ($action == 'add' && $user->rights->propale->creer) header("Location: ".DOL_URL_ROOT.'/comm/addpropal.php?socid='.$socid.'&action=create'); exit; } - if (empty($duration)) - { - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ValidityDuration")), 'errors'); - header("Location: ".DOL_URL_ROOT.'/comm/addpropal.php?socid='.$socid.'&action=create'); - exit; - } + if (empty($duration)) + { + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ValidityDuration")), 'errors'); + header("Location: ".DOL_URL_ROOT.'/comm/addpropal.php?socid='.$socid.'&action=create'); + exit; + } if (! $error) { @@ -913,8 +913,8 @@ else if ($action == 'remove_file' && $user->rights->propale->creer) $langs->load("other"); $upload_dir = $conf->propal->dir_output; $file = $upload_dir . '/' . GETPOST('file'); - $ret=dol_delete_file($file,0,0,0,$object); - if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + $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/commande/document.php b/htdocs/commande/document.php index 14560f448d7..0bccb1286b9 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -89,22 +89,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'); } } } @@ -121,8 +121,8 @@ 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). - $ret=dol_delete_file($file,0,0,0,$object); - if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + $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; @@ -174,8 +174,6 @@ if ($id > 0 || ! empty($ref)) print "\n"; print "\n"; - dol_htmloutput_mesg($mesg,$mesgs); - /* * Confirmation suppression fichier */ diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 6aad0512334..9a0ec025a95 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -1004,9 +1004,9 @@ else if ($action == 'remove_file') $langs->load("other"); $upload_dir = $conf->commande->dir_output; $file = $upload_dir . '/' . GETPOST('file'); - $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'); + $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 799fe8281d0..1894ef9e5f6 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1563,9 +1563,9 @@ else if ($action == 'remove_file') $langs->load("other"); $upload_dir = $conf->facture->dir_output; $file = $upload_dir . '/' . GETPOST('file'); - $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'); + $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 1cada1c24f4..52293e71ccf 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -92,22 +92,22 @@ if ($_POST["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,8 +124,8 @@ 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). - $ret=dol_delete_file($file,0,0,0,$object); - if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + $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; @@ -204,8 +204,6 @@ if ($id > 0 || ! empty($ref)) print "\n"; print "\n"; - dol_htmloutput_mesg($mesg,$mesgs); - /* * Confirmation suppression fichier */ diff --git a/htdocs/compta/sociales/document.php b/htdocs/compta/sociales/document.php index 591c253eb7f..937bb51bb31 100644 --- a/htdocs/compta/sociales/document.php +++ b/htdocs/compta/sociales/document.php @@ -87,22 +87,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'); } } } @@ -120,16 +120,11 @@ llxHeader("",$langs->trans("SocialContribution"),$help_url); if ($object->id) { - if ( $error_msg ) - { - echo '
'.$error_msg.'

'; - } - if ($action == 'delete') { $file = $upload_dir . '/' . GETPOST("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'))); + $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/contrat/document.php b/htdocs/contrat/document.php index f8320c50fc2..d9a26cc6222 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -92,22 +92,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'); } } } @@ -121,8 +121,8 @@ 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); - if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + $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; @@ -172,8 +172,6 @@ if ($object->id) print ''; - dol_htmloutput_mesg($mesg,$mesgs); - /* * Confirmation suppression fichier */ diff --git a/htdocs/ecm/docmine.php b/htdocs/ecm/docmine.php index ce83ab4a07a..b31e5bcbd26 100644 --- a/htdocs/ecm/docmine.php +++ b/htdocs/ecm/docmine.php @@ -85,15 +85,15 @@ if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC)) $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'); } } } @@ -110,8 +110,8 @@ 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). - $ret=dol_delete_file($file); - if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + $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 47ca6920299..2f91b981124 100644 --- a/htdocs/ecm/docother.php +++ b/htdocs/ecm/docother.php @@ -55,15 +55,15 @@ if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) $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'); } } } @@ -80,8 +80,8 @@ 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). - $ret=dol_delete_file($file); - if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + $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 50617eadc70..1b2fb5a5d2e 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -106,15 +106,15 @@ if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC)) $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'); } } } @@ -165,8 +165,8 @@ 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). - $ret=dol_delete_file($file); - if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + $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 3d2cc264909..3380984c17b 100644 --- a/htdocs/fichinter/document.php +++ b/htdocs/fichinter/document.php @@ -90,22 +90,22 @@ if (GETPOST('sendit','alpha') && ! 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'); } } } @@ -120,8 +120,8 @@ 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). - $ret=dol_delete_file($file,0,0,0,$object); - if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + $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; @@ -174,8 +174,6 @@ if ($object->id) print ''; - dol_htmloutput_mesg($mesg,$mesgs); - /* * Confirmation suppression fichier */ diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index 67319fa2b61..559d89da0ae 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -212,8 +212,8 @@ else if ($action == 'remove_file') $langs->load("other"); $upload_dir = $conf->ficheinter->dir_output; $file = $upload_dir . '/' . GETPOST('file'); - $ret=dol_delete_file($file,0,0,0,$object); - if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + $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 514318db01c..b8c35d1fda3 100644 --- a/htdocs/fourn/commande/document.php +++ b/htdocs/fourn/commande/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'); } } } @@ -121,8 +121,8 @@ 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). - $ret=dol_delete_file($file,0,0,0,$object); - if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + $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; @@ -207,8 +207,6 @@ if ($object->id > 0) print "\n"; - dol_htmloutput_mesg($mesg,$mesgs); - /* * Confirmation suppression fichier */ diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 68f138d311f..613d7272a75 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -614,8 +614,8 @@ 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'); - $ret=dol_delete_file($file,0,0,0,$object); - if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + $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 b0306de50c1..a494f6aea8c 100644 --- a/htdocs/fourn/facture/document.php +++ b/htdocs/fourn/facture/document.php @@ -88,22 +88,22 @@ if ($_POST['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'); } } } @@ -123,8 +123,8 @@ 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). - $ret=dol_delete_file($file); - if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + $ret=dol_delete_file($file); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); } } @@ -238,10 +238,6 @@ if ($facid > 0) print ''; print ''; - - dol_htmloutput_mesg($mesg); - - // Affiche formulaire upload $formfile=new FormFile($db); $formfile->form_attach_new_file(DOL_URL_ROOT.'/fourn/facture/document.php?facid='.$object->id,'',0,0,$user->rights->fournisseur->facture->creer,50,$object); diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index d11dfd57d68..2bb9907be29 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -829,8 +829,8 @@ elseif ($action == 'remove_file') { $upload_dir = $conf->fournisseur->facture->dir_output . "/"; $file = $upload_dir . '/' . GETPOST('file'); - $ret=dol_delete_file($file); - if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + $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/ftp/index.php b/htdocs/ftp/index.php index cd356d91b26..d1acf7982b9 100644 --- a/htdocs/ftp/index.php +++ b/htdocs/ftp/index.php @@ -106,15 +106,15 @@ if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) $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'); } } } diff --git a/htdocs/product/document.php b/htdocs/product/document.php index 1f469b24574..502a4a54f1f 100755 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -88,27 +88,39 @@ 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'); } } } } +// Delete +if ($action=='delete') +{ + $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); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); + Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); + exit; +} + /* * View @@ -121,18 +133,6 @@ llxHeader("","",$langs->trans("CardProduct".$object->type)); if ($object->id) { - if (! empty($mesg)) { - dol_htmloutput_mesg($mesg); - } - - if ($action=='delete') - { - $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'); - } - $head=product_prepare_head($object, $user); $titre=$langs->trans("CardProduct".$object->type); $picto=($object->type==1?'service':'product'); diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index f10616aeb75..a651796bc6f 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -87,22 +87,22 @@ if ($_POST["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'); } } } @@ -114,8 +114,8 @@ 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). - $ret=dol_delete_file($file,0,0,0,$object); - if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + $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; @@ -199,9 +199,6 @@ if ($object->id > 0) print "\n"; print "\n"; - dol_htmloutput_mesg($mesg); - - // Affiche formulaire upload $formfile=new FormFile($db); $formfile->form_attach_new_file(DOL_URL_ROOT.'/projet/document.php?id='.$object->id,'',0,0,($userWrite>0),50,$object); diff --git a/htdocs/projet/fiche.php b/htdocs/projet/fiche.php index 0c72a4601bb..f5ea9ef0426 100644 --- a/htdocs/projet/fiche.php +++ b/htdocs/projet/fiche.php @@ -251,8 +251,8 @@ if ($action == 'remove_file' && $user->rights->projet->creer) $langs->load("other"); $upload_dir = $conf->projet->dir_output . "/"; $file = $upload_dir . '/' . GETPOST('file'); - $ret=dol_delete_file($file); - if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + $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 418e23d7033..f8e58ff4fe3 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -85,22 +85,22 @@ if ($_POST["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'); } } } @@ -111,8 +111,8 @@ if ($action=='delete') { $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); - if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + $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; @@ -271,8 +271,6 @@ if ($object->id > 0) print '
'; - dol_htmloutput_mesg($mesg); - // Affiche formulaire upload $formfile=new FormFile($db); diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index 1359215a979..dfe8dd9ddb3 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -94,22 +94,22 @@ if ($_POST["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 (is_numeric($resupload) && $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'); } } } @@ -123,8 +123,8 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') { $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); - if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + $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; @@ -205,8 +205,6 @@ if ($object->id) print ''; - dol_htmloutput_mesg($mesg,$mesgs); - /* * Confirmation suppression fichier */ diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 5368a4341f8..63eafdbc72e 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -462,8 +462,8 @@ if (empty($reshook)) $langs->load("other"); $upload_dir = $conf->societe->dir_output; $file = $upload_dir . '/' . GETPOST('file'); - $ret=dol_delete_file($file,0,0,0,$object); - if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + $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'); } }