dolibarr  20.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  *
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
28 require '../main.inc.php';
29 require_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 $NBMAX = getDolGlobalString('MAIN_SIZE_SHORTLIST_LIMIT', 5);
37 $max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT', 5);
38 $now = dol_now();
39 
40 // Security check
41 //$socid = 0;
42 if ($user->socid > 0) { // Protection if external user
43  //$socid = $user->socid;
45 }
46 $result = restrictedArea($user, 'eventorganization');
47 
48 
49 
50 /*
51  * Actions
52  */
53 
54 // None
55 
56 
57 /*
58  * View
59  */
60 
61 $form = new Form($db);
62 $formfile = new FormFile($db);
63 
64 $title = $langs->trans('EventOrganizationArea');
65 
66 llxHeader('', $title, '');
67 
68 print load_fiche_titre($langs->trans("EventOrganizationArea"), '', 'eventorganization.png@eventorganization');
69 
70 print '<div class="fichecenter"><div class="fichethirdleft">';
71 
72 
73 /* BEGIN MODULEBUILDER DRAFT MYOBJECT
74 // Draft MyObject
75 if (isModEnabled('eventorganization') && $user->rights->eventorganization->read)
76 {
77  $langs->load("orders");
78 
79  $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";
80  $sql.= ", s.code_client";
81  $sql.= " FROM ".MAIN_DB_PREFIX."commande as c";
82  $sql.= ", ".MAIN_DB_PREFIX."societe as s";
83  if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
84  $sql.= " WHERE c.fk_soc = s.rowid";
85  $sql.= " AND c.fk_statut = 0";
86  $sql.= " AND c.entity IN (".getEntity('commande').")";
87  if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .((int) $user->id);
88  if ($socid) $sql.= " AND c.fk_soc = ".((int) $socid);
89 
90  $resql = $db->query($sql);
91  if ($resql)
92  {
93  $total = 0;
94  $num = $db->num_rows($resql);
95 
96  print '<table class="noborder centpercent">';
97  print '<tr class="liste_titre">';
98  print '<th colspan="3">'.$langs->trans("DraftMyObjects").($num?'<span class="badge marginleftonlyshort">'.$num.'</span>':'').'</th></tr>';
99 
100  $var = true;
101  if ($num > 0)
102  {
103  $i = 0;
104  while ($i < $num)
105  {
106 
107  $obj = $db->fetch_object($resql);
108  print '<tr class="oddeven"><td class="nowrap">';
109 
110  $myobjectstatic->id=$obj->rowid;
111  $myobjectstatic->ref=$obj->ref;
112  $myobjectstatic->ref_client=$obj->ref_client;
113  $myobjectstatic->total_ht = $obj->total_ht;
114  $myobjectstatic->total_tva = $obj->total_tva;
115  $myobjectstatic->total_ttc = $obj->total_ttc;
116 
117  print $myobjectstatic->getNomUrl(1);
118  print '</td>';
119  print '<td class="nowrap">';
120  print '</td>';
121  print '<td class="right" class="nowrap">'.price($obj->total_ttc).'</td></tr>';
122  $i++;
123  $total += $obj->total_ttc;
124  }
125  if ($total>0)
126  {
127 
128  print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" class="right">'.price($total)."</td></tr>";
129  }
130  }
131  else
132  {
133 
134  print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoOrder").'</td></tr>';
135  }
136  print "</table><br>";
137 
138  $db->free($resql);
139  }
140  else
141  {
142  dol_print_error($db);
143  }
144 }
145 END MODULEBUILDER DRAFT MYOBJECT */
146 
147 
148 print '</div><div class="fichetwothirdright">';
149 
150 
151 /* BEGIN MODULEBUILDER LASTMODIFIED MYOBJECT
152 // Last modified myobject
153 if (isModEnabled('eventorganization') && $user->rights->eventorganization->read)
154 {
155  $sql = "SELECT s.rowid, s.ref, s.label, s.date_creation, s.tms";
156  $sql.= " FROM ".MAIN_DB_PREFIX."eventorganization_myobject as s";
157  //if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
158  $sql.= " WHERE s.entity IN (".getEntity($myobjectstatic->element).")";
159  //if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .((int) $user->id);
160  //if ($socid) $sql.= " AND s.rowid = $socid";
161  $sql .= " ORDER BY s.tms DESC";
162  $sql .= $db->plimit($max, 0);
163 
164  $resql = $db->query($sql);
165  if ($resql)
166  {
167  $num = $db->num_rows($resql);
168  $i = 0;
169 
170  print '<table class="noborder centpercent">';
171  print '<tr class="liste_titre">';
172  print '<th colspan="2">';
173  print $langs->trans("BoxTitleLatestModifiedMyObjects", $max);
174  print '</th>';
175  print '<th class="right">'.$langs->trans("DateModificationShort").'</th>';
176  print '</tr>';
177  if ($num)
178  {
179  while ($i < $num)
180  {
181  $objp = $db->fetch_object($resql);
182 
183  $myobjectstatic->id=$objp->rowid;
184  $myobjectstatic->ref=$objp->ref;
185  $myobjectstatic->label=$objp->label;
186  $myobjectstatic->status = $objp->status;
187 
188  print '<tr class="oddeven">';
189  print '<td class="nowrap">'.$myobjectstatic->getNomUrl(1).'</td>';
190  print '<td class="right nowrap">';
191  print "</td>";
192  print '<td class="right nowrap">'.dol_print_date($db->jdate($objp->tms), 'day')."</td>";
193  print '</tr>';
194  $i++;
195  }
196 
197  $db->free($resql);
198  } else {
199  print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
200  }
201  print "</table><br>";
202  }
203 }
204 */
205 
206 print '</div></div>';
207 
208 // End of page
209 llxFooter();
210 $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($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 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.