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