dolibarr 24.0.0-beta
availabilities_note.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2007-2024 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2024-2026 Frédéric France <frederic.france@free.fr>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
25// Load Dolibarr environment
26require '../main.inc.php';
35require_once DOL_DOCUMENT_ROOT.'/bookcal/class/availabilities.class.php';
36require_once DOL_DOCUMENT_ROOT.'/bookcal/lib/bookcal_availabilities.lib.php';
37
38// Load translation files required by the page
39$langs->loadLangs(array("agenda", "companies"));
40
41// Get parameters
42$id = GETPOSTINT('id');
43$ref = GETPOST('ref', 'alpha');
44$action = GETPOST('action', 'aZ09');
45$cancel = GETPOST('cancel', 'alpha');
46$backtopage = GETPOST('backtopage', 'alpha');
47
48// Initialize a technical objects
50$diroutputmassaction = $conf->bookcal->dir_output.'/temp/massgeneration/'.$user->id;
51$hookmanager->initHooks(array('availabilitiesnote', 'globalcard')); // Note that conf->hooks_modules contains array
52// Fetch optionals attributes and labels
53$extrafields->fetch_name_optionals_label($object->table_element);
54
55// Load object
56include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'include', not 'include_once'. Include fetch and fetch_thirdparty but not fetch_optionals
57if ($id > 0 || !empty($ref)) {
58 $upload_dir = $conf->bookcal->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity]."/".$object->id;
59}
60
61$permissiontoread = $user->hasRight('bookcal', 'availabilities', 'read');
62$permissiontoadd = $user->hasRight('bookcal', 'availabilities', 'write');
63$permissionnote = $user->hasRight('bookcal', 'availabilities', 'write'); // Used by the include of actions_setnotes.inc.php
64
65// Security check (enable the most restrictive one)
66//if ($user->socid > 0) accessforbidden();
67//if ($user->socid > 0) $socid = $user->socid;
68//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
69//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
70if (!isModEnabled('bookcal')) {
72}
73if (!$permissiontoread) {
75}
76
77
78/*
79 * Actions
80 */
81
82$parameters = array();
83$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
84if ($reshook < 0) {
85 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
86}
87if (empty($reshook)) {
88 include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be 'include', not 'include_once'
89}
90
91
92/*
93 * View
94 */
95
96$form = new Form($db);
97
98//$help_url='EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes';
99$help_url = '';
100$title = $langs->trans('Availabilities').' - '.$langs->trans("Notes");
101llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-bookcal page-card_availabilities_note');
102
103if ($id > 0 || !empty($ref)) {
104 $object->fetch_thirdparty();
105
106 $head = availabilitiesPrepareHead($object);
107
108 print dol_get_fiche_head($head, 'note', $langs->trans("Availabilities"), -1, $object->picto);
109
110 // Object card
111 // ------------------------------------------------------------
112 $linkback = '<a href="'.dol_buildpath('/bookcal/availabilities_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
113
114 $morehtmlref = '<div class="refidno">';
115 /*
116 // Ref customer
117 $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
118 $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
119 // Thirdparty
120 $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '');
121 // Project
122 if (isModEnabled('project'))
123 {
124 $langs->load("projects");
125 $morehtmlref.='<br>'.$langs->trans('Project') . ' ';
126 if ($permissiontoadd)
127 {
128 if ($action != 'classify')
129 //$morehtmlref.='<a class="editfielda" href="' . dolBuildUrl($_SERVER['PHP_SELF'], ['action' => 'classify', 'id' => $object->id], true) . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
130 $morehtmlref.=' : ';
131 if ($action == 'classify') {
132 //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
133 $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
134 $morehtmlref.='<input type="hidden" name="action" value="classin">';
135 $morehtmlref.='<input type="hidden" name="token" value="'.newToken().'">';
136 $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
137 $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
138 $morehtmlref.='</form>';
139 } else {
140 $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
141 }
142 } else {
143 if (! empty($object->fk_project)) {
144 $proj = new Project($db);
145 $proj->fetch($object->fk_project);
146 $morehtmlref .= ': '.$proj->getNomUrl();
147 } else {
148 $morehtmlref .= '';
149 }
150 }
151 }*/
152 $morehtmlref .= '</div>';
153
154
155 dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
156
157
158 print '<div class="fichecenter">';
159 print '<div class="underbanner clearboth"></div>';
160
161
162 $cssclass = "titlefield";
163 include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
164
165 print '</div>';
166
167 print dol_get_fiche_end();
168}
169
170// End of page
171llxFooter();
172$db->close();
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:47
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
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:73
availabilitiesPrepareHead($object)
Prepare array of tabs for Availabilities.
Class for Availabilities.
Class to manage generation of HTML components Only common components must be here.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
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, $morecssdiv='')
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.
isModEnabled($module)
Is Dolibarr module enabled.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.