dolibarr/htdocs/admin/reception_extrafields.php

110 lines
3.1 KiB
PHP
Raw Normal View History

2018-10-03 18:05:22 +02:00
<?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
* Copyright (C) 2018 Quentin Vial-Gouteyron <quentin.vial-gouteyron@atm-consulting.fr>
*
* 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/>.
2018-10-03 18:05:22 +02:00
*/
/**
* \file htdocs/admin/reception_extrafields.php
* \ingroup reception
* \brief Page to setup extra fields of reception
*/
2022-09-07 20:08:59 +02:00
// Load Dolibarr environment
2018-10-03 18:05:22 +02:00
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/reception.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
2021-02-26 22:04:03 +01:00
if (!$user->admin) {
2018-10-03 18:05:22 +02:00
accessforbidden();
2021-02-26 22:04:03 +01:00
}
2018-10-03 18:05:22 +02:00
$langs->load("admin");
$langs->load("other");
$langs->load("receptions");
$langs->load("deliveries");
$extrafields = new ExtraFields($db);
$form = new Form($db);
// List of supported format
$type2label = ExtraFields::getListOfTypesLabels();
2018-10-03 18:05:22 +02:00
2020-09-16 19:39:50 +02:00
$action = GETPOST('action', 'aZ09');
$attrname = GETPOST('attrname', 'alpha');
$elementtype = 'reception'; //Must be the $table_element of the class that manage extrafield
2018-10-03 18:05:22 +02:00
2021-02-26 22:04:03 +01:00
if (!$user->admin) {
accessforbidden();
}
2018-10-03 18:05:22 +02:00
/*
* Actions
*/
require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
/*
* View
*/
$textobject = $langs->transnoentitiesnoconv("Receptions");
2018-10-03 18:05:22 +02:00
llxHeader('', $langs->trans("ReceptionsSetup"));
2018-10-03 18:05:22 +02:00
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("ReceptionsSetup"), $linkback, 'title_setup');
2018-10-03 18:05:22 +02:00
print "<br>\n";
$head = reception_admin_prepare_head();
2021-05-10 15:24:07 +02:00
print dol_get_fiche_head($head, 'attributes_reception', $langs->trans("Receptions"), -1, 'reception');
2018-10-03 18:05:22 +02:00
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
2020-10-27 18:19:31 +01:00
print dol_get_fiche_end();
2018-10-03 18:05:22 +02:00
// Creation of an optional field
2021-02-26 22:04:03 +01:00
if ($action == 'create') {
print "<br>";
print load_fiche_titre($langs->trans('NewAttribute'));
2018-10-03 18:05:22 +02:00
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
2018-10-03 18:05:22 +02:00
}
// Edition of an optional field
2021-02-26 22:04:03 +01:00
if ($action == 'edit' && !empty($attrname)) {
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
2018-10-03 18:05:22 +02:00
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
2018-10-03 18:05:22 +02:00
}
llxFooter();
$db->close();