dolibarr 20.0.0
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 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
26// Load Dolibarr environment
27require '../main.inc.php';
28require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
29require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
30
31// Load translation files required by the page
32$langs->load('projects');
33
34$action = GETPOST('action', 'aZ09');
35$id = GETPOSTINT('id');
36$ref = GETPOST('ref', 'alpha');
37
38$mine = (isset($_REQUEST['mode']) && $_REQUEST['mode'] == 'mine') ? 1 : 0;
39//if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
40
41$object = new Project($db);
42
43include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
44if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($object, 'fetchComments') && empty($object->comments)) {
45 $object->fetchComments();
46}
47
48// Security check
49$socid = 0;
50//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.
51$hookmanager->initHooks(array('projetnote'));
52$result = restrictedArea($user, 'projet', $id, 'projet&project');
53
54$permissionnote = $user->hasRight('projet', 'creer'); // Used by the include of actions_setnotes.inc.php
55
56
57/*
58 * Actions
59 */
60
61$parameters = array();
62$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
63if ($reshook < 0) {
64 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
65}
66if (empty($reshook)) {
67 include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
68}
69
70
71/*
72 * View
73 */
74
75$title = $langs->trans("Notes").' - '.$object->ref.' '.$object->name;
76if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/projectnameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) {
77 $title = $object->ref.' '.$object->name.' - '.$langs->trans("Note");
78}
79$help_url = "EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos";
80llxHeader("", $title, $help_url);
81
82$form = new Form($db);
83$userstatic = new User($db);
84
85$now = dol_now();
86
87if ($id > 0 || !empty($ref)) {
88 // To verify role of users
89 //$userAccess = $object->restrictedProjectArea($user,'read');
90 $userWrite = $object->restrictedProjectArea($user, 'write');
91 //$userDelete = $object->restrictedProjectArea($user,'delete');
92 //print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete;
93
94 $head = project_prepare_head($object);
95 print dol_get_fiche_head($head, 'notes', $langs->trans('Project'), -1, ($object->public ? 'projectpub' : 'project'));
96
97
98 // Project card
99
100 if (!empty($_SESSION['pageforbacktolist']) && !empty($_SESSION['pageforbacktolist']['project'])) {
101 $tmpurl = $_SESSION['pageforbacktolist']['project'];
102 $tmpurl = preg_replace('/__SOCID__/', (string) $object->socid, $tmpurl);
103 $linkback = '<a href="'.$tmpurl.(preg_match('/\?/', $tmpurl) ? '&' : '?'). 'restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
104 } else {
105 $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
106 }
107
108 $morehtmlref = '<div class="refidno">';
109 // Title
110 $morehtmlref .= $object->title;
111 // Thirdparty
112 if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
113 $morehtmlref .= '<br>'.$object->thirdparty->getNomUrl(1, 'project');
114 }
115 $morehtmlref .= '</div>';
116
117 // Define a complementary filter for search of next/prev ref.
118 if (!$user->hasRight('projet', 'all', 'lire')) {
119 $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
120 $object->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")";
121 }
122
123 dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
124
125
126 print '<div class="fichecenter">';
127 print '<div class="underbanner clearboth"></div>';
128
129 $cssclass = "titlefield";
130 include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
131
132 print '</div>';
133
134 print '<div class="clearboth"></div>';
135
136 print dol_get_fiche_end();
137}
138
139// End of page
140llxFooter();
141$db->close();
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:55
llxFooter()
Empty footer.
Definition wrapper.php:69
Class to manage generation of HTML components Only common components must be here.
Class to manage projects.
Class to manage Dolibarr users.
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)
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_now($mode='auto')
Return date for now.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
getDolGlobalString($key, $default='')
Return 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.