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