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