Fix: replace with new event message system

This commit is contained in:
Regis Houssin 2012-07-29 16:11:52 +02:00
parent 1591a5ac3b
commit a64723ea74
29 changed files with 147 additions and 175 deletions

View File

@ -68,7 +68,7 @@ $upload_dir = $conf->adherent->dir_output . "/" . get_exdir($id,2,0,1) . '/' . $
*/ */
// Envoie fichier // 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"); 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 // Used on menu or for setup page for example
$imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs"); $imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs");
} }
$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>'; setEventMessage($langs->trans("FileTransferComplete"));
} }
else else
{ {
$langs->load("errors"); $langs->load("errors");
if ($resupload < 0) // Unknown error if ($resupload < 0) // Unknown error
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>'; setEventMessage($langs->trans("ErrorFileNotUploaded"), 'errors');
} }
else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWithAVirus").'</div>'; setEventMessage($langs->trans("ErrorFileIsInfectedWithAVirus"), 'errors');
} }
else // Known error else // Known error
{ {
$mesg = '<div class="error">'.$langs->trans($resupload).'</div>'; setEventMessage($langs->trans($resupload), 'errors');
} }
} }
} }
@ -139,7 +139,9 @@ if ($id > 0)
/* /*
* Affichage onglets * Affichage onglets
*/ */
if ($conf->notification->enabled) $langs->load("mails"); if (! empty($conf->notification->enabled))
$langs->load("mails");
$head = member_prepare_head($member); $head = member_prepare_head($member);
$form=new Form($db); $form=new Form($db);
@ -210,8 +212,6 @@ if ($id > 0)
print '</div>'; print '</div>';
dol_htmloutput_mesg($mesg,$mesgs);
/* /*
* Confirmation suppression fichier * Confirmation suppression fichier
*/ */

View File

@ -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']); $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) if (is_numeric($resupload) && $resupload > 0)
{ {
$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>'; setEventMessage($langs->trans("FileTransferComplete"));
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'); include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php');
$formmail = new FormMail($db); $formmail = new FormMail($db);
@ -100,15 +100,15 @@ if (GETPOST('addfile') || GETPOST('addfilehtml'))
$langs->load("errors"); $langs->load("errors");
if ($resupload < 0) // Unknown error if ($resupload < 0) // Unknown error
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>'; setEventMessage($langs->trans("ErrorFileNotUploaded"), 'errors');
} }
else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWithAVirus").'</div>'; setEventMessage($langs->trans("ErrorFileIsInfectedWithAVirus"), 'errors');
} }
else // Known error else // Known error
{ {
$mesg = '<div class="error">'.$langs->trans($resupload).'</div>'; setEventMessage($langs->trans($resupload), 'errors');
} }
} }
} }

View File

@ -50,7 +50,7 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
if (is_numeric($resupload) && $resupload > 0) if (is_numeric($resupload) && $resupload > 0)
{ {
$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>'; setEventMessage($langs->trans("FileTransferComplete"));
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'); include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php');
$formmail = new FormMail($db); $formmail = new FormMail($db);
@ -61,7 +61,7 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
$langs->load("errors"); $langs->load("errors");
if ($resupload < 0) // Unknown error if ($resupload < 0) // Unknown error
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>'; setEventMessage($langs->trans("ErrorFileNotUploaded"), 'errors');
} }
else if (preg_match('/ErrorFileIsInfectedWithAVirus.(.*)/',$resupload,$reg)) // Files infected by a virus 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 else // Known error
{ {
$mesg = '<div class="error">'.$langs->trans($resupload).'</div>'; setEventMessage($langs->trans($resupload), 'errors');
} }
} }
} }

View File

@ -50,8 +50,8 @@ if (! $user->admin) accessforbidden();
if ($action == 'delete') if ($action == 'delete')
{ {
$file=$conf->admin->dir_output.'/backup/'.GETPOST('urlfile'); $file=$conf->admin->dir_output.'/backup/'.GETPOST('urlfile');
$ret=dol_delete_file($file, 1); $ret=dol_delete_file($file, 1);
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
$action=''; $action='';
} }

View File

@ -58,10 +58,10 @@ if ($file && ! $what)
if ($action == 'delete') if ($action == 'delete')
{ {
$file=$conf->admin->dir_output.'/backup/'.GETPOST('urlfile'); $file=$conf->admin->dir_output.'/backup/'.GETPOST('urlfile');
$ret=dol_delete_file($file, 1); $ret=dol_delete_file($file, 1);
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
$action=''; $action='';
} }

View File

@ -85,22 +85,22 @@ if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
// Used on menu or for setup page for example // Used on menu or for setup page for example
$imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs"); $imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs");
} }
$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>'; setEventMessage($langs->trans("FileTransferComplete"));
} }
else else
{ {
$langs->load("errors"); $langs->load("errors");
if ($resupload < 0) // Unknown error if ($resupload < 0) // Unknown error
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>'; setEventMessage($langs->trans("ErrorFileNotUploaded"), 'errors');
} }
else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWithAVirus").'</div>'; setEventMessage($langs->trans("ErrorFileIsInfectedWithAVirus"), 'errors');
} }
else // Known error else // Known error
{ {
$mesg = '<div class="error">'.$langs->trans($resupload).'</div>'; setEventMessage($langs->trans($resupload), 'errors');
} }
} }
} }
@ -112,10 +112,10 @@ if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
if ($action == 'delete') if ($action == 'delete')
{ {
$upload_dir = $conf->agenda->dir_output.'/'.dol_sanitizeFileName($objectid); $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). $file = $upload_dir . '/' . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
$ret=dol_delete_file($file); $ret=dol_delete_file($file);
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
$action=''; $action='';
} }
@ -291,8 +291,6 @@ if ($objectid > 0)
print '</div>'; print '</div>';
if ($mesg) { print $mesg."<br>"; }
// Affiche formulaire upload // Affiche formulaire upload
$formfile=new FormFile($db); $formfile=new FormFile($db);

View File

@ -272,12 +272,12 @@ else if ($action == 'add' && $user->rights->propale->creer)
header("Location: ".DOL_URL_ROOT.'/comm/addpropal.php?socid='.$socid.'&action=create'); header("Location: ".DOL_URL_ROOT.'/comm/addpropal.php?socid='.$socid.'&action=create');
exit; exit;
} }
if (empty($duration)) if (empty($duration))
{ {
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ValidityDuration")), 'errors'); setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ValidityDuration")), 'errors');
header("Location: ".DOL_URL_ROOT.'/comm/addpropal.php?socid='.$socid.'&action=create'); header("Location: ".DOL_URL_ROOT.'/comm/addpropal.php?socid='.$socid.'&action=create');
exit; exit;
} }
if (! $error) if (! $error)
{ {
@ -913,8 +913,8 @@ else if ($action == 'remove_file' && $user->rights->propale->creer)
$langs->load("other"); $langs->load("other");
$upload_dir = $conf->propal->dir_output; $upload_dir = $conf->propal->dir_output;
$file = $upload_dir . '/' . GETPOST('file'); $file = $upload_dir . '/' . GETPOST('file');
$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'))); if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
} }
} }

View File

@ -89,22 +89,22 @@ if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
// Used on menu or for setup page for example // Used on menu or for setup page for example
$imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs"); $imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs");
} }
$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>'; setEventMessage($langs->trans("FileTransferComplete"));
} }
else else
{ {
$langs->load("errors"); $langs->load("errors");
if ($resupload < 0) // Unknown error if ($resupload < 0) // Unknown error
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>'; setEventMessage($langs->trans("ErrorFileNotUploaded"), 'errors');
} }
else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWithAVirus").'</div>'; setEventMessage($langs->trans("ErrorFileIsInfectedWithAVirus"), 'errors');
} }
else // Known error else // Known error
{ {
$mesg = '<div class="error">'.$langs->trans($resupload).'</div>'; 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); $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). $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'))); if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
exit; exit;
@ -174,8 +174,6 @@ if ($id > 0 || ! empty($ref))
print "</table>\n"; print "</table>\n";
print "</div>\n"; print "</div>\n";
dol_htmloutput_mesg($mesg,$mesgs);
/* /*
* Confirmation suppression fichier * Confirmation suppression fichier
*/ */

View File

@ -1004,9 +1004,9 @@ else if ($action == 'remove_file')
$langs->load("other"); $langs->load("other");
$upload_dir = $conf->commande->dir_output; $upload_dir = $conf->commande->dir_output;
$file = $upload_dir . '/' . GETPOST('file'); $file = $upload_dir . '/' . GETPOST('file');
$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'))); if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
$action=''; $action='';
} }
} }

View File

@ -1563,9 +1563,9 @@ else if ($action == 'remove_file')
$langs->load("other"); $langs->load("other");
$upload_dir = $conf->facture->dir_output; $upload_dir = $conf->facture->dir_output;
$file = $upload_dir . '/' . GETPOST('file'); $file = $upload_dir . '/' . GETPOST('file');
$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'))); if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
$action=''; $action='';
} }
} }

View File

@ -92,22 +92,22 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
// Used on menu or for setup page for example // Used on menu or for setup page for example
$imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs"); $imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs");
} }
$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>'; setEventMessage($langs->trans("FileTransferComplete"));
} }
else else
{ {
$langs->load("errors"); $langs->load("errors");
if ($resupload < 0) // Unknown error if ($resupload < 0) // Unknown error
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>'; setEventMessage($langs->trans("ErrorFileNotUploaded"), 'errors');
} }
else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWithAVirus").'</div>'; setEventMessage($langs->trans("ErrorFileIsInfectedWithAVirus"), 'errors');
} }
else // Known error else // Known error
{ {
$mesg = '<div class="error">'.$langs->trans($resupload).'</div>'; 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); $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). $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'))); if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
exit; exit;
@ -204,8 +204,6 @@ if ($id > 0 || ! empty($ref))
print "</table>\n"; print "</table>\n";
print "</div>\n"; print "</div>\n";
dol_htmloutput_mesg($mesg,$mesgs);
/* /*
* Confirmation suppression fichier * Confirmation suppression fichier
*/ */

View File

@ -87,22 +87,22 @@ if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC))
// Used on menu or for setup page for example // Used on menu or for setup page for example
$imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs"); $imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs");
} }
$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>'; setEventMessage($langs->trans("FileTransferComplete"));
} }
else else
{ {
$langs->load("errors"); $langs->load("errors");
if ($resupload < 0) // Unknown error if ($resupload < 0) // Unknown error
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>'; setEventMessage($langs->trans("ErrorFileNotUploaded"), 'errors');
} }
else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWithAVirus").'</div>'; setEventMessage($langs->trans("ErrorFileIsInfectedWithAVirus"), 'errors');
} }
else // Known error else // Known error
{ {
$mesg = '<div class="error">'.$langs->trans($resupload).'</div>'; setEventMessage($langs->trans($resupload), 'errors');
} }
} }
} }
@ -120,16 +120,11 @@ llxHeader("",$langs->trans("SocialContribution"),$help_url);
if ($object->id) if ($object->id)
{ {
if ( $error_msg )
{
echo '<div class="error">'.$error_msg.'</div><br>';
}
if ($action == 'delete') if ($action == 'delete')
{ {
$file = $upload_dir . '/' . GETPOST("urlfile"); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). $file = $upload_dir . '/' . GETPOST("urlfile"); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
$ret=dol_delete_file($file); $ret=dol_delete_file($file);
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
} }

View File

@ -92,22 +92,22 @@ if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
// Used on menu or for setup page for example // Used on menu or for setup page for example
$imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs"); $imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs");
} }
$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>'; setEventMessage($langs->trans("FileTransferComplete"));
} }
else else
{ {
$langs->load("errors"); $langs->load("errors");
if ($resupload < 0) // Unknown error if ($resupload < 0) // Unknown error
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>'; setEventMessage($langs->trans("ErrorFileNotUploaded"), 'errors');
} }
else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWithAVirus").'</div>'; setEventMessage($langs->trans("ErrorFileIsInfectedWithAVirus"), 'errors');
} }
else // Known error else // Known error
{ {
$mesg = '<div class="error">'.$langs->trans($resupload).'</div>'; setEventMessage($langs->trans($resupload), 'errors');
} }
} }
} }
@ -121,8 +121,8 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
$langs->load("other"); $langs->load("other");
$file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). $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'))); if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
exit; exit;
@ -172,8 +172,6 @@ if ($object->id)
print '</div>'; print '</div>';
dol_htmloutput_mesg($mesg,$mesgs);
/* /*
* Confirmation suppression fichier * Confirmation suppression fichier
*/ */

View File

@ -85,15 +85,15 @@ if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC))
$langs->load("errors"); $langs->load("errors");
if ($resupload < 0) // Unknown error if ($resupload < 0) // Unknown error
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>'; setEventMessage($langs->trans("ErrorFileNotUploaded"), 'errors');
} }
else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWithAVirus").'</div>'; setEventMessage($langs->trans("ErrorFileIsInfectedWithAVirus"), 'errors');
} }
else // Known error else // Known error
{ {
$mesg = '<div class="error">'.$langs->trans($resupload).'</div>'; setEventMessage($langs->trans($resupload), 'errors');
} }
} }
} }
@ -110,8 +110,8 @@ if (GETPOST('action') == 'confirm_deletefile' && GETPOST('confirm') == 'yes')
{ {
$langs->load("other"); $langs->load("other");
$file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). $file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
$ret=dol_delete_file($file); $ret=dol_delete_file($file);
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
$result=$ecmdir->changeNbOfFiles('-'); $result=$ecmdir->changeNbOfFiles('-');

View File

@ -55,15 +55,15 @@ if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
$langs->load("errors"); $langs->load("errors");
if ($resupload < 0) // Unknown error if ($resupload < 0) // Unknown error
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>'; setEventMessage($langs->trans("ErrorFileNotUploaded"), 'errors');
} }
else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWithAVirus").'</div>'; setEventMessage($langs->trans("ErrorFileIsInfectedWithAVirus"), 'errors');
} }
else // Known error else // Known error
{ {
$mesg = '<div class="error">'.$langs->trans($resupload).'</div>'; setEventMessage($langs->trans($resupload), 'errors');
} }
} }
} }
@ -80,8 +80,8 @@ if ($_POST['action'] == 'confirm_deletefile' && $_POST['confirm'] == 'yes')
{ {
$langs->load("other"); $langs->load("other");
$file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). $file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
$ret=dol_delete_file($file); $ret=dol_delete_file($file);
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
} }

View File

@ -106,15 +106,15 @@ if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC))
$langs->load("errors"); $langs->load("errors");
if ($resupload < 0) // Unknown error if ($resupload < 0) // Unknown error
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>'; setEventMessage($langs->trans("ErrorFileNotUploaded"), 'errors');
} }
else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWithAVirus").'</div>'; setEventMessage($langs->trans("ErrorFileIsInfectedWithAVirus"), 'errors');
} }
else // Known error else // Known error
{ {
$mesg = '<div class="error">'.$langs->trans($resupload).'</div>'; setEventMessage($langs->trans($resupload), 'errors');
} }
} }
} }
@ -165,8 +165,8 @@ if ($action == 'confirm_deletefile')
$upload_dir = $conf->ecm->dir_output.'/'.$relativepath; $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). $file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
$ret=dol_delete_file($file); $ret=dol_delete_file($file);
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
$result=$ecmdir->changeNbOfFiles('-'); $result=$ecmdir->changeNbOfFiles('-');

View File

@ -90,22 +90,22 @@ if (GETPOST('sendit','alpha') && ! empty($conf->global->MAIN_UPLOAD_DOC))
// Used on menu or for setup page for example // Used on menu or for setup page for example
$imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs"); $imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs");
} }
$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>'; setEventMessage($langs->trans("FileTransferComplete"));
} }
else else
{ {
$langs->load("errors"); $langs->load("errors");
if ($resupload < 0) // Unknown error if ($resupload < 0) // Unknown error
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>'; setEventMessage($langs->trans("ErrorFileNotUploaded"), 'errors');
} }
else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWithAVirus").'</div>'; setEventMessage($langs->trans("ErrorFileIsInfectedWithAVirus"), 'errors');
} }
else // Known error else // Known error
{ {
$mesg = '<div class="error">'.$langs->trans($resupload).'</div>'; setEventMessage($langs->trans($resupload), 'errors');
} }
} }
} }
@ -120,8 +120,8 @@ else if ($action == 'confirm_deletefile' && $confirm == 'yes')
$object->fetch_thirdparty(); $object->fetch_thirdparty();
$file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). $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'))); if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
exit; exit;
@ -174,8 +174,6 @@ if ($object->id)
print '</div>'; print '</div>';
dol_htmloutput_mesg($mesg,$mesgs);
/* /*
* Confirmation suppression fichier * Confirmation suppression fichier
*/ */

View File

@ -212,8 +212,8 @@ else if ($action == 'remove_file')
$langs->load("other"); $langs->load("other");
$upload_dir = $conf->ficheinter->dir_output; $upload_dir = $conf->ficheinter->dir_output;
$file = $upload_dir . '/' . GETPOST('file'); $file = $upload_dir . '/' . GETPOST('file');
$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'))); if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
} }
} }

View File

@ -93,22 +93,22 @@ if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
// Used on menu or for setup page for example // Used on menu or for setup page for example
$imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs"); $imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs");
} }
$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>'; setEventMessage($langs->trans("FileTransferComplete"));
} }
else else
{ {
$langs->load("errors"); $langs->load("errors");
if ($resupload < 0) // Unknown error if ($resupload < 0) // Unknown error
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>'; setEventMessage($langs->trans("ErrorFileNotUploaded"), 'errors');
} }
else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWithAVirus").'</div>'; setEventMessage($langs->trans("ErrorFileIsInfectedWithAVirus"), 'errors');
} }
else // Known error else // Known error
{ {
$mesg = '<div class="error">'.$langs->trans($resupload).'</div>'; setEventMessage($langs->trans($resupload), 'errors');
} }
} }
} }
@ -121,8 +121,8 @@ else if ($action == 'confirm_deletefile' && $confirm == 'yes')
$langs->load("other"); $langs->load("other");
$file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). $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'))); if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
exit; exit;
@ -207,8 +207,6 @@ if ($object->id > 0)
print "</div>\n"; print "</div>\n";
dol_htmloutput_mesg($mesg,$mesgs);
/* /*
* Confirmation suppression fichier * Confirmation suppression fichier
*/ */

View File

@ -614,8 +614,8 @@ else if ($action == 'remove_file' && $user->rights->fournisseur->commande->creer
$langs->load("other"); $langs->load("other");
$upload_dir = $conf->fournisseur->commande->dir_output; $upload_dir = $conf->fournisseur->commande->dir_output;
$file = $upload_dir . '/' . GETPOST('file'); $file = $upload_dir . '/' . GETPOST('file');
$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'))); if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
} }
} }

View File

@ -88,22 +88,22 @@ if ($_POST['sendit'] && ! empty($conf->global->MAIN_UPLOAD_DOC))
// Used on menu or for setup page for example // Used on menu or for setup page for example
$imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs"); $imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs");
} }
$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>'; setEventMessage($langs->trans("FileTransferComplete"));
} }
else else
{ {
$langs->load("errors"); $langs->load("errors");
if ($resupload < 0) // Unknown error if ($resupload < 0) // Unknown error
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>'; setEventMessage($langs->trans("ErrorFileNotUploaded"), 'errors');
} }
else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWithAVirus").'</div>'; setEventMessage($langs->trans("ErrorFileIsInfectedWithAVirus"), 'errors');
} }
else // Known error else // Known error
{ {
$mesg = '<div class="error">'.$langs->trans($resupload).'</div>'; 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; $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). $file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
$ret=dol_delete_file($file); $ret=dol_delete_file($file);
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
} }
} }
@ -238,10 +238,6 @@ if ($facid > 0)
print '</table>'; print '</table>';
print '</div>'; print '</div>';
dol_htmloutput_mesg($mesg);
// Affiche formulaire upload // Affiche formulaire upload
$formfile=new FormFile($db); $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); $formfile->form_attach_new_file(DOL_URL_ROOT.'/fourn/facture/document.php?facid='.$object->id,'',0,0,$user->rights->fournisseur->facture->creer,50,$object);

View File

@ -829,8 +829,8 @@ elseif ($action == 'remove_file')
{ {
$upload_dir = $conf->fournisseur->facture->dir_output . "/"; $upload_dir = $conf->fournisseur->facture->dir_output . "/";
$file = $upload_dir . '/' . GETPOST('file'); $file = $upload_dir . '/' . GETPOST('file');
$ret=dol_delete_file($file); $ret=dol_delete_file($file);
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
} }
} }

View File

@ -106,15 +106,15 @@ if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
$langs->load("errors"); $langs->load("errors");
if ($resupload < 0) // Unknown error if ($resupload < 0) // Unknown error
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>'; setEventMessage($langs->trans("ErrorFileNotUploaded"), 'errors');
} }
else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWithAVirus").'</div>'; setEventMessage($langs->trans("ErrorFileIsInfectedWithAVirus"), 'errors');
} }
else // Known error else // Known error
{ {
$mesg = '<div class="error">'.$langs->trans($resupload).'</div>'; setEventMessage($langs->trans($resupload), 'errors');
} }
} }
} }

View File

@ -88,27 +88,39 @@ if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
// Used on menu or for setup page for example // Used on menu or for setup page for example
$imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs"); $imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs");
} }
$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>'; setEventMessage($langs->trans("FileTransferComplete"));
} }
else else
{ {
$langs->load("errors"); $langs->load("errors");
if ($resupload < 0) // Unknown error if ($resupload < 0) // Unknown error
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>'; setEventMessage($langs->trans("ErrorFileNotUploaded"), 'errors');
} }
else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWithAVirus").'</div>'; setEventMessage($langs->trans("ErrorFileIsInfectedWithAVirus"), 'errors');
} }
else // Known error else // Known error
{ {
$mesg = '<div class="error">'.$langs->trans($resupload).'</div>'; 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 * View
@ -121,18 +133,6 @@ llxHeader("","",$langs->trans("CardProduct".$object->type));
if ($object->id) 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); $head=product_prepare_head($object, $user);
$titre=$langs->trans("CardProduct".$object->type); $titre=$langs->trans("CardProduct".$object->type);
$picto=($object->type==1?'service':'product'); $picto=($object->type==1?'service':'product');

View File

@ -87,22 +87,22 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
// Used on menu or for setup page for example // Used on menu or for setup page for example
$imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs"); $imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs");
} }
$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>'; setEventMessage($langs->trans("FileTransferComplete"));
} }
else else
{ {
$langs->load("errors"); $langs->load("errors");
if ($resupload < 0) // Unknown error if ($resupload < 0) // Unknown error
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>'; setEventMessage($langs->trans("ErrorFileNotUploaded"), 'errors');
} }
else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWithAVirus").'</div>'; setEventMessage($langs->trans("ErrorFileIsInfectedWithAVirus"), 'errors');
} }
else // Known error else // Known error
{ {
$mesg = '<div class="error">'.$langs->trans($resupload).'</div>'; setEventMessage($langs->trans($resupload), 'errors');
} }
} }
} }
@ -114,8 +114,8 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->projet->s
$langs->load("other"); $langs->load("other");
$upload_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->ref); $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). $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'))); if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
exit; exit;
@ -199,9 +199,6 @@ if ($object->id > 0)
print "</table>\n"; print "</table>\n";
print "</div>\n"; print "</div>\n";
dol_htmloutput_mesg($mesg);
// Affiche formulaire upload // Affiche formulaire upload
$formfile=new FormFile($db); $formfile=new FormFile($db);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/projet/document.php?id='.$object->id,'',0,0,($userWrite>0),50,$object); $formfile->form_attach_new_file(DOL_URL_ROOT.'/projet/document.php?id='.$object->id,'',0,0,($userWrite>0),50,$object);

View File

@ -251,8 +251,8 @@ if ($action == 'remove_file' && $user->rights->projet->creer)
$langs->load("other"); $langs->load("other");
$upload_dir = $conf->projet->dir_output . "/"; $upload_dir = $conf->projet->dir_output . "/";
$file = $upload_dir . '/' . GETPOST('file'); $file = $upload_dir . '/' . GETPOST('file');
$ret=dol_delete_file($file); $ret=dol_delete_file($file);
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
} }
} }

View File

@ -85,22 +85,22 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
// Used on menu or for setup page for example // Used on menu or for setup page for example
$imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs"); $imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs");
} }
$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>'; setEventMessage($langs->trans("FileTransferComplete"));
} }
else else
{ {
$langs->load("errors"); $langs->load("errors");
if ($resupload < 0) // Unknown error if ($resupload < 0) // Unknown error
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>'; setEventMessage($langs->trans("ErrorFileNotUploaded"), 'errors');
} }
else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWithAVirus").'</div>'; setEventMessage($langs->trans("ErrorFileIsInfectedWithAVirus"), 'errors');
} }
else // Known error else // Known error
{ {
$mesg = '<div class="error">'.$langs->trans($resupload).'</div>'; setEventMessage($langs->trans($resupload), 'errors');
} }
} }
} }
@ -111,8 +111,8 @@ if ($action=='delete')
{ {
$langs->load("other"); $langs->load("other");
$file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). $file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
$ret=dol_delete_file($file); $ret=dol_delete_file($file);
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
exit; exit;
@ -271,8 +271,6 @@ if ($object->id > 0)
print '<br>'; print '<br>';
dol_htmloutput_mesg($mesg);
// Affiche formulaire upload // Affiche formulaire upload
$formfile=new FormFile($db); $formfile=new FormFile($db);

View File

@ -94,22 +94,22 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
// Used on menu or for setup page for example // Used on menu or for setup page for example
$imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs"); $imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs");
} }
$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>'; setEventMessage($langs->trans("FileTransferComplete"));
} }
else else
{ {
$langs->load("errors"); $langs->load("errors");
if (is_numeric($resupload) && $resupload < 0) // Unknown error if (is_numeric($resupload) && $resupload < 0) // Unknown error
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>'; setEventMessage($langs->trans("ErrorFileNotUploaded"), 'errors');
} }
else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWithAVirus").'</div>'; setEventMessage($langs->trans("ErrorFileIsInfectedWithAVirus"), 'errors');
} }
else // Known error else // Known error
{ {
$mesg = '<div class="error">'.$langs->trans($resupload).'</div>'; 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). $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'))); if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
exit; exit;
@ -205,8 +205,6 @@ if ($object->id)
print '</div>'; print '</div>';
dol_htmloutput_mesg($mesg,$mesgs);
/* /*
* Confirmation suppression fichier * Confirmation suppression fichier
*/ */

View File

@ -462,8 +462,8 @@ if (empty($reshook))
$langs->load("other"); $langs->load("other");
$upload_dir = $conf->societe->dir_output; $upload_dir = $conf->societe->dir_output;
$file = $upload_dir . '/' . GETPOST('file'); $file = $upload_dir . '/' . GETPOST('file');
$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'))); if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
} }
} }