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