dolibarr 21.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 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
28// Load Dolibarr environment
29require '../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
31
32// Load translation files required by the page
33$langs->loadLangs(array("eventorganization"));
34
35$action = GETPOST('action', 'aZ09');
36
37$NBMAX = getDolGlobalString('MAIN_SIZE_SHORTLIST_LIMIT', 5);
38$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT', 5);
39$now = dol_now();
40
41// Security check
42//$socid = 0;
43if ($user->socid > 0) { // Protection if external user
44 //$socid = $user->socid;
46}
47$result = restrictedArea($user, 'eventorganization');
48
49
50
51/*
52 * Actions
53 */
54
55// None
56
57
58/*
59 * View
60 */
61
62$form = new Form($db);
63$formfile = new FormFile($db);
64
65$title = $langs->trans('EventOrganizationArea');
66$help_url='EN:Module_Event_Organization';
67
68llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-eventorganization page-index');
69
70print load_fiche_titre($langs->trans("EventOrganizationArea"), '', 'eventorganization.png@eventorganization');
71
72print '<div class="fichecenter"><div class="fichethirdleft">';
73
74
75/* BEGIN MODULEBUILDER DRAFT MYOBJECT
76// Draft MyObject
77if (isModEnabled('eventorganization') && $user->rights->eventorganization->read)
78{
79 $langs->load("orders");
80
81 $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";
82 $sql.= ", s.code_client";
83 $sql.= " FROM ".MAIN_DB_PREFIX."commande as c";
84 $sql.= ", ".MAIN_DB_PREFIX."societe as s";
85 if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
86 $sql.= " WHERE c.fk_soc = s.rowid";
87 $sql.= " AND c.fk_statut = 0";
88 $sql.= " AND c.entity IN (".getEntity('commande').")";
89 if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .((int) $user->id);
90 if ($socid) $sql.= " AND c.fk_soc = ".((int) $socid);
91
92 $resql = $db->query($sql);
93 if ($resql)
94 {
95 $total = 0;
96 $num = $db->num_rows($resql);
97
98 print '<table class="noborder centpercent">';
99 print '<tr class="liste_titre">';
100 print '<th colspan="3">'.$langs->trans("DraftMyObjects").($num?'<span class="badge marginleftonlyshort">'.$num.'</span>':'').'</th></tr>';
101
102 $var = true;
103 if ($num > 0)
104 {
105 $i = 0;
106 while ($i < $num)
107 {
108
109 $obj = $db->fetch_object($resql);
110 print '<tr class="oddeven"><td class="nowrap">';
111
112 $myobjectstatic->id=$obj->rowid;
113 $myobjectstatic->ref=$obj->ref;
114 $myobjectstatic->ref_client=$obj->ref_client;
115 $myobjectstatic->total_ht = $obj->total_ht;
116 $myobjectstatic->total_tva = $obj->total_tva;
117 $myobjectstatic->total_ttc = $obj->total_ttc;
118
119 print $myobjectstatic->getNomUrl(1);
120 print '</td>';
121 print '<td class="nowrap">';
122 print '</td>';
123 print '<td class="right" class="nowrap">'.price($obj->total_ttc).'</td></tr>';
124 $i++;
125 $total += $obj->total_ttc;
126 }
127 if ($total>0)
128 {
129
130 print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" class="right">'.price($total)."</td></tr>";
131 }
132 }
133 else
134 {
135
136 print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoOrder").'</td></tr>';
137 }
138 print "</table><br>";
139
140 $db->free($resql);
141 }
142 else
143 {
144 dol_print_error($db);
145 }
146}
147END MODULEBUILDER DRAFT MYOBJECT */
148
149
150print '</div><div class="fichetwothirdright">';
151
152
153/* BEGIN MODULEBUILDER LASTMODIFIED MYOBJECT
154// Last modified myobject
155if (isModEnabled('eventorganization') && $user->rights->eventorganization->read)
156{
157 $sql = "SELECT s.rowid, s.ref, s.label, s.date_creation, s.tms";
158 $sql.= " FROM ".MAIN_DB_PREFIX."eventorganization_myobject as s";
159 //if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
160 $sql.= " WHERE s.entity IN (".getEntity($myobjectstatic->element).")";
161 //if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .((int) $user->id);
162 //if ($socid) $sql.= " AND s.rowid = $socid";
163 $sql .= " ORDER BY s.tms DESC";
164 $sql .= $db->plimit($max, 0);
165
166 $resql = $db->query($sql);
167 if ($resql)
168 {
169 $num = $db->num_rows($resql);
170 $i = 0;
171
172 print '<table class="noborder centpercent">';
173 print '<tr class="liste_titre">';
174 print '<th colspan="2">';
175 print $langs->trans("BoxTitleLatestModifiedMyObjects", $max);
176 print '</th>';
177 print '<th class="right">'.$langs->trans("DateModificationShort").'</th>';
178 print '</tr>';
179 if ($num)
180 {
181 while ($i < $num)
182 {
183 $objp = $db->fetch_object($resql);
184
185 $myobjectstatic->id=$objp->rowid;
186 $myobjectstatic->ref=$objp->ref;
187 $myobjectstatic->label=$objp->label;
188 $myobjectstatic->status = $objp->status;
189
190 print '<tr class="oddeven">';
191 print '<td class="nowrap">'.$myobjectstatic->getNomUrl(1).'</td>';
192 print '<td class="right nowrap">';
193 print "</td>";
194 print '<td class="right nowrap">'.dol_print_date($db->jdate($objp->tms), 'day')."</td>";
195 print '</tr>';
196 $i++;
197 }
198
199 $db->free($resql);
200 } else {
201 print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
202 }
203 print "</table><br>";
204 }
205}
206*/
207
208print '</div></div>';
209
210// End of page
211llxFooter();
212$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:70
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.