dolibarr  16.0.5
card.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (c) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
5  * Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
6  * Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
7  * Copyright (C) 2019 Thibault FOUCART <support@ptibogxiv.net>
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 require '../../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
31 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
32 require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
33 require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
34 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
35 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
36 
37 $WIDTH = DolGraph::getDefaultGraphSizeForStats('width', 380);
38 $HEIGHT = DolGraph::getDefaultGraphSizeForStats('height', 160);
39 
40 // Load translation files required by the page
41 $langs->loadLangs(array('companies', 'products', 'stocks', 'bills', 'other'));
42 
43 $id = GETPOST('id', 'int'); // For this page, id can also be 'all'
44 $ref = GETPOST('ref', 'alpha');
45 $mode = (GETPOST('mode', 'alpha') ? GETPOST('mode', 'alpha') : 'byunit');
46 $search_year = GETPOST('search_year', 'int');
47 $search_categ = GETPOST('search_categ', 'int');
48 $notab = GETPOST('notab', 'int');
49 $type = GETPOST('type', 'alpha');
50 
51 $error = 0;
52 $mesg = '';
53 $graphfiles = array();
54 
55 $socid = GETPOST('socid', 'int');
56 if (!empty($user->socid)) {
57  $socid = $user->socid;
58 }
59 if ($socid < 0) {
60  $socid = 0;
61 }
62 
63 // Security check
64 $fieldvalue = ($id > 0 ? $id : $ref);
65 $fieldtype = (!empty($ref) ? 'ref' : 'rowid');
66 
67 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
68 $hookmanager->initHooks(array('productstatscard', 'globalcard'));
69 
70 $tmp = dol_getdate(dol_now());
71 $currentyear = $tmp['year'];
72 if (empty($search_year)) {
73  $search_year = $currentyear;
74 }
75 $moreforfilter = "";
76 
77 $object = new Product($db);
78 if ($id > 0 || !empty($ref)) {
79  $result = $object->fetch($id, $ref);
80 }
81 
82 $result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
83 
84 
85 /*
86  * Actions
87  */
88 
89 // None
90 
91 
92 /*
93  * View
94  */
95 
96 $form = new Form($db);
97 $htmlother = new FormOther($db);
98 
99 if (!($id > 0) && empty($ref) || $notab) {
100  $notab = 1;
101 
102  llxHeader("", $langs->trans("ProductStatistics"));
103 
104  $type = GETPOST('type', 'int');
105 
106  $helpurl = '';
107  if ($type == '0') {
108  $helpurl = 'EN:Module_Products|FR:Module_Produits|ES:M&oacute;dulo_Productos';
109  //$title=$langs->trans("StatisticsOfProducts");
110  $title = $langs->trans("Statistics");
111  } elseif ($type == '1') {
112  $helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:M&oacute;dulo_Servicios';
113  //$title=$langs->trans("StatisticsOfServices");
114  $title = $langs->trans("Statistics");
115  } else {
116  $helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:M&oacute;dulo_Servicios';
117  //$title=$langs->trans("StatisticsOfProductsOrServices");
118  $title = $langs->trans("Statistics");
119  }
120 
121  $picto = 'product';
122  if ($type == 1) {
123  $picto = 'service';
124  }
125 
126  print load_fiche_titre($title, $mesg, $picto);
127 } else {
128  $result = $object->fetch($id, $ref);
129 
130  $title = $langs->trans('ProductServiceCard');
131  $helpurl = '';
132  $shortlabel = dol_trunc($object->label, 16);
133  if (GETPOST("type") == '0' || ($object->type == Product::TYPE_PRODUCT)) {
134  $title = $langs->trans('Product')." ".$shortlabel." - ".$langs->trans('Statistics');
135  $helpurl = 'EN:Module_Products|FR:Module_Produits|ES:M&oacute;dulo_Productos';
136  }
137  if (GETPOST("type") == '1' || ($object->type == Product::TYPE_SERVICE)) {
138  $title = $langs->trans('Service')." ".$shortlabel." - ".$langs->trans('Statistics');
139  $helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:M&oacute;dulo_Servicios';
140  }
141 
142  llxHeader('', $title, $helpurl);
143 }
144 
145 
146 if ($result && ($id > 0 || !empty($ref)) && empty($notab)) {
147  $head = product_prepare_head($object);
148  $titre = $langs->trans("CardProduct".$object->type);
149  $picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product');
150 
151  print dol_get_fiche_head($head, 'stats', $titre, -1, $picto);
152 
153  $linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
154 
155  dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref', '', '', '', 0, '', '', 1);
156 
157  print dol_get_fiche_end();
158 }
159 if ((!($id > 0) && empty($ref)) || $notab) {
160  $h = 0;
161  $head = array();
162 
163  $head[$h][0] = DOL_URL_ROOT.'/product/stats/card.php'.($type != '' ? '?type='.((int) $type) : '');
164  $head[$h][1] = $langs->trans("Chart");
165  $head[$h][2] = 'chart';
166  $h++;
167 
168  $title = $langs->trans("ListProductServiceByPopularity");
169  if ((string) $type == '1') {
170  $title = $langs->trans("ListServiceByPopularity");
171  }
172  if ((string) $type == '0') {
173  $title = $langs->trans("ListProductByPopularity");
174  }
175 
176  $head[$h][0] = DOL_URL_ROOT.'/product/popuprop.php'.($type != '' ? '?type='.((int) $type) : '');
177  $head[$h][1] = $langs->trans("ProductsPerPopularity");
178  $head[$h][2] = 'popularity';
179  $h++;
180 
181  print dol_get_fiche_head($head, 'chart', '', -1);
182 }
183 
184 
185 if ($result || !($id > 0)) {
186  print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
187  print '<input type="hidden" name="token" value="'.newToken().'">';
188  if (empty($id) || $notab) {
189  print '<input type="hidden" name="notab" value="1">';
190  }
191 
192  print '<table class="noborder centpercent">';
193  print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
194 
195  if (!($id > 0) || $notab) {
196  // Type
197  print '<tr><td class="titlefield">'.$langs->trans("Type").'</td><td>';
198  $array = array('-1'=>'&nbsp;', '0'=>$langs->trans('Product'), '1'=>$langs->trans('Service'));
199  print $form->selectarray('type', $array, $type, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100');
200  print '</td></tr>';
201 
202  // Product
203  print '<tr><td class="titlefield">'.$langs->trans("ProductOrService").'</td><td>';
204  print img_picto('', 'product', 'class="pictofixedwidth"');
205  print $form->select_produits($id, 'id', '', 0, 0, 1, 2, '', ($conf->dol_optimize_smallscreen ? 1 : 0), array(), 0, '1', 0, 'widthcentpercentminusx maxwidth400');
206  print '</td></tr>';
207 
208  // Tag
209  if (isModEnabled('categorie')) {
210  print '<tr><td class="titlefield">'.$langs->trans("Categories").'</td><td>';
211  $moreforfilter .= img_picto($langs->trans("Categories"), 'category', 'class="pictofixedwidth"');
212  $moreforfilter .= $htmlother->select_categories(Categorie::TYPE_PRODUCT, $search_categ, 'search_categ', 1, 1, 'widthcentpercentminusx maxwidth400');
213  print $moreforfilter;
214  print '</td></tr>';
215  }
216  } else {
217  print '<input type="hidden" name="id" value="'.$id.'">';
218  }
219 
220  // Year
221  print '<tr><td class="titlefield">'.$langs->trans("Year").'</td><td>';
222  $arrayyears = array();
223  for ($year = $currentyear - 25; $year < $currentyear; $year++) {
224  $arrayyears[$year] = $year;
225  }
226  if (!in_array($year, $arrayyears)) {
227  $arrayyears[$year] = $year;
228  }
229  if (!in_array($currentyear, $arrayyears)) {
230  $arrayyears[$currentyear] = $currentyear;
231  }
232  arsort($arrayyears);
233  print $form->selectarray('search_year', $arrayyears, $search_year, 1, 0, 0, '', 0, 0, 0, '', 'width75');
234  print '</td></tr>';
235 
236  // thirdparty
237  print '<tr><td class="titlefield">'.$langs->trans("ThirdParty").'</td><td>';
238  print img_picto('', 'company', 'class="pictofixedwidth"');
239  print $form->select_company($socid, 'socid', '', 1, 0, 0, array(), 0, 'widthcentpercentminusx maxwidth400');
240  print '</td></tr>';
241 
242  print '</table>';
243  print '<div class="center"><input type="submit" name="submit" class="button small" value="'.$langs->trans("Refresh").'"></div>';
244  print '</form><br>';
245 
246  print '<br>';
247 
248 
249  $param = '';
250  $param .= (GETPOSTISSET('id') ? '&id='.GETPOST('id', 'int') : '&id='.$object->id).(($type != '' && $type != '-1') ? '&type='.((int) $type) : '').'&search_year='.((int) $search_year).($notab ? '&notab='.$notab : '');
251  if ($socid > 0) {
252  $param .= '&socid='.((int) $socid);
253  }
254 
255  // Choice of stats mode (byunit or bynumber)
256  if (!empty($conf->dol_use_jmobile)) {
257  print "\n".'<div class="fichecenter"><div class="nowrap">'."\n";
258  }
259 
260  if ($mode == 'bynumber') {
261  print '<a class="a-mesure-disabled marginleftonly marginrightonly reposition" href="'.$_SERVER["PHP_SELF"].'?mode=byunit'.$param.'">';
262  } else {
263  print '<span class="a-mesure marginleftonly marginrightonly">';
264  }
265  print $langs->trans("StatsByNumberOfUnits");
266  if ($mode == 'bynumber') {
267  print '</a>';
268  } else {
269  print '</span>';
270  }
271 
272  if (!empty($conf->dol_use_jmobile)) {
273  print '</div>'."\n".'<div class="nowrap">'."\n";
274  }
275 
276  if ($mode == 'byunit') {
277  print '<a class="a-mesure-disabled marginleftonly marginrightonly reposition" href="'.$_SERVER["PHP_SELF"].'?mode=bynumber'.$param.'">';
278  } else {
279  print '<span class="a-mesure marginleftonly marginrightonly">';
280  }
281  print $langs->trans("StatsByNumberOfEntities");
282  if ($mode == 'byunit') {
283  print '</a>';
284  } else {
285  print '</span>';
286  }
287 
288  if (!empty($conf->dol_use_jmobile)) {
289  print '</div></div>';
290  } else {
291  print '<br>';
292  }
293  print '<br>';
294 
295  // Generation of graphs
296  $dir = (!empty($conf->product->multidir_temp[$conf->entity]) ? $conf->product->multidir_temp[$conf->entity] : $conf->service->multidir_temp[$conf->entity]);
297  if ($object->id > 0) { // We are on statistics for a dedicated product
298  if (!file_exists($dir.'/'.$object->id)) {
299  if (dol_mkdir($dir.'/'.$object->id) < 0) {
300  $mesg = $langs->trans("ErrorCanNotCreateDir", $dir);
301  $error++;
302  }
303  }
304  }
305 
306  if (isModEnabled('propal')) {
307  $graphfiles['propal'] = array('modulepart'=>'productstats_proposals',
308  'file' => $object->id.'/propal12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.($search_year > 0 ? '_year'.$search_year : '').'.png',
309  'label' => ($mode == 'byunit' ? $langs->transnoentitiesnoconv("NumberOfUnitsProposals") : $langs->transnoentitiesnoconv("NumberOfProposals")));
310  }
311 
312  if (isModEnabled('supplier_proposal')) {
313  $graphfiles['proposalssuppliers'] = array('modulepart'=>'productstats_proposalssuppliers',
314  'file' => $object->id.'/proposalssuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.($search_year > 0 ? '_year'.$search_year : '').'.png',
315  'label' => ($mode == 'byunit' ? $langs->transnoentitiesnoconv("NumberOfUnitsSupplierProposals") : $langs->transnoentitiesnoconv("NumberOfSupplierProposals")));
316  }
317 
318  if (isModEnabled('order')) {
319  $graphfiles['orders'] = array('modulepart'=>'productstats_orders',
320  'file' => $object->id.'/orders12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.($search_year > 0 ? '_year'.$search_year : '').'.png',
321  'label' => ($mode == 'byunit' ? $langs->transnoentitiesnoconv("NumberOfUnitsCustomerOrders") : $langs->transnoentitiesnoconv("NumberOfCustomerOrders")));
322  }
323 
324  if (isModEnabled('supplier_order')) {
325  $graphfiles['orderssuppliers'] = array('modulepart'=>'productstats_orderssuppliers',
326  'file' => $object->id.'/orderssuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.($search_year > 0 ? '_year'.$search_year : '').'.png',
327  'label' => ($mode == 'byunit' ? $langs->transnoentitiesnoconv("NumberOfUnitsSupplierOrders") : $langs->transnoentitiesnoconv("NumberOfSupplierOrders")));
328  }
329 
330  if (isModEnabled('facture')) {
331  $graphfiles['invoices'] = array('modulepart'=>'productstats_invoices',
332  'file' => $object->id.'/invoices12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.($search_year > 0 ? '_year'.$search_year : '').'.png',
333  'label' => ($mode == 'byunit' ? $langs->transnoentitiesnoconv("NumberOfUnitsCustomerInvoices") : $langs->transnoentitiesnoconv("NumberOfCustomerInvoices")));
334  }
335 
336  if (isModEnabled('supplier_invoice')) {
337  $graphfiles['invoicessuppliers'] = array('modulepart'=>'productstats_invoicessuppliers',
338  'file' => $object->id.'/invoicessuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.($search_year > 0 ? '_year'.$search_year : '').'.png',
339  'label' => ($mode == 'byunit' ? $langs->transnoentitiesnoconv("NumberOfUnitsSupplierInvoices") : $langs->transnoentitiesnoconv("NumberOfSupplierInvoices")));
340  }
341 
342  if (isModEnabled('contrat')) {
343  $graphfiles['contracts'] = array('modulepart'=>'productstats_contracts',
344  'file' => $object->id.'/contracts12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.($search_year > 0 ? '_year'.$search_year : '').'.png',
345  'label' => ($mode == 'byunit' ? $langs->transnoentitiesnoconv("NumberOfUnitsContracts") : $langs->transnoentitiesnoconv("NumberOfContracts")));
346  }
347 
348  if (isModEnabled('mrp')) {
349  $graphfiles['mrp'] = array('modulepart'=>'productstats_mrp',
350  'file' => $object->id.'/mos12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.($search_year > 0 ? '_year'.$search_year : '').'.png',
351  'label' => ($mode == 'byunit' ? $langs->transnoentitiesnoconv("NumberOfUnitsMos") : $langs->transnoentitiesnoconv("NumberOfMos")));
352  }
353 
354  $px = new DolGraph();
355 
356  if (!$error && count($graphfiles) > 0) {
357  $mesg = $px->isGraphKo();
358  if (!$mesg) {
359  foreach ($graphfiles as $key => $val) {
360  if (!$graphfiles[$key]['file']) {
361  continue;
362  }
363 
364  $graph_data = array();
365 
366  if (dol_is_file($dir.'/'.$graphfiles[$key]['file'])) {
367  // TODO Load cachefile $graphfiles[$key]['file']
368  } else {
369  $morefilters = '';
370  if ($search_categ > 0) {
371  $categ = new Categorie($db);
372  $categ->fetch($search_categ);
373  $listofprodids = $categ->getObjectsInCateg('product', 1);
374  $morefilters = ' AND d.fk_product IN ('.$db->sanitize((is_array($listofprodids) && count($listofprodids)) ? join(',', $listofprodids) : '0').')';
375  }
376  if ($search_categ == -2) {
377  $morefilters = ' AND d.fk_product NOT IN (SELECT cp.fk_product from '.MAIN_DB_PREFIX.'categorie_product as cp)';
378  }
379 
380  if ($key == 'propal') {
381  $graph_data = $object->get_nb_propal($socid, $mode, ((string) $type != '' ? $type : -1), $search_year, $morefilters);
382  }
383  if ($key == 'orders') {
384  $graph_data = $object->get_nb_order($socid, $mode, ((string) $type != '' ? $type : -1), $search_year, $morefilters);
385  }
386  if ($key == 'invoices') {
387  $graph_data = $object->get_nb_vente($socid, $mode, ((string) $type != '' ? $type : -1), $search_year, $morefilters);
388  }
389  if ($key == 'proposalssuppliers') {
390  $graph_data = $object->get_nb_propalsupplier($socid, $mode, ((string) $type != '' ? $type : -1), $search_year, $morefilters);
391  }
392  if ($key == 'invoicessuppliers') {
393  $graph_data = $object->get_nb_achat($socid, $mode, ((string) $type != '' ? $type : -1), $search_year, $morefilters);
394  }
395  if ($key == 'orderssuppliers') {
396  $graph_data = $object->get_nb_ordersupplier($socid, $mode, ((string) $type != '' ? $type : -1), $search_year, $morefilters);
397  }
398  if ($key == 'contracts') {
399  $graph_data = $object->get_nb_contract($socid, $mode, ((string) $type != '' ? $type : -1), $search_year, $morefilters);
400  }
401  if ($key == 'mrp') {
402  $graph_data = $object->get_nb_mos($socid, $mode, ((string) $type != '' ? $type : -1), $search_year, $morefilters);
403  }
404 
405  // TODO Save cachefile $graphfiles[$key]['file']
406  }
407 
408  if (is_array($graph_data)) {
409  $px->SetData($graph_data);
410  $px->SetYLabel($graphfiles[$key]['label']);
411  $px->SetMaxValue($px->GetCeilMaxValue() < 0 ? 0 : $px->GetCeilMaxValue());
412  $px->SetMinValue($px->GetFloorMinValue() > 0 ? 0 : $px->GetFloorMinValue());
413  $px->setShowLegend(0);
414  $px->SetWidth($WIDTH);
415  $px->SetHeight($HEIGHT);
416  $px->SetHorizTickIncrement(1);
417  $px->SetShading(3);
418  //print 'x '.$key.' '.$graphfiles[$key]['file'];
419 
420  $url = DOL_URL_ROOT.'/viewimage.php?modulepart='.$graphfiles[$key]['modulepart'].'&entity='.((int) $object->entity).'&file='.urlencode($graphfiles[$key]['file']).($notab ? '&notab='.$notab : '');
421  $px->draw($dir."/".$graphfiles[$key]['file'], $url);
422 
423  $graphfiles[$key]['total'] = $px->total();
424  $graphfiles[$key]['output'] = $px->show();
425  } else {
426  dol_print_error($db, 'Error for calculating graph on key='.$key.' - '.$object->error);
427  }
428  }
429 
430  //setEventMessages($langs->trans("ChartGenerated"), null, 'mesgs');
431  }
432  }
433 
434  // Show graphs
435  $i = 0;
436  if (count($graphfiles) > 0) {
437  foreach ($graphfiles as $key => $val) {
438  if (!$graphfiles[$key]['file']) {
439  continue;
440  }
441 
442  if ($graphfiles == 'propal' && !$user->rights->propale->lire) {
443  continue;
444  }
445  if ($graphfiles == 'order' && !$user->rights->commande->lire) {
446  continue;
447  }
448  if ($graphfiles == 'invoices' && !$user->rights->facture->lire) {
449  continue;
450  }
451  if ($graphfiles == 'proposals_suppliers' && !$user->rights->supplier_proposal->lire) {
452  continue;
453  }
454  if ($graphfiles == 'invoices_suppliers' && empty($user->rights->fournisseur->facture->lire)) {
455  continue;
456  }
457  if ($graphfiles == 'orders_suppliers' && empty($user->rights->fournisseur->commande->lire)) {
458  continue;
459  }
460  if ($graphfiles == 'mrp' && empty($user->rights->mrp->mo->read)) {
461  continue;
462  }
463 
464 
465  if ($i % 2 == 0) {
466  print "\n".'<div class="fichecenter"><div class="fichehalfleft">'."\n";
467  } else {
468  print "\n".'<div class="fichehalfright">'."\n";
469  }
470 
471  // Date generation
472  if ($graphfiles[$key]['output'] && !$px->isGraphKo()) {
473  if (file_exists($dir."/".$graphfiles[$key]['file']) && filemtime($dir."/".$graphfiles[$key]['file'])) {
474  $dategenerated = $langs->trans("GeneratedOn", dol_print_date(filemtime($dir."/".$graphfiles[$key]['file']), "dayhour"));
475  } else {
476  $dategenerated = $langs->trans("GeneratedOn", dol_print_date(dol_now(), "dayhour"));
477  }
478  } else {
479  $dategenerated = ($mesg ? '<span class="error">'.$mesg.'</span>' : $langs->trans("ChartNotGenerated"));
480  }
481  $linktoregenerate = '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?'.(GETPOSTISSET('id') ? 'id='.GETPOST('id', 'int') : 'id='.$object->id).(((string) $type != '' && $type != '-1') ? '&type='.((int) $type) : '').'&action=recalcul&mode='.urlencode($mode).'&search_year='.((int) $search_year).($search_categ > 0 ? '&search_categ='.((int) $search_categ) : '').'">';
482  $linktoregenerate .= img_picto($langs->trans("ReCalculate").' ('.$dategenerated.')', 'refresh');
483  $linktoregenerate .= '</a>';
484 
485 
486  // Show graph
487  print '<div class="div-table-responsive-no-min">';
488  print '<table class="noborder centpercent">';
489  // Label
490  print '<tr class="liste_titre"><td>';
491  print $graphfiles[$key]['label'];
492  print ' <span class="opacitymedium">('.$graphfiles[$key]['total'].')</span></td>';
493  print '<td align="right">'.$linktoregenerate.'</td>';
494  print '</tr>';
495  // Image
496  print '<tr class="impair"><td colspan="2" class="nohover" align="center">';
497  print $graphfiles[$key]['output'];
498  print '</td></tr>';
499  print '</table>';
500  print '</div>';
501 
502  if ($i % 2 == 0) {
503  print "\n".'</div>'."\n";
504  } else {
505  print "\n".'</div></div>';
506  print '<div class="clear"><div class="fichecenter"><br></div></div>'."\n";
507  }
508 
509  $i++;
510  }
511  }
512  // div not closed
513  if ($i % 2 == 1) {
514  print "\n".'<div class="fichehalfright">'."\n";
515  print "\n".'</div></div>';
516  print '<div class="clear"><div class="fichecenter"><br></div></div>'."\n";
517  }
518 }
519 
520 if (!($id > 0)) {
521  print dol_get_fiche_end();
522 }
523 
524 // End of page
525 llxFooter();
526 $db->close();
dol_getdate
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
Definition: functions.lib.php:2713
dol_trunc
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
Definition: functions.lib.php:3805
DolGraph\getDefaultGraphSizeForStats
static getDefaultGraphSizeForStats($direction, $defaultsize='')
getDefaultGraphSizeForStats
Definition: dolgraph.class.php:1539
restrictedArea
restrictedArea($user, $features, $objectid=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.
Definition: security.lib.php:234
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:73
load_fiche_titre
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
Definition: functions.lib.php:5204
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
dol_print_error
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
Definition: functions.lib.php:4844
DolGraph
Class to build graphs.
Definition: dolgraph.class.php:40
product_prepare_head
product_prepare_head($object)
Prepare array with list of tabs.
Definition: product.lib.php:35
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:142
FormOther
Classe permettant la generation de composants html autre Only common components are here.
Definition: html.formother.class.php:39
Categorie
Class to manage categories.
Definition: categorie.class.php:47
dol_banner_tab
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
Definition: functions.lib.php:2046
dol_is_file
dol_is_file($pathoffile)
Return if path is a file.
Definition: files.lib.php:477
dol_print_date
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
Definition: functions.lib.php:2514
img_picto
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
Definition: functions.lib.php:3880
dol_get_fiche_head
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
Definition: functions.lib.php:1822
dol_get_fiche_end
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Definition: functions.lib.php:2018
isModEnabled
isModEnabled($module)
Is Dolibarr module enabled.
Definition: functions.lib.php:105
GETPOSTISSET
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
Definition: functions.lib.php:386
Product
Class to manage products or services.
Definition: product.class.php:46
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:52
dol_now
dol_now($mode='auto')
Return date for now.
Definition: functions.lib.php:2845
Product\TYPE_SERVICE
const TYPE_SERVICE
Service.
Definition: product.class.php:504
Product\TYPE_PRODUCT
const TYPE_PRODUCT
Regular product.
Definition: product.class.php:500
dol_mkdir
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
Definition: functions.lib.php:6603
llxHeader
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:59