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