diff --git a/htdocs/projet/messaging.php b/htdocs/projet/messaging.php index 065985317fa..68dc434f4a1 100644 --- a/htdocs/projet/messaging.php +++ b/htdocs/projet/messaging.php @@ -93,6 +93,17 @@ if (!$user->hasRight('projet', 'lire')) { * Actions */ +$object = new Project($db); + +if ($id > 0 || !empty($ref)) { + $object->fetch($id, $ref); + $object->fetch_thirdparty(); + if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($object, 'fetchComments') && empty($object->comments)) { + $object->fetchComments(); + } + $object->info($object->id); +} + $parameters = array('id' => $socid); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { @@ -112,16 +123,6 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' */ $form = new Form($db); -$object = new Project($db); - -if ($id > 0 || !empty($ref)) { - $object->fetch($id, $ref); - $object->fetch_thirdparty(); - if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($object, 'fetchComments') && empty($object->comments)) { - $object->fetchComments(); - } - $object->info($object->id); -} $agenda = (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) ? '/'.$langs->trans("Agenda") : ''; $title = $langs->trans('Events').$agenda.' - '.$object->ref.' '.$object->name; if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/projectnameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) {