dolibarr 24.0.0-beta
note.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2010 Regis Houssin <regis.houssin@inodbox.com>
3 * Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
5 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
6 * Copyright (C) 2026 Juan Pablo Farber <jfarber55@hotmail.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
28// Load Dolibarr environment
29require '../main.inc.php';
37require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
38require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
39
40// Load translation files required by the page
41$langs->load('projects');
42
43$action = GETPOST('action', 'aZ09');
44$id = GETPOSTINT('id');
45$ref = GETPOST('ref', 'alpha');
46
47$mine = (GETPOST('mode', 'alpha') == 'mine') ? 1 : 0;
48
49$object = new Project($db);
50
51include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'include', not 'include_once'
52if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($object, 'fetchComments') && empty($object->comments)) {
53 $object->fetchComments();
54}
55
56// Security check
57//$socid = 0;
58//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignment.
59$hookmanager->initHooks(array('projetnote'));
60$result = restrictedArea($user, 'projet', $object->id, 'projet&project');
61
62$permissionnote = $user->hasRight('project', 'creer'); // Used by the include of actions_setnotes.inc.php
63
64
65/*
66 * Actions
67 */
68
69$parameters = array();
70$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
71if ($reshook < 0) {
72 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
73}
74if (empty($reshook)) {
75 include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be 'include', not 'include_once'
76}
77
78
79/*
80 * View
81 */
82
83$title = $langs->trans("Notes").' - '.$object->ref.' '.$object->name;
84if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/projectnameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) {
85 $title = $object->ref.' '.$object->name.' - '.$langs->trans("Note");
86}
87$help_url = "EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos";
88llxHeader("", $title, $help_url, '', 0, 0, '', '', '', 'mod-project page-card_note');
89
90$form = new Form($db);
91$userstatic = new User($db);
92
93$now = dol_now();
94
95if ($id > 0 || !empty($ref)) {
96 // To verify role of users
97 //$userAccess = $object->restrictedProjectArea($user,'read');
98 $userWrite = $object->restrictedProjectArea($user, 'write');
99 //$userDelete = $object->restrictedProjectArea($user,'delete');
100 //print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete;
101
102 $head = project_prepare_head($object);
103 print dol_get_fiche_head($head, 'notes', $langs->trans('Project'), -1, ($object->public ? 'projectpub' : 'project'));
104
105
106 // Project card
107
108 if (!empty($_SESSION['pageforbacktolist']) && !empty($_SESSION['pageforbacktolist']['project'])) {
109 $tmpurl = $_SESSION['pageforbacktolist']['project'];
110 $tmpurl = preg_replace('/__SOCID__/', (string) $object->socid, $tmpurl);
111 $linkback = '<a href="'.$tmpurl.(preg_match('/\?/', $tmpurl) ? '&' : '?'). 'restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
112 } else {
113 $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
114 }
115
116 $morehtmlref = '<div class="refidno">';
117 // Title
118 $morehtmlref .= $object->title;
119 // Thirdparty
120 if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
121 $morehtmlref .= '<br>'.$object->thirdparty->getNomUrl(1, 'project');
122 }
123 $morehtmlref .= '</div>';
124
125 // Define a complementary filter for search of next/prev ref.
126 if (!$user->hasRight('projet', 'all', 'lire')) {
127 $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
128 $object->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0');
129 }
130
131 dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
132
133
134 print '<div class="fichecenter">';
135 print '<div class="underbanner clearboth"></div>';
136
137 $cssclass = "titlefield";
138 include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
139
140 print '</div>';
141
142 print '<div class="clearboth"></div>';
143
144 print dol_get_fiche_end();
145}
146
147// End of page
148llxFooter();
149$db->close();
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:47
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
Class to manage generation of HTML components Only common components must be here.
Class to manage projects.
Class to manage Dolibarr users.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
dol_now($mode='gmt')
Return date for now.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
project_prepare_head(Project $project, $moreparam='')
Prepare array with list of tabs.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.