dolibarr  13.0.2
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 = $_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)) $object->fetchComments();
43 
44 // Security check
45 $socid = 0;
46 //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.
47 $result = restrictedArea($user, 'projet', $id, 'projet&project');
48 
49 $permissionnote = $user->rights->projet->creer; // Used by the include of actions_setnotes.inc.php
50 
51 
52 /*
53  * Actions
54  */
55 
56 include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
57 
58 
59 /*
60  * View
61  */
62 
63 $title = $langs->trans("Project").' - '.$langs->trans("Note").' - '.$object->ref.' '.$object->name;
64 if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title = $object->ref.' '.$object->name.' - '.$langs->trans("Note");
65 $help_url = "EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos";
66 llxHeader("", $title, $help_url);
67 
68 $form = new Form($db);
69 $userstatic = new User($db);
70 
71 $now = dol_now();
72 
73 if ($id > 0 || !empty($ref))
74 {
75  // To verify role of users
76  //$userAccess = $object->restrictedProjectArea($user,'read');
77  $userWrite = $object->restrictedProjectArea($user, 'write');
78  //$userDelete = $object->restrictedProjectArea($user,'delete');
79  //print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete;
80 
81  $head = project_prepare_head($object);
82  print dol_get_fiche_head($head, 'notes', $langs->trans('Project'), -1, ($object->public ? 'projectpub' : 'project'));
83 
84 
85  // Project card
86 
87  $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
88 
89  $morehtmlref = '<div class="refidno">';
90  // Title
91  $morehtmlref .= $object->title;
92  // Thirdparty
93  if ($object->thirdparty->id > 0)
94  {
95  $morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project');
96  }
97  $morehtmlref .= '</div>';
98 
99  // Define a complementary filter for search of next/prev ref.
100  if (!$user->rights->projet->all->lire)
101  {
102  $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
103  $object->next_prev_filter = " rowid in (".(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
104  }
105 
106  dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
107 
108 
109  print '<div class="fichecenter">';
110  print '<div class="underbanner clearboth"></div>';
111 
112  $cssclass = "titlefield";
113  include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
114 
115  print '</div>';
116 
117  print '<div class="clearboth"></div>';
118 
120 }
121 
122 // End of page
123 llxFooter();
124 $db->close();
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_now($mode= 'auto')
Return date for now.
Class to manage Dolibarr users.
Definition: user.class.php:44
llxHeader()
Empty header.
Definition: wrapper.php:45
Class to manage generation of HTML components Only common components must be here.
Class to manage projects.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
project_prepare_head(Project $project)
Prepare array with list of tabs.
Definition: project.lib.php:36
print
Draft customers invoices.
Definition: index.php:89
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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.
llxFooter()
Empty footer.
Definition: wrapper.php:59