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