dolibarr  13.0.2
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 require '../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.'/core/lib/expensereport.lib.php';
29 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
30 require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
31 
32 // Load translation files required by the page
33 $langs->loadLangs(array('trips', 'companies', 'bills', 'orders'));
34 
35 $id = GETPOST('id', 'int');
36 $ref = GETPOST('ref', 'alpha');
37 $socid = GETPOST('socid', 'int');
38 $action = GETPOST('action', 'aZ09');
39 
40 $childids = $user->getAllChildIds(1);
41 
42 // Security check
43 $socid = 0;
44 if ($user->socid) $socid = $user->socid;
45 $result = restrictedArea($user, 'expensereport', $id, 'expensereport');
46 
47 
48 $object = new ExpenseReport($db);
49 if (!$object->fetch($id, $ref) > 0)
50 {
51  dol_print_error($db);
52 }
53 
54 $permissionnote = $user->rights->expensereport->creer; // Used by the include of actions_setnotes.inc.php
55 
56 if ($object->id > 0)
57 {
58  // Check current user can read this expense report
59  $canread = 0;
60  if (!empty($user->rights->expensereport->readall)) $canread = 1;
61  if (!empty($user->rights->expensereport->lire) && in_array($object->fk_user_author, $childids)) $canread = 1;
62  if (!$canread)
63  {
65  }
66 }
67 
68 
69 /*
70  * Actions
71  */
72 
73 include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
74 
75 
76 /*
77  * View
78  */
79 $title = $langs->trans("ExpenseReport")." - ".$langs->trans("Note");
80 $helpurl = "EN:Module_Expense_Reports";
81 llxHeader("", $title, $helpurl);
82 
83 $form = new Form($db);
84 
85 if ($id > 0 || !empty($ref))
86 {
87  $object = new ExpenseReport($db);
88  $object->fetch($id, $ref);
89  $object->info($object->id);
90 
91  $head = expensereport_prepare_head($object);
92 
93  print dol_get_fiche_head($head, 'note', $langs->trans("ExpenseReport"), -1, 'trip');
94 
95  $linkback = '<a href="'.DOL_URL_ROOT.'/expensereport/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
96 
97  $morehtmlref = '<div class="refidno">';
98  $morehtmlref .= '</div>';
99 
100 
101  dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
102 
103  print '<div class="fichecenter">';
104  print '<div class="underbanner clearboth"></div>';
105 
106  $cssclass = "titlefield";
107  include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
108 
109  print '</div>';
110 
112 }
113 
114 // End of page
115 llxFooter();
116 $db->close();
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
llxHeader()
Empty header.
Definition: wrapper.php:45
Class to manage generation of HTML components Only common components must be here.
expensereport_prepare_head($object)
Prepare array with list of tabs.
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.
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Class to manage Trips and Expenses.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
Definition: index.php:89
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.
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