dolibarr 21.0.0-beta
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 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 = getDolGlobalString('MAIN_SIZE_SHORTLIST_LIMIT', 5);
47$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT', 5);
48$now = dol_now();
49
50// Security check
51//$socid = 0;
52if ($user->socid > 0) { // Protection if external user
53 //$socid = $user->socid;
55}
56$result = restrictedArea($user, 'eventorganization');
57
58
59
60/*
61 * Actions
62 */
63
64// None
65
66
67/*
68 * View
69 */
70
71$form = new Form($db);
72$formfile = new FormFile($db);
73
74$title = $langs->trans('EventOrganizationArea');
75$help_url='EN:Module_Event_Organization';
76
77llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-eventorganization page-index');
78
79print load_fiche_titre($langs->trans("EventOrganizationArea"), '', 'eventorganization.png@eventorganization');
80
81print '<div class="fichecenter"><div class="fichethirdleft">';
82
83
84/* BEGIN MODULEBUILDER DRAFT MYOBJECT
85// Draft MyObject
86if (isModEnabled('eventorganization') && $user->rights->eventorganization->read)
87{
88 $langs->load("orders");
89
90 $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";
91 $sql.= ", s.code_client";
92 $sql.= " FROM ".MAIN_DB_PREFIX."commande as c";
93 $sql.= ", ".MAIN_DB_PREFIX."societe as s";
94 if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
95 $sql.= " WHERE c.fk_soc = s.rowid";
96 $sql.= " AND c.fk_statut = 0";
97 $sql.= " AND c.entity IN (".getEntity('commande').")";
98 if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .((int) $user->id);
99 if ($socid) $sql.= " AND c.fk_soc = ".((int) $socid);
100
101 $resql = $db->query($sql);
102 if ($resql)
103 {
104 $total = 0;
105 $num = $db->num_rows($resql);
106
107 print '<table class="noborder centpercent">';
108 print '<tr class="liste_titre">';
109 print '<th colspan="3">'.$langs->trans("DraftMyObjects").($num?'<span class="badge marginleftonlyshort">'.$num.'</span>':'').'</th></tr>';
110
111 $var = true;
112 if ($num > 0)
113 {
114 $i = 0;
115 while ($i < $num)
116 {
117
118 $obj = $db->fetch_object($resql);
119 print '<tr class="oddeven"><td class="nowrap">';
120
121 $myobjectstatic->id=$obj->rowid;
122 $myobjectstatic->ref=$obj->ref;
123 $myobjectstatic->ref_client=$obj->ref_client;
124 $myobjectstatic->total_ht = $obj->total_ht;
125 $myobjectstatic->total_tva = $obj->total_tva;
126 $myobjectstatic->total_ttc = $obj->total_ttc;
127
128 print $myobjectstatic->getNomUrl(1);
129 print '</td>';
130 print '<td class="nowrap">';
131 print '</td>';
132 print '<td class="right" class="nowrap">'.price($obj->total_ttc).'</td></tr>';
133 $i++;
134 $total += $obj->total_ttc;
135 }
136 if ($total>0)
137 {
138
139 print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" class="right">'.price($total)."</td></tr>";
140 }
141 }
142 else
143 {
144
145 print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoOrder").'</td></tr>';
146 }
147 print "</table><br>";
148
149 $db->free($resql);
150 }
151 else
152 {
153 dol_print_error($db);
154 }
155}
156END MODULEBUILDER DRAFT MYOBJECT */
157
158
159print '</div><div class="fichetwothirdright">';
160
161
162/* BEGIN MODULEBUILDER LASTMODIFIED MYOBJECT
163// Last modified myobject
164if (isModEnabled('eventorganization') && $user->rights->eventorganization->read)
165{
166 $sql = "SELECT s.rowid, s.ref, s.label, s.date_creation, s.tms";
167 $sql.= " FROM ".MAIN_DB_PREFIX."eventorganization_myobject as s";
168 //if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
169 $sql.= " WHERE s.entity IN (".getEntity($myobjectstatic->element).")";
170 //if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .((int) $user->id);
171 //if ($socid) $sql.= " AND s.rowid = $socid";
172 $sql .= " ORDER BY s.tms DESC";
173 $sql .= $db->plimit($max, 0);
174
175 $resql = $db->query($sql);
176 if ($resql)
177 {
178 $num = $db->num_rows($resql);
179 $i = 0;
180
181 print '<table class="noborder centpercent">';
182 print '<tr class="liste_titre">';
183 print '<th colspan="2">';
184 print $langs->trans("BoxTitleLatestModifiedMyObjects", $max);
185 print '</th>';
186 print '<th class="right">'.$langs->trans("DateModificationShort").'</th>';
187 print '</tr>';
188 if ($num)
189 {
190 while ($i < $num)
191 {
192 $objp = $db->fetch_object($resql);
193
194 $myobjectstatic->id=$objp->rowid;
195 $myobjectstatic->ref=$objp->ref;
196 $myobjectstatic->label=$objp->label;
197 $myobjectstatic->status = $objp->status;
198
199 print '<tr class="oddeven">';
200 print '<td class="nowrap">'.$myobjectstatic->getNomUrl(1).'</td>';
201 print '<td class="right nowrap">';
202 print "</td>";
203 print '<td class="right nowrap">'.dol_print_date($db->jdate($objp->tms), 'day')."</td>";
204 print '</tr>';
205 $i++;
206 }
207
208 $db->free($resql);
209 } else {
210 print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
211 }
212 print "</table><br>";
213 }
214}
215*/
216
217print '</div></div>';
218
219// End of page
220llxFooter();
221$db->close();
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
Class to offer components to list and upload files.
Class to manage generation of HTML components Only common components must be here.
llxFooter()
Footer empty.
Definition document.php:107
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
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.