dolibarr 21.0.0-beta
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 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
29// Load Dolibarr environment
30require '../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php';
32require_once DOL_DOCUMENT_ROOT.'/core/lib/resource.lib.php';
33
42// Load translation files required by the page
43$langs->loadLangs(array('companies', 'interventions'));
44
45$id = GETPOSTINT('id');
46$ref = GETPOST('ref', 'alpha');
47$action = GETPOST('action', 'aZ09');
48
49// Security check
50if ($user->socid) {
51 $socid = $user->socid;
52}
53// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
54$hookmanager->initHooks(array('resourcenote'));
55
56$object = new Dolresource($db);
57
58// Load object
59include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'include', not 'include_once'.
60
61$result = restrictedArea($user, 'resource', $object->id, 'resource');
62
63$permissionnote = $user->hasRight('resource', 'write'); // Used by the include of actions_setnotes.inc.php
64
65
66/*
67 * Actions
68 */
69
70$parameters = array();
71$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
72if ($reshook < 0) {
73 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
74}
75if (empty($reshook)) {
76 include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be 'include', not 'include_once'
77}
78
79
80/*
81 * View
82 */
83
84$title = '';
85$help_url = '';
86llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-resource page-card_notes');
87
88$form = new Form($db);
89
90if ($id > 0 || !empty($ref)) {
91 $head = resource_prepare_head($object);
92 print dol_get_fiche_head($head, 'note', $langs->trans('ResourceSingular'), -1, 'resource');
93
94 $linkback = '<a href="'.DOL_URL_ROOT.'/resource/list.php'.(!empty($socid) ? '?id='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
95
96
97 $morehtmlref = '<div class="refidno">';
98 $morehtmlref .= '</div>';
99
100
101 dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
102
103
104 print '<div class="fichecenter">';
105 print '<div class="underbanner clearboth"></div>';
106
107 print '<table class="border tableforfield centpercent">';
108
109 // Resource type
110 print '<tr>';
111 print '<td class="titlefield">'.$langs->trans("ResourceType").'</td>';
112 print '<td>';
113 print $object->type_label;
114 print '</td>';
115 print '</tr>';
116
117 print "</table>";
118
119 print '</div>';
120
121 $permission = $user->hasRight('resource', 'write');
122 $cssclass = 'titlefield';
123 include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
124
125 print dol_get_fiche_end();
126}
127
128// End of page
129llxFooter();
130$db->close();
$id
Definition account.php:48
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:66
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:71
DAO Resource object.
Class to manage generation of HTML components Only common components must be here.
llxFooter()
Footer empty.
Definition document.php:107
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
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.
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.