dolibarr  x.y.z
card.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2005 Simon Tosser <simon@kornog-computing.com>
5  * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com>
6  * Copyright (C) 2016 Francis Appels <francis.appels@yahoo.com>
7  * Copyright (C) 2021 Noé Cendrier <noe.cendrier@altairis.fr>
8  * Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
9  * Copyright (C) 2022 Charlene Benke <charlene@patas-monkey.com>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program. If not, see <https://www.gnu.org/licenses/>.
23  */
24 
31 // Load Dolibarr environment
32 require '../../main.inc.php';
33 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
34 require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
35 require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
36 require_once DOL_DOCUMENT_ROOT.'/core/lib/stock.lib.php';
37 require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
38 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
39 require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
40 require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
41 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
42 if (!empty($conf->project->enabled)) {
43  require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
44  require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
45 }
46 
47 // Load translation files required by the page
48 $langs->loadLangs(array('products', 'stocks', 'companies', 'categories'));
49 
50 $action = GETPOST('action', 'aZ09');
51 $cancel = GETPOST('cancel', 'alpha');
52 $confirm = GETPOST('confirm');
53 $projectid = GETPOST('projectid', 'int');
54 
55 $id = GETPOST('id', 'int');
56 $socid = GETPOST('socid', 'int');
57 $ref = GETPOST('ref', 'alpha');
58 
59 $sortfield = GETPOST('sortfield', 'aZ09comma');
60 $sortorder = GETPOST('sortorder', 'aZ09comma');
61 if (!$sortfield) {
62  $sortfield = "p.ref";
63 }
64 if (!$sortorder) {
65  $sortorder = "DESC";
66 }
67 
68 $backtopage = GETPOST('backtopage', 'alpha');
69 
70 // Security check
71 //$result=restrictedArea($user,'stock', $id, 'entrepot&stock');
72 $result = restrictedArea($user, 'stock');
73 
74 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
75 $hookmanager->initHooks(array('warehousecard', 'globalcard'));
76 
77 $object = new Entrepot($db);
78 $extrafields = new ExtraFields($db);
79 
80 // fetch optionals attributes and labels
81 $extrafields->fetch_name_optionals_label($object->table_element);
82 
83 // Load object
84 if ($id > 0 || !empty($ref)) {
85  $ret = $object->fetch($id, $ref);
86  if ($ret <= 0) {
87  setEventMessages($object->error, $object->errors, 'errors');
88  $action = '';
89  }
90 }
91 
92 $usercanread = (($user->rights->stock->lire));
93 $usercancreate = (($user->rights->stock->creer));
94 $usercandelete = (($user->rights->stock->supprimer));
95 
96 
97 /*
98  * Actions
99  */
100 
101 $error = 0;
102 
103 $parameters = array('id'=>$id, 'ref'=>$ref);
104 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
105 if ($reshook < 0) {
106  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
107 }
108 if (empty($reshook)) {
109  $backurlforlist = DOL_URL_ROOT.'/product/stock/list.php';
110 
111  if (empty($backtopage) || ($cancel && empty($id))) {
112  if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
113  if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
114  $backtopage = $backurlforlist;
115  } else {
116  $backtopage = DOL_URL_ROOT.'/product/stock/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
117  }
118  }
119  }
120 
121  if ($cancel) {
122  if (!empty($backtopageforcancel)) {
123  header("Location: ".$backtopageforcancel);
124  exit;
125  } elseif (!empty($backtopage)) {
126  header("Location: ".$backtopage);
127  exit;
128  }
129  $action = '';
130  }
131 
132  // Ajout entrepot
133  if ($action == 'add' && $user->rights->stock->creer) {
134  $object->ref = (string) GETPOST("ref", "alpha");
135  $object->fk_parent = (int) GETPOST("fk_parent", "int");
136  $object->fk_project = GETPOST('projectid', 'int');
137  $object->label = (string) GETPOST("libelle", "alpha");
138  $object->description = (string) GETPOST("desc", "alpha");
139  $object->statut = GETPOST("statut", "int");
140  $object->lieu = (string) GETPOST("lieu", "alpha");
141  $object->address = (string) GETPOST("address", "alpha");
142  $object->zip = (string) GETPOST("zipcode", "alpha");
143  $object->town = (string) GETPOST("town", "alpha");
144  $object->country_id = GETPOST("country_id");
145  $object->phone = (string) GETPOST("phone", "alpha");
146  $object->fax = (string) GETPOST("fax", "alpha");
147 
148  if (!empty($object->label)) {
149  // Fill array 'array_options' with data from add form
150  $ret = $extrafields->setOptionalsFromPost(null, $object);
151  if ($ret < 0) {
152  $error++;
153  $action = 'create';
154  }
155 
156  if (!$error) {
157  $id = $object->create($user);
158  if ($id > 0) {
159  setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
160 
161  $categories = GETPOST('categories', 'array');
162  $object->setCategories($categories);
163  if (!empty($backtopage)) {
164  $backtopage = str_replace("__ID__", $id, $backtopage);
165  header("Location: ".$backtopage);
166  exit;
167  } else {
168  header("Location: card.php?id=".urlencode($id));
169  exit;
170  }
171  } else {
172  $action = 'create';
173  setEventMessages($object->error, $object->errors, 'errors');
174  }
175  }
176  } else {
177  setEventMessages($langs->trans("ErrorWarehouseRefRequired"), null, 'errors');
178  $action = "create"; // Force retour sur page creation
179  }
180  }
181 
182  // Delete warehouse
183  if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->stock->supprimer) {
184  $object->fetch(GETPOST('id', 'int'));
185  $result = $object->delete($user);
186  if ($result > 0) {
187  setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
188  header("Location: ".DOL_URL_ROOT.'/product/stock/list.php?restore_lastsearch_values=1');
189  exit;
190  } else {
191  setEventMessages($object->error, $object->errors, 'errors');
192  $action = '';
193  }
194  }
195 
196  // Modification entrepot
197  if ($action == 'update' && !$cancel) {
198  if ($object->fetch($id)) {
199  $object->label = GETPOST("libelle");
200  $object->fk_parent = GETPOST("fk_parent");
201  $object->fk_project = GETPOST('projectid');
202  $object->description = GETPOST("desc");
203  $object->statut = GETPOST("statut");
204  $object->lieu = GETPOST("lieu");
205  $object->address = GETPOST("address");
206  $object->zip = GETPOST("zipcode");
207  $object->town = GETPOST("town");
208  $object->country_id = GETPOST("country_id");
209  $object->phone = GETPOST("phone");
210  $object->fax = GETPOST("fax");
211 
212  // Fill array 'array_options' with data from add form
213  $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
214  if ($ret < 0) {
215  $error++;
216  }
217 
218  if (!$error) {
219  $ret = $object->update($id, $user);
220  if ($ret < 0) {
221  $error++;
222  }
223  }
224 
225  if ($error) {
226  $action = 'edit';
227  setEventMessages($object->error, $object->errors, 'errors');
228  } else {
229  $categories = GETPOST('categories', 'array');
230  $object->setCategories($categories);
231  $action = '';
232  }
233  } else {
234  $action = 'edit';
235  setEventMessages($object->error, $object->errors, 'errors');
236  }
237  } elseif ($action == 'update_extras') {
238  $object->oldcopy = dol_clone($object);
239 
240  // Fill array 'array_options' with data from update form
241  $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml'));
242  if ($ret < 0) {
243  $error++;
244  }
245  if (!$error) {
246  $result = $object->insertExtraFields();
247  if ($result < 0) {
248  setEventMessages($object->error, $object->errors, 'errors');
249  $error++;
250  }
251  }
252  if ($error) {
253  $action = 'edit_extras';
254  }
255  } elseif ($action == 'classin' && $usercancreate) {
256  // Link to a project
257  $object->setProject(GETPOST('projectid', 'int'));
258  }
259 
260  if ($cancel == $langs->trans("Cancel")) {
261  $action = '';
262  }
263 
264 
265  // Actions to build doc
266  $upload_dir = $conf->stock->dir_output;
267  $permissiontoadd = $user->rights->stock->creer;
268  include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
269 }
270 
271 
272 /*
273  * View
274  */
275 
276 $productstatic = new Product($db);
277 $form = new Form($db);
278 $formproduct = new FormProduct($db);
279 $formcompany = new FormCompany($db);
280 $formfile = new FormFile($db);
281 if (!empty($conf->project->enabled)) {
282  $formproject = new FormProjets($db);
283 }
284 
285 $title = $langs->trans("WarehouseCard");
286 if ($action == 'create') {
287  $title = $langs->trans("NewWarehouse");
288 }
289 
290 $help_url = 'EN:Module_Stocks_En|FR:Module_Stock|ES:M&oacute;dulo_Stocks';
291 llxHeader("", $title, $help_url);
292 
293 
294 if ($action == 'create') {
295  print load_fiche_titre($langs->trans("NewWarehouse"), '', 'stock');
296 
297  dol_set_focus('input[name="libelle"]');
298 
299  print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'."\n";
300  print '<input type="hidden" name="token" value="'.newToken().'">';
301  print '<input type="hidden" name="action" value="add">';
302  print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
303 
304  print dol_get_fiche_head();
305 
306  print '<table class="border centpercent">';
307 
308  // Ref
309  print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Ref").'</td><td><input name="libelle" size="20" value=""></td></tr>';
310 
311  print '<tr><td>'.$langs->trans("LocationSummary").'</td><td><input name="lieu" size="40" value="'.(!empty($object->lieu) ? $object->lieu : '').'"></td></tr>';
312 
313  // Parent entrepot
314  print '<tr><td>'.$langs->trans("AddIn").'</td><td>';
315  print img_picto('', 'stock').$formproduct->selectWarehouses((GETPOSTISSET('fk_parent') ? GETPOST('fk_parent', 'int') : 'ifone'), 'fk_parent', '', 1);
316  print '</td></tr>';
317 
318  // Project
319  if (!empty($conf->project->enabled)) {
320  $langs->load('projects');
321  print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">';
322  print img_picto('', 'project').$formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500');
323  print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$socid.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$socid).'"><span class="fa fa-plus-circle valignmiddle" title="'.$langs->trans("AddProject").'"></span></a>';
324  print '</td></tr>';
325  }
326 
327  // Description
328  print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
329  // Editeur wysiwyg
330  require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
331  $doleditor = new DolEditor('desc', (!empty($object->description) ? $object->description : ''), '', 180, 'dolibarr_notes', 'In', false, true, empty($conf->fckeditor->enabled) ? '' : $conf->fckeditor->enabled, ROWS_5, '90%');
332  $doleditor->Create();
333  print '</td></tr>';
334 
335  print '<tr><td>'.$langs->trans('Address').'</td><td><textarea name="address" class="quatrevingtpercent" rows="3" wrap="soft">';
336  print (!empty($object->address) ? $object->address : '');
337  print '</textarea></td></tr>';
338 
339  // Zip / Town
340  print '<tr><td>'.$langs->trans('Zip').'</td><td>';
341  print $formcompany->select_ziptown((!empty($object->zip) ? $object->zip : ''), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
342  print '</td></tr>';
343  print '<tr><td>'.$langs->trans('Town').'</td><td>';
344  print $formcompany->select_ziptown((!empty($object->town) ? $object->town : ''), 'town', array('zipcode', 'selectcountry_id', 'state_id'));
345  print '</td></tr>';
346 
347  // Country
348  print '<tr><td>'.$langs->trans('Country').'</td><td>';
349  print img_picto('', 'globe-americas', 'class="paddingright"');
350  print $form->select_country((!empty($object->country_id) ? $object->country_id : $mysoc->country_code), 'country_id');
351  if ($user->admin) {
352  print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
353  }
354  print '</td></tr>';
355 
356  // Phone / Fax
357  print '<tr><td class="titlefieldcreate">'.$form->editfieldkey('Phone', 'phone', '', $object, 0).'</td><td>';
358  print img_picto('', 'object_phoning', 'class="paddingright"');
359  print '<input name="phone" size="20" value="'.$object->phone.'"></td></tr>';
360  print '<tr><td class="titlefieldcreate">'.$form->editfieldkey('Fax', 'fax', '', $object, 0).'</td>';
361  print '<td>';
362  print img_picto('', 'object_phoning_fax', 'class="paddingright"');
363  print '<input name="fax" size="20" value="'.$object->fax.'"></td></tr>';
364 
365  // Status
366  print '<tr><td>'.$langs->trans("Status").'</td><td>';
367  print '<select id="warehousestatus" name="statut" class="flat">';
368  foreach ($object->statuts as $key => $value) {
369  if ($key == 1) {
370  print '<option value="'.$key.'" selected>'.$langs->trans($value).'</option>';
371  } else {
372  print '<option value="'.$key.'">'.$langs->trans($value).'</option>';
373  }
374  }
375  print '</select>';
376  print ajax_combobox('warehousestatus');
377  print '</td></tr>';
378 
379  // Other attributes
380  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
381 
382  if (isModEnabled('categorie')) {
383  // Categories
384  print '<tr><td>'.$langs->trans("Categories").'</td><td colspan="3">';
385  $cate_arbo = $form->select_all_categories(Categorie::TYPE_WAREHOUSE, '', 'parent', 64, 0, 1);
386  print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
387  print "</td></tr>";
388  }
389  print '</table>';
390 
391  print dol_get_fiche_end();
392 
393  print $form->buttonsSaveCancel("Create");
394 
395  print '</form>';
396 } else {
397  $id = GETPOST("id", 'int');
398  if ($id > 0 || $ref) {
399  $object = new Entrepot($db);
400  $result = $object->fetch($id, $ref);
401  if ($result <= 0) {
402  print 'No record found';
403  exit;
404  }
405 
406  /*
407  * Affichage fiche
408  */
409  if ($action <> 'edit' && $action <> 're-edit') {
410  $head = stock_prepare_head($object);
411 
412  print dol_get_fiche_head($head, 'card', $langs->trans("Warehouse"), -1, 'stock');
413 
414  $formconfirm = '';
415 
416  // Confirm delete warehouse
417  if ($action == 'delete') {
418  $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("DeleteAWarehouse"), $langs->trans("ConfirmDeleteWarehouse", $object->label), "confirm_delete", '', 0, 2);
419  }
420 
421  // Call Hook formConfirm
422  $parameters = array('formConfirm' => $formconfirm);
423  $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
424  if (empty($reshook)) {
425  $formconfirm .= $hookmanager->resPrint;
426  } elseif ($reshook > 0) {
427  $formconfirm = $hookmanager->resPrint;
428  }
429 
430  // Print form confirm
431  print $formconfirm;
432 
433  // Warehouse card
434  $linkback = '<a href="'.DOL_URL_ROOT.'/product/stock/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
435 
436  $morehtmlref = '<div class="refidno">';
437  $morehtmlref .= $langs->trans("LocationSummary").' : '.$object->lieu;
438 
439  // Project
440  if (!empty($conf->project->enabled)) {
441  $langs->load("projects");
442  $morehtmlref .= '<br>'.img_picto('', 'project').' '.$langs->trans('Project').' ';
443  if ($usercancreate) {
444  if ($action != 'classify') {
445  $morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
446  }
447  if ($action == 'classify') {
448  $projectid = $object->fk_project;
449  $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
450  $morehtmlref .= '<input type="hidden" name="action" value="classin">';
451  $morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
452  $morehtmlref .= $formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500');
453  $morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
454  $morehtmlref .= '</form>';
455  } else {
456  $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, ($socid > 0 ? $socid : -1), $object->fk_project, 'none', 0, 0, 0, 1);
457  }
458  } else {
459  if (!empty($object->fk_project)) {
460  $proj = new Project($db);
461  $proj->fetch($object->fk_project);
462  $morehtmlref .= ' : '.$proj->getNomUrl(1);
463  if ($proj->title) {
464  $morehtmlref .= ' - '.$proj->title;
465  }
466  } else {
467  $morehtmlref .= '';
468  }
469  }
470  }
471  $morehtmlref .= '</div>';
472 
473  $shownav = 1;
474  if ($user->socid && !in_array('stock', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) {
475  $shownav = 0;
476  }
477 
478  dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref', 'ref', $morehtmlref);
479 
480  print '<div class="fichecenter">';
481  print '<div class="fichehalfleft">';
482  print '<div class="underbanner clearboth"></div>';
483 
484  print '<table class="border centpercent tableforfield">';
485 
486  // Parent entrepot
487  $parentwarehouse = new Entrepot($db);
488  if (!empty($object->fk_parent) && $parentwarehouse->fetch($object->fk_parent) > 0) {
489  print '<tr><td>'.$langs->trans("ParentWarehouse").'</td><td>';
490  print $parentwarehouse->getNomUrl(3);
491  print '</td></tr>';
492  }
493 
494  print '<tr>';
495 
496  // Description
497  print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>'.dol_htmlentitiesbr($object->description).'</td></tr>';
498 
499  $calcproductsunique = $object->nb_different_products();
500  $calcproducts = $object->nb_products();
501 
502  // Total nb of different products
503  print '<tr><td>'.$langs->trans("NumberOfDifferentProducts").'</td><td>';
504  print empty($calcproductsunique['nb']) ? '0' : $calcproductsunique['nb'];
505  print "</td></tr>";
506 
507  // Nb of products
508  print '<tr><td>'.$langs->trans("NumberOfProducts").'</td><td>';
509  $valtoshow = price2num($calcproducts['nb'], 'MS');
510  print empty($valtoshow) ? '0' : $valtoshow;
511  print "</td></tr>";
512 
513  print '</table>';
514 
515  print '</div>';
516  print '<div class="fichehalfright">';
517  print '<div class="underbanner clearboth"></div>';
518 
519  print '<table class="border centpercent tableforfield">';
520 
521  // Value
522  print '<tr><td class="titlefield">'.$langs->trans("EstimatedStockValueShort").'</td><td>';
523  print price((empty($calcproducts['value']) ? '0' : price2num($calcproducts['value'], 'MT')), 0, $langs, 0, -1, -1, $conf->currency);
524  print "</td></tr>";
525 
526  // Last movement
527  if (!empty($user->rights->stock->mouvement->lire)) {
528  $sql = "SELECT max(m.datem) as datem";
529  $sql .= " FROM ".MAIN_DB_PREFIX."stock_mouvement as m";
530  $sql .= " WHERE m.fk_entrepot = ".((int) $object->id);
531  $resqlbis = $db->query($sql);
532  if ($resqlbis) {
533  $obj = $db->fetch_object($resqlbis);
534  $lastmovementdate = $db->jdate($obj->datem);
535  } else {
536  dol_print_error($db);
537  }
538  print '<tr><td>'.$langs->trans("LastMovement").'</td><td>';
539  if ($lastmovementdate) {
540  print dol_print_date($lastmovementdate, 'dayhour');
541  print ' &nbsp; &nbsp; ';
542  print img_picto($langs->trans('LastMovement'), 'movement', 'class="pictofixedwidth"');
543  print '<a href="'.DOL_URL_ROOT.'/product/stock/movement_list.php?id='.$object->id.'">'.$langs->trans("FullList").'</a>';
544  } else {
545  print $langs->trans("None");
546  }
547  print "</td></tr>";
548  }
549 
550  // Other attributes
551  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
552 
553  // Categories
554  if (isModEnabled('categorie')) {
555  print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td colspan="3">';
556  print $form->showCategories($object->id, Categorie::TYPE_WAREHOUSE, 1);
557  print "</td></tr>";
558  }
559 
560  print "</table>";
561 
562  print '</div>';
563  print '</div>';
564 
565  print '<div class="clearboth"></div>';
566 
567  print dol_get_fiche_end();
568 
569 
570  /*
571  * Action bar
572  */
573  print "<div class=\"tabsAction\">\n";
574 
575  $parameters = array();
576  $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
577  if (empty($reshook)) {
578  if (empty($action) || $action == 'classin') {
579  if ($user->rights->stock->creer) {
580  print '<a class="butAction" href="card.php?action=edit&token='.newToken().'&id='.$object->id.'">'.$langs->trans("Modify").'</a>';
581  } else {
582  print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("Modify").'</a>';
583  }
584 
585  if ($user->rights->stock->supprimer) {
586  print '<a class="butActionDelete" href="card.php?action=delete&token='.newToken().'&id='.$object->id.'">'.$langs->trans("Delete").'</a>';
587  } else {
588  print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("Delete").'</a>';
589  }
590  }
591  }
592 
593  print "</div>";
594 
595 
596  /* ************************************************************************** */
597  /* */
598  /* Affichage de la liste des produits de l'entrepot */
599  /* */
600  /* ************************************************************************** */
601  print '<br>';
602 
603  print '<table class="noborder centpercent">';
604  print "<tr class=\"liste_titre\">";
605  $parameters = array();
606  $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
607  print $hookmanager->resPrint;
608  print_liste_field_titre("Product", "", "p.ref", "&amp;id=".$id, "", "", $sortfield, $sortorder);
609  print_liste_field_titre("Label", "", "p.label", "&amp;id=".$id, "", "", $sortfield, $sortorder);
610  print_liste_field_titre("NumberOfUnit", "", "ps.reel", "&amp;id=".$id, "", '', $sortfield, $sortorder, 'right ');
611  if (!empty($conf->global->PRODUCT_USE_UNITS)) {
612  print_liste_field_titre("Unit", "", "p.fk_unit", "&amp;id=".$id, "", 'align="left"', $sortfield, $sortorder);
613  }
614  print_liste_field_titre($form->textwithpicto($langs->trans("AverageUnitPricePMPShort"), $langs->trans("AverageUnitPricePMPDesc")), "", "p.pmp", "&amp;id=".$id, "", '', $sortfield, $sortorder, 'right ');
615  print_liste_field_titre("EstimatedStockValueShort", "", "", "&amp;id=".$id, "", '', $sortfield, $sortorder, 'right ');
616  if (empty($conf->global->PRODUIT_MULTIPRICES)) {
617  print_liste_field_titre("SellPriceMin", "", "p.price", "&amp;id=".$id, "", '', $sortfield, $sortorder, 'right ');
618  }
619  if (empty($conf->global->PRODUIT_MULTIPRICES)) {
620  print_liste_field_titre("EstimatedStockValueSellShort", "", "", "&amp;id=".$id, "", '', $sortfield, $sortorder, 'right ');
621  }
622  if ($user->rights->stock->mouvement->creer) {
624  }
625  if ($user->rights->stock->creer) {
627  }
628  // Hook fields
629  $parameters = array('sortfield'=>$sortfield, 'sortorder'=>$sortorder);
630  $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
631  print $hookmanager->resPrint;
632  print "</tr>\n";
633 
634  $totalunit = 0;
635  $totalvalue = $totalvaluesell = 0;
636 
637  //For MultiCompany PMP per entity
638  $separatedPMP = false;
639  if (!empty($conf->global->MULTICOMPANY_PRODUCT_SHARING_ENABLED) && !empty($conf->global->MULTICOMPANY_PMP_PER_ENTITY_ENABLED)) {
640  $separatedPMP = true;
641  }
642 
643  $sql = "SELECT p.rowid as rowid, p.ref, p.label as produit, p.tobatch, p.fk_product_type as type, p.price, p.price_ttc, p.entity,";
644  $sql .= "p.tosell, p.tobuy,";
645  $sql .= "p.accountancy_code_sell,";
646  $sql .= "p.accountancy_code_sell_intra,";
647  $sql .= "p.accountancy_code_sell_export,";
648  $sql .= "p.accountancy_code_buy,";
649  $sql .= "p.accountancy_code_buy_intra,";
650  $sql .= "p.accountancy_code_buy_export,";
651  $sql .= 'p.barcode,';
652  if ($separatedPMP) {
653  $sql .= " pa.pmp as ppmp,";
654  } else {
655  $sql .= " p.pmp as ppmp,";
656  }
657  $sql .= " ps.reel as value";
658  if (!empty($conf->global->PRODUCT_USE_UNITS)) {
659  $sql .= ",fk_unit";
660  }
661  // Add fields from hooks
662  $parameters = array();
663  $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
664  if ($reshook > 0) { //Note that $sql is replaced if reshook > 0
665  $sql = "";
666  }
667  $sql .= $hookmanager->resPrint;
668  $sql .= " FROM ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."product as p";
669 
670  if ($separatedPMP) {
671  $sql .= ", ".MAIN_DB_PREFIX."product_perentity as pa";
672  }
673 
674  $sql .= " WHERE ps.fk_product = p.rowid";
675  $sql .= " AND ps.reel <> 0"; // We do not show if stock is 0 (no product in this warehouse)
676  $sql .= " AND ps.fk_entrepot = ".((int) $object->id);
677 
678  if ($separatedPMP) {
679  $sql .= " AND pa.fk_product = p.rowid AND pa.entity = ".(int) $conf->entity;
680  }
681 
682  $sql .= $db->order($sortfield, $sortorder);
683 
684  dol_syslog('List products', LOG_DEBUG);
685  $resql = $db->query($sql);
686  if ($resql) {
687  $num = $db->num_rows($resql);
688  $i = 0;
689  $sameunits = true;
690 
691  while ($i < $num) {
692  $objp = $db->fetch_object($resql);
693 
694  // Multilangs
695  if (getDolGlobalInt('MAIN_MULTILANGS')) { // si l'option est active
696  $sql = "SELECT label";
697  $sql .= " FROM ".MAIN_DB_PREFIX."product_lang";
698  $sql .= " WHERE fk_product = ".((int) $objp->rowid);
699  $sql .= " AND lang = '".$db->escape($langs->getDefaultLang())."'";
700  $sql .= " LIMIT 1";
701 
702  $result = $db->query($sql);
703  if ($result) {
704  $objtp = $db->fetch_object($result);
705  if ($objtp->label != '') {
706  $objp->produit = $objtp->label;
707  }
708  }
709  }
710 
711  //print '<td>'.dol_print_date($objp->datem).'</td>';
712  print '<tr class="oddeven">';
713 
714  $parameters = array('obj'=>$objp);
715  $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
716  print $hookmanager->resPrint;
717 
718  $productstatic->id = $objp->rowid;
719  $productstatic->ref = $objp->ref;
720  $productstatic->label = $objp->produit;
721  $productstatic->type = $objp->type;
722  $productstatic->entity = $objp->entity;
723  $productstatic->status_batch = $objp->tobatch;
724  if (!empty($conf->global->PRODUCT_USE_UNITS)) {
725  $productstatic->fk_unit = $objp->fk_unit;
726  }
727  $productstatic->status = $objp->tosell;
728  $productstatic->status_buy = $objp->tobuy;
729  $productstatic->barcode = $objp->barcode;
730  $productstatic->accountancy_code_sell = $objp->accountancy_code_sell;
731  $productstatic->accountancy_code_sell_intra = $objp->accountancy_code_sell_intra;
732  $productstatic->accountancy_code_sell_export = $objp->accountancy_code_sell_export;
733  $productstatic->accountancy_code_buy = $objp->accountancy_code_buy;
734  $productstatic->accountancy_code_buy_intra = $objp->accountancy_code_buy_intra;
735  $productstatic->accountancy_code_buy_export = $objp->accountancy_code_buy_export;
736 
737  print "<td>";
738  print $productstatic->getNomUrl(1, 'stock', 16);
739  print '</td>';
740 
741  // Label
742  print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($objp->produit).'">'.dol_escape_htmltag($objp->produit).'</td>';
743 
744  print '<td class="right">';
745  $valtoshow = price(price2num($objp->value, 'MS'), 0, '', 0, 0); // TODO replace with a qty() function
746  print empty($valtoshow) ? '0' : $valtoshow;
747  print '</td>';
748  $totalunit += $objp->value;
749 
750  if (!empty($conf->global->PRODUCT_USE_UNITS)) {
751  // Units
752  print '<td align="left">';
753  if (is_null($productstatic->fk_unit)) {
754  $productstatic->fk_unit = 1;
755  }
756  print $langs->trans($productstatic->getLabelOfUnit());
757  print '</td>';
758  }
759  // Price buy PMP
760  print '<td class="right nowraponall">'.price(price2num($objp->ppmp, 'MU')).'</td>';
761 
762  // Total PMP
763  print '<td class="right amount nowraponall">'.price(price2num($objp->ppmp * $objp->value, 'MT')).'</td>';
764  $totalvalue += price2num($objp->ppmp * $objp->value, 'MT');
765 
766  // Price sell min
767  if (empty($conf->global->PRODUIT_MULTIPRICES)) {
768  $pricemin = $objp->price;
769  print '<td class="right">';
770  print price(price2num($pricemin, 'MU'), 1);
771  print '</td>';
772  // Total sell min
773  print '<td class="right">';
774  print price(price2num($pricemin * $objp->value, 'MT'), 1);
775  print '</td>';
776  }
777  $totalvaluesell += price2num($pricemin * $objp->value, 'MT');
778 
779  if ($user->rights->stock->mouvement->creer) {
780  print '<td class="center"><a href="'.DOL_URL_ROOT.'/product/stock/product.php?dwid='.$object->id.'&id='.$objp->rowid.'&action=transfert&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$id).'">';
781  print img_picto($langs->trans("TransferStock"), 'add', 'class="hideonsmartphone pictofixedwidth" style="color: #a69944"');
782  print $langs->trans("TransferStock");
783  print "</a></td>";
784  }
785 
786  if ($user->rights->stock->creer) {
787  print '<td class="center"><a href="'.DOL_URL_ROOT.'/product/stock/product.php?dwid='.$object->id.'&id='.$objp->rowid.'&action=correction&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$id).'">';
788  print img_picto($langs->trans("CorrectStock"), 'add', 'class="hideonsmartphone pictofixedwidth" style="color: #a69944"');
789  print $langs->trans("CorrectStock");
790  print "</a></td>";
791  }
792 
793  if (!empty($conf->global->PRODUCT_USE_UNITS)) {
794  if ($i == 0) {
795  $units = $productstatic->fk_unit;
796  } elseif ($productstatic->fk_unit != $units) {
797  $sameunits = false;
798  }
799  }
800 
801  print "</tr>";
802  $i++;
803  }
804  $db->free($resql);
805 
806  // Total
807  print '<tr class="liste_total"><td class="liste_total" colspan="2">'.$langs->trans("Total").'</td>';
808  print '<td class="liste_total right">';
809  $valtoshow = price2num($totalunit, 'MS');
810  if (empty($conf->global->PRODUCT_USE_UNITS) || $sameunits) {
811  print empty($valtoshow) ? '0' : $valtoshow;
812  }
813  print '</td>';
814  print '<td class="liste_total">';
815  if (empty($conf->global->PRODUCT_USE_UNITS) && $sameunits) {
816  print $langs->trans($productstatic->getLabelOfUnit());
817  }
818  print '</td>';
819  print '<td class="liste_total right">'.price(price2num($totalvalue, 'MT')).'</td>';
820  if (empty($conf->global->PRODUIT_MULTIPRICES)) {
821  print '<td class="liste_total">&nbsp;</td>';
822  print '<td class="liste_total right">'.price(price2num($totalvaluesell, 'MT')).'</td>';
823  }
824 
825  if ($user->rights->stock->mouvement->creer) {
826  print '<td class="liste_total">&nbsp;</td>';
827  }
828 
829  if ($user->rights->stock->creer) {
830  print '<td class="liste_total">&nbsp;</td>';
831  }
832 
833  print '</tr>';
834  } else {
835  dol_print_error($db);
836  }
837  print "</table>\n";
838  }
839 
840 
841  /*
842  * Edition fiche
843  */
844  if ($action == 'edit' || $action == 're-edit') {
845  $langs->trans("WarehouseEdit");
846 
847  print '<form action="card.php" method="POST">';
848  print '<input type="hidden" name="token" value="'.newToken().'">';
849  print '<input type="hidden" name="action" value="update">';
850  print '<input type="hidden" name="id" value="'.$object->id.'">';
851 
852  $head = stock_prepare_head($object);
853 
854  print dol_get_fiche_head($head, 'card', $langs->trans("Warehouse"), 0, 'stock');
855 
856  print '<table class="border centpercent">';
857 
858  // Ref
859  print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Ref").'</td><td><input name="libelle" size="20" value="'.$object->label.'"></td></tr>';
860 
861  print '<tr><td>'.$langs->trans("LocationSummary").'</td><td><input name="lieu" class="minwidth300" value="'.$object->lieu.'"></td></tr>';
862 
863  // Parent entrepot
864  print '<tr><td>'.$langs->trans("AddIn").'</td><td>';
865  print $formproduct->selectWarehouses($object->fk_parent, 'fk_parent', '', 1);
866  print '</td></tr>';
867 
868  // Project
869  if (!empty($conf->project->enabled)) {
870  $projectid = $object->fk_project;
871  $langs->load('projects');
872  print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">';
873  print img_picto('', 'project').$formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500');
874  print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.($socid > 0 ? $socid : "").'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create'.($socid > 0 ? '&socid='.$socid : "")).'"><span class="fa fa-plus-circle valignmiddle" title="'.$langs->trans("AddProject").'"></span></a>';
875  print '</td></tr>';
876  }
877 
878  // Description
879  print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
880  // Editeur wysiwyg
881  require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
882  $doleditor = new DolEditor('desc', $object->description, '', 180, 'dolibarr_notes', 'In', false, true, $conf->fckeditor->enabled, ROWS_5, '90%');
883  $doleditor->Create();
884  print '</td></tr>';
885 
886  print '<tr><td>'.$langs->trans('Address').'</td><td><textarea name="address" class="quatrevingtpercent" rows="3" wrap="soft">';
887  print $object->address;
888  print '</textarea></td></tr>';
889 
890  // Zip / Town
891  print '<tr><td>'.$langs->trans('Zip').'</td><td>';
892  print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
893  print '</td></tr>';
894  print '<tr><td>'.$langs->trans('Town').'</td><td>';
895  print $formcompany->select_ziptown($object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id'));
896  print '</td></tr>';
897 
898  // Country
899  print '<tr><td>'.$langs->trans('Country').'</td><td>';
900  print img_picto('', 'globe-americas', 'class="paddingright"');
901  print $form->select_country($object->country_id ? $object->country_id : $mysoc->country_code, 'country_id');
902  if ($user->admin) {
903  print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
904  }
905  print '</td></tr>';
906 
907  // Phone / Fax
908  print '<tr><td class="titlefieldcreate">'.$form->editfieldkey('Phone', 'phone', '', $object, 0).'</td><td>';
909  print img_picto('', 'object_phoning', 'class="paddingright"');
910  print '<input name="phone" size="20" value="'.$object->phone.'"></td></tr>';
911  print '<tr><td class="titlefieldcreate">'.$form->editfieldkey('Fax', 'fax', '', $object, 0).'</td><td>';
912  print img_picto('', 'object_phoning_fax', 'class="paddingright"');
913  print '<input name="fax" size="20" value="'.$object->fax.'"></td></tr>';
914 
915  // Status
916  print '<tr><td>'.$langs->trans("Status").'</td><td>';
917  print '<select id="warehousestatus" name="statut" class="flat">';
918  foreach ($object->statuts as $key => $value) {
919  if ($key == $object->statut) {
920  print '<option value="'.$key.'" selected>'.$langs->trans($value).'</option>';
921  } else {
922  print '<option value="'.$key.'">'.$langs->trans($value).'</option>';
923  }
924  }
925  print '</select>';
926  print ajax_combobox('warehousestatus');
927 
928  print '</td></tr>';
929 
930  // Other attributes
931  $parameters = array('colspan' => ' colspan="3"', 'cols' => '3');
932  $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
933  print $hookmanager->resPrint;
934  if (empty($reshook)) {
935  print $object->showOptionals($extrafields, 'edit', $parameters);
936  }
937 
938  // Tags-Categories
939  if (isModEnabled('categorie')) {
940  print '<tr><td class="tdtop">'.$langs->trans("Categories").'</td><td colspan="3">';
941  $cate_arbo = $form->select_all_categories(Categorie::TYPE_WAREHOUSE, '', 'parent', 64, 0, 1);
942  $c = new Categorie($db);
943  $cats = $c->containing($object->id, Categorie::TYPE_WAREHOUSE);
944  $arrayselected = array();
945  foreach ($cats as $cat) {
946  $arrayselected[] = $cat->id;
947  }
948  print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
949  print "</td></tr>";
950  }
951 
952  print '</table>';
953 
954  print dol_get_fiche_end();
955 
956  print $form->buttonsSaveCancel();
957 
958  print '</form>';
959  }
960  }
961 }
962 
963 /*
964  * Documents generated
965  */
966 
967 $modulepart = 'stock';
968 
969 if ($action != 'create' && $action != 'edit' && $action != 'delete') {
970  print '<br>';
971  print '<div class="fichecenter"><div class="fichehalfleft">';
972  print '<a name="builddoc"></a>'; // ancre
973 
974  // Documents
975  $objectref = dol_sanitizeFileName($object->ref);
976  $relativepath = $object->ref.'/'.$objectref.'.pdf';
977  $filedir = $conf->stock->dir_output.'/'.$objectref;
978  $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
979  $genallowed = $usercanread;
980  $delallowed = $usercancreate;
981  $modulepart = 'stock';
982 
983  print $formfile->showdocuments($modulepart, $objectref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 0, 0, 0, 28, 0, '', 0, '', '', '', $object);
984  $somethingshown = $formfile->numoffiles;
985 
986  print '</div><div class="fichehalfright">';
987 
988  $MAXEVENT = 10;
989 
990  $morehtmlcenter = '';
991  //$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/product/stock/agenda.php?id='.$object->id);
992 
993  // List of actions on element
994  include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
995  $formactions = new FormActions($db);
996  $somethingshown = $formactions->showactions($object, 'stock', 0, 1, '', $MAXEVENT, '', $morehtmlcenter); // Show all action for product
997 
998  print '</div></div>';
999 }
1000 
1001 // End of page
1002 llxFooter();
1003 $db->close();
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
Definition: agenda.php:118
if(preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) if(preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) if($action=='set') elseif($action=='specimen') elseif($action=='setmodel') elseif($action=='del') elseif($action=='setdoc') $formactions
View.
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
Definition: ajax.lib.php:449
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:56
llxFooter()
Empty footer.
Definition: wrapper.php:70
Class to manage categories.
Class to manage a WYSIWYG editor.
Class to manage warehouses.
Class to manage standard extra fields.
Class to manage building of HTML components.
Class to build HTML component for third parties management Only common components are here.
Class to offer components to list and upload files.
Class to manage generation of HTML components Only common components must be here.
Class with static methods for building HTML components related to products Only components common to ...
Class to manage building of HTML components.
Class to manage products or services.
Class to manage projects.
$parameters
Actions.
Definition: card.php:79
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:745
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
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.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_set_focus($selector)
Set focus onto field with selector (similar behaviour of 'autofocus' HTML5 tag)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for each properties) With native =...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
isModEnabled($module)
Is Dolibarr module enabled.
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
$formconfirm
if ($action == 'delbookkeepingyear') {
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.
stock_prepare_head($object)
Prepare array with list of tabs.
Definition: stock.lib.php:30