dolibarr  17.0.4
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", 'restricthtml');
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 minwidth100">';
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  // View mode
407  if ($action <> 'edit' && $action <> 're-edit') {
408  $head = stock_prepare_head($object);
409 
410  print dol_get_fiche_head($head, 'card', $langs->trans("Warehouse"), -1, 'stock');
411 
412  $formconfirm = '';
413 
414  // Confirm delete warehouse
415  if ($action == 'delete') {
416  $formquestion = array(
417  array('type' => 'other', 'name' => 'info', 'label' => img_warning('').$langs->trans("WarningThisWIllAlsoDeleteStock"), 'morecss'=>'warning')
418  );
419  $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("DeleteAWarehouse"), $langs->trans("ConfirmDeleteWarehouse", $object->label), "confirm_delete", $formquestion, 0, 2);
420  }
421 
422  // Call Hook formConfirm
423  $parameters = array('formConfirm' => $formconfirm);
424  $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
425  if (empty($reshook)) {
426  $formconfirm .= $hookmanager->resPrint;
427  } elseif ($reshook > 0) {
428  $formconfirm = $hookmanager->resPrint;
429  }
430 
431  // Print form confirm
432  print $formconfirm;
433 
434  // Warehouse card
435  $linkback = '<a href="'.DOL_URL_ROOT.'/product/stock/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
436 
437  $morehtmlref = '<div class="refidno">';
438  $morehtmlref .= $langs->trans("LocationSummary").' : '.$object->lieu;
439 
440  // Project
441  if (!empty($conf->project->enabled)) {
442  $langs->load("projects");
443  $morehtmlref .= '<br>'.img_picto('', 'project').' '.$langs->trans('Project').' ';
444  if ($usercancreate) {
445  if ($action != 'classify') {
446  $morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
447  }
448  if ($action == 'classify') {
449  $projectid = $object->fk_project;
450  $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
451  $morehtmlref .= '<input type="hidden" name="action" value="classin">';
452  $morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
453  $morehtmlref .= $formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500');
454  $morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
455  $morehtmlref .= '</form>';
456  } else {
457  $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, ($socid > 0 ? $socid : -1), $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
458  }
459  } else {
460  if (!empty($object->fk_project)) {
461  $proj = new Project($db);
462  $proj->fetch($object->fk_project);
463  $morehtmlref .= ' : '.$proj->getNomUrl(1);
464  if ($proj->title) {
465  $morehtmlref .= ' - '.$proj->title;
466  }
467  } else {
468  $morehtmlref .= '';
469  }
470  }
471  }
472  $morehtmlref .= '</div>';
473 
474  $shownav = 1;
475  if ($user->socid && !in_array('stock', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) {
476  $shownav = 0;
477  }
478 
479  dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref', 'ref', $morehtmlref);
480 
481  print '<div class="fichecenter">';
482  print '<div class="fichehalfleft">';
483  print '<div class="underbanner clearboth"></div>';
484 
485  print '<table class="border centpercent tableforfield">';
486 
487  // Parent entrepot
488  $parentwarehouse = new Entrepot($db);
489  if (!empty($object->fk_parent) && $parentwarehouse->fetch($object->fk_parent) > 0) {
490  print '<tr><td>'.$langs->trans("ParentWarehouse").'</td><td>';
491  print $parentwarehouse->getNomUrl(3);
492  print '</td></tr>';
493  }
494 
495  print '<tr>';
496 
497  // Description
498  print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>'.dol_htmlentitiesbr($object->description).'</td></tr>';
499 
500  $calcproductsunique = $object->nb_different_products();
501  $calcproducts = $object->nb_products();
502 
503  // Total nb of different products
504  print '<tr><td>'.$langs->trans("NumberOfDifferentProducts").'</td><td>';
505  print empty($calcproductsunique['nb']) ? '0' : $calcproductsunique['nb'];
506  print "</td></tr>";
507 
508  // Nb of products
509  print '<tr><td>'.$langs->trans("NumberOfProducts").'</td><td>';
510  $valtoshow = price2num($calcproducts['nb'], 'MS');
511  print empty($valtoshow) ? '0' : $valtoshow;
512  print "</td></tr>";
513 
514  print '</table>';
515 
516  print '</div>';
517  print '<div class="fichehalfright">';
518  print '<div class="underbanner clearboth"></div>';
519 
520  print '<table class="border centpercent tableforfield">';
521 
522  // Value
523  print '<tr><td class="titlefield">'.$langs->trans("EstimatedStockValueShort").'</td><td>';
524  print price((empty($calcproducts['value']) ? '0' : price2num($calcproducts['value'], 'MT')), 0, $langs, 0, -1, -1, $conf->currency);
525  print "</td></tr>";
526 
527  // Last movement
528  if (!empty($user->rights->stock->mouvement->lire)) {
529  $sql = "SELECT max(m.datem) as datem";
530  $sql .= " FROM ".MAIN_DB_PREFIX."stock_mouvement as m";
531  $sql .= " WHERE m.fk_entrepot = ".((int) $object->id);
532  $resqlbis = $db->query($sql);
533  if ($resqlbis) {
534  $obj = $db->fetch_object($resqlbis);
535  $lastmovementdate = $db->jdate($obj->datem);
536  } else {
537  dol_print_error($db);
538  }
539  print '<tr><td>'.$langs->trans("LastMovement").'</td><td>';
540  if ($lastmovementdate) {
541  print dol_print_date($lastmovementdate, 'dayhour');
542  print ' &nbsp; &nbsp; ';
543  print img_picto($langs->trans('LastMovement'), 'movement', 'class="pictofixedwidth"');
544  print '<a href="'.DOL_URL_ROOT.'/product/stock/movement_list.php?id='.$object->id.'">'.$langs->trans("FullList").'</a>';
545  } else {
546  print $langs->trans("None");
547  }
548  print "</td></tr>";
549  }
550 
551  // Other attributes
552  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
553 
554  // Categories
555  if (isModEnabled('categorie')) {
556  print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td colspan="3">';
557  print $form->showCategories($object->id, Categorie::TYPE_WAREHOUSE, 1);
558  print "</td></tr>";
559  }
560 
561  print "</table>";
562 
563  print '</div>';
564  print '</div>';
565 
566  print '<div class="clearboth"></div>';
567 
568  print dol_get_fiche_end();
569 
570 
571  /*
572  * Action bar
573  */
574  print "<div class=\"tabsAction\">\n";
575 
576  $parameters = array();
577  $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
578  if (empty($reshook)) {
579  if (empty($action) || $action == 'classin') {
580  if ($user->rights->stock->creer) {
581  print '<a class="butAction" href="card.php?action=edit&token='.newToken().'&id='.$object->id.'">'.$langs->trans("Modify").'</a>';
582  } else {
583  print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("Modify").'</a>';
584  }
585 
586  if ($user->rights->stock->supprimer) {
587  print '<a class="butActionDelete" href="card.php?action=delete&token='.newToken().'&id='.$object->id.'">'.$langs->trans("Delete").'</a>';
588  } else {
589  print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("Delete").'</a>';
590  }
591  }
592  }
593 
594  print "</div>";
595 
596 
597  // Show list of products into warehouse
598  print '<br>';
599 
600 
601  $totalarray = array();
602  $totalarray['val'] = array ();
603  $totalarray['pos'] = array ();
604  $totalarray['type'] = array ();
605  $totalarray['nbfield'] = 0;
606 
607  // TODO Create $arrayfields with all fields to show
608 
609  print '<table class="noborder centpercent">';
610  print "<tr class=\"liste_titre\">";
611  $parameters = array('totalarray' => &$totalarray);
612  $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
613  print $hookmanager->resPrint;
614 
615  print_liste_field_titre("Product", "", "p.ref", "&amp;id=".$id, "", "", $sortfield, $sortorder);
616  print_liste_field_titre("Label", "", "p.label", "&amp;id=".$id, "", "", $sortfield, $sortorder);
617  print_liste_field_titre("NumberOfUnit", "", "ps.reel", "&amp;id=".$id, "", '', $sortfield, $sortorder, 'right ');
618  $totalarray['nbfield'] += 3;
619  $totalarray['pos'][$totalarray['nbfield']] = 'totalunit';
620  $totalarray['type'][$totalarray['nbfield']] = 'stock';
621 
622  if (!empty($conf->global->PRODUCT_USE_UNITS)) {
623  print_liste_field_titre("Unit", "", "p.fk_unit", "&amp;id=".$id, "", 'align="left"', $sortfield, $sortorder);
624  $totalarray['nbfield']++;
625  $totalarray['pos'][$totalarray['nbfield']] = 'units';
626  $totalarray['type'][$totalarray['nbfield']] = 'string';
627  }
628 
629  print_liste_field_titre($form->textwithpicto($langs->trans("AverageUnitPricePMPShort"), $langs->trans("AverageUnitPricePMPDesc")), "", "p.pmp", "&amp;id=".$id, "", '', $sortfield, $sortorder, 'right ');
630  $totalarray['nbfield']++;
631 
632  print_liste_field_titre("EstimatedStockValueShort", "", "", "&amp;id=".$id, "", '', $sortfield, $sortorder, 'right ');
633  $totalarray['nbfield']++;
634  $totalarray['pos'][$totalarray['nbfield']] = 'totalvalue';
635 
636  if (empty($conf->global->PRODUIT_MULTIPRICES)) {
637  print_liste_field_titre("SellPriceMin", "", "p.price", "&amp;id=".$id, "", '', $sortfield, $sortorder, 'right ');
638  $totalarray['nbfield']++;
639  }
640  if (empty($conf->global->PRODUIT_MULTIPRICES)) {
641  print_liste_field_titre("EstimatedStockValueSellShort", "", "", "&amp;id=".$id, "", '', $sortfield, $sortorder, 'right ');
642  $totalarray['nbfield']++;
643  $totalarray['pos'][$totalarray['nbfield']] = 'totalvaluesell';
644  }
645  if ($user->rights->stock->mouvement->creer) {
647  $totalarray['nbfield']++;
648  }
649  if ($user->rights->stock->creer) {
651  $totalarray['nbfield']++;
652  }
653  // Hook fields
654  $parameters = array('sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray' => &$totalarray);
655  $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
656  print $hookmanager->resPrint;
657  print "</tr>\n";
658 
659  $totalunit = 0;
660  $totalvalue = $totalvaluesell = 0;
661 
662  //For MultiCompany PMP per entity
663  $separatedPMP = false;
664  if (!empty($conf->global->MULTICOMPANY_PRODUCT_SHARING_ENABLED) && !empty($conf->global->MULTICOMPANY_PMP_PER_ENTITY_ENABLED)) {
665  $separatedPMP = true;
666  }
667 
668  $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,";
669  $sql .= "p.tosell, p.tobuy,";
670  $sql .= "p.accountancy_code_sell,";
671  $sql .= "p.accountancy_code_sell_intra,";
672  $sql .= "p.accountancy_code_sell_export,";
673  $sql .= "p.accountancy_code_buy,";
674  $sql .= "p.accountancy_code_buy_intra,";
675  $sql .= "p.accountancy_code_buy_export,";
676  $sql .= 'p.barcode,';
677  if ($separatedPMP) {
678  $sql .= " pa.pmp as ppmp,";
679  } else {
680  $sql .= " p.pmp as ppmp,";
681  }
682  $sql .= " ps.reel as value";
683  if (!empty($conf->global->PRODUCT_USE_UNITS)) {
684  $sql .= ",fk_unit";
685  }
686  // Add fields from hooks
687  $parameters = array();
688  $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
689  if ($reshook > 0) { //Note that $sql is replaced if reshook > 0
690  $sql = "";
691  }
692  $sql .= $hookmanager->resPrint;
693  $sql .= " FROM ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."product as p";
694 
695  if ($separatedPMP) {
696  $sql .= ", ".MAIN_DB_PREFIX."product_perentity as pa";
697  }
698 
699  $sql .= " WHERE ps.fk_product = p.rowid";
700  $sql .= " AND ps.reel <> 0"; // We do not show if stock is 0 (no product in this warehouse)
701  $sql .= " AND ps.fk_entrepot = ".((int) $object->id);
702 
703  if ($separatedPMP) {
704  $sql .= " AND pa.fk_product = p.rowid AND pa.entity = ".(int) $conf->entity;
705  }
706 
707  $sql .= $db->order($sortfield, $sortorder);
708 
709  dol_syslog('List products', LOG_DEBUG);
710  $resql = $db->query($sql);
711  if ($resql) {
712  $num = $db->num_rows($resql);
713  $i = 0;
714  $sameunits = true;
715 
716  while ($i < $num) {
717  $objp = $db->fetch_object($resql);
718 
719  // Multilangs
720  if (getDolGlobalInt('MAIN_MULTILANGS')) { // si l'option est active
721  $sql = "SELECT label";
722  $sql .= " FROM ".MAIN_DB_PREFIX."product_lang";
723  $sql .= " WHERE fk_product = ".((int) $objp->rowid);
724  $sql .= " AND lang = '".$db->escape($langs->getDefaultLang())."'";
725  $sql .= " LIMIT 1";
726 
727  $result = $db->query($sql);
728  if ($result) {
729  $objtp = $db->fetch_object($result);
730  if ($objtp->label != '') {
731  $objp->produit = $objtp->label;
732  }
733  }
734  }
735 
736  //print '<td>'.dol_print_date($objp->datem).'</td>';
737  print '<tr class="oddeven">';
738 
739  $parameters = array('obj'=>$objp, 'totalarray' => &$totalarray);
740  $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
741  print $hookmanager->resPrint;
742 
743  $productstatic->id = $objp->rowid;
744  $productstatic->ref = $objp->ref;
745  $productstatic->label = $objp->produit;
746  $productstatic->type = $objp->type;
747  $productstatic->entity = $objp->entity;
748  $productstatic->status_batch = $objp->tobatch;
749  if (!empty($conf->global->PRODUCT_USE_UNITS)) {
750  $productstatic->fk_unit = $objp->fk_unit;
751  }
752  $productstatic->status = $objp->tosell;
753  $productstatic->status_buy = $objp->tobuy;
754  $productstatic->barcode = $objp->barcode;
755  $productstatic->accountancy_code_sell = $objp->accountancy_code_sell;
756  $productstatic->accountancy_code_sell_intra = $objp->accountancy_code_sell_intra;
757  $productstatic->accountancy_code_sell_export = $objp->accountancy_code_sell_export;
758  $productstatic->accountancy_code_buy = $objp->accountancy_code_buy;
759  $productstatic->accountancy_code_buy_intra = $objp->accountancy_code_buy_intra;
760  $productstatic->accountancy_code_buy_export = $objp->accountancy_code_buy_export;
761 
762  // Ref
763  print "<td>";
764  print $productstatic->getNomUrl(1, 'stock', 16);
765  print '</td>';
766 
767  // Label
768  print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($objp->produit).'">'.dol_escape_htmltag($objp->produit).'</td>';
769 
770  // Value
771  print '<td class="right">';
772  $valtoshow = price(price2num($objp->value, 'MS'), 0, '', 0, 0); // TODO replace with a qty() function
773  print empty($valtoshow) ? '0' : $valtoshow;
774  print '</td>';
775  $totalunit += $objp->value;
776 
777  if (!empty($conf->global->PRODUCT_USE_UNITS)) {
778  // Units
779  print '<td align="left">';
780  if (is_null($productstatic->fk_unit)) {
781  $productstatic->fk_unit = 1;
782  }
783  print $langs->trans($productstatic->getLabelOfUnit());
784  print '</td>';
785  }
786 
787  // Price buy PMP
788  print '<td class="right nowraponall">'.price(price2num($objp->ppmp, 'MU')).'</td>';
789 
790  // Total PMP
791  print '<td class="right amount nowraponall">'.price(price2num($objp->ppmp * $objp->value, 'MT')).'</td>';
792  $totalvalue += price2num($objp->ppmp * $objp->value, 'MT');
793 
794  // Price sell min
795  if (empty($conf->global->PRODUIT_MULTIPRICES)) {
796  $pricemin = $objp->price;
797  print '<td class="right">';
798  print price(price2num($pricemin, 'MU'), 1);
799  print '</td>';
800  // Total sell min
801  print '<td class="right">';
802  print price(price2num($pricemin * $objp->value, 'MT'), 1);
803  print '</td>';
804  }
805  $totalvaluesell += price2num($pricemin * $objp->value, 'MT');
806 
807  // Link to transfer
808  if ($user->rights->stock->mouvement->creer) {
809  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).'">';
810  print img_picto($langs->trans("TransferStock"), 'add', 'class="hideonsmartphone pictofixedwidth" style="color: #a69944"');
811  print $langs->trans("TransferStock");
812  print "</a></td>";
813  }
814 
815  // Link to stock
816  if ($user->rights->stock->creer) {
817  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).'">';
818  print img_picto($langs->trans("CorrectStock"), 'add', 'class="hideonsmartphone pictofixedwidth" style="color: #a69944"');
819  print $langs->trans("CorrectStock");
820  print "</a></td>";
821  }
822 
823  print "</tr>";
824 
825  $i++;
826 
827  // Define $unit and $sameunits
828  if (!empty($conf->global->PRODUCT_USE_UNITS)) {
829  if ($i == 0) {
830  $units = $productstatic->fk_unit;
831  } elseif ($productstatic->fk_unit != $units) {
832  $sameunits = false;
833  }
834  }
835  }
836  $db->free($resql);
837 
838  $totalarray['val']['totalunit'] = $totalunit;
839  $totalarray['val']['totalvalue'] = price2num($totalvalue, 'MT');
840  $totalarray['val']['totalvaluesell'] = price2num($totalvaluesell, 'MT');
841  $totalarray['val']['units'] = $langs->trans($productstatic->getLabelOfUnit());
842 
843  $parameters = array('totalarray' => &$totalarray);
844  // Note that $action and $object may have been modified by hook
845  $reshook = $hookmanager->executeHooks('printFieldListTotal', $parameters, $object);
846  if ($reshook < 0) {
847  setEventMessages($hookmanager->error, $hookmanager->errors);
848  }
849 
850  // Show total line
851  include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
852  } else {
853  dol_print_error($db);
854  }
855  print "</table>\n";
856  }
857 
858 
859  // Edit mode
860  if ($action == 'edit' || $action == 're-edit') {
861  $langs->trans("WarehouseEdit");
862 
863  print '<form action="card.php" method="POST">';
864  print '<input type="hidden" name="token" value="'.newToken().'">';
865  print '<input type="hidden" name="action" value="update">';
866  print '<input type="hidden" name="id" value="'.$object->id.'">';
867 
868  $head = stock_prepare_head($object);
869 
870  print dol_get_fiche_head($head, 'card', $langs->trans("Warehouse"), 0, 'stock');
871 
872  print '<table class="border centpercent">';
873 
874  // Ref
875  print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Ref").'</td><td><input name="libelle" size="20" value="'.$object->label.'"></td></tr>';
876 
877  print '<tr><td>'.$langs->trans("LocationSummary").'</td><td><input name="lieu" class="minwidth300" value="'.$object->lieu.'"></td></tr>';
878 
879  // Parent entrepot
880  print '<tr><td>'.$langs->trans("AddIn").'</td><td>';
881  print $formproduct->selectWarehouses($object->fk_parent, 'fk_parent', '', 1);
882  print '</td></tr>';
883 
884  // Project
885  if (!empty($conf->project->enabled)) {
886  $projectid = $object->fk_project;
887  $langs->load('projects');
888  print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">';
889  print img_picto('', 'project').$formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500');
890  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>';
891  print '</td></tr>';
892  }
893 
894  // Description
895  print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
896  // Editeur wysiwyg
897  require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
898  $doleditor = new DolEditor('desc', $object->description, '', 180, 'dolibarr_notes', 'In', false, true, $conf->fckeditor->enabled, ROWS_5, '90%');
899  $doleditor->Create();
900  print '</td></tr>';
901 
902  print '<tr><td>'.$langs->trans('Address').'</td><td><textarea name="address" class="quatrevingtpercent" rows="3" wrap="soft">';
903  print $object->address;
904  print '</textarea></td></tr>';
905 
906  // Zip / Town
907  print '<tr><td>'.$langs->trans('Zip').'</td><td>';
908  print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
909  print '</td></tr>';
910  print '<tr><td>'.$langs->trans('Town').'</td><td>';
911  print $formcompany->select_ziptown($object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id'));
912  print '</td></tr>';
913 
914  // Country
915  print '<tr><td>'.$langs->trans('Country').'</td><td>';
916  print img_picto('', 'globe-americas', 'class="paddingright"');
917  print $form->select_country($object->country_id ? $object->country_id : $mysoc->country_code, 'country_id');
918  if ($user->admin) {
919  print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
920  }
921  print '</td></tr>';
922 
923  // Phone / Fax
924  print '<tr><td class="titlefieldcreate">'.$form->editfieldkey('Phone', 'phone', '', $object, 0).'</td><td>';
925  print img_picto('', 'object_phoning', 'class="paddingright"');
926  print '<input name="phone" size="20" value="'.$object->phone.'"></td></tr>';
927  print '<tr><td class="titlefieldcreate">'.$form->editfieldkey('Fax', 'fax', '', $object, 0).'</td><td>';
928  print img_picto('', 'object_phoning_fax', 'class="paddingright"');
929  print '<input name="fax" size="20" value="'.$object->fax.'"></td></tr>';
930 
931  // Status
932  print '<tr><td>'.$langs->trans("Status").'</td><td>';
933  print '<select id="warehousestatus" name="statut" class="flat">';
934  foreach ($object->statuts as $key => $value) {
935  if ($key == $object->statut) {
936  print '<option value="'.$key.'" selected>'.$langs->trans($value).'</option>';
937  } else {
938  print '<option value="'.$key.'">'.$langs->trans($value).'</option>';
939  }
940  }
941  print '</select>';
942  print ajax_combobox('warehousestatus');
943 
944  print '</td></tr>';
945 
946  // Other attributes
947  $parameters = array('colspan' => ' colspan="3"', 'cols' => '3');
948  $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
949  print $hookmanager->resPrint;
950  if (empty($reshook)) {
951  print $object->showOptionals($extrafields, 'edit', $parameters);
952  }
953 
954  // Tags-Categories
955  if (isModEnabled('categorie')) {
956  print '<tr><td class="tdtop">'.$langs->trans("Categories").'</td><td colspan="3">';
957  $cate_arbo = $form->select_all_categories(Categorie::TYPE_WAREHOUSE, '', 'parent', 64, 0, 1);
958  $c = new Categorie($db);
959  $cats = $c->containing($object->id, Categorie::TYPE_WAREHOUSE);
960  $arrayselected = array();
961  foreach ($cats as $cat) {
962  $arrayselected[] = $cat->id;
963  }
964  print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
965  print "</td></tr>";
966  }
967 
968  print '</table>';
969 
970  print dol_get_fiche_end();
971 
972  print $form->buttonsSaveCancel();
973 
974  print '</form>';
975  }
976  }
977 }
978 
979 /*
980  * Documents generated
981  */
982 
983 $modulepart = 'stock';
984 
985 if ($action != 'create' && $action != 'edit' && $action != 'delete') {
986  print '<br>';
987  print '<div class="fichecenter"><div class="fichehalfleft">';
988  print '<a name="builddoc"></a>'; // ancre
989 
990  // Documents
991  $objectref = dol_sanitizeFileName($object->ref);
992  $relativepath = $object->ref.'/'.$objectref.'.pdf';
993  $filedir = $conf->stock->dir_output.'/'.$objectref;
994  $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
995  $genallowed = $usercanread;
996  $delallowed = $usercancreate;
997  $modulepart = 'stock';
998 
999  print $formfile->showdocuments($modulepart, $objectref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 0, 0, 0, 28, 0, '', 0, '', '', '', $object);
1000  $somethingshown = $formfile->numoffiles;
1001 
1002  print '</div><div class="fichehalfright">';
1003 
1004  $MAXEVENT = 10;
1005 
1006  $morehtmlcenter = '';
1007  //$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/product/stock/agenda.php?id='.$object->id);
1008 
1009  // List of actions on element
1010  include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
1011  $formactions = new FormActions($db);
1012  $somethingshown = $formactions->showactions($object, 'stock', 0, 1, '', $MAXEVENT, '', $morehtmlcenter); // Show all action for product
1013 
1014  print '</div></div>';
1015 }
1016 
1017 // End of page
1018 llxFooter();
1019 $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.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
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