factorized form attach, documents list and links list for the document pages

This commit is contained in:
Cédric Salvador 2013-07-30 16:44:47 +02:00 committed by Raphaël Doursenaud
parent 3529f5238b
commit c96b2d3b87
8 changed files with 67 additions and 33 deletions

View File

@ -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 '</div>';
// 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
{

View File

@ -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 '</div>';
// 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
{

View File

@ -4,6 +4,7 @@
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
*
* 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

View File

@ -0,0 +1,42 @@
<?php
/*
* Confirm suppression
*/
if ($action == 'delete') {
$ret = $form->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 '<br>';
}
$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 "<br>";
//List of links
$formfile->list_of_links($object, $permission);
print "<br>";

View File

@ -5,6 +5,7 @@
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
*
* 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

View File

@ -3,6 +3,7 @@
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
*
* 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

View File

@ -140,15 +140,10 @@ if ($object->id)
print '</div>';
// 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
{

View File

@ -229,15 +229,18 @@ if ($object->id > 0)
print '<br>';
// 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
{