dolibarr 19.0.4
productlot_card.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2007-2018 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2018 All-3kcis <contact@all-3kcis.fr>
4 * Copyright (C) 2021 Noé Cendrier <noe.cendrier@altairis.fr>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
27// Load Dolibarr environment
28require '../../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
30require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
31require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
32require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
33require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
34require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
35require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php';
36
37global $conf, $db, $langs, $user;
38
39// Load translation files required by the page
40$langs->loadLangs(array('stocks', 'other', 'productbatch'));
41
42// Get parameters
43$id = GETPOST('id', 'int');
44$lineid = GETPOST('lineid', 'int');
45$action = GETPOST('action', 'aZ09');
46$confirm = GETPOST('confirm', 'alpha');
47$cancel = GETPOST('cancel', 'aZ09');
48$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'myobjectcard'; // To manage different context of search
49$backtopage = GETPOST('backtopage', 'alpha');
50
51// Initialize technical objects
52$object = new Productlot($db);
53$extrafields = new ExtraFields($db);
54$hookmanager->initHooks(array('productlotcard', 'globalcard')); // Note that conf->hooks_modules contains array
55
56// Fetch optionals attributes and labels
57$extrafields->fetch_name_optionals_label($object->table_element);
58
59$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
60
61// Initialize array of search criterias
62$search_all = GETPOST("search_all", 'alpha');
63$search = array();
64foreach ($object->fields as $key => $val) {
65 if (GETPOST('search_'.$key, 'alpha')) {
66 $search[$key] = GETPOST('search_'.$key, 'alpha');
67 }
68}
69
70if (empty($action) && empty($id) && empty($ref)) {
71 $action = 'view';
72}
73
74$batch = GETPOST('batch', 'alpha');
75$productid = GETPOST('productid', 'int');
76$ref = GETPOST('ref', 'alpha'); // ref is productid_batch
77
78$search_entity = GETPOST('search_entity', 'int');
79$search_fk_product = GETPOST('search_fk_product', 'int');
80$search_batch = GETPOST('search_batch', 'alpha');
81$search_fk_user_creat = GETPOST('search_fk_user_creat', 'int');
82$search_fk_user_modif = GETPOST('search_fk_user_modif', 'int');
83$search_import_key = GETPOST('search_import_key', 'int');
84
85if (empty($action) && empty($id) && empty($ref)) {
86 $action = 'list';
87}
88
89// Load object
90//include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
91if ($id || $ref) {
92 if ($ref) {
93 $tmp = explode('_', $ref);
94 $productid = $tmp[0];
95 $batch = $tmp[1];
96 }
97 $object->fetch($id, $productid, $batch);
98 $object->ref = $object->batch; // Old system for document management ( it uses $object->ref)
99 $upload_dir = $conf->productbatch->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, $modulepart);
100 $filearray = dol_dir_list($upload_dir, "files");
101 if (empty($filearray)) {
102 // If no files linked yet, use new system on lot id. (Batch is not unique and can be same on different product)
103 $object->fetch($id, $productid, $batch);
104 }
105}
106
107// Initialize technical object to manage hooks of modules. Note that conf->hooks_modules contains array array
108$hookmanager->initHooks(array('productlotcard', 'globalcard'));
109
110
111$permissionnote = $user->hasRight('stock', 'creer'); // Used by the include of actions_setnotes.inc.php
112$permissiondellink = $user->hasRight('stock', 'creer'); // Used by the include of actions_dellink.inc.php
113$permissiontoadd = $user->hasRight('stock', 'creer'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
114
115$usercanread = $user->hasRight('produit', 'lire');
116$usercancreate = $user->hasRight('produit', 'creer');
117$usercandelete = $user->hasRight('produit', 'supprimer');
118
119$upload_dir = $conf->productbatch->multidir_output[$conf->entity];
120
121$permissiontoread = $usercanread;
122$permissiontoadd = $usercancreate;
123$permissiontodelete = $usercandelete;
124
125// Security check
126if (!isModEnabled('productbatch')) {
127 accessforbidden('Module not enabled');
128}
129$socid = 0;
130if ($user->socid > 0) { // Protection if external user
131 //$socid = $user->socid;
133}
134//$result = restrictedArea($user, 'productbatch');
135if (!$permissiontoread) {
137}
138
139
140/*
141 * Actions
142 */
143
144$parameters = array();
145$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
146if ($reshook < 0) {
147 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
148}
149
150if (empty($reshook)) {
151 $error = 0;
152
153 $backurlforlist = dol_buildpath('/product/stock/productlot_list.php', 1);
154
155 if ($action == 'seteatby' && $user->hasRight('stock', 'creer') && ! GETPOST('cancel', 'alpha')) {
156 $newvalue = dol_mktime(12, 0, 0, GETPOST('eatbymonth', 'int'), GETPOST('eatbyday', 'int'), GETPOST('eatbyyear', 'int'));
157 $result = $object->setValueFrom('eatby', $newvalue, '', null, 'date', '', $user, 'PRODUCTLOT_MODIFY');
158 if ($result < 0) {
159 setEventMessages($object->error, null, 'errors');
160 $action = 'editeatby';
161 } else {
162 $action = 'view';
163 }
164 }
165
166 if ($action == 'setsellby' && $user->hasRight('stock', 'creer') && ! GETPOST('cancel', 'alpha')) {
167 $newvalue = dol_mktime(12, 0, 0, GETPOST('sellbymonth', 'int'), GETPOST('sellbyday', 'int'), GETPOST('sellbyyear', 'int'));
168 $result = $object->setValueFrom('sellby', $newvalue, '', null, 'date', '', $user, 'PRODUCTLOT_MODIFY');
169 if ($result < 0) {
170 setEventMessages($object->error, null, 'errors');
171 $action = 'editsellby';
172 } else {
173 $action = 'view';
174 }
175 }
176
177 if ($action == 'seteol_date' && $user->hasRight('stock', 'creer') && ! GETPOST('cancel', 'alpha')) {
178 $newvalue = dol_mktime(12, 0, 0, GETPOST('eol_datemonth', 'int'), GETPOST('eol_dateday', 'int'), GETPOST('eol_dateyear', 'int'));
179 $result = $object->setValueFrom('eol_date', $newvalue, '', null, 'date', '', $user, 'PRODUCTLOT_MODIFY');
180 if ($result < 0) {
181 setEventMessages($object->error, null, 'errors');
182 $action = 'editeol_date';
183 } else {
184 $action = 'view';
185 }
186 }
187
188 if ($action == 'setmanufacturing_date' && $user->hasRight('stock', 'creer') && ! GETPOST('cancel', 'alpha')) {
189 $newvalue = dol_mktime(12, 0, 0, GETPOST('manufacturing_datemonth', 'int'), GETPOST('manufacturing_dateday', 'int'), GETPOST('manufacturing_dateyear', 'int'));
190 $result = $object->setValueFrom('manufacturing_date', $newvalue, '', null, 'date', '', $user, 'PRODUCTLOT_MODIFY');
191 if ($result < 0) {
192 setEventMessages($object->error, null, 'errors');
193 $action = 'editmanufacturing_date';
194 } else {
195 $action = 'view';
196 }
197 }
198
199 if ($action == 'setscrapping_date' && $user->hasRight('stock', 'creer') && ! GETPOST('cancel', 'alpha')) {
200 $newvalue = dol_mktime(12, 0, 0, GETPOST('scrapping_datemonth', 'int'), GETPOST('scrapping_dateday', 'int'), GETPOST('scrapping_dateyear', 'int'));
201 $result = $object->setValueFrom('scrapping_date', $newvalue, '', null, 'date', '', $user, 'PRODUCTLOT_MODIFY');
202 if ($result < 0) {
203 setEventMessages($object->error, null, 'errors');
204 $action = 'editscrapping_date';
205 } else {
206 $action = 'view';
207 }
208 }
209
210 /* if ($action == 'setcommissionning_date' && $user->hasRight('stock', 'creer') && ! GETPOST('cancel', 'alpha')) {
211 $newvalue = dol_mktime(12, 0, 0, GETPOST('commissionning_datemonth', 'int'), GETPOST('commissionning_dateday', 'int'), GETPOST('commissionning_dateyear', 'int'));
212 $result = $object->setValueFrom('commissionning_date', $newvalue, '', null, 'date', '', $user, 'PRODUCTLOT_MODIFY');
213 if ($result < 0) {
214 setEventMessages($object->error, null, 'errors');
215 $action == 'editcommissionning_date';
216 } else {
217 $action = 'view';
218 }
219 } */
220
221 if ($action == 'setqc_frequency' && $user->hasRight('stock', 'creer') && ! GETPOST('cancel', 'alpha')) {
222 $result = $object->setValueFrom('qc_frequency', GETPOST('qc_frequency'), '', null, 'int', '', $user, 'PRODUCT_MODIFY');
223 if ($result < 0) { // Prévoir un test de format de durée
224 setEventMessages($object->error, null, 'errors');
225 $action = 'editqc_frequency';
226 } else {
227 $action = 'view';
228 }
229 }
230
231 $triggermodname = 'PRODUCT_LOT_MODIFY'; // Name of trigger action code to execute when we modify record
232
233 // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen
234 include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
235 /*
236 if ($action == 'update_extras') {
237 $object->oldcopy = dol_clone($object, 2);
238
239 // Fill array 'array_options' with data from update form
240 $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml'));
241 if ($ret < 0) $error++;
242
243 if (!$error) {
244 // Actions on extra fields
245 $result = $object->insertExtraFields('PRODUCT_LOT_MODIFY');
246 if ($result < 0) {
247 setEventMessages($object->error, $object->errors, 'errors');
248 $error++;
249 }
250 }
251
252 if ($error) {
253 $action = 'edit_extras';
254 }
255 }
256
257 // Action to add record
258 if ($action == 'add') {
259 if (GETPOST('cancel', 'alpha')) {
260 $urltogo = $backtopage ? $backtopage : dol_buildpath('/stock/list.php', 1);
261 header("Location: ".$urltogo);
262 exit;
263 }
264
265 $error = 0;
266
267 $object->entity = GETPOST('entity', 'int');
268 $object->fk_product = GETPOST('fk_product', 'int');
269 $object->batch = GETPOST('batch', 'alpha');
270 $object->fk_user_creat = GETPOST('fk_user_creat', 'int');
271 $object->fk_user_modif = GETPOST('fk_user_modif', 'int');
272 $object->import_key = GETPOST('import_key', 'int');
273
274 if (empty($object->ref)) {
275 $error++;
276 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Ref")), null, 'errors');
277 }
278
279 if (!$error) {
280 $result = $object->create($user);
281 if ($result > 0) {
282 // Creation OK
283 $urltogo = $backtopage ? $backtopage : dol_buildpath('/stock/list.php', 1);
284 header("Location: ".$urltogo);
285 exit;
286 }
287 {
288 // Creation KO
289 if (!empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
290 else setEventMessages($object->error, null, 'errors');
291 $action = 'create';
292 }
293 } else {
294 $action = 'create';
295 }
296 }
297
298 // Cancel
299 if ($action == 'update' && GETPOST('cancel', 'alpha')) $action = 'view';
300
301 // Action to update record
302 if ($action == 'update' && !GETPOST('cancel', 'alpha')) {
303 $error = 0;
304
305 $object->entity = GETPOST('entity', 'int');
306 $object->fk_product = GETPOST('fk_product', 'int');
307 $object->batch = GETPOST('batch', 'alpha');
308 $object->fk_user_creat = GETPOST('fk_user_creat', 'int');
309 $object->fk_user_modif = GETPOST('fk_user_modif', 'int');
310 $object->import_key = GETPOST('import_key', 'int');
311
312 if (empty($object->ref)) {
313 $error++;
314 setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Ref")), null, 'errors');
315 }
316
317 if (!$error) {
318 $result = $object->update($user);
319 if ($result > 0) {
320 $action = 'view';
321 } else {
322 // Creation KO
323 if (!empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
324 else setEventMessages($object->error, null, 'errors');
325 $action = 'edit';
326 }
327 } else {
328 $action = 'edit';
329 }
330 }
331
332 // Action to delete
333 if ($action == 'confirm_delete') {
334 $result = $object->delete($user);
335 if ($result > 0) {
336 // Delete OK
337 setEventMessages("RecordDeleted", null, 'mesgs');
338 header("Location: ".dol_buildpath('/stock/list.php', 1));
339 exit;
340 } else {
341 if (!empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
342 else setEventMessages($object->error, null, 'errors');
343 }
344 }
345 */
346 // Action to build doc
347 include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
348
349 // Actions to send emails
350 $triggersendname = 'PRODUCT_LOT_SENTBYMAIL';
351 $autocopy = 'MAIN_MAIL_AUTOCOPY_PRODUCT_LOT_TO';
352 $trackid = 'productlot'.$object->id;
353 include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
354}
355
356
357
358
359/*
360 * View
361 */
362
363$form = new Form($db);
364$formfile = new FormFile($db);
365
366$title = $langs->trans("ProductLot");
367$help_url = '';
368
369llxHeader('', $title, $help_url);
370
371
372// Part to create
373if ($action == 'create') {
374 print load_fiche_titre($langs->trans("Batch"), '', 'object_'.$object->picto);
375
376 print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
377 print '<input type="hidden" name="token" value="'.newToken().'">';
378 print '<input type="hidden" name="action" value="add">';
379 if ($backtopage) {
380 print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
381 }
382 if ($backtopageforcancel) {
383 print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
384 }
385
386 print dol_get_fiche_head(array(), '');
387
388 print '<table class="border centpercent tableforfieldcreate">'."\n";
389
390 // Common attributes
391 include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php';
392
393 // Other attributes
394 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
395
396 print '</table>'."\n";
397
398 print dol_get_fiche_end();
399
400 print $form->buttonsSaveCancel("Create");
401
402 print '</form>';
403
404 //dol_set_focus('input[name="ref"]');
405}
406
407
408// Part to show record
409if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) {
410 $res = $object->fetch_optionals();
411
412 $head = productlot_prepare_head($object);
413 print dol_get_fiche_head($head, 'card', $langs->trans("Batch"), -1, $object->picto);
414
415 $formconfirm = '';
416
417 // Confirmation to delete
418 if ($action == 'delete') {
419 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteBatch'), $langs->trans('ConfirmDeleteBatch'), 'confirm_delete', '', 0, 1);
420 }
421
422 // Call Hook formConfirm
423 $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
424 $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
425 if (empty($reshook)) {
426 $formconfirm .= $hookmanager->resPrint;
427 } elseif ($reshook > 0) {
428 $formconfirm = $hookmanager->resPrint;
429 }
430
431 // Print form confirm
432 print $formconfirm;
433
434 // Object card
435 // ------------------------------------------------------------
436 $linkback = '<a href="'.DOL_URL_ROOT.'/product/stock/productlot_list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
437
438 $shownav = 1;
439 if ($user->socid && !in_array('batch', explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')))) {
440 $shownav = 0;
441 }
442
443 $morehtmlref = '';
444
445 dol_banner_tab($object, 'id', $linkback, $shownav, 'rowid', 'batch', $morehtmlref);
446
447 print '<div class="fichecenter">';
448 print '<div class="underbanner clearboth"></div>';
449 print '<table class="border centpercent tableforfield">'."\n";
450
451 // Product
452 print '<tr><td class="titlefield">'.$langs->trans("Product").'</td><td>';
453 $producttmp = new Product($db);
454 $producttmp->fetch($object->fk_product);
455 print $producttmp->getNomUrl(1, 'stock')." - ".$producttmp->label;
456 print '</td></tr>';
457
458 // Sell by
459 if (!getDolGlobalString('PRODUCT_DISABLE_SELLBY')) {
460 print '<tr><td>';
461 print $form->editfieldkey($langs->trans('SellByDate'), 'sellby', $object->sellby, $object, $user->hasRight('stock', 'creer'), 'datepicker');
462 print '</td><td>';
463 print $form->editfieldval($langs->trans('SellByDate'), 'sellby', $object->sellby, $object, $user->hasRight('stock', 'creer'), 'datepicker', '', null, null, '', 1, '', 'id', 'auto', array(), $action);
464 print '</td>';
465 print '</tr>';
466 }
467
468 // Eat by
469 if (!getDolGlobalString('PRODUCT_DISABLE_EATBY')) {
470 print '<tr><td>';
471 print $form->editfieldkey($langs->trans('EatByDate'), 'eatby', $object->eatby, $object, $user->hasRight('stock', 'creer'), 'datepicker');
472 print '</td><td>';
473 print $form->editfieldval($langs->trans('EatByDate'), 'eatby', $object->eatby, $object, $user->hasRight('stock', 'creer'), 'datepicker', '', null, null, '', 1, '', 'id', 'auto', array(), $action);
474 print '</td>';
475 print '</tr>';
476 }
477
478 if (getDolGlobalString('PRODUCT_LOT_ENABLE_TRACEABILITY')) {
479 print '<tr><td>'.$form->editfieldkey($langs->trans('ManufacturingDate'), 'manufacturing_date', $object->manufacturing_date, $object, $user->hasRight('stock', 'creer')).'</td>';
480 print '<td>'.$form->editfieldval($langs->trans('ManufacturingDate'), 'manufacturing_date', $object->manufacturing_date, $object, $user->hasRight('stock', 'creer'), 'datepicker').'</td>';
481 print '</tr>';
482 // print '<tr><td>'.$form->editfieldkey($langs->trans('FirstUseDate'), 'commissionning_date', $object->commissionning_date, $object, $user->hasRight('stock', 'creer')).'</td>';
483 // print '<td>'.$form->editfieldval($langs->trans('FirstUseDate'), 'commissionning_date', $object->commissionning_date, $object, $user->hasRight('stock', 'creer'), 'datepicker').'</td>';
484 // print '</tr>';
485 print '<tr><td>'.$form->editfieldkey($langs->trans('DestructionDate'), 'scrapping_date', $object->scrapping_date, $object, $user->hasRight('stock', 'creer')).'</td>';
486 print '<td>'.$form->editfieldval($langs->trans('DestructionDate'), 'scrapping_date', $object->scrapping_date, $object, $user->hasRight('stock', 'creer'), 'datepicker').'</td>';
487 print '</tr>';
488 }
489
490 // Quality control
491 if (getDolGlobalString('PRODUCT_LOT_ENABLE_QUALITY_CONTROL')) {
492 print '<tr><td>'.$form->editfieldkey($langs->trans('EndOfLife'), 'eol_date', $object->eol_date, $object, $user->hasRight('stock', 'creer')).'</td>';
493 print '<td>'.$form->editfieldval($langs->trans('EndOfLife'), 'eol_date', $object->eol_date, $object, $user->hasRight('stock', 'creer'), 'datepicker').'</td>';
494 print '</tr>';
495 print '<tr><td>'.$form->editfieldkey($langs->trans('QCFrequency'), 'qc_frequency', $object->qc_frequency, $object, $user->hasRight('stock', 'creer')).'</td>';
496 print '<td>'.$form->editfieldval($langs->trans('QCFrequency'), 'qc_frequency', $object->qc_frequency, $object, $user->hasRight('stock', 'creer'), 'string').'</td>';
497 print '</tr>';
498 print '<tr><td>'.$form->editfieldkey($langs->trans('Lifetime'), 'lifetime', $object->lifetime, $object, $user->hasRight('stock', 'creer')).'</td>';
499 print '<td>'.$form->editfieldval($langs->trans('Lifetime'), 'lifetime', $object->lifetime, $object, $user->hasRight('stock', 'creer'), 'string').'</td>';
500 print '</tr>';
501 }
502
503 // Other attributes
504 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
505
506 print '</table>';
507
508 print '</div>';
509
510 print '<div class="clearboth"></div>';
511
512 print dol_get_fiche_end();
513
514 // Link to other lists
515 print '<a href="'.DOL_URL_ROOT.'/product/reassortlot.php?sref='.urlencode($producttmp->ref).'&search_batch='.urlencode($object->batch).'">'.img_object('', 'stock', 'class="pictofixedwidth"').$langs->trans("ShowCurrentStockOfLot").'</a><br>';
516 print '<br>';
517 print '<a href="'.DOL_URL_ROOT.'/product/stock/movement_list.php?search_product_ref='.urlencode($producttmp->ref).'&search_batch='.urlencode($object->batch).'">'.img_object('', 'movement', 'class="pictofixedwidth"').$langs->trans("ShowLogOfMovementIfLot").'</a><br>';
518
519 print '<br>';
520
521
522 // Buttons for actions
523 if ($action != 'presend' && $action != 'editline') {
524 print '<div class="tabsAction">'."\n";
525 $parameters = array();
526 $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
527 if ($reshook < 0) {
528 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
529 }
530
531 if (empty($reshook)) {
532 /*TODO
533 if ($user->hasRight('stock', 'lire')) {
534 print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a></div>'."\n";
535 }
536 */
537 print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete);
538 }
539
540 print '</div>'."\n";
541 }
542}
543
544
545
546/*
547 * Generated documents
548 */
549
550if ($action != 'presend') {
551 print '<div class="fichecenter"><div class="fichehalfleft">';
552 print '<a name="builddoc"></a>'; // ancre
553
554 $includedocgeneration = 1;
555
556 // Documents
557 if ($includedocgeneration) {
558 $objref = dol_sanitizeFileName($object->ref);
559 $relativepath = $objref.'/'.$objref.'.pdf';
560 $filedir = $conf->productbatch->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'product_batch');
561 $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
562 $genallowed = $usercanread; // If you can read, you can build the PDF to read content
563 $delallowed = $usercancreate; // If you can create/edit, you can remove a file on card
564 print $formfile->showdocuments('product_batch', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 0, 0, 0, 28, 0, '', 0, '', (empty($object->default_lang) ? '' : $object->default_lang), '', $object);
565 }
566
567 print '</div><div class="fichehalfright">';
568
569 $MAXEVENT = 10;
570
571 include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
572 $formactions = new FormActions($db);
573 $somethingshown = $formactions->showactions($object, 'productlot', 0, 1, '', $MAXEVENT);
574
575 print '</div></div>';
576}
577
578// End of page
579llxFooter();
580$db->close();
if(preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) if(preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) if($action=='set') elseif( $action=='specimen') elseif($action=='setmodel') elseif( $action=='del') elseif($action=='setdoc') $formactions
View.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:55
llxFooter()
Empty footer.
Definition wrapper.php:69
Class to manage standard extra fields.
Class to manage building of HTML components.
Class to offer components to list and upload files.
Class to manage generation of HTML components Only common components must be here.
Class to manage products or services.
Class with list of lots and properties.
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
Definition files.lib.php:62
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
productlot_prepare_head($object)
Prepare array with list of tabs.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.