dolibarr 21.0.0-beta
info.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2005-2006 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
4 * Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
5 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
6 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.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.'/core/lib/functions2.lib.php';
31require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
32require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php';
33
42if (!$user->hasRight('categorie', 'lire')) {
44}
45
46// Load translation files required by the page
47$langs->loadLangs(array('categories', 'sendings'));
48
49$socid = 0;
50$id = GETPOSTINT('id');
51$label = GETPOST('label', 'alpha');
52
53// Security check
54if ($user->socid) {
55 $socid = $user->socid;
56}
57$result = restrictedArea($user, 'categorie', $id, '&category');
58
59$object = new Categorie($db);
60$result = $object->fetch($id, $label);
61if ($result <= 0) {
62 dol_print_error($db, $object->error);
63 exit;
64}
65
66$type = $object->type;
67if (is_numeric($type)) {
68 $type = Categorie::$MAP_ID_TO_CODE[(int) $type]; // For backward compatibility
69}
70
71/*
72 * View
73 */
74
75$form = new Form($db);
76
77llxHeader('', $langs->trans('Categories'), '');
78
79//$object->info($object->id);
80
81$title = Categorie::$MAP_TYPE_TITLE_AREA[$type];
82
83$head = categories_prepare_head($object, $type);
84print dol_get_fiche_head($head, 'info', $langs->trans($title), -1, 'category');
85
86$backtolist = (GETPOST('backtolist') ? GETPOST('backtolist') : DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.urlencode($type));
87$linkback = '<a href="'.dol_sanitizeUrl($backtolist).'">'.$langs->trans("BackToList").'</a>';
88$object->next_prev_filter = 'type:=:'.((int) $object->type);
89$object->ref = $object->label;
90$morehtmlref = '<br><div class="refidno"><a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.urlencode($type).'">'.$langs->trans("Root").'</a> >> ';
91$ways = $object->print_all_ways(" &gt;&gt; ", '', 1);
92foreach ($ways as $way) {
93 $morehtmlref .= $way."<br>\n";
94}
95$morehtmlref .= '</div>';
96
97dol_banner_tab($object, 'label', $linkback, ($user->socid ? 0 : 1), 'label', 'label', $morehtmlref, '&type='.$type, 0, '', '', 1);
98
99print '<br>';
100
101print '<div class="fichecenter">';
102print '<div class="underbanner clearboth"></div>';
103
104print '<br>';
105
106print '<table "border centpercent tableforfield">';
107
108print '<tr><td>';
109dol_print_object_info($object);
110print '</td></tr>';
111
112print '</table>';
113
114print '</div>';
115
116print dol_get_fiche_end();
117
118// End of page
119llxFooter();
120$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
categories_prepare_head(Categorie $object, $type)
Prepare array with list of tabs.
Class to manage categories.
Class to manage generation of HTML components Only common components must be here.
llxFooter()
Footer empty.
Definition document.php:107
dol_print_object_info($object, $usetable=0)
Show information on an object TODO Move this into html.formother.
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.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.