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