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