[Qual] Uniformize code

This commit is contained in:
philippe grand 2015-11-21 17:38:09 +01:00
parent 55bab28b9c
commit e78794cab2
5 changed files with 37 additions and 37 deletions

View File

@ -117,18 +117,18 @@ if ($action == 'add' && $user->rights->ecm->setup)
else
{
$langs->load("errors");
setEventMessage($langs->trans($ecmdir->error), 'errors');
setEventMessage($ecmdir->errors, 'errors');
setEventMessages($langs->trans($ecmdir->error), null, 'errors');
setEventMessages($ecmdir->error, $ecmdir->errors, 'errors');
$action = 'create';
}
}
}
// Suppression fichier
// Deleting file
else if ($action == 'confirm_deletesection' && $confirm == 'yes')
{
$result=$ecmdir->delete($user);
setEventMessage($langs->trans("ECMSectionWasRemoved", $ecmdir->label));
setEventMessages($langs->trans("ECMSectionWasRemoved", $ecmdir->label), null, 'mesgs');
}

View File

@ -88,23 +88,23 @@ if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC))
$langs->load("errors");
if ($resupload < 0) // Unknown error
{
setEventMessage($langs->trans("ErrorFileNotUploaded"), 'errors');
setEventMessages($langs->trans("ErrorFileNotUploaded"), null, 'errors');
}
else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus
{
setEventMessage($langs->trans("ErrorFileIsInfectedWithAVirus"), 'errors');
setEventMessages($langs->trans("ErrorFileIsInfectedWithAVirus"), null, 'errors');
}
else // Known error
{
setEventMessage($langs->trans($resupload), 'errors');
setEventMessages($langs->trans($resupload), null, 'errors');
}
}
}
else
{
// Echec transfert (fichier depassant la limite ?)
// Failed transfer (exceeding the limit file?)
$langs->load("errors");
setEventMessage($langs->trans("ErrorFailToCreateDir",$upload_dir), 'errors');
setEventMessages($langs->trans("ErrorFailToCreateDir",$upload_dir), null, 'errors');
}
}
@ -133,7 +133,7 @@ if ($action == 'confirm_deletedir' && $confirm == 'yes')
else
{
$langs->load('errors');
setEventMessage($langs->trans($ecmdir->error,$ecmdir->label), 'errors');
setEventMessages($langs->trans($ecmdir->error,$ecmdir->label), null, 'errors');
}
}
@ -164,7 +164,7 @@ if ($action == 'update' && ! GETPOST('cancel'))
if (! $result)
{
$langs->load('errors');
setEventMessage($langs->trans('ErrorFailToRenameDir',$olddir,$newdir), 'errors');
setEventMessages($langs->trans('ErrorFailToRenameDir',$olddir,$newdir), null, 'errors');
$error++;
}
}
@ -184,7 +184,7 @@ if ($action == 'update' && ! GETPOST('cancel'))
else
{
$db->rollback();
setEventMessage($ecmdir->error, 'errors');
setEventMessages($ecmdir->error, $ecmdir->errors, 'errors');
}
}
@ -201,7 +201,7 @@ llxHeader();
$form=new Form($db);
// Construit liste des fichiers
// Built the file List
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
$totalsize=0;
foreach($filearray as $key => $file)
@ -349,7 +349,7 @@ if ($action == 'delete_dir')
$formfile=new FormFile($db);
/*
// Affiche formulaire upload
// Display upload form
if ($user->rights->ecm->upload)
{
$formfile->form_attach_new_file(DOL_URL_ROOT.'/ecm/docmine.php','',0,$section);

View File

@ -55,15 +55,15 @@ if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
$langs->load("errors");
if ($resupload < 0) // Unknown error
{
setEventMessage($langs->trans("ErrorFileNotUploaded"), 'errors');
setEventMessages($langs->trans("ErrorFileNotUploaded"), null, 'errors');
}
else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus
{
setEventMessage($langs->trans("ErrorFileIsInfectedWithAVirus"), 'errors');
setEventMessages($langs->trans("ErrorFileIsInfectedWithAVirus"), null, 'errors');
}
else // Known error
{
setEventMessage($langs->trans($resupload), 'errors');
setEventMessages($langs->trans($resupload), null, 'errors');
}
}
}
@ -81,8 +81,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')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
}
@ -106,7 +106,7 @@ print load_fiche_titre($langs->trans("ECMAutoOrg"));
/*
* Confirmation de la suppression d'une ligne produit
* Confirmation of deleting a product line
*/
if ($_GET['action'] == 'delete_file')
{
@ -114,7 +114,7 @@ if ($_GET['action'] == 'delete_file')
}
// Construit liste des fichiers
// Construct files list
clearstatcache();
$totalsize=0;
$filearray=array();

View File

@ -117,22 +117,22 @@ if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC))
$langs->load("errors");
if ($resupload < 0) // Unknown error
{
setEventMessage($langs->trans("ErrorFileNotUploaded"), 'errors');
setEventMessages($langs->trans("ErrorFileNotUploaded"), null, 'errors');
}
else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus
{
setEventMessage($langs->trans("ErrorFileIsInfectedWithAVirus"), 'errors');
setEventMessages($langs->trans("ErrorFileIsInfectedWithAVirus"), null, 'errors');
}
else // Known error
{
setEventMessage($langs->trans($resupload), 'errors');
setEventMessages($langs->trans($resupload), null, 'errors');
}
}
}
else
{
$langs->load("errors");
setEventMessage($langs->trans("ErrorFailToCreateDir",$upload_dir), 'errors');
setEventMessages($langs->trans("ErrorFailToCreateDir",$upload_dir), null, 'errors');
}
}
}
@ -154,7 +154,7 @@ if ($action == 'add' && $user->rights->ecm->setup)
}
else
{
setEventMessage('Error '.$langs->trans($ecmdir->error), 'errors');
setEventMessages('Error '.$langs->trans($ecmdir->error), null, 'errors');
$action = "create";
}
@ -182,8 +182,8 @@ if ($action == 'confirm_deletefile')
$file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_POST 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');
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
$result=$ecmdir->changeNbOfFiles('-');
@ -196,7 +196,7 @@ if ($action == 'confirm_deletefile')
if ($action == 'confirm_deletesection' && GETPOST('confirm') == 'yes')
{
$result=$ecmdir->delete($user);
setEventMessage($langs->trans("ECMSectionWasRemoved", $ecmdir->label));
setEventMessages($langs->trans("ECMSectionWasRemoved", $ecmdir->label), null, 'mesgs');
clearstatcache();
}

View File

@ -117,22 +117,22 @@ if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC))
$langs->load("errors");
if ($resupload < 0) // Unknown error
{
setEventMessage($langs->trans("ErrorFileNotUploaded"), 'errors');
setEventMessages($langs->trans("ErrorFileNotUploaded"), null, 'errors');
}
else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus
{
setEventMessage($langs->trans("ErrorFileIsInfectedWithAVirus"), 'errors');
setEventMessages($langs->trans("ErrorFileIsInfectedWithAVirus"), null, 'errors');
}
else // Known error
{
setEventMessage($langs->trans($resupload), 'errors');
setEventMessages($langs->trans($resupload), null, 'errors');
}
}
}
else
{
$langs->load("errors");
setEventMessage($langs->trans("ErrorFailToCreateDir",$upload_dir), 'errors');
setEventMessages($langs->trans("ErrorFailToCreateDir",$upload_dir), null, 'errors');
}
}
}
@ -155,7 +155,7 @@ if ($action == 'add' && $user->rights->ecm->setup)
else
{
//TODO: Translate
setEventMessage('Error '.$langs->trans($ecmdir->error), 'errors');
setEventMessages('Error '.$langs->trans($ecmdir->error), null, 'errors');
$action = "create";
}
@ -183,8 +183,8 @@ if ($action == 'confirm_deletefile')
$file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_POST 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');
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
$result=$ecmdir->changeNbOfFiles('-');
@ -197,7 +197,7 @@ if ($action == 'confirm_deletefile')
if ($action == 'confirm_deletesection' && GETPOST('confirm') == 'yes')
{
$result=$ecmdir->delete($user);
setEventMessage($langs->trans("ECMSectionWasRemoved", $ecmdir->label));
setEventMessages($langs->trans("ECMSectionWasRemoved", $ecmdir->label), null, 'mesgs');
clearstatcache();
}