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 >
2016-08-04 10:08:58 +02:00
* Copyright ( C ) 2004 - 2016 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' ;
2015-06-29 16:57:32 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php' ;
2012-08-22 23:11:24 +02:00
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' ;
2016-08-29 10:32:00 +02:00
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php' ;
2003-09-04 13:08:03 +02:00
2018-05-26 21:11:25 +02:00
// Load translation files required by the page
$langs -> loadLangs ( array ( 'projects' , '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' );
2017-06-08 12:21:41 +02:00
$confirm = GETPOST ( 'confirm' , 'aZ09' );
2015-06-03 11:55:39 +02:00
$status = GETPOST ( 'status' , 'int' );
2015-06-29 16:57:32 +02:00
$opp_status = GETPOST ( 'opp_status' , 'int' );
2016-01-28 20:04:02 +01:00
$opp_percent = price2num ( GETPOST ( 'opp_percent' , '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
2017-06-10 12:56:28 +02:00
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
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-10-01 16:50:18 +02:00
//include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Can't 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
{
2017-10-07 13:09:31 +02:00
$ret = $object -> fetch ( $id , $ref ); // If we create project, ref may be defined into POST but record does not yet exists into database
if ( $ret > 0 ) {
$object -> fetch_thirdparty ();
2018-05-22 16:07:32 +02:00
if ( ! empty ( $conf -> global -> PROJECT_ALLOW_COMMENT_ON_PROJECT ) && method_exists ( $object , 'fetchComments' ) && empty ( $object -> comments )) $object -> fetchComments ();
2017-10-07 13:09:31 +02:00
$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
2017-06-08 12:21:41 +02:00
$socid = GETPOST ( 'socid' , 'int' );
2017-01-12 15:23:30 +01:00
//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement.
2016-03-22 16:48:51 +01:00
$result = restrictedArea ( $user , 'projet' , $object -> id , 'projet&project' );
2013-04-30 18:23:44 +02:00
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 )
{
2017-10-07 13:09:31 +02:00
$result = $object -> delete ( $user );
if ( $result > 0 )
{
header ( " Location: index.php " );
exit ;
}
else
{
dol_syslog ( $object -> error , LOG_DEBUG );
setEventMessages ( $langs -> trans ( " CantRemoveProject " ), null , 'errors' );
}
2014-05-08 20:02:34 +02:00
}
2015-03-04 18:56:57 +01:00
if ( $backtopage )
{
2017-10-07 13:09:31 +02:00
header ( " Location: " . $backtopage );
exit ;
2015-03-04 18:56:57 +01:00
}
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 )
{
2017-10-07 13:09:31 +02:00
$error = 0 ;
if ( empty ( $_POST [ " ref " ]))
{
setEventMessages ( $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentities ( " Ref " )), null , 'errors' );
$error ++ ;
}
if ( empty ( $_POST [ " title " ]))
{
setEventMessages ( $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentities ( " Label " )), null , 'errors' );
$error ++ ;
}
if ( GETPOST ( 'opp_amount' ) != '' && ! ( GETPOST ( 'opp_status' ) > 0 ))
{
$error ++ ;
setEventMessages ( $langs -> trans ( " ErrorOppStatusRequiredIfAmount " ), null , 'errors' );
}
// Create with status validated immediatly
if ( ! empty ( $conf -> global -> PROJECT_CREATE_NO_DRAFT ))
{
$status = Project :: STATUS_VALIDATED ;
}
if ( ! $error )
{
$error = 0 ;
$db -> begin ();
$object -> ref = GETPOST ( 'ref' , 'alpha' );
$object -> title = GETPOST ( 'title' , 'none' ); // Do not use 'alpha' here, we want field as it is
$object -> socid = GETPOST ( 'socid' , 'int' );
$object -> description = GETPOST ( 'description' , 'none' ); // Do not use 'alpha' here, we want field as it is
$object -> public = GETPOST ( 'public' , 'alpha' );
2018-02-01 17:50:19 +01:00
$object -> opp_amount = price2num ( GETPOST ( 'opp_amount' , 'alpha' ));
$object -> budget_amount = price2num ( GETPOST ( 'budget_amount' , 'alpha' ));
2017-10-07 13:09:31 +02:00
$object -> datec = dol_now ();
$object -> date_start = $date_start ;
$object -> date_end = $date_end ;
$object -> statut = $status ;
$object -> opp_status = $opp_status ;
$object -> opp_percent = $opp_percent ;
2018-02-26 14:28:51 +01:00
$object -> bill_time = ( GETPOST ( 'bill_time' , 'alpha' ) == 'on' ? 1 : 0 );
2017-10-07 13:09:31 +02:00
// 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
2017-10-07 13:09:31 +02:00
$result = $object -> create ( $user );
if ( ! $error && $result > 0 )
{
// Add myself as project leader
$result = $object -> add_contact ( $user -> id , 'PROJECTLEADER' , 'internal' );
if ( $result < 0 )
{
$langs -> load ( " errors " );
setEventMessages ( $langs -> trans ( $object -> error ), null , 'errors' );
$error ++ ;
}
}
else
{
$langs -> load ( " errors " );
setEventMessages ( $langs -> trans ( $object -> error ), null , 'errors' );
$error ++ ;
}
if ( ! $error && ! empty ( $object -> id ) > 0 )
{
// Category association
$categories = GETPOST ( 'categories' , 'array' );
$result = $object -> setCategories ( $categories );
if ( $result < 0 ) {
$langs -> load ( " errors " );
setEventMessages ( $object -> error , $object -> errors , 'errors' );
$error ++ ;
}
}
2014-05-08 20:02:34 +02:00
2017-10-07 13:09:31 +02:00
if ( ! $error )
{
$db -> commit ();
if ( $backtopage )
2015-06-03 11:55:39 +02:00
{
2017-10-07 13:09:31 +02:00
header ( " Location: " . $backtopage . '&projectid=' . $object -> id );
exit ;
2015-06-03 11:55:39 +02:00
}
else
{
2017-10-07 13:09:31 +02:00
header ( " Location:card.php?id= " . $object -> id );
exit ;
2015-06-03 11:55:39 +02:00
}
2017-10-07 13:09:31 +02:00
}
else
{
$db -> rollback ();
$action = 'create' ;
}
}
else
{
$action = 'create' ;
}
2014-05-08 20:02:34 +02:00
}
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 )
{
2017-10-07 13:09:31 +02:00
$error = 0 ;
if ( empty ( $ref ))
{
$error ++ ;
//$_GET["id"]=$_POST["id"]; // We return on the project card
setEventMessages ( $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentities ( " Ref " )), null , 'errors' );
}
if ( empty ( $_POST [ " title " ]))
{
$error ++ ;
//$_GET["id"]=$_POST["id"]; // We return on the project card
setEventMessages ( $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentities ( " Label " )), null , 'errors' );
}
$db -> begin ();
if ( ! $error )
{
2015-09-24 16:32:48 +02:00
$object -> oldcopy = clone $object ;
2014-05-08 20:02:34 +02:00
$old_start_date = $object -> date_start ;
2017-10-07 13:09:31 +02:00
$object -> ref = GETPOST ( 'ref' , 'alpha' );
$object -> title = GETPOST ( 'title' , 'none' ); // Do not use 'alpha' here, we want field as it is
2018-02-01 17:50:19 +01:00
$object -> statut = GETPOST ( 'status' , 'int' );
2017-10-07 13:09:31 +02:00
$object -> socid = GETPOST ( 'socid' , 'int' );
$object -> description = GETPOST ( 'description' , 'none' ); // Do not use 'alpha' here, we want field as it is
$object -> public = GETPOST ( 'public' , 'alpha' );
$object -> date_start = empty ( $_POST [ " projectstart " ]) ? '' : $date_start ;
$object -> date_end = empty ( $_POST [ " projectend " ]) ? '' : $date_end ;
2018-02-01 17:50:19 +01:00
if ( isset ( $_POST [ 'opp_amount' ])) $object -> opp_amount = price2num ( GETPOST ( 'opp_amount' , 'alpha' ));
if ( isset ( $_POST [ 'budget_amount' ])) $object -> budget_amount = price2num ( GETPOST ( 'budget_amount' , 'alpha' ));
2017-10-07 13:09:31 +02:00
if ( isset ( $_POST [ 'opp_status' ])) $object -> opp_status = $opp_status ;
if ( isset ( $_POST [ 'opp_percent' ])) $object -> opp_percent = $opp_percent ;
2018-02-26 14:28:51 +01:00
$object -> bill_time = ( GETPOST ( 'bill_time' , 'alpha' ) == 'on' ? 1 : 0 );
2017-10-07 13:09:31 +02:00
// 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 ++ ;
2017-10-07 13:09:31 +02:00
}
2010-11-11 13:16:55 +01:00
2015-07-10 10:42:42 +02:00
if ( $object -> opp_amount && ( $object -> opp_status <= 0 ))
2017-10-07 13:09:31 +02:00
{
$error ++ ;
setEventMessages ( $langs -> trans ( " ErrorOppStatusRequiredIfAmount " ), null , 'errors' );
}
if ( ! $error )
{
$result = $object -> update ( $user );
if ( $result < 0 )
{
$error ++ ;
if ( $result == - 4 ) setEventMessages ( $langs -> trans ( " ErrorRefAlreadyExists " ), null , 'errors' );
else setEventMessages ( $object -> error , $object -> errors , 'errors' );
} else {
// Category association
$categories = GETPOST ( 'categories' , 'array' );
$result = $object -> setCategories ( $categories );
if ( $result < 0 )
{
$error ++ ;
setEventMessages ( $object -> error , $object -> errors , 'errors' );
}
}
}
if ( ! $error )
{
if ( GETPOST ( " reportdate " ) && ( $object -> date_start != $old_start_date ))
{
$result = $object -> shiftTaskDate ( $old_start_date );
if ( $result < 0 )
{
$error ++ ;
setEventMessages ( $langs -> trans ( " ErrorShiftTaskDate " ) . ':' . $object -> error , $object -> errors , 'errors' );
}
}
}
2013-04-30 18:23:44 +02:00
2017-02-01 13:25:16 +01:00
// Check if we must change status
2017-10-07 13:09:31 +02:00
if ( GETPOST ( 'closeproject' ))
{
$resclose = $object -> setClose ( $user );
if ( $resclose < 0 )
{
$error ++ ;
setEventMessages ( $langs -> trans ( " FailedToCloseProject " ) . ':' . $object -> error , $object -> errors , 'errors' );
}
}
2017-06-02 12:27:46 +02:00
2017-10-07 13:09:31 +02:00
if ( $error )
{
2014-05-08 20:02:34 +02:00
$db -> rollback ();
2017-10-07 13:09:31 +02:00
$action = 'edit' ;
}
else
2013-10-23 18:26:18 +02:00
{
2017-10-07 13:09:31 +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 );
2017-10-07 13:09:31 +02:00
}
2017-06-02 12:27:46 +02:00
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
2017-10-07 13:09:31 +02:00
$outputlangs = $langs ;
if ( GETPOST ( 'lang_id' , 'aZ09' ))
{
$outputlangs = new Translate ( " " , $conf );
$outputlangs -> setDefaultLang ( GETPOST ( 'lang_id' , 'aZ09' ));
}
$result = $object -> generateDocument ( $object -> modelpdf , $outputlangs );
if ( $result <= 0 )
{
setEventMessages ( $object -> error , $object -> errors , 'errors' );
$action = '' ;
}
2014-05-08 20:02:34 +02:00
}
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 )
{
2017-10-07 13:09:31 +02:00
if ( $object -> id > 0 )
{
2016-07-01 17:49:13 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php' ;
2016-08-29 10:32:00 +02:00
2016-07-01 17:49:13 +02:00
$langs -> load ( " other " );
$upload_dir = $conf -> projet -> dir_output ;
$file = $upload_dir . '/' . GETPOST ( 'file' );
$ret = dol_delete_file ( $file , 0 , 0 , 0 , $object );
if ( $ret )
setEventMessages ( $langs -> trans ( " FileWasRemoved " , GETPOST ( 'file' )), null , 'mesgs' );
else
setEventMessages ( $langs -> trans ( " ErrorFailToDeleteFile " , GETPOST ( 'file' )), null , 'errors' );
$action = '' ;
2017-10-07 13:09:31 +02:00
}
2014-05-08 20:02:34 +02:00
}
2012-05-29 23:50:13 +02:00
2012-04-27 10:32:01 +02:00
2017-06-08 12:21:41 +02:00
if ( $action == 'confirm_validate' && $confirm == 'yes' )
2014-05-08 20:02:34 +02:00
{
2017-10-07 13:09:31 +02:00
$result = $object -> setValid ( $user );
if ( $result <= 0 )
{
setEventMessages ( $object -> error , $object -> errors , 'errors' );
}
2014-05-08 20:02:34 +02:00
}
2010-01-04 23:04:04 +01:00
2017-06-08 12:21:41 +02:00
if ( $action == 'confirm_close' && $confirm == 'yes' )
2014-05-08 20:02:34 +02:00
{
2017-10-07 13:09:31 +02:00
$result = $object -> setClose ( $user );
if ( $result <= 0 )
{
setEventMessages ( $object -> error , $object -> errors , 'errors' );
}
2014-05-08 20:02:34 +02:00
}
2010-01-04 23:04:04 +01:00
2017-06-08 12:21:41 +02:00
if ( $action == 'confirm_reopen' && $confirm == 'yes' )
2014-05-08 20:02:34 +02:00
{
2017-10-07 13:09:31 +02:00
$result = $object -> setValid ( $user );
if ( $result <= 0 )
{
setEventMessages ( $object -> error , $object -> errors , '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 )
{
2017-10-07 13:09:31 +02:00
$object -> fetch ( $id );
$result = $object -> delete ( $user );
if ( $result > 0 )
{
setEventMessages ( $langs -> trans ( " RecordDeleted " ), null , 'mesgs' );
2018-02-26 21:16:40 +01:00
header ( " Location: list.php?restore_lastsearch_values=1 " );
2017-10-07 13:09:31 +02:00
exit ;
}
else
{
dol_syslog ( $object -> error , LOG_DEBUG );
setEventMessages ( $object -> error , $object -> errors , 'errors' );
}
2014-05-08 20:02:34 +02:00
}
2003-09-04 13:08:03 +02:00
2017-06-08 12:21:41 +02:00
if ( $action == 'confirm_clone' && $user -> rights -> projet -> creer && $confirm == 'yes' )
2014-05-08 20:02:34 +02:00
{
2017-10-07 13:09:31 +02:00
$clone_contacts = GETPOST ( 'clone_contacts' ) ? 1 : 0 ;
$clone_tasks = GETPOST ( 'clone_tasks' ) ? 1 : 0 ;
2014-05-08 20:02:34 +02:00
$clone_project_files = GETPOST ( 'clone_project_files' ) ? 1 : 0 ;
$clone_task_files = GETPOST ( 'clone_task_files' ) ? 1 : 0 ;
2017-10-07 13:09:31 +02:00
$clone_notes = GETPOST ( 'clone_notes' ) ? 1 : 0 ;
$move_date = GETPOST ( 'move_date' ) ? 1 : 0 ;
$clone_thirdparty = GETPOST ( 'socid' , 'int' ) ? GETPOST ( 'socid' , 'int' ) : 0 ;
$result = $object -> createFromClone ( $object -> id , $clone_contacts , $clone_tasks , $clone_project_files , $clone_task_files , $clone_notes , $move_date , 0 , $clone_thirdparty );
if ( $result <= 0 )
{
setEventMessages ( $object -> error , $object -> errors , 'errors' );
}
else
{
// Load new object
$newobject = new Project ( $db );
$newobject -> fetch ( $result );
$newobject -> fetch_optionals ();
$newobject -> fetch_thirdparty (); // Load new object
$object = $newobject ;
$action = 'edit' ;
$comefromclone = true ;
}
2014-05-08 20:02:34 +02:00
}
2018-03-28 15:22:47 +02:00
// Actions to send emails
$trigger_name = 'PROJECT_SENTBYMAIL' ;
$paramname = 'id' ;
$autocopy = 'MAIN_MAIL_AUTOCOPY_ORDER_TO' ; // used to know the automatic BCC to add
$trackid = 'proj' . $object -> id ;
include DOL_DOCUMENT_ROOT . '/core/actions_sendmails.inc.php' ;
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 );
2015-06-29 16:57:32 +02:00
$formproject = new FormProjets ( $db );
2010-05-23 22:01:10 +02:00
$userstatic = new User ( $db );
2016-02-01 01:19:37 +01:00
$title = $langs -> trans ( " Project " ) . ' - ' . $object -> ref . ( $object -> thirdparty -> name ? ' - ' . $object -> thirdparty -> name : '' ) . ( $object -> title ? ' - ' . $object -> title : '' );
if ( ! empty ( $conf -> global -> MAIN_HTML_TITLE ) && preg_match ( '/projectnameonly/' , $conf -> global -> MAIN_HTML_TITLE )) $title = $object -> ref . ( $object -> thirdparty -> name ? ' - ' . $object -> thirdparty -> name : '' ) . ( $object -> title ? ' - ' . $object -> title : '' );
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
{
2017-10-07 13:09:31 +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 );
2017-10-07 13:09:31 +02:00
print load_fiche_titre ( $langs -> trans ( " NewProject " ), '' , 'title_project' );
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">' ;
print '<input type="hidden" name="backtopage" value="' . $backtopage . '">' ;
dol_fiche_head ();
print '<table class="border" width="100%">' ;
$defaultref = '' ;
$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 )
{
$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 );
}
if ( is_numeric ( $defaultref ) && $defaultref <= 0 ) $defaultref = '' ;
// Ref
$suggestedref = ( $_POST [ " ref " ] ? $_POST [ " ref " ] : $defaultref );
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">' . $langs -> trans ( " Ref " ) . '</span></td><td><input size="12" type="text" name="ref" value="' . dol_escape_htmltag ( $suggestedref ) . '">' ;
print ' ' . $form -> textwithpicto ( '' , $langs -> trans ( " YouCanCompleteRef " , $suggestedref ));
print '</td></tr>' ;
// Label
print '<tr><td><span class="fieldrequired">' . $langs -> trans ( " Label " ) . '</span></td><td><input size="80" type="text" name="title" value="' . dol_escape_htmltag ( GETPOST ( " title " , 'none' )) . '" autofocus></td></tr>' ;
// Thirdparty
if ( $conf -> societe -> enabled )
{
print '<tr><td>' ;
print ( empty ( $conf -> global -> PROJECT_THIRDPARTY_REQUIRED ) ? '' : '<span class="fieldrequired">' );
print $langs -> trans ( " ThirdParty " );
print ( empty ( $conf -> global -> PROJECT_THIRDPARTY_REQUIRED ) ? '' : '</span>' );
print '</td><td class="maxwidthonsmartphone">' ;
$filteronlist = '' ;
if ( ! empty ( $conf -> global -> PROJECT_FILTER_FOR_THIRDPARTY_LIST )) $filteronlist = $conf -> global -> PROJECT_FILTER_FOR_THIRDPARTY_LIST ;
$text = $form -> select_company ( GETPOST ( 'socid' , 'int' ), 'socid' , $filteronlist , 'SelectThirdParty' , 1 , 0 , array (), 0 , 'minwidth300' );
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 ;
print ' <a href="' . DOL_URL_ROOT . '/societe/card.php?action=create&backtopage=' . urlencode ( $_SERVER [ " PHP_SELF " ] . '?action=create' ) . '">' . $langs -> trans ( " AddThirdParty " ) . '</a>' ;
print '</td></tr>' ;
}
// Status
if ( $status != '' )
{
print '<tr><td>' . $langs -> trans ( " Status " ) . '</td><td>' ;
print '<input type="hidden" name="status" value="' . $status . '">' ;
print $object -> LibStatut ( $status , 4 );
print '</td></tr>' ;
}
// Visibility
print '<tr><td>' . $langs -> trans ( " Visibility " ) . '</td><td class="maxwidthonsmartphone">' ;
$array = array ();
if ( empty ( $conf -> global -> PROJECT_DISABLE_PRIVATE_PROJECT )) $array [ 0 ] = $langs -> trans ( " PrivateProject " );
if ( empty ( $conf -> global -> PROJECT_DISABLE_PUBLIC_PROJECT )) $array [ 1 ] = $langs -> trans ( " SharedProject " );
print $form -> selectarray ( 'public' , $array , GETPOST ( 'public' ) ? GETPOST ( 'public' ) : $object -> public );
print '</td></tr>' ;
// Date start
print '<tr><td>' . $langs -> trans ( " DateStart " ) . '</td><td>' ;
print $form -> select_date (( $date_start ? $date_start : '' ), 'projectstart' , 0 , 0 , 0 , '' , 1 , 0 , 1 );
print '</td></tr>' ;
// Date end
print '<tr><td>' . $langs -> trans ( " DateEnd " ) . '</td><td>' ;
print $form -> select_date (( $date_end ? $date_end :- 1 ), 'projectend' , 0 , 0 , 0 , '' , 1 , 0 , 1 );
print '</td></tr>' ;
if ( ! empty ( $conf -> global -> PROJECT_USE_OPPORTUNITIES ))
{
// Opportunity status
print '<tr><td>' . $langs -> trans ( " OpportunityStatus " ) . '</td>' ;
print '<td class="maxwidthonsmartphone">' ;
print $formproject -> selectOpportunityStatus ( 'opp_status' , GETPOST ( 'opp_status' ) ? GETPOST ( 'opp_status' ) : $object -> opp_status );
print '</tr>' ;
// Opportunity probability
print '<tr><td>' . $langs -> trans ( " OpportunityProbability " ) . '</td>' ;
print '<td><input size="5" type="text" id="opp_percent" name="opp_percent" value="' . dol_escape_htmltag ( GETPOST ( 'opp_percent' ) != '' ? GETPOST ( 'opp_percent' ) : '' ) . '"><span class="hideonsmartphone"> %</span>' ;
print '<input type="hidden" name="opp_percent_not_set" id="opp_percent_not_set" value="' . dol_escape_htmltag ( GETPOST ( 'opp_percent' ) != '' ? '0' : '1' ) . '">' ;
print '</td>' ;
print '</tr>' ;
// Opportunity amount
print '<tr><td>' . $langs -> trans ( " OpportunityAmount " ) . '</td>' ;
print '<td><input size="5" type="text" name="opp_amount" value="' . dol_escape_htmltag ( GETPOST ( 'opp_amount' ) != '' ? GETPOST ( 'opp_amount' ) : '' ) . '"></td>' ;
print '</tr>' ;
}
2015-06-29 16:57:32 +02:00
2015-06-30 01:53:01 +02:00
// Budget
print '<tr><td>' . $langs -> trans ( " Budget " ) . '</td>' ;
2017-10-06 12:08:01 +02:00
print '<td><input size="5" type="text" name="budget_amount" value="' . dol_escape_htmltag ( GETPOST ( 'budget_amount' ) != '' ? GETPOST ( 'budget_amount' ) : '' ) . '"></td>' ;
2015-06-30 01:53:01 +02:00
print '</tr>' ;
2015-02-16 10:58:05 +01:00
2017-10-07 13:09:31 +02:00
// Description
print '<tr><td class="tdtop">' . $langs -> trans ( " Description " ) . '</td>' ;
print '<td>' ;
print '<textarea name="description" wrap="soft" class="centpercent" rows="' . ROWS_3 . '">' . dol_escape_htmltag ( GETPOST ( " description " , 'none' )) . '</textarea>' ;
print '</td></tr>' ;
2018-02-26 14:28:51 +01:00
// Bill time
if ( ! empty ( $conf -> global -> PROJECT_BILL_TIME_SPENT ))
{
print '<tr><td>' . $langs -> trans ( " BillTime " ) . '</td>' ;
print '<td><input type="checkbox" name="bill_time"' . ( GETPOST ( 'bill_time' , 'alpha' ) != '' ? ' checked="checked"' : '' ) . '"></td>' ;
print '</tr>' ;
}
2017-10-07 13:09:31 +02:00
if ( $conf -> categorie -> enabled ) {
// Categories
print '<tr><td>' . $langs -> trans ( " Categories " ) . '</td><td colspan="3">' ;
$cate_arbo = $form -> select_all_categories ( Categorie :: TYPE_PROJECT , '' , 'parent' , 64 , 0 , 1 );
$arrayselected = GETPOST ( 'categories' , 'array' );
print $form -> multiselectarray ( 'categories' , $cate_arbo , $arrayselected , '' , 0 , '' , 0 , '100%' );
print " </td></tr> " ;
}
// Other options
$parameters = array ();
$reshook = $hookmanager -> executeHooks ( 'formObjectOptions' , $parameters , $object , $action ); // Note that $action and $object may have been modified by hook
print $hookmanager -> resPrint ;
2018-04-13 13:37:43 +02:00
if ( empty ( $reshook ))
2017-10-07 13:09:31 +02:00
{
print $object -> showOptionals ( $extrafields , 'edit' );
}
print '</table>' ;
dol_fiche_end ();
print '<div class="center">' ;
print '<input type="submit" class="button" value="' . $langs -> trans ( " CreateDraft " ) . '">' ;
if ( ! empty ( $backtopage ))
{
print ' ' ;
print '<input type="submit" class="button" name="cancel" value="' . $langs -> trans ( " Cancel " ) . '">' ;
}
else
{
print ' ' ;
print '<input type="button" class="button" value="' . $langs -> trans ( " Cancel " ) . '" onClick="javascript:history.go(-1)">' ;
}
print '</div>' ;
print '</form>' ;
// Change probability from status
print ' < script type = " text/javascript " language = " javascript " >
2016-01-28 20:04:02 +01:00
jQuery ( document ) . ready ( function () {
function change_percent ()
{
2016-08-29 10:32:00 +02:00
var element = jQuery ( " #opp_status option:selected " );
2016-01-28 20:04:02 +01:00
var defaultpercent = element . attr ( " defaultpercent " );
/*if (jQuery("#opp_percent_not_set").val() == "") */
jQuery ( " #opp_percent " ) . val ( defaultpercent );
}
/*init_myfunc();*/
jQuery ( " #opp_status " ) . change ( function () {
change_percent ();
});
});
</ script > ' ;
2008-09-10 11:43:48 +02:00
}
2017-06-02 12:27:46 +02:00
elseif ( $object -> id > 0 )
2008-09-10 11:43:48 +02:00
{
2017-10-07 13:09:31 +02:00
/*
2010-11-11 13:16:55 +01:00
* Show or edit
*/
2017-06-02 12:27:46 +02:00
2018-02-21 14:48:25 +01:00
$res = $object -> fetch_optionals ();
2017-10-07 13:09:31 +02:00
// To verify role of users
$userAccess = $object -> restrictedProjectArea ( $user , 'read' );
$userWrite = $object -> restrictedProjectArea ( $user , 'write' );
$userDelete = $object -> restrictedProjectArea ( $user , 'delete' );
//print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete;
// Confirmation validation
if ( $action == 'validate' )
{
print $form -> formconfirm ( $_SERVER [ " PHP_SELF " ] . '?id=' . $object -> id , $langs -> trans ( 'ValidateProject' ), $langs -> trans ( 'ConfirmValidateProject' ), 'confirm_validate' , '' , 0 , 1 );
}
// Confirmation close
if ( $action == 'close' )
{
print $form -> formconfirm ( $_SERVER [ " PHP_SELF " ] . " ?id= " . $object -> id , $langs -> trans ( " CloseAProject " ), $langs -> trans ( " ConfirmCloseAProject " ), " confirm_close " , '' , '' , 1 );
}
// Confirmation reopen
if ( $action == 'reopen' )
{
print $form -> formconfirm ( $_SERVER [ " PHP_SELF " ] . " ?id= " . $object -> id , $langs -> trans ( " ReOpenAProject " ), $langs -> trans ( " ConfirmReOpenAProject " ), " confirm_reopen " , '' , '' , 1 );
}
// Confirmation delete
if ( $action == 'delete' )
{
$text = $langs -> trans ( " ConfirmDeleteAProject " );
$task = new Task ( $db );
$taskarray = $task -> getTasksArray ( 0 , 0 , $object -> id , 0 , 0 );
$nboftask = count ( $taskarray );
if ( $nboftask ) $text .= '<br>' . img_warning () . ' ' . $langs -> trans ( " ThisWillAlsoRemoveTasks " , $nboftask );
print $form -> formconfirm ( $_SERVER [ " PHP_SELF " ] . " ?id= " . $object -> id , $langs -> trans ( " DeleteAProject " ), $text , " confirm_delete " , '' , '' , 1 );
}
// Clone confirmation
if ( $action == 'clone' )
{
$formquestion = array (
'text' => $langs -> trans ( " ConfirmClone " ),
2016-10-16 12:12:45 +02:00
array ( 'type' => 'other' , 'name' => 'socid' , 'label' => $langs -> trans ( " SelectThirdParty " ), 'value' => $form -> select_company ( GETPOST ( 'socid' , 'int' ) > 0 ? GETPOST ( 'socid' , 'int' ) : $object -> socid , 'socid' , '' , " None " , 0 , 0 , null , 0 , 'minwidth200' )),
2017-10-07 13:09:31 +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 ),
array ( 'type' => 'checkbox' , 'name' => 'move_date' , 'label' => $langs -> trans ( " CloneMoveDate " ), 'value' => true ),
array ( 'type' => 'checkbox' , 'name' => 'clone_notes' , 'label' => $langs -> trans ( " CloneNotes " ), 'value' => true ),
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 )
);
print $form -> formconfirm ( $_SERVER [ " PHP_SELF " ] . " ?id= " . $object -> id , $langs -> trans ( " CloneProject " ), $langs -> trans ( " ConfirmCloneProject " ), " confirm_clone " , $formquestion , '' , 1 , 300 , 590 );
}
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 );
if ( $action == 'edit' && $userWrite > 0 )
{
dol_fiche_head ( $head , 'project' , $langs -> trans ( " Project " ), 0 , ( $object -> public ? 'projectpub' : 'project' ));
print '<table class="border" width="100%">' ;
// Ref
$suggestedref = $object -> ref ;
print '<tr><td class="titlefield fieldrequired">' . $langs -> trans ( " Ref " ) . '</td>' ;
print '<td><input size="12" name="ref" value="' . $suggestedref . '">' ;
print ' ' . $form -> textwithpicto ( '' , $langs -> trans ( " YouCanCompleteRef " , $suggestedref ));
print '</td></tr>' ;
// Label
print '<tr><td class="fieldrequired">' . $langs -> trans ( " Label " ) . '</td>' ;
2018-10-15 11:04:29 +02:00
print '<td><input class="quatrevingtpercent" name="title" value="' . dol_escape_htmltag ( $object -> title ) . '"></td></tr>' ;
2017-10-07 13:09:31 +02:00
2018-02-01 17:50:19 +01:00
// Status
print '<tr><td class="fieldrequired">' . $langs -> trans ( " Status " ) . '</td><td>' ;
print '<select class="flat" name="status">' ;
foreach ( $object -> statuts_short as $key => $val )
{
print '<option value="' . $key . '"' . (( GETPOSTISSET ( 'status' ) ? GETPOST ( 'status' ) : $object -> statut ) == $key ? ' selected="selected"' : '' ) . '>' . $langs -> trans ( $val ) . '</option>' ;
}
print '</select>' ;
print '</td></tr>' ;
2017-10-07 13:09:31 +02:00
// Thirdparty
if ( $conf -> societe -> enabled )
{
print '<tr><td>' ;
print ( empty ( $conf -> global -> PROJECT_THIRDPARTY_REQUIRED ) ? '' : '<span class="fieldrequired">' );
print $langs -> trans ( " ThirdParty " );
print ( empty ( $conf -> global -> PROJECT_THIRDPARTY_REQUIRED ) ? '' : '</span>' );
print '</td><td>' ;
$filteronlist = '' ;
if ( ! empty ( $conf -> global -> PROJECT_FILTER_FOR_THIRDPARTY_LIST )) $filteronlist = $conf -> global -> PROJECT_FILTER_FOR_THIRDPARTY_LIST ;
$text = $form -> select_company ( $object -> thirdparty -> id , 'socid' , $filteronlist , 'None' , 1 , 0 , array (), 0 , 'minwidth300' );
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 , 0 , '' , '' , 2 );
}
else print $text ;
print '</td></tr>' ;
}
// Visibility
print '<tr><td>' . $langs -> trans ( " Visibility " ) . '</td><td>' ;
$array = array ();
if ( empty ( $conf -> global -> PROJECT_DISABLE_PRIVATE_PROJECT )) $array [ 0 ] = $langs -> trans ( " PrivateProject " );
if ( empty ( $conf -> global -> PROJECT_DISABLE_PUBLIC_PROJECT )) $array [ 1 ] = $langs -> trans ( " SharedProject " );
print $form -> selectarray ( 'public' , $array , $object -> public );
print '</td></tr>' ;
if ( ! empty ( $conf -> global -> PROJECT_USE_OPPORTUNITIES ))
{
// Opportunity status
print '<tr><td>' . $langs -> trans ( " OpportunityStatus " ) . '</td>' ;
print '<td>' ;
print $formproject -> selectOpportunityStatus ( 'opp_status' , $object -> opp_status , 1 , 0 , 0 , 0 , 'inline-block valignmiddle' );
print '<div id="divtocloseproject" class="inline-block valign" style="display: none;"> ' ;
print '<input type="checkbox" id="inputcloseproject" name="closeproject" /> ' ;
print $langs -> trans ( " AlsoCloseAProject " );
print '</div>' ;
print '</td>' ;
print '</tr>' ;
2016-01-28 20:04:02 +01:00
// Opportunity probability
print '<tr><td>' . $langs -> trans ( " OpportunityProbability " ) . '</td>' ;
2018-02-04 23:12:19 +01:00
print '<td><input size="5" type="text" id="opp_percent" name="opp_percent" value="' . ( isset ( $_POST [ 'opp_percent' ]) ? GETPOST ( 'opp_percent' ) : ( strcmp ( $object -> opp_percent , '' ) ? vatrate ( $object -> opp_percent ) : '' )) . '"> %' ;
2016-07-09 14:58:51 +02:00
print '<span id="oldopppercent"></span>' ;
print '</td>' ;
2016-01-28 20:04:02 +01:00
print '</tr>' ;
2016-08-29 10:32:00 +02:00
2015-06-30 01:53:01 +02:00
// Opportunity amount
print '<tr><td>' . $langs -> trans ( " OpportunityAmount " ) . '</td>' ;
2018-02-04 23:12:19 +01:00
print '<td><input size="5" type="text" name="opp_amount" value="' . ( isset ( $_POST [ 'opp_amount' ]) ? GETPOST ( 'opp_amount' ) : ( strcmp ( $object -> opp_amount , '' ) ? price2num ( $object -> opp_amount ) : '' )) . '"></td>' ;
2015-06-30 01:53:01 +02:00
print '</tr>' ;
}
2017-10-07 13:09:31 +02:00
// Date start
print '<tr><td>' . $langs -> trans ( " DateStart " ) . '</td><td>' ;
print $form -> select_date ( $object -> date_start ? $object -> date_start :- 1 , 'projectstart' , 0 , 0 , 0 , '' , 1 , 0 , 1 );
print ' <input type="checkbox" class="valignmiddle" name="reportdate" value="yes" ' ;
if ( $comefromclone ){ print ' checked ' ;}
2016-10-17 18:18:06 +02:00
print '/> ' . $langs -> trans ( " ProjectReportDate " );
2017-10-07 13:09:31 +02:00
print '</td></tr>' ;
// Date end
print '<tr><td>' . $langs -> trans ( " DateEnd " ) . '</td><td>' ;
print $form -> select_date ( $object -> date_end ? $object -> date_end :- 1 , 'projectend' , 0 , 0 , 0 , '' , 1 , 0 , 1 );
print '</td></tr>' ;
// Budget
print '<tr><td>' . $langs -> trans ( " Budget " ) . '</td>' ;
print '<td><input size="5" type="text" name="budget_amount" value="' . ( isset ( $_POST [ 'budget_amount' ]) ? GETPOST ( 'budget_amount' ) : ( strcmp ( $object -> budget_amount , '' ) ? price ( $object -> budget_amount , 0 , $langs , 1 , 0 ) : '' )) . '"></td>' ;
print '</tr>' ;
// Description
print '<tr><td class="tdtop">' . $langs -> trans ( " Description " ) . '</td>' ;
print '<td>' ;
print '<textarea name="description" wrap="soft" class="centpercent" rows="' . ROWS_3 . '">' . $object -> description . '</textarea>' ;
print '</td></tr>' ;
2018-02-26 14:28:51 +01:00
// Bill time
if ( ! empty ( $conf -> global -> PROJECT_BILL_TIME_SPENT ))
{
print '<tr><td>' . $langs -> trans ( " BillTime " ) . '</td>' ;
print '<td><input type="checkbox" name="bill_time"' . (( GETPOSTISSET ( 'bill_time' ) ? GETPOST ( 'bill_time' , 'alpha' ) : $object -> bill_time ) ? ' checked="checked"' : '' ) . '"></td>' ;
print '</tr>' ;
}
2017-10-07 13:09:31 +02:00
// Tags-Categories
if ( $conf -> categorie -> enabled )
{
print '<tr><td class="tdtop">' . $langs -> trans ( " Categories " ) . '</td><td>' ;
$cate_arbo = $form -> select_all_categories ( Categorie :: TYPE_PROJECT , '' , 'parent' , 64 , 0 , 1 );
$c = new Categorie ( $db );
$cats = $c -> containing ( $object -> id , Categorie :: TYPE_PROJECT );
foreach ( $cats as $cat ) {
$arrayselected [] = $cat -> id ;
}
print $form -> multiselectarray ( 'categories' , $cate_arbo , $arrayselected , '' , 0 , '' , 0 , '100%' );
print " </td></tr> " ;
}
// Other options
$parameters = array ();
$reshook = $hookmanager -> executeHooks ( 'formObjectOptions' , $parameters , $object , $action ); // Note that $action and $object may have been modified by hook
print $hookmanager -> resPrint ;
2018-04-13 13:28:48 +02:00
if ( empty ( $reshook ))
2017-10-07 13:09:31 +02:00
{
print $object -> showOptionals ( $extrafields , 'edit' );
}
print '</table>' ;
}
else
{
dol_fiche_head ( $head , 'project' , $langs -> trans ( " Project " ), - 1 , ( $object -> public ? 'projectpub' : 'project' ));
// Project card
$linkback = '<a href="' . DOL_URL_ROOT . '/projet/list.php?restore_lastsearch_values=1">' . $langs -> trans ( " BackToList " ) . '</a>' ;
$morehtmlref = '<div class="refidno">' ;
// Title
$morehtmlref .= $object -> title ;
// Thirdparty
$morehtmlref .= '<br>' . $langs -> trans ( 'ThirdParty' ) . ' : ' ;
if ( $object -> thirdparty -> id > 0 )
{
$morehtmlref .= $object -> thirdparty -> getNomUrl ( 1 , 'project' );
}
$morehtmlref .= '</div>' ;
// Define a complementary filter for search of next/prev ref.
if ( ! $user -> rights -> projet -> all -> lire )
{
$objectsListId = $object -> getProjectsAuthorizedForUser ( $user , 0 , 0 );
$object -> next_prev_filter = " rowid in ( " . ( count ( $objectsListId ) ? join ( ',' , array_keys ( $objectsListId )) : '0' ) . " ) " ;
}
dol_banner_tab ( $object , 'ref' , $linkback , 1 , 'ref' , 'ref' , $morehtmlref );
print '<div class="fichecenter">' ;
print '<div class="fichehalfleft">' ;
print '<div class="underbanner clearboth"></div>' ;
print '<table class="border" width="100%">' ;
// Visibility
print '<tr><td class="titlefield">' . $langs -> trans ( " Visibility " ) . '</td><td>' ;
if ( $object -> public ) print $langs -> trans ( 'SharedProject' );
else print $langs -> trans ( 'PrivateProject' );
print '</td></tr>' ;
if ( ! empty ( $conf -> global -> PROJECT_USE_OPPORTUNITIES ))
{
// Opportunity status
print '<tr><td>' . $langs -> trans ( " OpportunityStatus " ) . '</td><td>' ;
$code = dol_getIdFromCode ( $db , $object -> opp_status , 'c_lead_status' , 'rowid' , 'code' );
if ( $code ) print $langs -> trans ( " OppStatus " . $code );
print '</td></tr>' ;
// Opportunity percent
print '<tr><td>' . $langs -> trans ( " OpportunityProbability " ) . '</td><td>' ;
if ( strcmp ( $object -> opp_percent , '' )) print price ( $object -> opp_percent , 0 , $langs , 1 , 0 ) . ' %' ;
print '</td></tr>' ;
// Opportunity Amount
print '<tr><td>' . $langs -> trans ( " OpportunityAmount " ) . '</td><td>' ;
/* if ( $object -> opp_status )
2017-06-08 12:21:41 +02:00
{
print price ( $obj -> opp_amount , 1 , $langs , 1 , 0 , - 1 , $conf -> currency );
} */
2017-10-07 13:09:31 +02:00
if ( strcmp ( $object -> opp_amount , '' )) print price ( $object -> opp_amount , 0 , $langs , 1 , 0 , - 1 , $conf -> currency );
print '</td></tr>' ;
}
2017-06-02 12:27:46 +02:00
2017-10-07 13:09:31 +02:00
// Date start - end
print '<tr><td>' . $langs -> trans ( " DateStart " ) . ' - ' . $langs -> trans ( " DateEnd " ) . '</td><td>' ;
2018-02-15 02:02:32 +01:00
$start = dol_print_date ( $object -> date_start , 'day' );
2017-04-05 14:48:24 +02:00
print ( $start ? $start : '?' );
2018-02-15 02:02:32 +01:00
$end = dol_print_date ( $object -> date_end , 'day' );
2017-04-05 14:48:24 +02:00
print ' - ' ;
print ( $end ? $end : '?' );
if ( $object -> hasDelay ()) print img_warning ( " Late " );
2017-10-07 13:09:31 +02:00
print '</td></tr>' ;
2017-06-02 12:27:46 +02:00
2017-10-07 13:09:31 +02:00
// Budget
print '<tr><td>' . $langs -> trans ( " Budget " ) . '</td><td>' ;
if ( strcmp ( $object -> budget_amount , '' )) print price ( $object -> budget_amount , 0 , $langs , 1 , 0 , 0 , $conf -> currency );
print '</td></tr>' ;
2015-02-16 10:58:05 +01:00
2017-10-07 13:09:31 +02:00
// Other attributes
$cols = 2 ;
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php' ;
2017-06-02 12:27:46 +02:00
2017-10-07 13:09:31 +02:00
print '</table>' ;
2017-06-02 12:27:46 +02:00
2017-10-07 13:09:31 +02:00
print '</div>' ;
print '<div class="fichehalfright">' ;
print '<div class="ficheaddleft">' ;
print '<div class="underbanner clearboth"></div>' ;
2017-06-02 12:27:46 +02:00
2017-10-07 13:09:31 +02:00
print '<table class="border" width="100%">' ;
2017-06-02 12:27:46 +02:00
2017-10-07 13:09:31 +02:00
// Description
print '<td class="titlefield tdtop">' . $langs -> trans ( " Description " ) . '</td><td>' ;
print nl2br ( $object -> description );
print '</td></tr>' ;
2010-11-11 13:16:55 +01:00
2018-02-26 14:28:51 +01:00
// Bill time
if ( ! empty ( $conf -> global -> PROJECT_BILL_TIME_SPENT ))
{
print '<tr><td>' . $langs -> trans ( " BillTime " ) . '</td>' ;
print '<td>' . yn ( $object -> bill_time ) . '</td>' ;
print '</tr>' ;
}
2017-10-07 13:09:31 +02:00
// Categories
if ( $conf -> categorie -> enabled ) {
print '<tr><td valign="middle">' . $langs -> trans ( " Categories " ) . '</td><td>' ;
print $form -> showCategories ( $object -> id , 'project' , 1 );
print " </td></tr> " ;
}
2017-06-02 12:27:46 +02:00
2017-10-07 13:09:31 +02:00
print '</table>' ;
2017-06-02 12:27:46 +02:00
2017-10-07 13:09:31 +02:00
print '</div>' ;
print '</div>' ;
print '</div>' ;
2017-06-02 12:27:46 +02:00
2017-10-07 13:09:31 +02:00
print '<div class="clearboth"></div>' ;
}
2010-11-11 13:16:55 +01:00
2017-10-07 13:09:31 +02:00
dol_fiche_end ();
2010-11-11 13:16:55 +01:00
2015-01-30 16:33:39 +01:00
if ( $action == 'edit' && $userWrite > 0 )
{
2017-10-07 13:09:31 +02:00
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>' ;
2015-01-30 16:33:39 +01:00
}
2017-10-07 13:09:31 +02:00
print '</form>' ;
2015-01-30 16:33:39 +01:00
2017-10-07 13:09:31 +02:00
// Change probability from status
if ( ! empty ( $conf -> use_javascript_ajax ) && ! empty ( $conf -> global -> PROJECT_USE_OPPORTUNITIES ))
{
// Default value to close or not when we set opp to 'WON'.
$defaultcheckedwhenoppclose = 1 ;
if ( empty ( $conf -> global -> PROJECT_HIDE_TASKS )) $defaultcheckedwhenoppclose = 0 ;
2017-06-02 12:27:46 +02:00
2017-10-07 13:09:31 +02:00
print '<!-- Javascript to manage opportunity status change -->' ;
print ' < script type = " text/javascript " language = " javascript " >
2017-02-01 13:25:16 +01:00
jQuery ( document ) . ready ( function () {
function change_percent ()
{
var element = jQuery ( " #opp_status option:selected " );
var defaultpercent = element . attr ( " defaultpercent " );
var defaultcloseproject = '.$defaultcheckedwhenoppclose.' ;
var elemcode = element . attr ( " elemcode " );
var oldpercent = \ '' . dol_escape_js ( $object -> opp_percent ) . ' \ ' ;
console . log ( " We select " + elemcode );
2017-06-03 00:58:51 +02:00
/* Define if checkbox to close is checked or not */
2017-06-03 01:55:05 +02:00
var closeproject = 0 ;
2017-06-03 00:58:51 +02:00
if ( elemcode == \ ' LOST\ ' ) closeproject = 1 ;
if ( elemcode == \ ' WON\ ' ) closeproject = defaultcloseproject ;
if ( closeproject ) jQuery ( " #inputcloseproject " ) . prop ( " checked " , true );
2017-02-01 13:25:16 +01:00
else jQuery ( " #inputcloseproject " ) . prop ( " checked " , false );
2017-06-02 12:27:46 +02:00
2017-06-03 00:58:51 +02:00
/* Make the close project checkbox visible or not */
2017-06-03 01:55:05 +02:00
console . log ( " closeproject= " + closeproject );
2017-06-02 12:27:46 +02:00
if ( elemcode == \ ' WON\ ' || elemcode == \ ' LOST\ ' )
2017-02-01 13:25:16 +01:00
{
jQuery ( " #divtocloseproject " ) . show ();
}
else
{
jQuery ( " #divtocloseproject " ) . hide ();
}
2017-06-02 12:27:46 +02:00
2018-04-06 00:01:24 +02:00
/* Change percent with default percent (defaultpercent) if new status (defaultpercent) is higher than current (jQuery("#opp_percent").val()) */
console . log ( " oldpercent= " + oldpercent );
if ( oldpercent != \ ' \ ' && ( parseFloat ( defaultpercent ) < parseFloat ( oldpercent )))
2017-02-01 13:25:16 +01:00
{
if ( jQuery ( " #opp_percent " ) . val () != \ '\' && oldpercent != \'\') jQuery("#oldopppercent").text(\' - ' . dol_escape_js ( $langs -> transnoentities ( " PreviousValue " )) . ' : \ ' + oldpercent + \ ' % \ ' );
2018-04-06 00:01:24 +02:00
if ( parseFloat ( oldpercent ) != 100 ) { jQuery ( " #opp_percent " ) . val ( oldpercent ); }
else { jQuery ( " #opp_percent " ) . val ( defaultpercent ); }
}
2018-04-13 13:28:48 +02:00
else
2018-04-06 00:01:24 +02:00
{
if (( parseFloat ( jQuery ( " #opp_percent " ) . val ()) < parseFloat ( defaultpercent )));
{
if ( jQuery ( " #opp_percent " ) . val () != \ '\' && oldpercent != \'\') jQuery("#oldopppercent").text(\' - ' . dol_escape_js ( $langs -> transnoentities ( " PreviousValue " )) . ' : \ ' + oldpercent + \ ' % \ ' );
jQuery ( " #opp_percent " ) . val ( defaultpercent );
}
2017-02-01 13:25:16 +01:00
}
}
jQuery ( " #opp_status " ) . change ( function () {
change_percent ();
});
2016-01-28 20:04:02 +01:00
});
</ script > ' ;
2017-10-07 13:09:31 +02:00
}
2016-08-29 10:32:00 +02:00
2017-10-07 13:09:31 +02:00
/*
2010-11-11 13:16:55 +01:00
* Boutons actions
*/
2017-10-07 13:09:31 +02:00
print '<div class="tabsAction">' ;
$parameters = array ();
$reshook = $hookmanager -> executeHooks ( 'addMoreActionsButtons' , $parameters , $object , $action ); // Note that $action and $object may have been
// modified by hook
if ( empty ( $reshook ))
{
2018-03-28 17:10:12 +02:00
if ( $action != " edit " && $action != 'presend' )
2017-10-07 13:09:31 +02:00
{
// Create event
2017-12-07 00:28:43 +01:00
/* if ( $conf -> agenda -> enabled && ! empty ( $conf -> global -> MAIN_ADD_EVENT_ON_ELEMENT_CARD )) // Add hidden condition because this is not a
2017-10-07 13:09:31 +02:00
// "workflow" action so should appears somewhere else on
// page.
{
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&origin=' . $object -> element . '&originid=' . $object -> id . '&socid=' . $object -> socid . '&projectid=' . $object -> id . '">' . $langs -> trans ( " AddAction " ) . '</a></div>' ;
2017-12-07 00:28:43 +01:00
} */
2016-10-18 22:23:03 +02:00
2018-03-28 15:22:47 +02:00
// Send
2018-03-28 16:07:02 +02:00
if ( $object -> statut != 2 )
{
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id=' . $object -> id . '&action=presend&mode=init#formmailbeforetitle">' . $langs -> trans ( 'SendMail' ) . '</a></div>' ;
}
2018-03-28 15:22:47 +02:00
2016-10-18 22:23:03 +02:00
// Modify
2017-10-07 13:09:31 +02:00
if ( $object -> statut != 2 && $user -> rights -> projet -> creer )
{
if ( $userWrite > 0 )
{
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id=' . $object -> id . '&action=edit">' . $langs -> trans ( " Modify " ) . '</a></div>' ;
}
else
{
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="' . $langs -> trans ( " NotOwnerOfProject " ) . '">' . $langs -> trans ( 'Modify' ) . '</a></div>' ;
}
}
// Validate
if ( $object -> statut == 0 && $user -> rights -> projet -> creer )
{
if ( $userWrite > 0 )
{
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id=' . $object -> id . '&action=validate">' . $langs -> trans ( " Validate " ) . '</a></div>' ;
}
else
{
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="' . $langs -> trans ( " NotOwnerOfProject " ) . '">' . $langs -> trans ( 'Validate' ) . '</a></div>' ;
}
}
// Close
if ( $object -> statut == 1 && $user -> rights -> projet -> creer )
{
if ( $userWrite > 0 )
{
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id=' . $object -> id . '&action=close">' . $langs -> trans ( " Close " ) . '</a></div>' ;
}
else
{
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="' . $langs -> trans ( " NotOwnerOfProject " ) . '">' . $langs -> trans ( 'Close' ) . '</a></div>' ;
}
}
// Reopen
if ( $object -> statut == 2 && $user -> rights -> projet -> creer )
{
if ( $userWrite > 0 )
{
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id=' . $object -> id . '&action=reopen">' . $langs -> trans ( " ReOpen " ) . '</a></div>' ;
}
else
{
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="' . $langs -> trans ( " NotOwnerOfProject " ) . '">' . $langs -> trans ( 'ReOpen' ) . '</a></div>' ;
}
}
// Add button to create objects from project
if ( ! empty ( $conf -> global -> PROJECT_SHOW_CREATE_OBJECT_BUTTON ))
{
if ( ! empty ( $conf -> propal -> enabled ) && $user -> rights -> propal -> creer )
{
$langs -> load ( " propal " );
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/comm/propal/card.php?action=create&projectid=' . $object -> id . '&socid=' . $object -> socid . '">' . $langs -> trans ( " AddProp " ) . '</a></div>' ;
}
if ( ! empty ( $conf -> commande -> enabled ) && $user -> rights -> commande -> creer )
{
$langs -> load ( " orders " );
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/commande/card.php?action=create&projectid=' . $object -> id . '&socid=' . $object -> socid . '">' . $langs -> trans ( " CreateOrder " ) . '</a></div>' ;
}
if ( ! empty ( $conf -> facture -> enabled ) && $user -> rights -> facture -> creer )
{
$langs -> load ( " bills " );
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/compta/facture/card.php?action=create&projectid=' . $object -> id . '&socid=' . $object -> socid . '">' . $langs -> trans ( " CreateBill " ) . '</a></div>' ;
}
if ( ! empty ( $conf -> supplier_proposal -> enabled ) && $user -> rights -> supplier_proposal -> creer )
{
$langs -> load ( " supplier_proposal " );
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/supplier_proposal/card.php?action=create&projectid=' . $object -> id . '&socid=' . $object -> socid . '">' . $langs -> trans ( " AddSupplierProposal " ) . '</a></div>' ;
}
if ( ! empty ( $conf -> supplier_order -> enabled ) && $user -> rights -> fournisseur -> commande -> creer )
{
$langs -> load ( " suppliers " );
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/fourn/commande/card.php?action=create&projectid=' . $object -> id . '&socid=' . $object -> socid . '">' . $langs -> trans ( " AddSupplierOrder " ) . '</a></div>' ;
}
if ( ! empty ( $conf -> supplier_invoice -> enabled ) && $user -> rights -> fournisseur -> facture -> creer )
{
$langs -> load ( " suppliers " );
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/fourn/facture/card.php?action=create&projectid=' . $object -> id . '&socid=' . $object -> socid . '">' . $langs -> trans ( " AddSupplierInvoice " ) . '</a></div>' ;
}
if ( ! empty ( $conf -> ficheinter -> enabled ) && $user -> rights -> ficheinter -> creer )
{
$langs -> load ( " interventions " );
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/fichinter/card.php?action=create&projectid=' . $object -> id . '&socid=' . $object -> socid . '">' . $langs -> trans ( " AddIntervention " ) . '</a></div>' ;
}
if ( ! empty ( $conf -> contrat -> enabled ) && $user -> rights -> contrat -> creer )
{
$langs -> load ( " contracts " );
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/contrat/card.php?action=create&projectid=' . $object -> id . '&socid=' . $object -> socid . '">' . $langs -> trans ( " AddContract " ) . '</a></div>' ;
}
if ( ! empty ( $conf -> expensereport -> enabled ) && $user -> rights -> expensereport -> creer )
{
$langs -> load ( " trips " );
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/expensereport/card.php?action=create&projectid=' . $object -> id . '&socid=' . $object -> socid . '">' . $langs -> trans ( " AddTrip " ) . '</a></div>' ;
}
if ( ! empty ( $conf -> don -> enabled ) && $user -> rights -> don -> creer )
{
$langs -> load ( " donations " );
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/don/card.php?action=create&projectid=' . $object -> id . '&socid=' . $object -> socid . '">' . $langs -> trans ( " AddDonation " ) . '</a></div>' ;
}
}
// Clone
if ( $user -> rights -> projet -> creer )
{
if ( $userWrite > 0 )
{
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id=' . $object -> id . '&action=clone">' . $langs -> trans ( 'ToClone' ) . '</a></div>' ;
}
else
{
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="' . $langs -> trans ( " NotOwnerOfProject " ) . '">' . $langs -> trans ( 'ToClone' ) . '</a></div>' ;
}
}
// Delete
if ( $user -> rights -> projet -> supprimer || ( $object -> statut == 0 && $user -> rights -> projet -> creer ))
{
if ( $userDelete > 0 || ( $object -> statut == 0 && $user -> rights -> projet -> creer ))
{
print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?id=' . $object -> id . '&action=delete">' . $langs -> trans ( " Delete " ) . '</a></div>' ;
}
else
{
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="' . $langs -> trans ( " NotOwnerOfProject " ) . '">' . $langs -> trans ( 'Delete' ) . '</a></div>' ;
}
}
}
}
print " </div> " ;
2018-03-28 17:10:12 +02:00
if ( GETPOST ( 'modelselected' )) {
$action = 'presend' ;
}
2017-10-07 13:09:31 +02:00
if ( $action != 'presend' )
{
print '<div class="fichecenter"><div class="fichehalfleft">' ;
print '<a name="builddoc"></a>' ; // ancre
/*
2010-11-11 13:16:55 +01:00
* Documents generes
*/
2017-10-07 13:09:31 +02:00
$filename = dol_sanitizeFileName ( $object -> ref );
$filedir = $conf -> projet -> dir_output . " / " . dol_sanitizeFileName ( $object -> ref );
$urlsource = $_SERVER [ " PHP_SELF " ] . " ?id= " . $object -> id ;
$genallowed = ( $user -> rights -> projet -> lire && $userAccess > 0 );
$delallowed = ( $user -> rights -> projet -> creer && $userWrite > 0 );
2010-11-11 13:16:55 +01:00
2017-10-07 13:09:31 +02:00
print $formfile -> showdocuments ( 'project' , $filename , $filedir , $urlsource , $genallowed , $delallowed , $object -> modelpdf );
2010-11-11 13:16:55 +01:00
2017-10-07 13:09:31 +02:00
print '</div><div class="fichehalfright"><div class="ficheaddleft">' ;
2010-11-11 13:16:55 +01:00
2017-11-21 12:28:34 +01:00
$MAXEVENT = 10 ;
2017-10-04 12:58:13 +02:00
2017-10-07 13:09:31 +02:00
$morehtmlright = '<a href="' . DOL_URL_ROOT . '/projet/info.php?id=' . $object -> id . '">' ;
$morehtmlright .= $langs -> trans ( " SeeAll " );
$morehtmlright .= '</a>' ;
2017-10-04 12:58:13 +02:00
2017-10-07 13:09:31 +02:00
// List of actions on element
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php' ;
$formactions = new FormActions ( $db );
2018-02-01 17:50:19 +01:00
$somethingshown = $formactions -> showactions ( $object , 'project' , 0 , 1 , '' , $MAXEVENT , '' , $morehtmlright );
2010-11-11 13:16:55 +01:00
2017-10-07 13:09:31 +02:00
print '</div></div></div>' ;
}
2014-05-08 20:02:34 +02:00
2018-03-28 15:22:47 +02:00
// Presend form
$modelmail = 'project' ;
$defaulttopic = 'SendProjectRef' ;
$diroutput = $conf -> projet -> dir_output ;
$trackid = 'proj' . $object -> id ;
include DOL_DOCUMENT_ROOT . '/core/tpl/card_presend.tpl.php' ;
2017-10-07 13:09:31 +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
}
2016-11-19 02:16:12 +01:00
else
{
2017-10-07 13:09:31 +02:00
print $langs -> trans ( " RecordNotFound " );
2016-11-19 02:16:12 +01: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 ();