dolibarr 18.0.6
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$result = restrictedArea($user, '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', '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->rights->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->rights->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);
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->statuts 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(',', $conf->global->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 (!empty($user->rights->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->rights->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->rights->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 print '<br>';
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 '<table class="noborder centpercent">';
612 print "<tr class=\"liste_titre\">";
613 $parameters = array('totalarray' => &$totalarray);
614 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
615 print $hookmanager->resPrint;
616
617 print_liste_field_titre("Product", "", "p.ref", "&amp;id=".$id, "", "", $sortfield, $sortorder);
618 print_liste_field_titre("Label", "", "p.label", "&amp;id=".$id, "", "", $sortfield, $sortorder);
619 print_liste_field_titre("NumberOfUnit", "", "ps.reel", "&amp;id=".$id, "", '', $sortfield, $sortorder, 'right ');
620 $totalarray['nbfield'] += 3;
621 $totalarray['pos'][$totalarray['nbfield']] = 'totalunit';
622 $totalarray['type'][$totalarray['nbfield']] = 'stock';
623
624 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
625 print_liste_field_titre("Unit", "", "p.fk_unit", "&amp;id=".$id, "", 'align="left"', $sortfield, $sortorder);
626 $totalarray['nbfield']++;
627 $totalarray['pos'][$totalarray['nbfield']] = 'units';
628 $totalarray['type'][$totalarray['nbfield']] = 'string';
629 }
630
631 print_liste_field_titre($form->textwithpicto($langs->trans("AverageUnitPricePMPShort"), $langs->trans("AverageUnitPricePMPDesc")), "", "p.pmp", "&amp;id=".$id, "", '', $sortfield, $sortorder, 'right ');
632 $totalarray['nbfield']++;
633
634 print_liste_field_titre("EstimatedStockValueShort", "", "", "&amp;id=".$id, "", '', $sortfield, $sortorder, 'right ');
635 $totalarray['nbfield']++;
636 $totalarray['pos'][$totalarray['nbfield']] = 'totalvalue';
637 $totalarray['type'][$totalarray['nbfield']] = '';
638
639
640 if (empty($conf->global->PRODUIT_MULTIPRICES)) {
641 print_liste_field_titre("SellPriceMin", "", "p.price", "&amp;id=".$id, "", '', $sortfield, $sortorder, 'right ');
642 $totalarray['nbfield']++;
643 }
644 if (empty($conf->global->PRODUIT_MULTIPRICES)) {
645 print_liste_field_titre("EstimatedStockValueSellShort", "", "", "&amp;id=".$id, "", '', $sortfield, $sortorder, 'right ');
646 $totalarray['nbfield']++;
647 $totalarray['pos'][$totalarray['nbfield']] = 'totalvaluesell';
648 $totalarray['type'][$totalarray['nbfield']] = '';
649 }
650 if ($user->rights->stock->mouvement->creer) {
652 $totalarray['nbfield']++;
653 }
654 if ($user->rights->stock->creer) {
656 $totalarray['nbfield']++;
657 }
658 // Hook fields
659 $parameters = array('sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray' => &$totalarray);
660 $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
661 print $hookmanager->resPrint;
662 print "</tr>\n";
663
664 $totalunit = 0;
665 $totalvalue = $totalvaluesell = 0;
666
667 //For MultiCompany PMP per entity
668 $separatedPMP = false;
669 if (!empty($conf->global->MULTICOMPANY_PRODUCT_SHARING_ENABLED) && !empty($conf->global->MULTICOMPANY_PMP_PER_ENTITY_ENABLED)) {
670 $separatedPMP = true;
671 }
672
673 $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,";
674 $sql .= "p.tosell, p.tobuy,";
675 $sql .= "p.accountancy_code_sell,";
676 $sql .= "p.accountancy_code_sell_intra,";
677 $sql .= "p.accountancy_code_sell_export,";
678 $sql .= "p.accountancy_code_buy,";
679 $sql .= "p.accountancy_code_buy_intra,";
680 $sql .= "p.accountancy_code_buy_export,";
681 $sql .= 'p.barcode,';
682 if ($separatedPMP) {
683 $sql .= " pa.pmp as ppmp,";
684 } else {
685 $sql .= " p.pmp as ppmp,";
686 }
687 $sql .= " ps.reel as value";
688 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
689 $sql .= ",fk_unit";
690 }
691 // Add fields from hooks
692 $parameters = array();
693 $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
694 if ($reshook > 0) { //Note that $sql is replaced if reshook > 0
695 $sql = "";
696 }
697 $sql .= $hookmanager->resPrint;
698 $sql .= " FROM ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."product as p";
699
700 if ($separatedPMP) {
701 $sql .= ", ".MAIN_DB_PREFIX."product_perentity as pa";
702 }
703
704 $sql .= " WHERE ps.fk_product = p.rowid";
705 $sql .= " AND ps.reel <> 0"; // We do not show if stock is 0 (no product in this warehouse)
706 $sql .= " AND ps.fk_entrepot = ".((int) $object->id);
707
708 if ($separatedPMP) {
709 $sql .= " AND pa.fk_product = p.rowid AND pa.entity = ".(int) $conf->entity;
710 }
711
712 $sql .= $db->order($sortfield, $sortorder);
713
714 dol_syslog('List products', LOG_DEBUG);
715 $resql = $db->query($sql);
716 if ($resql) {
717 $num = $db->num_rows($resql);
718 $i = 0;
719 $sameunits = true;
720
721 while ($i < $num) {
722 $objp = $db->fetch_object($resql);
723
724 // Multilangs
725 if (getDolGlobalInt('MAIN_MULTILANGS')) { // si l'option est active
726 $sql = "SELECT label";
727 $sql .= " FROM ".MAIN_DB_PREFIX."product_lang";
728 $sql .= " WHERE fk_product = ".((int) $objp->rowid);
729 $sql .= " AND lang = '".$db->escape($langs->getDefaultLang())."'";
730 $sql .= " LIMIT 1";
731
732 $result = $db->query($sql);
733 if ($result) {
734 $objtp = $db->fetch_object($result);
735 if ($objtp->label != '') {
736 $objp->produit = $objtp->label;
737 }
738 }
739 }
740
741 //print '<td>'.dol_print_date($objp->datem).'</td>';
742 print '<tr class="oddeven">';
743
744 $parameters = array('obj'=>$objp, 'totalarray' => &$totalarray);
745 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
746 print $hookmanager->resPrint;
747
748 $productstatic->id = $objp->rowid;
749 $productstatic->ref = $objp->ref;
750 $productstatic->label = $objp->produit;
751 $productstatic->type = $objp->type;
752 $productstatic->entity = $objp->entity;
753 $productstatic->status_batch = $objp->tobatch;
754 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
755 $productstatic->fk_unit = $objp->fk_unit;
756 }
757 $productstatic->status = $objp->tosell;
758 $productstatic->status_buy = $objp->tobuy;
759 $productstatic->barcode = $objp->barcode;
760 $productstatic->accountancy_code_sell = $objp->accountancy_code_sell;
761 $productstatic->accountancy_code_sell_intra = $objp->accountancy_code_sell_intra;
762 $productstatic->accountancy_code_sell_export = $objp->accountancy_code_sell_export;
763 $productstatic->accountancy_code_buy = $objp->accountancy_code_buy;
764 $productstatic->accountancy_code_buy_intra = $objp->accountancy_code_buy_intra;
765 $productstatic->accountancy_code_buy_export = $objp->accountancy_code_buy_export;
766
767 // Ref
768 print "<td>";
769 print $productstatic->getNomUrl(1, 'stock', 16);
770 print '</td>';
771
772 // Label
773 print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($objp->produit).'">'.dol_escape_htmltag($objp->produit).'</td>';
774
775 // Value
776 print '<td class="right">';
777 $valtoshow = price(price2num($objp->value, 'MS'), 0, '', 0, 0); // TODO replace with a qty() function
778 print empty($valtoshow) ? '0' : $valtoshow;
779 print '</td>';
780 $totalunit += $objp->value;
781
782 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
783 // Units
784 print '<td align="left">';
785 if (is_null($productstatic->fk_unit)) {
786 $productstatic->fk_unit = 1;
787 }
788 print $langs->trans($productstatic->getLabelOfUnit());
789 print '</td>';
790 }
791
792 // Price buy PMP
793 print '<td class="right nowraponall">'.price(price2num($objp->ppmp, 'MU')).'</td>';
794
795 // Total PMP
796 print '<td class="right amount nowraponall">'.price(price2num($objp->ppmp * $objp->value, 'MT')).'</td>';
797 $totalvalue += price2num($objp->ppmp * $objp->value, 'MT');
798
799 // Price sell min
800 if (empty($conf->global->PRODUIT_MULTIPRICES)) {
801 $pricemin = $objp->price;
802 print '<td class="right">';
803 print price(price2num($pricemin, 'MU'), 1);
804 print '</td>';
805 // Total sell min
806 print '<td class="right">';
807 print price(price2num($pricemin * $objp->value, 'MT'), 1);
808 print '</td>';
809 }
810 $totalvaluesell += price2num($pricemin * $objp->value, 'MT');
811
812 // Link to transfer
813 if ($user->rights->stock->mouvement->creer) {
814 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).'">';
815 print img_picto($langs->trans("TransferStock"), 'add', 'class="hideonsmartphone pictofixedwidth" style="color: #a69944"');
816 print $langs->trans("TransferStock");
817 print "</a></td>";
818 }
819
820 // Link to stock
821 if ($user->rights->stock->creer) {
822 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).'">';
823 print img_picto($langs->trans("CorrectStock"), 'add', 'class="hideonsmartphone pictofixedwidth" style="color: #a69944"');
824 print $langs->trans("CorrectStock");
825 print "</a></td>";
826 }
827
828 print "</tr>";
829
830 $i++;
831
832 // Define $unit and $sameunits
833 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
834 if ($i == 0) {
835 $units = $productstatic->fk_unit;
836 } elseif ($productstatic->fk_unit != $units) {
837 $sameunits = false;
838 }
839 }
840 }
841 $db->free($resql);
842
843 $totalarray['val']['totalunit'] = $totalunit;
844 $totalarray['val']['totalvalue'] = price2num($totalvalue, 'MT');
845 $totalarray['val']['totalvaluesell'] = price2num($totalvaluesell, 'MT');
846 $totalarray['val']['units'] = $langs->trans($productstatic->getLabelOfUnit());
847
848 $parameters = array('totalarray' => &$totalarray);
849 // Note that $action and $object may have been modified by hook
850 $reshook = $hookmanager->executeHooks('printFieldListTotal', $parameters, $object);
851 if ($reshook < 0) {
852 setEventMessages($hookmanager->error, $hookmanager->errors);
853 }
854
855 // Show total line
856 include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
857 } else {
858 dol_print_error($db);
859 }
860 print "</table>\n";
861 }
862
863
864 // Edit mode
865 if ($action == 'edit' || $action == 're-edit') {
866 $langs->trans("WarehouseEdit");
867
868 print '<form action="card.php" method="POST">';
869 print '<input type="hidden" name="token" value="'.newToken().'">';
870 print '<input type="hidden" name="action" value="update">';
871 print '<input type="hidden" name="id" value="'.$object->id.'">';
872
873 $head = stock_prepare_head($object);
874
875 print dol_get_fiche_head($head, 'card', $langs->trans("Warehouse"), 0, 'stock');
876
877 print '<table class="border centpercent">';
878
879 // Ref
880 print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Ref").'</td><td><input name="libelle" size="20" value="'.$object->label.'"></td></tr>';
881
882 print '<tr><td>'.$langs->trans("LocationSummary").'</td><td><input name="lieu" class="minwidth300" value="'.$object->lieu.'"></td></tr>';
883
884 // Parent entrepot
885 print '<tr><td>'.$langs->trans("AddIn").'</td><td>';
886 print $formproduct->selectWarehouses($object->fk_parent, 'fk_parent', '', 1);
887 print '</td></tr>';
888
889 // Project
890 if (isModEnabled('project')) {
891 $projectid = $object->fk_project;
892 $langs->load('projects');
893 print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">';
894 print img_picto('', 'project').$formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500');
895 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>';
896 print '</td></tr>';
897 }
898
899 // Description
900 print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
901 // Editeur wysiwyg
902 require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
903 $doleditor = new DolEditor('desc', $object->description, '', 180, 'dolibarr_notes', 'In', false, true, isModEnabled('fckeditor'), ROWS_5, '90%');
904 $doleditor->Create();
905 print '</td></tr>';
906
907 print '<tr><td>'.$langs->trans('Address').'</td><td><textarea name="address" class="quatrevingtpercent" rows="3" wrap="soft">';
908 print $object->address;
909 print '</textarea></td></tr>';
910
911 // Zip / Town
912 print '<tr><td>'.$langs->trans('Zip').'</td><td>';
913 print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
914 print '</td></tr>';
915 print '<tr><td>'.$langs->trans('Town').'</td><td>';
916 print $formcompany->select_ziptown($object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id'));
917 print '</td></tr>';
918
919 // Country
920 print '<tr><td>'.$langs->trans('Country').'</td><td>';
921 print img_picto('', 'globe-americas', 'class="paddingright"');
922 print $form->select_country($object->country_id ? $object->country_id : $mysoc->country_code, 'country_id');
923 if ($user->admin) {
924 print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
925 }
926 print '</td></tr>';
927
928 // Phone / Fax
929 print '<tr><td class="titlefieldcreate">'.$form->editfieldkey('Phone', 'phone', '', $object, 0).'</td><td>';
930 print img_picto('', 'object_phoning', 'class="paddingright"');
931 print '<input name="phone" size="20" value="'.$object->phone.'"></td></tr>';
932 print '<tr><td class="titlefieldcreate">'.$form->editfieldkey('Fax', 'fax', '', $object, 0).'</td><td>';
933 print img_picto('', 'object_phoning_fax', 'class="paddingright"');
934 print '<input name="fax" size="20" value="'.$object->fax.'"></td></tr>';
935
936 // Status
937 print '<tr><td>'.$langs->trans("Status").'</td><td>';
938 print '<select id="warehousestatus" name="statut" class="flat">';
939 foreach ($object->statuts as $key => $value) {
940 if ($key == $object->statut) {
941 print '<option value="'.$key.'" selected>'.$langs->trans($value).'</option>';
942 } else {
943 print '<option value="'.$key.'">'.$langs->trans($value).'</option>';
944 }
945 }
946 print '</select>';
947 print ajax_combobox('warehousestatus');
948
949 print '</td></tr>';
950
951 // Other attributes
952 $parameters = array('colspan' => ' colspan="3"', 'cols' => '3');
953 $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
954 print $hookmanager->resPrint;
955 if (empty($reshook)) {
956 print $object->showOptionals($extrafields, 'edit', $parameters);
957 }
958
959 // Tags-Categories
960 if (isModEnabled('categorie')) {
961 print '<tr><td class="tdtop">'.$langs->trans("Categories").'</td><td colspan="3">';
962 $cate_arbo = $form->select_all_categories(Categorie::TYPE_WAREHOUSE, '', 'parent', 64, 0, 1);
963 $c = new Categorie($db);
964 $cats = $c->containing($object->id, Categorie::TYPE_WAREHOUSE);
965 $arrayselected = array();
966 foreach ($cats as $cat) {
967 $arrayselected[] = $cat->id;
968 }
969 print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
970 print "</td></tr>";
971 }
972
973 print '</table>';
974
975 print dol_get_fiche_end();
976
977 print $form->buttonsSaveCancel();
978
979 print '</form>';
980 }
981 }
982}
983
984/*
985 * Documents generated
986 */
987
988$modulepart = 'stock';
989
990if ($action != 'create' && $action != 'edit' && $action != 'delete') {
991 print '<br>';
992 print '<div class="fichecenter"><div class="fichehalfleft">';
993 print '<a name="builddoc"></a>'; // ancre
994
995 // Documents
996 $objectref = dol_sanitizeFileName($object->ref);
997 $relativepath = $object->ref.'/'.$objectref.'.pdf';
998 $filedir = $conf->stock->dir_output.'/'.$objectref;
999 $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
1000 $genallowed = $usercanread;
1001 $delallowed = $usercancreate;
1002 $modulepart = 'stock';
1003
1004 print $formfile->showdocuments($modulepart, $objectref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 0, 0, 0, 28, 0, '', 0, '', '', '', $object);
1005 $somethingshown = $formfile->numoffiles;
1006
1007 print '</div><div class="fichehalfright">';
1008
1009 $MAXEVENT = 10;
1010
1011 $morehtmlcenter = '';
1012 //$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/product/stock/agenda.php?id='.$object->id);
1013
1014 // List of actions on element
1015 include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
1016 $formactions = new FormActions($db);
1017 $somethingshown = $formactions->showactions($object, 'stock', 0, 1, '', $MAXEVENT, '', $morehtmlcenter); // Show all action for product
1018
1019 print '</div></div>';
1020}
1021
1022// End of page
1023llxFooter();
1024$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