diff --git a/htdocs/ecm/docmine.php b/htdocs/ecm/docmine.php
index 89427dcb461..eb6389860fe 100644
--- a/htdocs/ecm/docmine.php
+++ b/htdocs/ecm/docmine.php
@@ -95,13 +95,13 @@ if ( $_POST["sendit"] && $conf->upload != 0)
if (is_dir($upload_dir))
{
$result = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0);
- if ($result == 1)
+ if ($result > 0)
{
//$mesg = '
'.$langs->trans("FileTransferComplete").'
';
//print_r($_FILES);
$result=$ecmdir->changeNbOfFiles('+');
}
- else if (!$result)
+ else if ($result < 0)
{
// Echec transfert (fichier depassant la limite ?)
$mesg = ''.$langs->trans("ErrorFileNotUploaded").'
';
@@ -292,17 +292,21 @@ if ($_GET['action'] == 'delete_dir')
print '
';
}
+$formfile=new FormFile($db);
// Affiche formulaire upload
-$formfile=new FormFile($db);
-$formfile->form_attach_new_file(DOL_URL_ROOT.'/ecm/docmine.php','',0,$section);
-
+if ($user->rights->ecm->create)
+{
+ $formfile->form_attach_new_file(DOL_URL_ROOT.'/ecm/docmine.php','',0,$section);
+}
// List of document
-$param='§ion='.$section;
-$formfile->list_of_documents($filearray,'','ecm',$param,1,$relativepath);
-
-
+// TODO: prevoir un droit sur la suppression des documents
+if ($user->rights->ecm->read)
+{
+ $param='§ion='.$section;
+ $formfile->list_of_documents($filearray,'','ecm',$param,1,$relativepath);
+}
// End of page
$db->close();