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