dolibarr 20.0.0
note.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
3 * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
4 * Copyright (C) 2016 Laurent Destailleur <aldy@users.sourceforge.net>
5 * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
6 * Copyright (C) 2016 Gilles Poirier <glgpoirier@gmail.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
28// Load Dolibarr environment
29require '../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php';
31require_once DOL_DOCUMENT_ROOT.'/core/lib/resource.lib.php';
32
33// Load translation files required by the page
34$langs->loadLangs(array('companies', 'interventions'));
35
36$id = GETPOSTINT('id');
37$ref = GETPOST('ref', 'alpha');
38$action = GETPOST('action', 'aZ09');
39
40// Security check
41if ($user->socid) {
42 $socid = $user->socid;
43}
44// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
45$hookmanager->initHooks(array('resourcenote'));
46
47$object = new Dolresource($db);
48
49// Load object
50include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
51
52$result = restrictedArea($user, 'resource', $object->id, 'resource');
53
54$permissionnote = $user->hasRight('resource', 'write'); // Used by the include of actions_setnotes.inc.php
55
56
57/*
58 * Actions
59 */
60
61$parameters = array();
62$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
63if ($reshook < 0) {
64 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
65}
66if (empty($reshook)) {
67 include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
68}
69
70
71/*
72 * View
73 */
74
75$title = '';
76$help_url = '';
77llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-resource page-card_notes');
78
79$form = new Form($db);
80
81if ($id > 0 || !empty($ref)) {
82 $head = resource_prepare_head($object);
83 print dol_get_fiche_head($head, 'note', $langs->trans('ResourceSingular'), -1, 'resource');
84
85 $linkback = '<a href="'.DOL_URL_ROOT.'/resource/list.php'.(!empty($socid) ? '?id='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
86
87
88 $morehtmlref = '<div class="refidno">';
89 $morehtmlref .= '</div>';
90
91
92 dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
93
94
95 print '<div class="fichecenter">';
96 print '<div class="underbanner clearboth"></div>';
97
98 print '<table class="border tableforfield centpercent">';
99
100 // Resource type
101 print '<tr>';
102 print '<td class="titlefield">'.$langs->trans("ResourceType").'</td>';
103 print '<td>';
104 print $object->type_label;
105 print '</td>';
106 print '</tr>';
107
108 print "</table>";
109
110 print '</div>';
111
112 $permission = $user->hasRight('resource', 'write');
113 $cssclass = 'titlefield';
114 include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
115
116 print dol_get_fiche_end();
117}
118
119// End of page
120llxFooter();
121$db->close();
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:55
llxFooter()
Empty footer.
Definition wrapper.php:69
DAO Resource object.
Class to manage generation of HTML components Only common components must be here.
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.
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.
resource_prepare_head($object)
Prepare head for 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.