|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <[email protected]> |
|
4
|
|
|
* Copyright (C) 2003 Jean-Louis Bergamo <[email protected]> |
|
5
|
|
|
* Copyright (C) 2004-2011 Laurent Destailleur <[email protected]> |
|
6
|
|
|
* Copyright (C) 2012 Regis Houssin <[email protected]> |
|
7
|
|
|
* Copyright (C) 2014 Florian Henry <[email protected]> |
|
8
|
|
|
* Copyright (C) 2015 Jean-François Ferry <[email protected]> |
|
9
|
|
|
* Copyright (C) 2024 Rafael San José <[email protected]> |
|
10
|
|
|
* |
|
11
|
|
|
* This program is free software; you can redistribute it and/or modify |
|
12
|
|
|
* it under the terms of the GNU General Public License as published by |
|
13
|
|
|
* the Free Software Foundation; either version 3 of the License, or |
|
14
|
|
|
* (at your option) any later version. |
|
15
|
|
|
* |
|
16
|
|
|
* This program is distributed in the hope that it will be useful, |
|
17
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
18
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
19
|
|
|
* GNU General Public License for more details. |
|
20
|
|
|
* |
|
21
|
|
|
* You should have received a copy of the GNU General Public License |
|
22
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>. |
|
23
|
|
|
*/ |
|
24
|
|
|
|
|
25
|
|
|
namespace DoliModules\BookCal\Controller; |
|
26
|
|
|
|
|
27
|
|
|
global $conf; |
|
28
|
|
|
global $db; |
|
29
|
|
|
global $user; |
|
30
|
|
|
global $hookmanager; |
|
31
|
|
|
global $user; |
|
32
|
|
|
global $menumanager; |
|
33
|
|
|
global $langs; |
|
34
|
|
|
global $mysoc; |
|
35
|
|
|
|
|
36
|
|
|
use DoliCore\Base\DolibarrController; |
|
37
|
|
|
use DoliCore\Form\Form; |
|
38
|
|
|
use DoliCore\Lib\ExtraFields; |
|
39
|
|
|
use http\Encoding\Stream; |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* \file htdocs/bookcal/admin/availabilities_extrafields.php |
|
43
|
|
|
* \ingroup bookcal |
|
44
|
|
|
* \brief Page to setup extra fields of availabilities |
|
45
|
|
|
*/ |
|
46
|
|
|
|
|
47
|
|
|
// Load Dolibarr environment |
|
48
|
|
|
require BASE_PATH . '/main.inc.php'; |
|
49
|
|
|
require_once BASE_PATH . '/../Dolibarr/Modules/BookCal/Lib/BookCal.php'; |
|
50
|
|
|
|
|
51
|
|
|
class BookCalAdminAvailabilitiesExtrafieldsController extends DolibarrController |
|
52
|
|
|
{ |
|
53
|
|
|
|
|
54
|
|
|
public function index(bool $executeActions = true): bool |
|
55
|
|
|
{ |
|
56
|
|
|
global $conf; |
|
57
|
|
|
global $db; |
|
58
|
|
|
global $user; |
|
59
|
|
|
global $hookmanager; |
|
60
|
|
|
global $user; |
|
61
|
|
|
global $menumanager; |
|
62
|
|
|
global $langs; |
|
63
|
|
|
|
|
64
|
|
|
// Load translation files required by the page |
|
65
|
|
|
$langs->loadLangs(['agenda', 'admin']); |
|
66
|
|
|
|
|
67
|
|
|
$extrafields = new ExtraFields($db); |
|
68
|
|
|
$form = new Form($db); |
|
69
|
|
|
|
|
70
|
|
|
// List of supported format |
|
71
|
|
|
$tmptype2label = ExtraFields::$type2label; |
|
72
|
|
|
$type2label = ['']; |
|
73
|
|
|
foreach ($tmptype2label as $key => $val) { |
|
74
|
|
|
$type2label[$key] = $langs->transnoentitiesnoconv($val); |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
$action = GETPOST('action', 'aZ09'); |
|
78
|
|
|
$attrname = GETPOST('attrname', 'alpha'); |
|
79
|
|
|
$elementtype = 'bookcal_availabilities'; //Must be the $table_element of the class that manage extrafield |
|
80
|
|
|
|
|
81
|
|
|
if (!$user->admin) { |
|
82
|
|
|
accessforbidden(); |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
|
|
86
|
|
|
/* |
|
87
|
|
|
* Actions |
|
88
|
|
|
*/ |
|
89
|
|
|
|
|
90
|
|
|
require DOL_DOCUMENT_ROOT . '/core/actions_extrafields.inc.php'; |
|
91
|
|
|
|
|
92
|
|
|
|
|
93
|
|
|
/* |
|
94
|
|
|
* View |
|
95
|
|
|
*/ |
|
96
|
|
|
require_once realpath(BASE_PATH . '/../Dolibarr/Modules/BookCal/Views/admin_availabilities_extrafields.php'); |
|
97
|
|
|
|
|
98
|
|
|
$db->close(); |
|
99
|
|
|
|
|
100
|
|
|
return true; |
|
101
|
|
|
} |
|
102
|
|
|
} |
|
103
|
|
|
|