dolibarr 25.0.0-alpha
eventorganizationindex.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
6 * Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
7 * Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
29// Load Dolibarr environment
30require '../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
32
41// Load translation files required by the page
42$langs->loadLangs(array("eventorganization"));
43
44$action = GETPOST('action', 'aZ09');
45
46$NBMAX = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT', 5);
47
48$max = getDolUserInt('MAIN_SIZE_SHORTLIST_LIMIT', getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT', 5));
49
50$now = dol_now();
51
52// Security check
53//$socid = 0;
54if ($user->socid > 0) { // Protection if external user
55 //$socid = $user->socid;
57}
58$result = restrictedArea($user, 'eventorganization');
59
60
61
62/*
63 * Actions
64 */
65
66// None
67
68
69/*
70 * View
71 */
72
73$form = new Form($db);
74$formfile = new FormFile($db);
75
76$title = $langs->trans('EventOrganizationArea');
77$help_url='EN:Module_Event_Organization';
78
79llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-eventorganization page-index');
80
81print load_fiche_titre($langs->trans("EventOrganizationArea"), '', 'eventorganization.png@eventorganization');
82
83print '<div class="fichecenter"><div class="fichethirdleft">';
84
85
86/* BEGIN MODULEBUILDER DRAFT MYOBJECT
87// Draft MyObject
88if (isModEnabled('eventorganization') && $user->rights->eventorganization->read)
89{
90 $langs->load("orders");
91
92 $sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.tva as total_tva, c.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
93 $sql.= ", s.code_client";
94 $sql.= " FROM ".MAIN_DB_PREFIX."commande as c";
95 $sql.= ", ".MAIN_DB_PREFIX."societe as s";
96 if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
97 $sql.= " WHERE c.fk_soc = s.rowid";
98 $sql.= " AND c.fk_statut = 0";
99 $sql.= " AND c.entity IN (".getEntity('commande').")";
100 if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .((int) $user->id);
101 if ($socid) $sql.= " AND c.fk_soc = ".((int) $socid);
102
103 $resql = $db->query($sql);
104 if ($resql)
105 {
106 $total = 0;
107 $num = $db->num_rows($resql);
108
109 print '<table class="noborder centpercent">';
110 print '<tr class="liste_titre">';
111 print '<th colspan="3">'.$langs->trans("DraftMyObjects").($num?'<span class="badge marginleftonlyshort">'.$num.'</span>':'').'</th></tr>';
112
113 $var = true;
114 if ($num > 0)
115 {
116 $i = 0;
117 while ($i < $num)
118 {
119
120 $obj = $db->fetch_object($resql);
121 print '<tr class="oddeven"><td class="nowrap">';
122
123 $myobjectstatic->id=$obj->rowid;
124 $myobjectstatic->ref=$obj->ref;
125 $myobjectstatic->ref_client=$obj->ref_client;
126 $myobjectstatic->total_ht = $obj->total_ht;
127 $myobjectstatic->total_tva = $obj->total_tva;
128 $myobjectstatic->total_ttc = $obj->total_ttc;
129
130 print $myobjectstatic->getNomUrl(1);
131 print '</td>';
132 print '<td class="nowrap">';
133 print '</td>';
134 print '<td class="right" class="nowrap">'.price($obj->total_ttc).'</td></tr>';
135 $i++;
136 $total += $obj->total_ttc;
137 }
138 if ($total>0)
139 {
140
141 print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" class="right">'.price($total)."</td></tr>";
142 }
143 }
144 else
145 {
146
147 print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoOrder").'</td></tr>';
148 }
149 print "</table><br>";
150
151 $db->free($resql);
152 }
153 else
154 {
155 dol_print_error($db);
156 }
157}
158END MODULEBUILDER DRAFT MYOBJECT */
159
160
161print '</div><div class="fichetwothirdright">';
162
163
164/* BEGIN MODULEBUILDER LASTMODIFIED MYOBJECT
165// Last modified myobject
166if (isModEnabled('eventorganization') && $user->rights->eventorganization->read)
167{
168 $sql = "SELECT s.rowid, s.ref, s.label, s.date_creation, s.tms";
169 $sql.= " FROM ".MAIN_DB_PREFIX."eventorganization_myobject as s";
170 //if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
171 $sql.= " WHERE s.entity IN (".getEntity($myobjectstatic->element).")";
172 //if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .((int) $user->id);
173 //if ($socid) $sql.= " AND s.rowid = $socid";
174 $sql .= " ORDER BY s.tms DESC";
175 $sql .= $db->plimit($max, 0);
176
177 $resql = $db->query($sql);
178 if ($resql)
179 {
180 $num = $db->num_rows($resql);
181 $i = 0;
182
183 print '<table class="noborder centpercent">';
184 print '<tr class="liste_titre">';
185 print '<th colspan="2">';
186 print $langs->trans("BoxTitleLatestModifiedMyObjects", $max);
187 print '</th>';
188 print '<th class="right">'.$langs->trans("DateModificationShort").'</th>';
189 print '</tr>';
190 if ($num)
191 {
192 while ($i < $num)
193 {
194 $objp = $db->fetch_object($resql);
195
196 $myobjectstatic->id=$objp->rowid;
197 $myobjectstatic->ref=$objp->ref;
198 $myobjectstatic->label=$objp->label;
199 $myobjectstatic->status = $objp->status;
200
201 print '<tr class="oddeven">';
202 print '<td class="nowrap">'.$myobjectstatic->getNomUrl(1).'</td>';
203 print '<td class="right nowrap">';
204 print "</td>";
205 print '<td class="right nowrap">'.dol_print_date($db->jdate($objp->tms), 'day')."</td>";
206 print '</tr>';
207 $i++;
208 }
209
210 $db->free($resql);
211 } else {
212 print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
213 }
214 print "</table><br>";
215 }
216}
217*/
218
219print '</div></div>';
220
221// End of page
222llxFooter();
223$db->close();
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
Class to offer components to list and upload files.
Class to manage generation of HTML components Only common components must be here.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
dol_now($mode='gmt')
Return date for now.
getDolUserInt($key, $default=0, $tmpuser=null)
Return Dolibarr user constant int value.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
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.