From e78794cab2ebe4f9f4aac8b8e1f168a66854e9e1 Mon Sep 17 00:00:00 2001 From: philippe grand Date: Sat, 21 Nov 2015 17:38:09 +0100 Subject: [PATCH] [Qual] Uniformize code --- htdocs/ecm/docdir.php | 8 ++++---- htdocs/ecm/docmine.php | 20 ++++++++++---------- htdocs/ecm/docother.php | 14 +++++++------- htdocs/ecm/index.php | 16 ++++++++-------- htdocs/ecm/index_auto.php | 16 ++++++++-------- 5 files changed, 37 insertions(+), 37 deletions(-) diff --git a/htdocs/ecm/docdir.php b/htdocs/ecm/docdir.php index 07c6a6029e8..7cd3a235c6b 100644 --- a/htdocs/ecm/docdir.php +++ b/htdocs/ecm/docdir.php @@ -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'); } diff --git a/htdocs/ecm/docmine.php b/htdocs/ecm/docmine.php index 7f70cb3b500..2ec6dfc4aae 100644 --- a/htdocs/ecm/docmine.php +++ b/htdocs/ecm/docmine.php @@ -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); diff --git a/htdocs/ecm/docother.php b/htdocs/ecm/docother.php index 3efe0716228..2f0f231523f 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 { - 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(); diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php index 54c514ec1f2..e3fa4ece95d 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -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(); } diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php index 0531050aa3d..76ce04235e4 100644 --- a/htdocs/ecm/index_auto.php +++ b/htdocs/ecm/index_auto.php @@ -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(); }