From 0b8d78c4f60bb96a39e65899040d9f8d51de3e3d Mon Sep 17 00:00:00 2001 From: fhenry Date: Tue, 30 Apr 2013 18:23:44 +0200 Subject: [PATCH] [ bug #865 ] Dolibarr navigation array in project/task do not work Conflicts: htdocs/projet/fiche.php Change-Id: I7607f97d21cc695c9b295d94f5abcb64fe25f3af --- htdocs/projet/class/project.class.php | 2 ++ htdocs/projet/fiche.php | 28 ++++++++++++++------------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index d602c54aaee..e6376bbe7eb 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -36,6 +36,7 @@ class Project extends CommonObject public $table_element = 'projet'; //!< Name of table without prefix where object is stored public $table_element_line = 'projet_task'; public $fk_element = 'fk_projet'; + protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe var $id; var $ref; @@ -52,6 +53,7 @@ class Project extends CommonObject var $statuts_short; var $statuts; var $oldcopy; + /** * Constructor diff --git a/htdocs/projet/fiche.php b/htdocs/projet/fiche.php index a9d3895879d..17e5975a272 100644 --- a/htdocs/projet/fiche.php +++ b/htdocs/projet/fiche.php @@ -44,12 +44,6 @@ if ($id == '' && $ref == '' && ($action != "create" && $action != "add" && $acti $mine = GETPOST('mode')=='mine' ? 1 : 0; //if (! $user->rights->projet->all->lire) $mine=1; // Special for projects - -// Security check -$socid=0; -if ($user->societe_id > 0) $socid=$user->societe_id; -$result = restrictedArea($user, 'projet', $id); - // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('projectcard')); @@ -61,6 +55,11 @@ if ($object->id > 0) $object->fetch_thirdparty(); } +// Security check +$socid=0; +if ($user->societe_id > 0) $socid=$user->societe_id; +$result = restrictedArea($user, 'projet', $object->id); + // fetch optionals attributes and labels $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); @@ -137,7 +136,7 @@ if ($action == 'add' && $user->rights->projet->creer) $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); @@ -209,7 +208,7 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->projet->creer) $object->public = GETPOST('public','alpha'); $object->date_start = empty($_POST["project"])?'':$date_start; $object->date_end = empty($_POST["projectend"])?'':$date_end; - + // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); @@ -560,7 +559,7 @@ else { print $object->showOptionals($extrafields,'edit'); } - + print ''; print '

'; @@ -741,10 +740,13 @@ else print ''; - // 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); + 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); + } print ''; }