dolibarr 18.0.6
note.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
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.'/core/lib/expensereport.lib.php';
30require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
31require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
32
33// Load translation files required by the page
34$langs->loadLangs(array('trips', 'companies', 'bills', 'orders'));
35
36$id = GETPOST('id', 'int');
37$ref = GETPOST('ref', 'alpha');
38$socid = GETPOST('socid', 'int');
39$action = GETPOST('action', 'aZ09');
40
41$childids = $user->getAllChildIds(1);
42
43// Security check
44$socid = 0;
45if ($user->socid) {
46 $socid = $user->socid;
47}
48$hookmanager->initHooks(array('expensereportnote'));
49
50$result = restrictedArea($user, 'expensereport', $id, 'expensereport');
51
52
53$object = new ExpenseReport($db);
54if (!$object->fetch($id, $ref) > 0) {
55 dol_print_error($db);
56}
57
58$permissionnote = $user->rights->expensereport->creer; // Used by the include of actions_setnotes.inc.php
59
60if ($object->id > 0) {
61 // Check current user can read this expense report
62 $canread = 0;
63 if (!empty($user->rights->expensereport->readall)) {
64 $canread = 1;
65 }
66 if (!empty($user->rights->expensereport->lire) && in_array($object->fk_user_author, $childids)) {
67 $canread = 1;
68 }
69 if (!$canread) {
71 }
72}
73
74/*
75 * Actions
76 */
77
78$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
79if ($reshook < 0) {
80 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
81}
82if (empty($reshook)) {
83 include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
84}
85
86
87/*
88 * View
89 */
90$title = $langs->trans("ExpenseReport")." - ".$langs->trans("Note");
91$helpurl = "EN:Module_Expense_Reports";
92llxHeader("", $title, $helpurl);
93
94$form = new Form($db);
95
96if ($id > 0 || !empty($ref)) {
97 $object = new ExpenseReport($db);
98 $object->fetch($id, $ref);
99 $object->info($object->id);
100
101 $head = expensereport_prepare_head($object);
102
103 print dol_get_fiche_head($head, 'note', $langs->trans("ExpenseReport"), -1, 'trip');
104
105 $linkback = '<a href="'.DOL_URL_ROOT.'/expensereport/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
106
107 $morehtmlref = '<div class="refidno">';
108 $morehtmlref .= '</div>';
109
110
111 dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
112
113 print '<div class="fichecenter">';
114 print '<div class="underbanner clearboth"></div>';
115
116 $cssclass = "titlefield";
117 include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
118
119 print '</div>';
120
121 print dol_get_fiche_end();
122}
123
124// End of page
125llxFooter();
126$db->close();
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:56
llxFooter()
Empty footer.
Definition wrapper.php:70
Class to manage Trips and Expenses.
Class to manage generation of HTML components Only common components must be here.
expensereport_prepare_head($object)
Prepare array with list of tabs.
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.
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_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.