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