diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index e73fddb7574..741db311e20 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -41,8 +41,9 @@ $langs->load("commercial"); $langs->load("other"); $langs->load("bills"); -$objectid = GETPOST('id','int'); -$action=GETPOST('action','alpha'); +$objectid = GETPOST('id', 'int'); +$action=GETPOST('action', 'alpha'); +$confirm = GETPOST('confirm', 'alpha'); // Security check $socid = GETPOST('socid','int'); @@ -252,15 +253,10 @@ if ($act->id > 0) print ''; - - // Affiche formulaire upload - $formfile=new FormFile($db); - $formfile->form_attach_new_file(DOL_URL_ROOT.'/comm/action/document.php?id='.$act->id,'',0,0,($user->rights->agenda->myactions->create||$user->rights->agenda->allactions->create),50,$act); - - - // List of document - $param='&id='.$act->id; - $formfile->list_of_documents($filearray,$act,'actions',$param,0,'',$user->rights->agenda->myactions->create); + $modulepart = 'actions'; + $permission = $user->rights->agenda->myactions->create||$user->rights->agenda->allactions->create; + $param = '&id=' . $act->id; + include_once DOL_DOCUMENT_ROOT . '/core/tpl/doc2.tpl.php'; } else { diff --git a/htdocs/compta/sociales/document.php b/htdocs/compta/sociales/document.php index dcef5eb1561..c13618691fd 100644 --- a/htdocs/compta/sociales/document.php +++ b/htdocs/compta/sociales/document.php @@ -41,6 +41,7 @@ $langs->load("bills"); $id = GETPOST('id','int'); $action = GETPOST("action"); +$confirm = GETPOST('confirm', 'alpha'); // Security check if ($user->societe_id) $socid=$user->societe_id; @@ -159,16 +160,10 @@ if ($object->id) print ''; - - // Affiche formulaire upload - $formfile=new FormFile($db); - $formfile->form_attach_new_file(DOL_URL_ROOT.'/compta/sociales/document.php?id='.$object->id,'',0,0,$user->rights->tax->charges->creer,50,$object); - - - // List of document - //$param='&id='.$object->id; - $formfile->list_of_documents($filearray,$object,'tax',$param); - + $modulepart = 'tax'; + $permission = $user->rights->tax->charges->creer; + $param = '&id=' . $object->id; + include_once DOL_DOCUMENT_ROOT . '/core/tpl/doc2.tpl.php'; } else { diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index 2c9e4b42166..b63679cc1de 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -4,6 +4,7 @@ * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2005 Simon TOSSER + * Copyright (C) 2013 Cédric Salvador * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/core/tpl/doc2.tpl.php b/htdocs/core/tpl/doc2.tpl.php new file mode 100644 index 00000000000..c2ac769b500 --- /dev/null +++ b/htdocs/core/tpl/doc2.tpl.php @@ -0,0 +1,42 @@ +form_confirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&urlfile=' . urlencode(GETPOST("urlfile")) . '&linkid=' . GETPOST('linkid', 'int'), + $langs->trans('DeleteFile'), + $langs->trans('ConfirmDeleteFile'), + 'confirm_deletefile', + '', + 0, + 1 + ); + if ($ret == 'html') print '
'; +} + +$formfile=new FormFile($db); + +// Show upload form +$formfile->form_attach_new_file($_SERVER["PHP_SELF"].'?id='.$object->id, + '', + 0, + 0, + $permission, + 50, + $object + ); + +// List of document +$formfile->list_of_documents($filearray, + $object, + $modulepart, + $param, + 0, + '', + $permission + ); + +print "
"; +//List of links +$formfile->list_of_links($object, $permission); +print "
"; diff --git a/htdocs/fichinter/document.php b/htdocs/fichinter/document.php index 6638d031651..2dc8f7aedea 100644 --- a/htdocs/fichinter/document.php +++ b/htdocs/fichinter/document.php @@ -5,6 +5,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2005 Simon TOSSER * Copyright (C) 2011-2012 Juanjo Menent + * Copyright (C) 2013 Cédric Salvador * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php index 3e288899d1d..287708da211 100644 --- a/htdocs/fourn/facture/document.php +++ b/htdocs/fourn/facture/document.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2013 Cédric Salvador * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/product/document.php b/htdocs/product/document.php index 9aefbe18dad..34d12669617 100644 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -140,15 +140,10 @@ if ($object->id) print ''; - - // Affiche formulaire upload - $formfile=new FormFile($db); - $formfile->form_attach_new_file(DOL_URL_ROOT.'/product/document.php?id='.$object->id,'',0,0,($user->rights->produit->creer||$user->rights->service->creer),50,$object); - - - // List of document - $formfile->list_of_documents($filearray,$object,'produit'); - + $modulepart = 'produit'; + $permission = $user->rights->produit->creer; + $param = '&id=' . $object->id; + include_once DOL_DOCUMENT_ROOT . '/core/tpl/doc2.tpl.php'; } else { diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index 1a01958b230..c5702aa54c9 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -229,15 +229,18 @@ if ($object->id > 0) print '
'; - - // Affiche formulaire upload + $modulepart = 'projet'; + $permission = $user->rights->projet->creer; + $param = '&id=' . $object->id; + include_once DOL_DOCUMENT_ROOT . '/core/tpl/doc2.tpl.php'; + /*// Affiche formulaire upload $formfile=new FormFile($db); $formfile->form_attach_new_file(DOL_URL_ROOT.'/projet/tasks/document.php?id='.$object->id.($withproject?'&withproject=1':''),'',0,0,$user->rights->projet->creer,50,$object); // List of document $param='&id='.$object->id; - $formfile->list_of_documents($filearray,$object,'projet',$param,0,dol_sanitizeFileName($projectstatic->ref).'/'.dol_sanitizeFileName($object->ref).'/'); + $formfile->list_of_documents($filearray,$object,'projet',$param,0,dol_sanitizeFileName($projectstatic->ref).'/'.dol_sanitizeFileName($object->ref).'/');*/ } else {