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