dolibarr 19.0.4
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 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
27// Load Dolibarr environment
28require '../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
30
31// Load translation files required by the page
32$langs->loadLangs(array("eventorganization"));
33
34$action = GETPOST('action', 'aZ09');
35
36$max = 5;
37$now = dol_now();
38
39// Security check
40//$socid = 0;
41if ($user->socid > 0) { // Protection if external user
42 //$socid = $user->socid;
44}
45$result = restrictedArea($user, 'eventorganization');
46
47
48
49/*
50 * Actions
51 */
52
53// None
54
55
56/*
57 * View
58 */
59
60$form = new Form($db);
61$formfile = new FormFile($db);
62
63$title = $langs->trans('EventOrganizationArea');
64
65llxHeader('', $title, '');
66
67print load_fiche_titre($langs->trans("EventOrganizationArea"), '', 'eventorganization.png@eventorganization');
68
69print '<div class="fichecenter"><div class="fichethirdleft">';
70
71
72/* BEGIN MODULEBUILDER DRAFT MYOBJECT
73// Draft MyObject
74if (isModEnabled('eventorganization') && $user->rights->eventorganization->read)
75{
76 $langs->load("orders");
77
78 $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";
79 $sql.= ", s.code_client";
80 $sql.= " FROM ".MAIN_DB_PREFIX."commande as c";
81 $sql.= ", ".MAIN_DB_PREFIX."societe as s";
82 if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
83 $sql.= " WHERE c.fk_soc = s.rowid";
84 $sql.= " AND c.fk_statut = 0";
85 $sql.= " AND c.entity IN (".getEntity('commande').")";
86 if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .((int) $user->id);
87 if ($socid) $sql.= " AND c.fk_soc = ".((int) $socid);
88
89 $resql = $db->query($sql);
90 if ($resql)
91 {
92 $total = 0;
93 $num = $db->num_rows($resql);
94
95 print '<table class="noborder centpercent">';
96 print '<tr class="liste_titre">';
97 print '<th colspan="3">'.$langs->trans("DraftMyObjects").($num?'<span class="badge marginleftonlyshort">'.$num.'</span>':'').'</th></tr>';
98
99 $var = true;
100 if ($num > 0)
101 {
102 $i = 0;
103 while ($i < $num)
104 {
105
106 $obj = $db->fetch_object($resql);
107 print '<tr class="oddeven"><td class="nowrap">';
108
109 $myobjectstatic->id=$obj->rowid;
110 $myobjectstatic->ref=$obj->ref;
111 $myobjectstatic->ref_client=$obj->ref_client;
112 $myobjectstatic->total_ht = $obj->total_ht;
113 $myobjectstatic->total_tva = $obj->total_tva;
114 $myobjectstatic->total_ttc = $obj->total_ttc;
115
116 print $myobjectstatic->getNomUrl(1);
117 print '</td>';
118 print '<td class="nowrap">';
119 print '</td>';
120 print '<td class="right" class="nowrap">'.price($obj->total_ttc).'</td></tr>';
121 $i++;
122 $total += $obj->total_ttc;
123 }
124 if ($total>0)
125 {
126
127 print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" class="right">'.price($total)."</td></tr>";
128 }
129 }
130 else
131 {
132
133 print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoOrder").'</td></tr>';
134 }
135 print "</table><br>";
136
137 $db->free($resql);
138 }
139 else
140 {
141 dol_print_error($db);
142 }
143}
144END MODULEBUILDER DRAFT MYOBJECT */
145
146
147print '</div><div class="fichetwothirdright">';
148
149
150$NBMAX = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
151$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT');
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()
Empty header.
Definition wrapper.php:55
llxFooter()
Empty footer.
Definition wrapper.php:69
Class to offer components to list and upload files.
Class to manage generation of HTML components Only common components must be here.
load_fiche_titre($titre, $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.
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.