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