dolibarr/htdocs/resource/note.php

118 lines
3.4 KiB
PHP
Raw Normal View History

2016-01-31 12:30:15 +01:00
<?php
2018-10-27 14:43:12 +02:00
/* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
2016-01-31 12:30:15 +01:00
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
2016-06-06 12:29:15 +02:00
* Copyright (C) 2016 Laurent Destailleur <aldy@users.sourceforge.net>
2016-01-31 12:30:15 +01:00
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
2016-06-06 12:29:15 +02:00
* Copyright (C) 2016 Gilles Poirier <glgpoirier@gmail.com>
2016-01-31 12:30:15 +01:00
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
2019-09-23 21:55:30 +02:00
* along with this program. If not, see <https://www.gnu.org/licenses/>.
2016-01-31 12:30:15 +01:00
*/
/**
* \file htdocs/resource/note.php
* \ingroup fichinter
* \brief Fiche d'information sur une resource
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php';
2016-01-31 12:30:15 +01:00
require_once DOL_DOCUMENT_ROOT.'/core/lib/resource.lib.php';
2018-05-26 18:41:16 +02:00
// Load translation files required by the page
$langs->loadLangs(array('companies', 'interventions'));
2016-01-31 12:30:15 +01:00
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
2020-09-16 19:39:50 +02:00
$action = GETPOST('action', 'aZ09');
2016-01-31 12:30:15 +01:00
// Security check
2021-02-26 20:53:03 +01:00
if ($user->socid) {
$socid = $user->socid;
}
2021-07-09 18:36:21 +02:00
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('resourcenote'));
$object = new DolResource($db);
2021-10-25 15:32:10 +02:00
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
$result = restrictedArea($user, 'resource', $object->id, 'resource');
2016-01-31 12:30:15 +01:00
$permissionnote = $user->rights->resource->write; // Used by the include of actions_setnotes.inc.php
2016-01-31 12:30:15 +01:00
2016-06-06 12:29:15 +02:00
2016-01-31 12:30:15 +01:00
/*
* Actions
*/
2021-07-09 18:36:21 +02:00
$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
2021-07-11 09:54:13 +02:00
if ($reshook < 0) {
2021-07-09 18:36:21 +02:00
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
2021-07-11 09:54:13 +02:00
}
2021-07-11 09:54:28 +02:00
if (empty($reshook)) {
2021-07-09 18:36:21 +02:00
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
2021-07-11 09:54:13 +02:00
}
2016-01-31 12:30:15 +01:00
/*
* View
*/
llxHeader();
$form = new Form($db);
2021-02-26 20:53:03 +01:00
if ($id > 0 || !empty($ref)) {
2016-01-31 12:30:15 +01:00
$head = resource_prepare_head($object);
2020-10-22 22:50:03 +02:00
print dol_get_fiche_head($head, 'note', $langs->trans('ResourceSingular'), -1, 'resource');
2017-05-23 13:38:48 +02:00
$linkback = '<a href="'.DOL_URL_ROOT.'/resource/list.php'.(!empty($socid) ? '?id='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
2017-10-20 23:48:42 +02:00
$morehtmlref = '<div class="refidno">';
$morehtmlref .= '</div>';
2017-10-20 23:48:42 +02:00
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
2017-05-23 13:38:48 +02:00
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
2017-10-20 23:48:42 +02:00
2019-06-05 12:16:55 +02:00
print '<table class="border tableforfield centpercent">';
2016-01-31 12:30:15 +01:00
// Resource type
print '<tr>';
print '<td class="titlefield">'.$langs->trans("ResourceType").'</td>';
2016-01-31 12:30:15 +01:00
print '<td>';
print $object->type_label;
print '</td>';
2017-05-23 13:38:48 +02:00
print '</tr>';
2017-10-20 23:48:42 +02:00
2017-05-23 13:38:48 +02:00
print "</table>";
2016-01-31 12:30:15 +01:00
2017-05-23 13:38:48 +02:00
print '</div>';
2017-10-20 23:48:42 +02:00
$permission = $user->rights->resource->write;
$cssclass = 'titlefield';
2016-01-31 12:30:15 +01:00
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
2020-10-27 18:19:31 +01:00
print dol_get_fiche_end();
2016-01-31 12:30:15 +01:00
}
2018-08-06 11:53:33 +02:00
// End of page
2016-01-31 12:30:15 +01:00
llxFooter();
$db->close();