2004-10-20 22:06:49 +02:00
< ? php
2005-04-05 13:46:55 +02:00
/* Copyright ( C ) 2001 - 2005 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
2013-12-01 15:46:15 +01:00
* Copyright ( C ) 2004 - 2013 Laurent Destailleur < eldy @ users . sourceforge . net >
2012-12-30 15:13:49 +01:00
* Copyright ( C ) 2005 - 2012 Regis Houssin < regis . houssin @ capnetworks . com >
2003-09-04 13:08:03 +02:00
*
* 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
2013-01-16 15:36:08 +01:00
* the Free Software Foundation ; either version 3 of the License , or
2003-09-04 13:08:03 +02:00
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
2011-08-01 01:19:04 +02:00
* along with this program . If not , see < http :// www . gnu . org / licenses />.
2003-09-04 13:08:03 +02:00
*/
2004-08-14 15:16:01 +02:00
2005-07-16 13:21:08 +02:00
/**
2014-09-18 21:18:25 +02:00
* \file htdocs / projet / card . php
2008-09-10 11:43:48 +02:00
* \ingroup projet
2010-02-15 01:57:27 +01:00
* \brief Project card
2008-09-10 11:43:48 +02:00
*/
2009-01-10 04:40:06 +01:00
2012-08-22 23:24:21 +02:00
require '../main.inc.php' ;
2012-08-22 23:11:24 +02:00
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/projet/class/task.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/modules/project/modules_project.php' ;
2013-04-12 11:09:53 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php' ;
2003-09-04 13:08:03 +02:00
2010-01-04 22:45:59 +01:00
$langs -> load ( " projects " );
2010-01-13 19:20:21 +01:00
$langs -> load ( 'companies' );
2010-01-04 22:45:59 +01:00
2012-02-04 18:34:52 +01:00
$id = GETPOST ( 'id' , 'int' );
2012-04-27 11:03:01 +02:00
$ref = GETPOST ( 'ref' , 'alpha' );
2012-02-27 17:02:56 +01:00
$action = GETPOST ( 'action' , 'alpha' );
$backtopage = GETPOST ( 'backtopage' , 'alpha' );
2015-03-04 18:56:57 +01:00
$cancel = GETPOST ( 'cancel' , 'alpha' );
2009-08-28 03:14:35 +02:00
2012-02-04 18:34:52 +01:00
if ( $id == '' && $ref == '' && ( $action != " create " && $action != " add " && $action != " update " && ! $_POST [ " cancel " ])) accessforbidden ();
2006-03-10 18:19:14 +01:00
2010-11-11 13:16:55 +01:00
$mine = GETPOST ( 'mode' ) == 'mine' ? 1 : 0 ;
2010-05-29 01:26:08 +02:00
//if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
2010-05-30 14:21:32 +02:00
Add: hooks and triggers for a lot of core modules (action/calendrier, deplacement, dons, tva, contact/tiers, contrat, product lines, expedition, fournisseur commandes et factures, fiche intervention, projet et taches)
Signed-off-by: Stephen L. <lrq3000@gmail.com>
2012-08-14 15:50:45 +02:00
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
2014-10-06 07:20:58 +02:00
$hookmanager -> initHooks ( array ( 'projectcard' , 'globalcard' ));
Add: hooks and triggers for a lot of core modules (action/calendrier, deplacement, dons, tva, contact/tiers, contrat, product lines, expedition, fournisseur commandes et factures, fiche intervention, projet et taches)
Signed-off-by: Stephen L. <lrq3000@gmail.com>
2012-08-14 15:50:45 +02:00
2012-07-02 19:30:37 +02:00
$object = new Project ( $db );
2013-04-12 11:09:53 +02:00
$extrafields = new ExtraFields ( $db );
2015-03-04 20:52:54 +01:00
2015-03-02 17:54:35 +01:00
// Load object
2015-03-04 20:52:54 +01:00
//include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Can use generic include because when creating a project, ref is defined and we dont want error if fetch fails from ref.
2014-09-18 09:59:29 +02:00
if ( $id > 0 || ! empty ( $ref ))
2012-07-02 19:30:37 +02:00
{
2015-03-04 18:56:57 +01:00
$ret = $object -> fetch ( $id , $ref ); // If we create project, ref may be defined into POST but record does not yet exists into database
2015-02-28 10:45:48 +01:00
if ( $ret > 0 ) {
$object -> fetch_thirdparty ();
$id = $object -> id ;
}
2012-06-09 18:37:54 +02:00
}
2010-05-23 22:01:10 +02:00
2013-04-30 18:23:44 +02:00
// Security check
2014-06-11 18:01:15 +02:00
$socid = GETPOST ( 'socid' );
2013-04-30 18:23:44 +02:00
if ( $user -> societe_id > 0 ) $socid = $user -> societe_id ;
$result = restrictedArea ( $user , 'projet' , $object -> id );
2013-04-12 11:09:53 +02:00
// fetch optionals attributes and labels
2013-04-26 10:29:14 +02:00
$extralabels = $extrafields -> fetch_name_optionals_label ( $object -> table_element );
2013-04-12 11:09:53 +02:00
2014-09-12 17:21:48 +02:00
$date_start = dol_mktime ( 0 , 0 , 0 , GETPOST ( 'projectstartmonth' , 'int' ), GETPOST ( 'projectstartday' , 'int' ), GETPOST ( 'projectstartyear' , 'int' ));
2014-05-07 15:11:46 +02:00
$date_end = dol_mktime ( 0 , 0 , 0 , GETPOST ( 'projectendmonth' , 'int' ), GETPOST ( 'projectendday' , 'int' ), GETPOST ( 'projectendyear' , 'int' ));
2012-08-31 14:31:36 +02:00
2010-05-23 22:01:10 +02:00
2008-02-24 14:18:40 +01:00
/*
2008-09-10 11:43:48 +02:00
* Actions
*/
2007-11-29 22:19:21 +01:00
2014-05-08 20:02:34 +02:00
$parameters = array ( 'id' => $socid , 'objcanvas' => $objcanvas );
$reshook = $hookmanager -> executeHooks ( 'doActions' , $parameters , $object , $action ); // Note that $action and $object may have been modified by some hooks
2014-09-28 03:41:32 +02:00
if ( $reshook < 0 ) setEventMessages ( $hookmanager -> error , $hookmanager -> errors , 'errors' );
2014-05-08 20:02:34 +02:00
if ( empty ( $reshook ))
2011-07-04 10:00:52 +02:00
{
2014-05-08 20:02:34 +02:00
// Cancel
2015-03-04 18:56:57 +01:00
if ( $cancel )
2014-05-08 20:02:34 +02:00
{
if ( GETPOST ( " comefromclone " ) == 1 )
{
$result = $object -> delete ( $user );
if ( $result > 0 )
{
header ( " Location: index.php " );
exit ;
}
else
{
dol_syslog ( $object -> error , LOG_DEBUG );
2014-07-20 02:32:13 +02:00
setEventMessage ( $langs -> trans ( " CantRemoveProject " ), 'errors' );
2014-05-08 20:02:34 +02:00
}
}
2015-03-04 18:56:57 +01:00
if ( $backtopage )
{
header ( " Location: " . $backtopage );
exit ;
}
2014-05-08 20:02:34 +02:00
2015-03-04 18:56:57 +01:00
$action = '' ;
2012-04-27 11:03:01 +02:00
}
2010-11-11 13:16:55 +01:00
2014-05-08 20:02:34 +02:00
if ( $action == 'add' && $user -> rights -> projet -> creer )
{
$error = 0 ;
if ( empty ( $_POST [ " ref " ]))
{
2014-07-20 02:32:13 +02:00
setEventMessage ( $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentities ( " Ref " )), 'errors' );
2014-05-08 20:02:34 +02:00
$error ++ ;
}
if ( empty ( $_POST [ " title " ]))
{
2014-07-20 02:32:13 +02:00
setEventMessage ( $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentities ( " Label " )), 'errors' );
2014-05-08 20:02:34 +02:00
$error ++ ;
}
2011-02-09 15:45:42 +01:00
2014-05-08 20:02:34 +02:00
if ( ! $error )
{
$error = 0 ;
$db -> begin ();
$object -> ref = GETPOST ( 'ref' , 'alpha' );
$object -> title = GETPOST ( 'title' ); // Do not use 'alpha' here, we want field as it is
$object -> socid = GETPOST ( 'socid' , 'int' );
$object -> description = GETPOST ( 'description' ); // Do not use 'alpha' here, we want field as it is
$object -> public = GETPOST ( 'public' , 'alpha' );
2015-02-16 10:58:05 +01:00
$object -> budget_amount = GETPOST ( 'budget_amount' , 'int' );
2014-05-08 20:02:34 +02:00
$object -> datec = dol_now ();
$object -> date_start = $date_start ;
$object -> date_end = $date_end ;
// Fill array 'array_options' with data from add form
$ret = $extrafields -> setOptionalsFromPost ( $extralabels , $object );
2015-02-26 14:25:30 +01:00
if ( $ret < 0 ) $error ++ ;
2014-05-08 20:02:34 +02:00
$result = $object -> create ( $user );
2015-03-04 18:56:57 +01:00
if ( ! $error && $result > 0 )
2014-05-08 20:02:34 +02:00
{
// Add myself as project leader
$result = $object -> add_contact ( $user -> id , 'PROJECTLEADER' , 'internal' );
if ( $result < 0 )
{
$langs -> load ( " errors " );
2014-07-20 02:32:13 +02:00
setEventMessage ( $langs -> trans ( $object -> error ), 'errors' );
2014-05-08 20:02:34 +02:00
$error ++ ;
}
}
else
{
$langs -> load ( " errors " );
2014-07-20 02:32:13 +02:00
setEventMessage ( $langs -> trans ( $object -> error ), 'errors' );
2014-05-08 20:02:34 +02:00
$error ++ ;
}
if ( ! $error )
{
$db -> commit ();
2014-09-18 21:18:25 +02:00
header ( " Location:card.php?id= " . $object -> id );
2014-05-08 20:02:34 +02:00
exit ;
}
else
{
$db -> rollback ();
$action = 'create' ;
}
}
else
{
$action = 'create' ;
}
}
2009-07-28 20:12:47 +02:00
2014-05-08 20:02:34 +02:00
if ( $action == 'update' && ! $_POST [ " cancel " ] && $user -> rights -> projet -> creer )
{
$error = 0 ;
2010-11-11 13:16:55 +01:00
2014-05-08 20:02:34 +02:00
if ( empty ( $ref ))
{
$error ++ ;
//$_GET["id"]=$_POST["id"]; // On retourne sur la fiche projet
2014-07-20 02:32:13 +02:00
setEventMessage ( $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentities ( " Ref " )), 'errors' );
2014-05-08 20:02:34 +02:00
}
if ( empty ( $_POST [ " title " ]))
{
$error ++ ;
//$_GET["id"]=$_POST["id"]; // On retourne sur la fiche projet
2014-07-20 02:32:13 +02:00
setEventMessage ( $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentities ( " Label " )), 'errors' );
2014-05-08 20:02:34 +02:00
}
2013-12-01 15:46:15 +01:00
2014-05-08 20:02:34 +02:00
$db -> begin ();
2013-12-01 15:46:15 +01:00
2014-05-08 20:02:34 +02:00
if ( ! $error )
{
$object -> oldcopy = dol_clone ( $object );
$old_start_date = $object -> date_start ;
$object -> ref = GETPOST ( 'ref' , 'alpha' );
$object -> title = GETPOST ( 'title' ); // Do not use 'alpha' here, we want field as it is
$object -> socid = GETPOST ( 'socid' , 'int' );
$object -> description = GETPOST ( 'description' ); // Do not use 'alpha' here, we want field as it is
$object -> public = GETPOST ( 'public' , 'alpha' );
2015-02-16 10:58:05 +01:00
$object -> budget_amount = GETPOST ( 'budget_amount' , 'int' );
2014-09-12 17:21:48 +02:00
$object -> date_start = empty ( $_POST [ " projectstart " ]) ? '' : $date_start ;
2014-05-08 20:02:34 +02:00
$object -> date_end = empty ( $_POST [ " projectend " ]) ? '' : $date_end ;
// Fill array 'array_options' with data from add form
$ret = $extrafields -> setOptionalsFromPost ( $extralabels , $object );
2015-02-26 14:25:30 +01:00
if ( $ret < 0 ) $error ++ ;
2014-05-08 20:02:34 +02:00
}
2010-11-11 13:16:55 +01:00
2014-05-08 20:02:34 +02:00
if ( ! $error )
{
$result = $object -> update ( $user );
if ( $result < 0 )
{
$error ++ ;
setEventMessage ( $object -> errors , 'errors' );
}
}
2012-04-27 11:03:01 +02:00
2014-05-08 20:02:34 +02:00
if ( ! $error )
{
if ( GETPOST ( " reportdate " ) && ( $object -> date_start != $old_start_date ))
{
$result = $object -> shiftTaskDate ( $old_start_date );
if ( $result < 0 )
{
$error ++ ;
2014-07-20 02:32:13 +02:00
setEventMessage ( $langs -> trans ( " ErrorShiftTaskDate " ) . ':' . $object -> error , 'errors' );
2014-05-08 20:02:34 +02:00
}
}
}
2013-04-30 18:23:44 +02:00
2014-05-08 20:02:34 +02:00
if ( $error )
{
$db -> rollback ();
$action = 'edit' ;
}
else
2013-10-23 18:26:18 +02:00
{
2014-05-08 20:02:34 +02:00
$db -> commit ();
2010-11-11 13:16:55 +01:00
2014-11-20 14:44:49 +01:00
if ( GETPOST ( 'socid' , 'int' ) > 0 ) $object -> fetch_thirdparty ( GETPOST ( 'socid' , 'int' ));
2014-09-18 09:36:47 +02:00
else unset ( $object -> thirdparty );
2014-05-08 20:02:34 +02:00
}
}
2013-10-23 18:26:18 +02:00
2014-05-08 20:02:34 +02:00
// Build doc
if ( $action == 'builddoc' && $user -> rights -> projet -> creer )
2013-10-23 18:26:18 +02:00
{
2014-05-08 20:02:34 +02:00
// Save last template used to generate document
if ( GETPOST ( 'model' )) $object -> setDocModel ( $user , GETPOST ( 'model' , 'alpha' ));
2010-11-11 13:16:55 +01:00
2014-05-08 20:02:34 +02:00
$outputlangs = $langs ;
if ( GETPOST ( 'lang_id' ))
{
$outputlangs = new Translate ( " " , $conf );
$outputlangs -> setDefaultLang ( GETPOST ( 'lang_id' ));
}
2014-09-16 20:53:43 +02:00
$result = $object -> generateDocument ( $object -> modelpdf , $outputlangs );
2014-05-08 20:02:34 +02:00
if ( $result <= 0 )
{
dol_print_error ( $db , $result );
exit ;
}
}
2010-01-13 19:20:21 +01:00
2014-05-08 20:02:34 +02:00
// Delete file in doc form
if ( $action == 'remove_file' && $user -> rights -> projet -> creer )
{
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php' ;
2012-05-29 23:50:13 +02:00
2014-05-08 20:02:34 +02:00
if ( $object -> id > 0 )
{
$langs -> load ( " other " );
$upload_dir = $conf -> projet -> dir_output . " / " ;
$file = $upload_dir . '/' . GETPOST ( 'file' );
$ret = dol_delete_file ( $file );
if ( $ret ) setEventMessage ( $langs -> trans ( " FileWasRemoved " , GETPOST ( 'urlfile' )));
else setEventMessage ( $langs -> trans ( " ErrorFailToDeleteFile " , GETPOST ( 'urlfile' )), 'errors' );
}
}
2012-05-29 23:50:13 +02:00
2012-04-27 10:32:01 +02:00
2014-05-08 20:02:34 +02:00
if ( $action == 'confirm_validate' && GETPOST ( 'confirm' ) == 'yes' )
{
$result = $object -> setValid ( $user );
if ( $result <= 0 )
{
2014-07-20 02:32:13 +02:00
setEventMessage ( $object -> error , 'errors' );
2014-05-08 20:02:34 +02:00
}
}
2010-01-04 23:04:04 +01:00
2014-05-08 20:02:34 +02:00
if ( $action == 'confirm_close' && GETPOST ( 'confirm' ) == 'yes' )
{
$result = $object -> setClose ( $user );
if ( $result <= 0 )
{
2014-07-20 02:32:13 +02:00
setEventMessage ( $object -> error , 'errors' );
2014-05-08 20:02:34 +02:00
}
}
2010-01-04 23:04:04 +01:00
2014-05-08 20:02:34 +02:00
if ( $action == 'confirm_reopen' && GETPOST ( 'confirm' ) == 'yes' )
{
$result = $object -> setValid ( $user );
if ( $result <= 0 )
{
2014-07-20 02:32:13 +02:00
setEventMessage ( $object -> error , 'errors' );
2014-05-08 20:02:34 +02:00
}
}
2010-01-04 22:45:59 +01:00
2014-05-08 20:02:34 +02:00
if ( $action == 'confirm_delete' && GETPOST ( " confirm " ) == " yes " && $user -> rights -> projet -> supprimer )
{
$object -> fetch ( $id );
$result = $object -> delete ( $user );
if ( $result > 0 )
{
header ( " Location: index.php " );
exit ;
}
else
{
dol_syslog ( $object -> error , LOG_DEBUG );
2014-07-03 17:15:42 +02:00
setEventMessage ( $object -> error , 'errors' );
setEventMessage ( $object -> errors , 'errors' );
2014-05-08 20:02:34 +02:00
}
}
2003-09-04 13:08:03 +02:00
2014-05-08 20:02:34 +02:00
if ( $action == 'confirm_clone' && $user -> rights -> projet -> creer && GETPOST ( 'confirm' ) == 'yes' )
{
$clone_contacts = GETPOST ( 'clone_contacts' ) ? 1 : 0 ;
$clone_tasks = GETPOST ( 'clone_tasks' ) ? 1 : 0 ;
$clone_project_files = GETPOST ( 'clone_project_files' ) ? 1 : 0 ;
$clone_task_files = GETPOST ( 'clone_task_files' ) ? 1 : 0 ;
$clone_notes = GETPOST ( 'clone_notes' ) ? 1 : 0 ;
2014-12-05 21:40:55 +01:00
$move_date = GETPOST ( 'move_date' ) ? 1 : 0 ;
$result = $object -> createFromClone ( $object -> id , $clone_contacts , $clone_tasks , $clone_project_files , $clone_task_files , $clone_notes , $move_date );
2014-05-08 20:02:34 +02:00
if ( $result <= 0 )
{
2014-07-20 02:32:13 +02:00
setEventMessage ( $object -> error , 'errors' );
2014-05-08 20:02:34 +02:00
}
else
{
$object -> fetch ( $result ); // Load new object
$action = 'edit' ;
$comefromclone = true ;
}
}
2012-04-27 10:32:01 +02:00
}
2005-08-14 03:38:12 +02:00
2008-03-02 23:20:44 +01:00
/*
2008-09-10 11:43:48 +02:00
* View
*/
2008-03-02 23:20:44 +01:00
2011-11-08 10:18:45 +01:00
$form = new Form ( $db );
2010-01-13 18:58:34 +01:00
$formfile = new FormFile ( $db );
2010-05-23 22:01:10 +02:00
$userstatic = new User ( $db );
2015-03-23 12:44:41 +01:00
$title = $langs -> trans ( " Project " ) . ' - ' . $object -> ref . ' ' . $object -> name ;
if ( ! empty ( $conf -> global -> MAIN_HTML_TITLE ) && preg_match ( '/projectnameonly/' , $conf -> global -> MAIN_HTML_TITLE ) && $object -> name ) $title = $object -> ref . ' ' . $object -> name ;
2010-05-23 22:01:10 +02:00
$help_url = " EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos " ;
2015-03-23 12:44:41 +01:00
llxHeader ( " " , $title , $help_url );
2004-08-07 03:25:00 +02:00
2010-01-28 12:08:11 +01:00
2012-02-04 18:34:52 +01:00
if ( $action == 'create' && $user -> rights -> projet -> creer )
2003-09-04 13:08:03 +02:00
{
2010-11-11 13:16:55 +01:00
/*
* Create
*/
2014-06-11 18:01:15 +02:00
$thirdparty = new Societe ( $db );
if ( $socid > 0 ) $thirdparty -> fetch ( $socid );
2015-04-18 23:39:04 +02:00
print_fiche_titre ( $langs -> trans ( " NewProject " ), '' , 'title_project' );
2008-09-10 11:43:48 +02:00
2010-11-11 13:16:55 +01:00
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
print '<input type="hidden" name="token" value="' . $_SESSION [ 'newtoken' ] . '">' ;
print '<input type="hidden" name="action" value="add">' ;
2012-02-27 17:02:56 +01:00
print '<input type="hidden" name="backtopage" value="' . $backtopage . '">' ;
2012-02-04 18:34:52 +01:00
2015-01-30 16:33:39 +01:00
print dol_fiche_head ();
2011-07-04 10:00:52 +02:00
print '<table class="border" width="100%">' ;
2004-10-23 17:09:29 +02:00
2010-11-11 13:16:55 +01:00
$defaultref = '' ;
2014-06-11 18:01:15 +02:00
$modele = empty ( $conf -> global -> PROJECT_ADDON ) ? 'mod_project_simple' : $conf -> global -> PROJECT_ADDON ;
// Search template files
$file = '' ; $classname = '' ; $filefound = 0 ;
$dirmodels = array_merge ( array ( '/' ),( array ) $conf -> modules_parts [ 'models' ]);
foreach ( $dirmodels as $reldir )
2010-11-11 13:16:55 +01:00
{
2014-06-11 18:01:15 +02:00
$file = dol_buildpath ( $reldir . " core/modules/project/ " . $modele . '.php' , 0 );
if ( file_exists ( $file ))
{
$filefound = 1 ;
$classname = $modele ;
break ;
}
}
if ( $filefound )
{
$result = dol_include_once ( $reldir . " core/modules/project/ " . $modele . '.php' );
$modProject = new $classname ;
$defaultref = $modProject -> getNextValue ( $thirdparty , $object );
2010-11-11 13:16:55 +01:00
}
2010-02-15 01:57:27 +01:00
2010-08-12 20:52:34 +02:00
if ( is_numeric ( $defaultref ) && $defaultref <= 0 ) $defaultref = '' ;
2010-01-23 01:44:26 +01:00
2010-11-11 13:16:55 +01:00
// Ref
print '<tr><td><span class="fieldrequired">' . $langs -> trans ( " Ref " ) . '</span></td><td><input size="12" type="text" name="ref" value="' . ( $_POST [ " ref " ] ? $_POST [ " ref " ] : $defaultref ) . '"></td></tr>' ;
2006-09-23 01:12:50 +02:00
2010-11-11 13:16:55 +01:00
// Label
2015-02-16 10:58:05 +01:00
print '<tr><td><span class="fieldrequired">' . $langs -> trans ( " Label " ) . '</span></td><td><input size="40" type="text" name="title" value="' . GETPOST ( " title " ) . '"></td></tr>' ;
2008-09-10 11:43:48 +02:00
2015-04-14 12:32:19 +02:00
// Thirdparty
2011-06-13 16:29:05 +02:00
print '<tr><td>' . $langs -> trans ( " ThirdParty " ) . '</td><td>' ;
2015-04-14 12:32:19 +02:00
$filteronlist = '' ;
if ( ! empty ( $conf -> global -> PROJECT_FILTER_FOR_THIRDPARTY_LIST )) $filteronlist = $conf -> global -> PROJECT_FILTER_FOR_THIRDPARTY_LIST ;
$text = $form -> select_thirdparty_list ( GETPOST ( 'socid' , 'int' ), 'socid' , $filteronlist , 1 , 1 );
2014-11-28 02:05:40 +01:00
if ( empty ( $conf -> global -> PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS ) && empty ( $conf -> dol_use_jmobile ))
{
$texthelp = $langs -> trans ( " IfNeedToUseOhterObjectKeepEmpty " );
print $form -> textwithtooltip ( $text . ' ' . img_help (), $texthelp , 1 );
}
else print $text ;
2010-11-11 13:16:55 +01:00
print '</td></tr>' ;
2004-10-23 17:09:29 +02:00
2010-11-11 13:16:55 +01:00
// Public
print '<tr><td>' . $langs -> trans ( " Visibility " ) . '</td><td>' ;
$array = array ( 0 => $langs -> trans ( " PrivateProject " ), 1 => $langs -> trans ( " SharedProject " ));
2012-05-29 23:50:13 +02:00
print $form -> selectarray ( 'public' , $array , $object -> public );
2010-11-11 13:16:55 +01:00
print '</td></tr>' ;
2008-09-10 11:43:48 +02:00
2010-11-11 13:16:55 +01:00
// Date start
print '<tr><td>' . $langs -> trans ( " DateStart " ) . '</td><td>' ;
2014-09-12 17:21:48 +02:00
print $form -> select_date (( $date_start ? $date_start : '' ), 'projectstart' );
2010-11-11 13:16:55 +01:00
print '</td></tr>' ;
2009-07-28 20:12:47 +02:00
2010-11-11 13:16:55 +01:00
// Date end
print '<tr><td>' . $langs -> trans ( " DateEnd " ) . '</td><td>' ;
2012-08-31 14:31:36 +02:00
print $form -> select_date (( $date_end ? $date_end :- 1 ), 'projectend' );
2010-11-11 13:16:55 +01:00
print '</td></tr>' ;
2010-02-03 22:48:16 +01:00
2015-02-16 10:58:05 +01:00
// Budget
print '<tr><td>' . $langs -> trans ( " Budget " ) . '</td>' ;
2015-02-21 12:57:17 +01:00
print '<td><input size="4" type="text" name="budget_amount" value="' . ( GETPOST ( 'budget_amount' ) != '' ? price ( GETPOST ( 'budget_amount' )) : '' ) . '"></td></tr>' ;
2015-02-16 10:58:05 +01:00
print '</td></tr>' ;
2010-11-11 13:16:55 +01:00
// Description
print '<tr><td valign="top">' . $langs -> trans ( " Description " ) . '</td>' ;
print '<td>' ;
print '<textarea name="description" wrap="soft" cols="80" rows="' . ROWS_3 . '">' . $_POST [ " description " ] . '</textarea>' ;
print '</td></tr>' ;
2010-01-04 22:45:59 +01:00
Add: hooks and triggers for a lot of core modules (action/calendrier, deplacement, dons, tva, contact/tiers, contrat, product lines, expedition, fournisseur commandes et factures, fiche intervention, projet et taches)
Signed-off-by: Stephen L. <lrq3000@gmail.com>
2012-08-14 15:50:45 +02:00
// Other options
$parameters = array ();
$reshook = $hookmanager -> executeHooks ( 'formObjectOptions' , $parameters , $object , $action ); // Note that $action and $object may have been modified by hook
2013-04-12 11:09:53 +02:00
if ( empty ( $reshook ) && ! empty ( $extrafields -> attribute_label ))
{
print $object -> showOptionals ( $extrafields , 'edit' );
}
Add: hooks and triggers for a lot of core modules (action/calendrier, deplacement, dons, tva, contact/tiers, contrat, product lines, expedition, fournisseur commandes et factures, fiche intervention, projet et taches)
Signed-off-by: Stephen L. <lrq3000@gmail.com>
2012-08-14 15:50:45 +02:00
2010-11-11 13:16:55 +01:00
print '</table>' ;
2010-02-28 00:42:45 +01:00
2015-01-30 16:33:39 +01:00
dol_fiche_end ();
print '<div class="center">' ;
2011-07-04 10:00:52 +02:00
print '<input type="submit" class="button" value="' . $langs -> trans ( " Create " ) . '">' ;
2012-02-27 17:02:56 +01:00
if ( ! empty ( $backtopage ))
2011-07-04 10:00:52 +02:00
{
print ' ' ;
print '<input type="submit" class="button" name="cancel" value="' . $langs -> trans ( " Cancel " ) . '">' ;
}
2014-11-24 06:43:15 +01:00
print '</div>' ;
2012-03-26 18:23:08 +02:00
2010-11-11 13:16:55 +01:00
print '</form>' ;
2005-01-14 21:30:49 +01:00
2008-09-10 11:43:48 +02:00
}
else
{
2010-11-11 13:16:55 +01:00
/*
* Show or edit
*/
2013-04-12 11:09:53 +02:00
$res = $object -> fetch_optionals ( $object -> id , $extralabels );
2010-11-11 13:16:55 +01:00
// To verify role of users
2012-05-29 23:50:13 +02:00
$userAccess = $object -> restrictedProjectArea ( $user , 'read' );
$userWrite = $object -> restrictedProjectArea ( $user , 'write' );
$userDelete = $object -> restrictedProjectArea ( $user , 'delete' );
2012-02-04 18:34:52 +01:00
//print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete;
2010-11-11 13:16:55 +01:00
// Confirmation validation
2012-02-04 18:34:52 +01:00
if ( $action == 'validate' )
2010-11-11 13:16:55 +01:00
{
2013-09-06 11:51:24 +02:00
print $form -> formconfirm ( $_SERVER [ " PHP_SELF " ] . '?id=' . $object -> id , $langs -> trans ( 'ValidateProject' ), $langs -> trans ( 'ConfirmValidateProject' ), 'confirm_validate' , '' , 0 , 1 );
2010-11-11 13:16:55 +01:00
}
// Confirmation close
2012-02-04 18:34:52 +01:00
if ( $action == 'close' )
2010-11-11 13:16:55 +01:00
{
2013-09-06 11:51:24 +02:00
print $form -> formconfirm ( $_SERVER [ " PHP_SELF " ] . " ?id= " . $object -> id , $langs -> trans ( " CloseAProject " ), $langs -> trans ( " ConfirmCloseAProject " ), " confirm_close " , '' , '' , 1 );
2010-11-11 13:16:55 +01:00
}
// Confirmation reopen
2012-02-04 18:34:52 +01:00
if ( $action == 'reopen' )
2010-11-11 13:16:55 +01:00
{
2013-09-06 11:51:24 +02:00
print $form -> formconfirm ( $_SERVER [ " PHP_SELF " ] . " ?id= " . $object -> id , $langs -> trans ( " ReOpenAProject " ), $langs -> trans ( " ConfirmReOpenAProject " ), " confirm_reopen " , '' , '' , 1 );
2010-11-11 13:16:55 +01:00
}
// Confirmation delete
2012-02-04 18:34:52 +01:00
if ( $action == 'delete' )
2010-11-11 13:16:55 +01:00
{
2011-05-18 14:33:38 +02:00
$text = $langs -> trans ( " ConfirmDeleteAProject " );
$task = new Task ( $db );
2012-05-29 23:50:13 +02:00
$taskarray = $task -> getTasksArray ( 0 , 0 , $object -> id , 0 , 0 );
2011-09-17 21:49:50 +02:00
$nboftask = count ( $taskarray );
2011-05-18 14:33:38 +02:00
if ( $nboftask ) $text .= '<br>' . img_warning () . ' ' . $langs -> trans ( " ThisWillAlsoRemoveTasks " , $nboftask );
2013-09-06 11:51:24 +02:00
print $form -> formconfirm ( $_SERVER [ " PHP_SELF " ] . " ?id= " . $object -> id , $langs -> trans ( " DeleteAProject " ), $text , " confirm_delete " , '' , '' , 1 );
2010-11-11 13:16:55 +01:00
}
2012-04-27 10:54:18 +02:00
2012-04-27 11:03:01 +02:00
// Clone confirmation
if ( $action == 'clone' )
{
2012-05-07 17:04:35 +02:00
$formquestion = array (
'text' => $langs -> trans ( " ConfirmClone " ),
2013-10-19 17:51:21 +02:00
array ( 'type' => 'checkbox' , 'name' => 'clone_contacts' , 'label' => $langs -> trans ( " CloneContacts " ), 'value' => true ),
array ( 'type' => 'checkbox' , 'name' => 'clone_tasks' , 'label' => $langs -> trans ( " CloneTasks " ), 'value' => true ),
2014-12-05 21:40:55 +01:00
array ( 'type' => 'checkbox' , 'name' => 'move_date' , 'label' => $langs -> trans ( " CloneMoveDate " ), 'value' => true ),
2013-10-19 17:51:21 +02:00
array ( 'type' => 'checkbox' , 'name' => 'clone_notes' , 'label' => $langs -> trans ( " CloneNotes " ), 'value' => true ),
2013-10-20 14:31:08 +02:00
array ( 'type' => 'checkbox' , 'name' => 'clone_project_files' , 'label' => $langs -> trans ( " CloneProjectFiles " ), 'value' => false ),
array ( 'type' => 'checkbox' , 'name' => 'clone_task_files' , 'label' => $langs -> trans ( " CloneTaskFiles " ), 'value' => false )
2012-05-07 17:04:35 +02:00
);
2012-05-29 23:50:13 +02:00
print $form -> formconfirm ( $_SERVER [ " PHP_SELF " ] . " ?id= " . $object -> id , $langs -> trans ( " CloneProject " ), $langs -> trans ( " ConfirmCloneProject " ), " confirm_clone " , $formquestion , '' , 1 , 240 );
2012-04-27 11:03:01 +02:00
}
2012-05-07 17:04:35 +02:00
2015-01-30 16:33:39 +01:00
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
print '<input type="hidden" name="token" value="' . $_SESSION [ 'newtoken' ] . '">' ;
print '<input type="hidden" name="action" value="update">' ;
print '<input type="hidden" name="id" value="' . $object -> id . '">' ;
print '<input type="hidden" name="comefromclone" value="' . $comefromclone . '">' ;
$head = project_prepare_head ( $object );
dol_fiche_head ( $head , 'project' , $langs -> trans ( " Project " ), 0 ,( $object -> public ? 'projectpub' : 'project' ));
2012-02-04 18:34:52 +01:00
if ( $action == 'edit' && $userWrite > 0 )
2010-11-11 13:16:55 +01:00
{
print '<table class="border" width="100%">' ;
// Ref
print '<tr><td width="30%">' . $langs -> trans ( " Ref " ) . '</td>' ;
2012-05-29 23:50:13 +02:00
print '<td><input size="12" name="ref" value="' . $object -> ref . '"></td></tr>' ;
2010-11-11 13:16:55 +01:00
// Label
print '<tr><td>' . $langs -> trans ( " Label " ) . '</td>' ;
2015-01-30 16:33:39 +01:00
print '<td><input size="40" name="title" value="' . $object -> title . '"></td></tr>' ;
2010-11-11 13:16:55 +01:00
// Customer
2014-05-08 20:29:16 +02:00
print '<tr><td>' . $langs -> trans ( " ThirdParty " ) . '</td><td>' ;
2015-04-14 12:32:19 +02:00
$filteronlist = '' ;
if ( ! empty ( $conf -> global -> PROJECT_FILTER_FOR_THIRDPARTY_LIST )) $filteronlist = $conf -> global -> PROJECT_FILTER_FOR_THIRDPARTY_LIST ;
$text = $form -> select_thirdparty_list ( $object -> thirdparty -> id , 'socid' , $filteronlist , 1 , 1 );
2012-08-03 19:05:20 +02:00
$texthelp = $langs -> trans ( " IfNeedToUseOhterObjectKeepEmpty " );
print $form -> textwithtooltip ( $text . ' ' . img_help (), $texthelp , 1 );
2010-11-11 13:16:55 +01:00
print '</td></tr>' ;
// Visibility
print '<tr><td>' . $langs -> trans ( " Visibility " ) . '</td><td>' ;
$array = array ( 0 => $langs -> trans ( " PrivateProject " ), 1 => $langs -> trans ( " SharedProject " ));
2012-05-29 23:50:13 +02:00
print $form -> selectarray ( 'public' , $array , $object -> public );
2010-11-11 13:16:55 +01:00
print '</td></tr>' ;
// Statut
2012-05-29 23:50:13 +02:00
print '<tr><td>' . $langs -> trans ( " Status " ) . '</td><td>' . $object -> getLibStatut ( 4 ) . '</td></tr>' ;
2010-11-11 13:16:55 +01:00
// Date start
print '<tr><td>' . $langs -> trans ( " DateStart " ) . '</td><td>' ;
2014-09-12 17:21:48 +02:00
print $form -> select_date ( $object -> date_start ? $object -> date_start :- 1 , 'projectstart' );
2012-08-31 14:31:36 +02:00
print ' <input type="checkbox" name="reportdate" value="yes" ' ;
2012-05-07 17:04:35 +02:00
if ( $comefromclone ){ print ' checked="checked" ' ;}
2012-08-31 14:31:36 +02:00
print '/> ' . $langs -> trans ( " ProjectReportDate " );
2010-11-11 13:16:55 +01:00
print '</td></tr>' ;
// Date end
print '<tr><td>' . $langs -> trans ( " DateEnd " ) . '</td><td>' ;
2012-05-29 23:50:13 +02:00
print $form -> select_date ( $object -> date_end ? $object -> date_end :- 1 , 'projectend' );
2010-11-11 13:16:55 +01:00
print '</td></tr>' ;
2015-02-16 10:58:05 +01:00
// Budget
print '<tr><td>' . $langs -> trans ( " Budget " ) . '</td>' ;
print '<td><input size="4" type="text" name="budget_amount" value="' . ( price ( isset ( $_POST [ 'budget_amount' ]) ? GETPOST ( 'budget_amount' ) : $object -> budget_amount )) . '"></td></tr>' ;
print '</td></tr>' ;
2010-11-11 13:16:55 +01:00
// Description
print '<tr><td valign="top">' . $langs -> trans ( " Description " ) . '</td>' ;
print '<td>' ;
2012-05-29 23:50:13 +02:00
print '<textarea name="description" wrap="soft" cols="80" rows="' . ROWS_3 . '">' . $object -> description . '</textarea>' ;
2010-11-11 13:16:55 +01:00
print '</td></tr>' ;
Add: hooks and triggers for a lot of core modules (action/calendrier, deplacement, dons, tva, contact/tiers, contrat, product lines, expedition, fournisseur commandes et factures, fiche intervention, projet et taches)
Signed-off-by: Stephen L. <lrq3000@gmail.com>
2012-08-14 15:50:45 +02:00
// Other options
$parameters = array ();
$reshook = $hookmanager -> executeHooks ( 'formObjectOptions' , $parameters , $object , $action ); // Note that $action and $object may have been modified by hook
2013-04-12 11:09:53 +02:00
if ( empty ( $reshook ) && ! empty ( $extrafields -> attribute_label ))
{
print $object -> showOptionals ( $extrafields , 'edit' );
}
2013-04-30 18:23:44 +02:00
2010-11-11 13:16:55 +01:00
print '</table>' ;
}
else
{
print '<table class="border" width="100%">' ;
2014-09-18 20:33:37 +02:00
$linkback = '<a href="' . DOL_URL_ROOT . '/projet/list.php">' . $langs -> trans ( " BackToList " ) . '</a>' ;
2012-07-28 21:49:47 +02:00
2010-11-11 13:16:55 +01:00
// Ref
print '<tr><td width="30%">' . $langs -> trans ( " Ref " ) . '</td><td>' ;
// Define a complementary filter for search of next/prev ref.
if ( ! $user -> rights -> projet -> all -> lire )
{
2012-05-29 23:50:13 +02:00
$objectsListId = $object -> getProjectsAuthorizedForUser ( $user , $mine , 0 );
$object -> next_prev_filter = " rowid in ( " . ( count ( $objectsListId ) ? join ( ',' , array_keys ( $objectsListId )) : '0' ) . " ) " ;
2010-11-11 13:16:55 +01:00
}
2012-07-28 21:49:47 +02:00
print $form -> showrefnav ( $object , 'ref' , $linkback , 1 , 'ref' , 'ref' );
2010-11-11 13:16:55 +01:00
print '</td></tr>' ;
// Label
2012-05-29 23:50:13 +02:00
print '<tr><td>' . $langs -> trans ( " Label " ) . '</td><td>' . $object -> title . '</td></tr>' ;
2010-11-11 13:16:55 +01:00
// Third party
2014-05-08 20:29:16 +02:00
print '<tr><td>' . $langs -> trans ( " ThirdParty " ) . '</td><td>' ;
2014-09-18 09:36:47 +02:00
if ( $object -> thirdparty -> id > 0 ) print $object -> thirdparty -> getNomUrl ( 1 );
2010-11-11 13:16:55 +01:00
else print ' ' ;
print '</td></tr>' ;
// Visibility
print '<tr><td>' . $langs -> trans ( " Visibility " ) . '</td><td>' ;
2012-05-29 23:50:13 +02:00
if ( $object -> public ) print $langs -> trans ( 'SharedProject' );
2010-11-11 13:16:55 +01:00
else print $langs -> trans ( 'PrivateProject' );
print '</td></tr>' ;
// Statut
2012-05-29 23:50:13 +02:00
print '<tr><td>' . $langs -> trans ( " Status " ) . '</td><td>' . $object -> getLibStatut ( 4 ) . '</td></tr>' ;
2010-11-11 13:16:55 +01:00
// Date start
print '<tr><td>' . $langs -> trans ( " DateStart " ) . '</td><td>' ;
2012-05-29 23:50:13 +02:00
print dol_print_date ( $object -> date_start , 'day' );
2010-11-11 13:16:55 +01:00
print '</td></tr>' ;
// Date end
print '<tr><td>' . $langs -> trans ( " DateEnd " ) . '</td><td>' ;
2012-05-29 23:50:13 +02:00
print dol_print_date ( $object -> date_end , 'day' );
2010-11-11 13:16:55 +01:00
print '</td></tr>' ;
2015-02-16 10:58:05 +01:00
// Budget
print '<tr><td>' . $langs -> trans ( " Budget " ) . '</td><td>' ;
if ( $object -> budget_amount != '' ) print price ( $object -> budget_amount , '' , $langs , 0 , 0 , 0 , $conf -> currency );
print '</td></tr>' ;
2010-11-11 13:16:55 +01:00
// Description
print '<td valign="top">' . $langs -> trans ( " Description " ) . '</td><td>' ;
2012-05-29 23:50:13 +02:00
print nl2br ( $object -> description );
2010-11-11 13:16:55 +01:00
print '</td></tr>' ;
Add: hooks and triggers for a lot of core modules (action/calendrier, deplacement, dons, tva, contact/tiers, contrat, product lines, expedition, fournisseur commandes et factures, fiche intervention, projet et taches)
Signed-off-by: Stephen L. <lrq3000@gmail.com>
2012-08-14 15:50:45 +02:00
// Other options
$parameters = array ();
$reshook = $hookmanager -> executeHooks ( 'formObjectOptions' , $parameters , $object , $action ); // Note that $action and $object may have been modified by hook
2013-04-12 11:09:53 +02:00
if ( empty ( $reshook ) && ! empty ( $extrafields -> attribute_label ))
{
print $object -> showOptionals ( $extrafields );
}
2010-11-11 13:16:55 +01:00
print '</table>' ;
}
dol_fiche_end ();
2015-01-30 16:33:39 +01:00
if ( $action == 'edit' && $userWrite > 0 )
{
print '<div align="center">' ;
print '<input name="update" class="button" type="submit" value="' . $langs -> trans ( " Modify " ) . '"> ' ;
print '<input type="submit" class="button" name="cancel" value="' . $langs -> trans ( " Cancel " ) . '">' ;
print '</div>' ;
}
print '</form>' ;
2010-11-11 13:16:55 +01:00
/*
* Boutons actions
*/
print '<div class="tabsAction">' ;
2012-02-04 18:34:52 +01:00
if ( $action != " edit " )
2010-11-11 13:16:55 +01:00
{
2012-04-27 11:03:01 +02:00
// Validate
2012-05-29 23:50:13 +02:00
if ( $object -> statut == 0 && $user -> rights -> projet -> creer )
2010-11-11 13:16:55 +01:00
{
2012-02-04 18:34:52 +01:00
if ( $userWrite > 0 )
2010-11-11 13:16:55 +01:00
{
2015-01-30 16:33:39 +01:00
print '<a class="butAction" href="card.php?id=' . $object -> id . '&action=validate">' . $langs -> trans ( " Validate " ) . '</a>' ;
2010-11-11 13:16:55 +01:00
}
else
{
2015-01-30 16:33:39 +01:00
print '<a class="butActionRefused" href="#" title="' . $langs -> trans ( " NotOwnerOfProject " ) . '">' . $langs -> trans ( 'Validate' ) . '</a>' ;
2010-11-11 13:16:55 +01:00
}
}
// Modify
2012-05-29 23:50:13 +02:00
if ( $object -> statut != 2 && $user -> rights -> projet -> creer )
2010-11-11 13:16:55 +01:00
{
2012-02-04 18:34:52 +01:00
if ( $userWrite > 0 )
2010-11-11 13:16:55 +01:00
{
2014-09-18 21:18:25 +02:00
print '<a class="butAction" href="card.php?id=' . $object -> id . '&action=edit">' . $langs -> trans ( " Modify " ) . '</a>' ;
2010-11-11 13:16:55 +01:00
}
else
{
print '<a class="butActionRefused" href="#" title="' . $langs -> trans ( " NotOwnerOfProject " ) . '">' . $langs -> trans ( 'Modify' ) . '</a>' ;
}
}
// Close
2012-05-29 23:50:13 +02:00
if ( $object -> statut == 1 && $user -> rights -> projet -> creer )
2010-11-11 13:16:55 +01:00
{
2012-02-04 18:34:52 +01:00
if ( $userWrite > 0 )
2010-11-11 13:16:55 +01:00
{
2014-09-18 21:18:25 +02:00
print '<a class="butAction" href="card.php?id=' . $object -> id . '&action=close">' . $langs -> trans ( " Close " ) . '</a>' ;
2010-11-11 13:16:55 +01:00
}
else
{
print '<a class="butActionRefused" href="#" title="' . $langs -> trans ( " NotOwnerOfProject " ) . '">' . $langs -> trans ( 'Close' ) . '</a>' ;
}
}
// Reopen
2012-05-29 23:50:13 +02:00
if ( $object -> statut == 2 && $user -> rights -> projet -> creer )
2010-11-11 13:16:55 +01:00
{
2012-02-04 18:34:52 +01:00
if ( $userWrite > 0 )
2010-11-11 13:16:55 +01:00
{
2014-09-18 21:18:25 +02:00
print '<a class="butAction" href="card.php?id=' . $object -> id . '&action=reopen">' . $langs -> trans ( " ReOpen " ) . '</a>' ;
2010-11-11 13:16:55 +01:00
}
else
{
print '<a class="butActionRefused" href="#" title="' . $langs -> trans ( " NotOwnerOfProject " ) . '">' . $langs -> trans ( 'ReOpen' ) . '</a>' ;
}
}
2012-05-07 17:04:35 +02:00
2012-04-27 11:03:01 +02:00
// Clone
if ( $user -> rights -> projet -> creer )
{
if ( $userWrite > 0 )
{
2014-09-18 21:18:25 +02:00
print '<a class="butAction" href="card.php?id=' . $object -> id . '&action=clone">' . $langs -> trans ( 'ToClone' ) . '</a>' ;
2012-04-27 11:03:01 +02:00
}
else
{
print '<a class="butActionRefused" href="#" title="' . $langs -> trans ( " NotOwnerOfProject " ) . '">' . $langs -> trans ( 'ToClone' ) . '</a>' ;
}
}
2010-11-11 13:16:55 +01:00
// Delete
if ( $user -> rights -> projet -> supprimer )
{
2012-02-04 18:34:52 +01:00
if ( $userDelete > 0 )
2010-11-11 13:16:55 +01:00
{
2014-09-18 21:18:25 +02:00
print '<a class="butActionDelete" href="card.php?id=' . $object -> id . '&action=delete">' . $langs -> trans ( " Delete " ) . '</a>' ;
2010-11-11 13:16:55 +01:00
}
else
{
print '<a class="butActionRefused" href="#" title="' . $langs -> trans ( " NotOwnerOfProject " ) . '">' . $langs -> trans ( 'Delete' ) . '</a>' ;
}
}
}
print " </div> " ;
print " <br> \n " ;
2012-02-04 18:34:52 +01:00
if ( $action != 'presend' )
2010-11-11 13:16:55 +01:00
{
print '<table width="100%"><tr><td width="50%" valign="top">' ;
print '<a name="builddoc"></a>' ; // ancre
/*
* Documents generes
*/
2012-05-29 23:50:13 +02:00
$filename = dol_sanitizeFileName ( $object -> ref );
$filedir = $conf -> projet -> dir_output . " / " . dol_sanitizeFileName ( $object -> ref );
$urlsource = $_SERVER [ " PHP_SELF " ] . " ?id= " . $object -> id ;
2012-02-04 18:34:52 +01:00
$genallowed = ( $user -> rights -> projet -> lire && $userAccess > 0 );
$delallowed = ( $user -> rights -> projet -> creer && $userWrite > 0 );
2010-11-11 13:16:55 +01:00
$var = true ;
2012-05-29 23:50:13 +02:00
$somethingshown = $formfile -> show_documents ( 'project' , $filename , $filedir , $urlsource , $genallowed , $delallowed , $object -> modelpdf );
2010-11-11 13:16:55 +01:00
print '</td><td valign="top" width="50%">' ;
2013-04-30 18:23:44 +02:00
if ( ! empty ( $object -> id ))
{
// List of actions on element
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php' ;
$formactions = new FormActions ( $db );
$somethingshown = $formactions -> showactions ( $object , 'project' , $socid );
}
2010-11-11 13:16:55 +01:00
print '</td></tr></table>' ;
}
2014-05-08 20:02:34 +02:00
// Hook to add more things on page
$parameters = array ();
$reshook = $hookmanager -> executeHooks ( 'mainCardTabAddMore' , $parameters , $object , $action ); // Note that $action and $object may have been modified by hook
2003-09-04 13:08:03 +02:00
}
2004-10-23 17:09:29 +02:00
2011-08-27 16:24:16 +02:00
llxFooter ();
2012-02-04 18:34:52 +01:00
$db -> close ();