26require
'../main.inc.php';
27require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
28require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/mouvementstock.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
40$langs->loadLangs(array(
"mrp",
"stocks",
"other"));
45$action =
GETPOST(
'action',
'aZ09');
46$confirm =
GETPOST(
'confirm',
'alpha');
47$cancel =
GETPOST(
'cancel',
'aZ09');
48$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'mostockmovement';
49$backtopage =
GETPOST(
'backtopage',
'alpha');
50$optioncss =
GETPOST(
'optioncss',
'aZ');
51$massaction =
GETPOST(
'massaction',
'aZ09');
52$lineid =
GETPOST(
'lineid',
'int');
56$month =
GETPOST(
"month",
'int');
58$search_ref =
GETPOST(
'search_ref',
'alpha');
59$search_movement =
GETPOST(
"search_movement",
'alpha');
60$search_product_ref = trim(
GETPOST(
"search_product_ref",
'alpha'));
61$search_product = trim(
GETPOST(
"search_product",
'alpha'));
62$search_warehouse = trim(
GETPOST(
"search_warehouse",
'alpha'));
63$search_inventorycode = trim(
GETPOST(
"search_inventorycode",
'alpha'));
64$search_user = trim(
GETPOST(
"search_user",
'alpha'));
65$search_batch = trim(
GETPOST(
"search_batch",
'alpha'));
66$search_qty = trim(
GETPOST(
"search_qty",
'alpha'));
67$search_type_mouvement =
GETPOST(
'search_type_mouvement',
'int');
69$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
70$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
71$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
72$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
73if (empty($page) || $page == -1) {
76$offset = $limit * $page;
78 $sortfield =
"m.datem";
87$diroutputmassaction = $conf->mrp->dir_output.
'/temp/massgeneration/'.$user->id;
88$hookmanager->initHooks(array(
'mocard',
'globalcard'));
91$extrafields->fetch_name_optionals_label($object->table_element);
93$search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
96$search_all = trim(
GETPOST(
"search_all",
'alpha'));
98foreach ($object->fields as $key => $val) {
99 if (
GETPOST(
'search_'.$key,
'alpha')) {
100 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
104if (empty($action) && empty($id) && empty($ref)) {
109include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
114$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
115$result =
restrictedArea($user,
'mrp', $object->id,
'mrp_mo',
'',
'fk_soc',
'rowid', $isdraft);
121 'm.rowid'=>array(
'label'=>
"Ref",
'checked'=>1,
'position'=>1),
122 'm.datem'=>array(
'label'=>
"Date",
'checked'=>1,
'position'=>2),
123 'p.ref'=>array(
'label'=>
"ProductRef",
'checked'=>1,
'css'=>
'maxwidth100',
'position'=>3),
124 'p.label'=>array(
'label'=>
"ProductLabel",
'checked'=>0,
'position'=>5),
125 'm.batch'=>array(
'label'=>
"BatchNumberShort",
'checked'=>1,
'position'=>8,
'enabled'=>(isModEnabled(
'productbatch'))),
126 'pl.eatby'=>array(
'label'=>
"EatByDate",
'checked'=>0,
'position'=>9,
'enabled'=>(isModEnabled(
'productbatch'))),
127 'pl.sellby'=>array(
'label'=>
"SellByDate",
'checked'=>0,
'position'=>10,
'enabled'=>(isModEnabled(
'productbatch'))),
128 'e.ref'=>array(
'label'=>
"Warehouse",
'checked'=>1,
'position'=>100,
'enabled'=>(!($id > 0))),
129 'm.fk_user_author'=>array(
'label'=>
"Author",
'checked'=>0,
'position'=>120),
130 'm.inventorycode'=>array(
'label'=>
"InventoryCodeShort",
'checked'=>1,
'position'=>130),
131 'm.label'=>array(
'label'=>
"MovementLabel",
'checked'=>1,
'position'=>140),
132 'm.type_mouvement'=>array(
'label'=>
"TypeMovement",
'checked'=>0,
'position'=>150),
133 'origin'=>array(
'label'=>
"Origin",
'checked'=>1,
'position'=>155),
134 'm.fk_projet'=>array(
'label'=>
'Project',
'checked'=>0,
'position'=>180),
135 'm.value'=>array(
'label'=>
"Qty",
'checked'=>1,
'position'=>200),
136 'm.price'=>array(
'label'=>
"UnitPurchaseValue",
'checked'=>0,
'position'=>210)
141 unset($arrayfields[
'pl.sellby']);
144 unset($arrayfields[
'pl.eatby']);
146$objectlist->fields =
dol_sort_array($objectlist->fields,
'position');
150$permissionnote = $user->rights->mrp->write;
151$permissiondellink = $user->rights->mrp->write;
152$permissiontoadd = $user->rights->mrp->write;
153$permissiontodelete = $user->rights->mrp->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
154$upload_dir = $conf->mrp->multidir_output[isset($object->entity) ? $object->entity : 1];
156$permissiontoproduce = $permissiontoadd;
157$permissiontoupdatecost = $user->hasRight(
'bom',
'write');
159if ($permissiontoupdatecost) {
160 $arrayfields[
'm.price'][
'enabled'] = 1;
163$arrayofselected = array();
170if (
GETPOST(
'cancel',
'alpha')) {
174if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
178$parameters = array();
179$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
184include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
187if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
191 $search_movement =
"";
192 $search_type_mouvement =
"";
193 $search_inventorycode =
"";
194 $search_product_ref =
"";
195 $search_product =
"";
196 $search_warehouse =
"";
202 $search_array_options = array();
205if (empty($reshook)) {
210 if (empty($backtopage) || ($cancel && empty($id))) {
212 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
213 $backtopage = $backurlforlist;
215 $backtopage = DOL_URL_ROOT.
'/mrp/mo_production.php?id='.($id > 0 ? $id :
'__ID__');
218 $triggermodname =
'MO_MODIFY';
221 include DOL_DOCUMENT_ROOT.
'/core/actions_addupdatedelete.inc.php';
224 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
227 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
230 $triggersendname =
'MO_SENTBYMAIL';
231 $autocopy =
'MAIN_MAIL_AUTOCOPY_MO_TO';
232 $trackid =
'mo'.$object->id;
233 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
238 if ($action ==
'set_thirdparty' && $permissiontoadd) {
239 $object->setValueFrom(
'fk_soc',
GETPOST(
'fk_soc',
'int'),
'',
'',
'date',
'', $user, $triggermodname);
241 if ($action ==
'classin' && $permissiontoadd) {
242 $object->setProject(
GETPOST(
'projectid',
'int'));
245 if ($action ==
'confirm_reopen') {
246 $result = $object->setStatut($object::STATUS_INPROGRESS, 0,
'',
'MRP_REOPEN');
256$form =
new Form($db);
259$productstatic =
new Product($db);
261$warehousestatic =
new Entrepot($db);
262$userstatic =
new User($db);
264$help_url =
'EN:Module_Manufacturing_Orders|FR:Module_Ordres_de_Fabrication|DE:Modul_Fertigungsauftrag';
266llxHeader(
'', $langs->trans(
'Mo'), $help_url);
269if ($object->id > 0 && (empty($action) || ($action !=
'edit' && $action !=
'create'))) {
270 $res = $object->fetch_thirdparty();
271 $res = $object->fetch_optionals();
275 print
dol_get_fiche_head($head,
'stockmovement', $langs->trans(
"ManufacturingOrder"), -1, $object->picto);
280 if ($action ==
'delete') {
281 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'DeleteMo'), $langs->trans(
'ConfirmDeleteMo'),
'confirm_delete',
'', 0, 1);
284 if ($action ==
'deleteline') {
285 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&lineid='.$lineid, $langs->trans(
'DeleteLine'), $langs->trans(
'ConfirmDeleteLine'),
'confirm_deleteline',
'', 0, 1);
288 if ($action ==
'clone') {
290 $formquestion = array();
291 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneMo', $object->ref),
'confirm_clone', $formquestion,
'yes', 1);
295 if ($action ==
'xxx') {
296 $formquestion = array();
307 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'XXX'), $text,
'confirm_xxx', $formquestion, 0, 1, 220);
311 $parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
312 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
313 if (empty($reshook)) {
314 $formconfirm .= $hookmanager->resPrint;
315 } elseif ($reshook > 0) {
316 $formconfirm = $hookmanager->resPrint;
325 $linkback =
'<a href="'.dol_buildpath(
'/mrp/mo_list.php', 1).
'?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
327 $morehtmlref =
'<div class="refidno">';
333 if (is_object($object->thirdparty)) {
334 $morehtmlref .= $object->thirdparty->getNomUrl(1,
'customer');
336 $morehtmlref .=
' (<a href="'.DOL_URL_ROOT.
'/commande/list.php?socid='.$object->thirdparty->id.
'&search_societe='.urlencode($object->thirdparty->name).
'">'.$langs->trans(
"OtherOrders").
'</a>)';
340 if (isModEnabled(
'project')) {
341 $langs->load(
"projects");
342 if (is_object($object->thirdparty)) {
343 $morehtmlref .=
'<br>';
345 if ($permissiontoadd) {
346 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
347 if ($action !=
'classify') {
348 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
350 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
352 if (!empty($object->fk_project)) {
354 $proj->fetch($object->fk_project);
355 $morehtmlref .= $proj->getNomUrl(1);
357 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
362 $morehtmlref .=
'</div>';
365 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
368 print
'<div class="fichecenter">';
369 print
'<div class="fichehalfleft">';
370 print
'<div class="underbanner clearboth"></div>';
371 print
'<table class="border centpercent tableforfield">'.
"\n";
374 $keyforbreak =
'fk_warehouse';
375 unset($object->fields[
'fk_project']);
376 unset($object->fields[
'fk_soc']);
377 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_view.tpl.php';
380 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
386 print
'<div class="clearboth"></div>';
424 $sql =
"SELECT p.rowid, p.ref as product_ref, p.label as produit, p.tobatch, p.fk_product_type as type, p.entity,";
425 $sql .=
" e.ref as warehouse_ref, e.rowid as entrepot_id, e.lieu,";
426 $sql .=
" m.rowid as mid, m.value as qty, m.datem, m.fk_user_author, m.label, m.inventorycode, m.fk_origin, m.origintype,";
427 $sql .=
" m.batch, m.price,";
428 $sql .=
" m.type_mouvement,";
429 $sql .=
" pl.rowid as lotid, pl.eatby, pl.sellby,";
430 $sql .=
" u.login, u.photo, u.lastname, u.firstname";
432 if (!empty($extrafields->attributes[$objectlist->table_element][
'label'])) {
433 foreach ($extrafields->attributes[$objectlist->table_element][
'label'] as $key => $val) {
434 $sql .= ($extrafields->attributes[$objectlist->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
438 $parameters = array();
439 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
440 $sql .= $hookmanager->resPrint;
441 $sql .=
" FROM ".MAIN_DB_PREFIX.
"entrepot as e,";
442 $sql .=
" ".MAIN_DB_PREFIX.
"product as p,";
443 $sql .=
" ".MAIN_DB_PREFIX.
"stock_mouvement as m";
444 if (!empty($extrafields->attributes[$objectlist->table_element]) && is_array($extrafields->attributes[$objectlist->table_element][
'label']) && count($extrafields->attributes[$objectlist->table_element][
'label'])) {
445 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$objectlist->table_element.
"_extrafields as ef on (m.rowid = ef.fk_object)";
447 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"user as u ON m.fk_user_author = u.rowid";
448 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product_lot as pl ON m.batch = pl.batch AND m.fk_product = pl.fk_product";
449 $sql .=
" WHERE m.fk_product = p.rowid";
450 $sql .=
" AND m.origintype = 'mo' AND m.fk_origin = ".(int) $object->id;
452 $sql .=
" AND m.rowid = ".((int) $msid);
454 $sql .=
" AND m.fk_entrepot = e.rowid";
455 $sql .=
" AND e.entity IN (".getEntity(
'stock').
")";
457 $sql .=
" AND p.fk_product_type = 0";
460 if (!empty($search_ref)) {
463 if (!empty($search_movement)) {
466 if (!empty($search_inventorycode)) {
469 if (!empty($search_product_ref)) {
472 if (!empty($search_product)) {
475 if ($search_warehouse !=
'' && $search_warehouse !=
'-1') {
478 if (!empty($search_user)) {
479 $sql .=
natural_search(array(
'u.lastname',
'u.firstname',
'u.login'), $search_user);
481 if (!empty($search_batch)) {
484 if ($search_qty !=
'') {
487 if ($search_type_mouvement !=
'' && $search_type_mouvement !=
'-1') {
488 $sql .=
natural_search(
'm.type_mouvement', $search_type_mouvement, 2);
491 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
493 $parameters = array();
494 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
495 $sql .= $hookmanager->resPrint;
496 $sql .= $db->order($sortfield, $sortorder);
498 $nbtotalofrecords =
'';
500 $result = $db->query($sql);
501 $nbtotalofrecords = $db->num_rows($result);
502 if (($page * $limit) > $nbtotalofrecords) {
507 $sql .= $db->plimit($limit + 1, $offset);
509 $resql = $db->query($sql);
513 $num = $db->num_rows($resql);
516 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
517 $param .=
'&contextpage='.urlencode($contextpage);
519 if ($limit > 0 && $limit != $conf->liste_limit) {
520 $param .=
'&limit='.((int) $limit);
523 $param .=
'&id='.urlencode($id);
525 if ($search_movement) {
526 $param .=
'&search_movement='.urlencode($search_movement);
528 if ($search_inventorycode) {
529 $param .=
'&search_inventorycode='.urlencode($search_inventorycode);
531 if ($search_type_mouvement) {
532 $param .=
'&search_type_mouvement='.urlencode($search_type_mouvement);
534 if ($search_product_ref) {
535 $param .=
'&search_product_ref='.urlencode($search_product_ref);
537 if ($search_product) {
538 $param .=
'&search_product='.urlencode($search_product);
541 $param .=
'&search_batch='.urlencode($search_batch);
543 if ($search_warehouse > 0) {
544 $param .=
'&search_warehouse='.urlencode($search_warehouse);
547 $param .=
'&search_user='.urlencode($search_user);
551 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
554 $arrayofmassactions = array(
559 if (in_array($massaction, array(
'presend',
'predelete'))) {
560 $arrayofmassactions = array();
562 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
564 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
565 if ($optioncss !=
'') {
566 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
568 print
'<input type="hidden" name="token" value="'.newToken().
'">';
569 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
570 print
'<input type="hidden" name="action" value="list">';
571 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
572 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
573 print
'<input type="hidden" name="page" value="'.$page.
'">';
574 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
576 print
'<input type="hidden" name="id" value="'.$id.
'">';
580 print_barre_liste(
'', $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'', 0,
'',
'', $limit);
582 print_barre_liste(
'', $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'generic', 0,
'',
'', $limit);
587 $parameters = array();
588 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
589 if (empty($reshook)) {
590 $moreforfilter .= $hookmanager->resPrint;
592 $moreforfilter = $hookmanager->resPrint;
595 if (!empty($moreforfilter)) {
596 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
597 print $moreforfilter;
601 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
602 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
604 print
'<div class="div-table-responsive">';
605 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
608 print
'<tr class="liste_titre_filter">';
609 if (!empty($arrayfields[
'm.rowid'][
'checked'])) {
611 print
'<td class="liste_titre left">';
612 print
'<input class="flat maxwidth25" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
615 if (!empty($arrayfields[
'm.datem'][
'checked'])) {
616 print
'<td class="liste_titre nowraponall">';
617 print
'<input class="flat" type="text" size="2" maxlength="2" placeholder="'.dol_escape_htmltag($langs->trans(
"Month")).
'" name="month" value="'.$month.
'">';
618 if (!isModEnabled(
'productbatch')) {
622 $syear = $year ? $year : -1;
623 print
'<input class="flat maxwidth50" type="text" maxlength="4" placeholder="'.dol_escape_htmltag($langs->trans(
"Year")).
'" name="year" value="'.($syear > 0 ? $syear :
'').
'">';
627 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
629 print
'<td class="liste_titre left">';
630 print
'<input class="flat maxwidth75" type="text" name="search_product_ref" value="'.dol_escape_htmltag($search_product_ref).
'">';
633 if (!empty($arrayfields[
'p.label'][
'checked'])) {
635 print
'<td class="liste_titre left">';
636 print
'<input class="flat maxwidth100" type="text" name="search_product" value="'.dol_escape_htmltag($search_product).
'">';
640 if (!empty($arrayfields[
'm.batch'][
'checked'])) {
641 print
'<td class="liste_titre center"><input class="flat maxwidth75" type="text" name="search_batch" value="'.dol_escape_htmltag($search_batch).
'"></td>';
643 if (!empty($arrayfields[
'pl.eatby'][
'checked'])) {
644 print
'<td class="liste_titre left">';
647 if (!empty($arrayfields[
'pl.sellby'][
'checked'])) {
648 print
'<td class="liste_titre left">';
652 if (!empty($arrayfields[
'e.ref'][
'checked'])) {
653 print
'<td class="liste_titre maxwidthonsmartphone left">';
655 print $formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'warehouseopen,warehouseinternal', 1, 0, 0,
'', 0, 0,
null,
'maxwidth200');
658 if (!empty($arrayfields[
'm.fk_user_author'][
'checked'])) {
660 print
'<td class="liste_titre left">';
661 print
'<input class="flat" type="text" size="6" name="search_user" value="'.dol_escape_htmltag($search_user).
'">';
664 if (!empty($arrayfields[
'm.inventorycode'][
'checked'])) {
666 print
'<td class="liste_titre left">';
667 print
'<input class="flat" type="text" size="4" name="search_inventorycode" value="'.dol_escape_htmltag($search_inventorycode).
'">';
670 if (!empty($arrayfields[
'm.label'][
'checked'])) {
672 print
'<td class="liste_titre left">';
673 print
'<input class="flat" type="text" size="8" name="search_movement" value="'.dol_escape_htmltag($search_movement).
'">';
676 if (!empty($arrayfields[
'm.type_mouvement'][
'checked'])) {
678 print
'<td class="liste_titre center">';
680 print
'<select id="search_type_mouvement" name="search_type_mouvement" class="maxwidth150">';
681 print
'<option value="" '.(($search_type_mouvement ==
"") ?
'selected="selected"' :
'').
'> </option>';
682 print
'<option value="0" '.(($search_type_mouvement ==
"0") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockIncreaseAfterCorrectTransfer').
'</option>';
683 print
'<option value="1" '.(($search_type_mouvement ==
"1") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockDecreaseAfterCorrectTransfer').
'</option>';
684 print
'<option value="2" '.(($search_type_mouvement ==
"2") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockDecrease').
'</option>';
685 print
'<option value="3" '.(($search_type_mouvement ==
"3") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockIncrease').
'</option>';
692 if (!empty($arrayfields[
'origin'][
'checked'])) {
694 print
'<td class="liste_titre left">';
698 if (!empty($arrayfields[
'm.fk_projet'][
'checked'])) {
700 print
'<td class="liste_titre" align="left">';
704 if (!empty($arrayfields[
'm.value'][
'checked'])) {
706 print
'<td class="liste_titre right">';
707 print
'<input class="flat" type="text" size="4" name="search_qty" value="'.dol_escape_htmltag($search_qty).
'">';
710 if (!empty($arrayfields[
'm.price'][
'checked'])) {
712 print
'<td class="liste_titre left">';
719 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
722 $parameters = array(
'arrayfields'=>$arrayfields);
723 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
724 print $hookmanager->resPrint;
726 if (!empty($arrayfields[
'm.datec'][
'checked'])) {
727 print
'<td class="liste_titre">';
731 if (!empty($arrayfields[
'm.tms'][
'checked'])) {
732 print
'<td class="liste_titre">';
736 print
'<td class="liste_titre maxwidthsearch">';
737 $searchpicto = $form->showFilterAndCheckAddButtons(0);
742 $totalarray = array();
743 $totalarray[
'nbfield'] = 0;
745 print
'<tr class="liste_titre">';
746 if (!empty($arrayfields[
'm.rowid'][
'checked'])) {
747 print_liste_field_titre($arrayfields[
'm.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'm.rowid',
'', $param,
'', $sortfield, $sortorder);
748 $totalarray[
'nbfield']++;
750 if (!empty($arrayfields[
'm.datem'][
'checked'])) {
751 print_liste_field_titre($arrayfields[
'm.datem'][
'label'], $_SERVER[
"PHP_SELF"],
'm.datem',
'', $param,
'', $sortfield, $sortorder);
752 $totalarray[
'nbfield']++;
754 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
755 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'p.ref',
'', $param,
'', $sortfield, $sortorder);
756 $totalarray[
'nbfield']++;
758 if (!empty($arrayfields[
'p.label'][
'checked'])) {
759 print_liste_field_titre($arrayfields[
'p.label'][
'label'], $_SERVER[
"PHP_SELF"],
'p.label',
'', $param,
'', $sortfield, $sortorder);
760 $totalarray[
'nbfield']++;
762 if (!empty($arrayfields[
'm.batch'][
'checked'])) {
763 print_liste_field_titre($arrayfields[
'm.batch'][
'label'], $_SERVER[
"PHP_SELF"],
'm.batch',
'', $param,
'', $sortfield, $sortorder,
'center ');
764 $totalarray[
'nbfield']++;
766 if (!empty($arrayfields[
'pl.eatby'][
'checked'])) {
767 print_liste_field_titre($arrayfields[
'pl.eatby'][
'label'], $_SERVER[
"PHP_SELF"],
'pl.eatby',
'', $param,
'', $sortfield, $sortorder,
'center ');
768 $totalarray[
'nbfield']++;
770 if (!empty($arrayfields[
'pl.sellby'][
'checked'])) {
771 print_liste_field_titre($arrayfields[
'pl.sellby'][
'label'], $_SERVER[
"PHP_SELF"],
'pl.sellby',
'', $param,
'', $sortfield, $sortorder,
'center ');
772 $totalarray[
'nbfield']++;
774 if (!empty($arrayfields[
'e.ref'][
'checked'])) {
776 print_liste_field_titre($arrayfields[
'e.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"e.ref",
"", $param,
"", $sortfield, $sortorder);
777 $totalarray[
'nbfield']++;
779 if (!empty($arrayfields[
'm.fk_user_author'][
'checked'])) {
780 print_liste_field_titre($arrayfields[
'm.fk_user_author'][
'label'], $_SERVER[
"PHP_SELF"],
"m.fk_user_author",
"", $param,
"", $sortfield, $sortorder);
781 $totalarray[
'nbfield']++;
783 if (!empty($arrayfields[
'm.inventorycode'][
'checked'])) {
784 print_liste_field_titre($arrayfields[
'm.inventorycode'][
'label'], $_SERVER[
"PHP_SELF"],
"m.inventorycode",
"", $param,
"", $sortfield, $sortorder);
785 $totalarray[
'nbfield']++;
787 if (!empty($arrayfields[
'm.label'][
'checked'])) {
788 print_liste_field_titre($arrayfields[
'm.label'][
'label'], $_SERVER[
"PHP_SELF"],
"m.label",
"", $param,
"", $sortfield, $sortorder);
789 $totalarray[
'nbfield']++;
791 if (!empty($arrayfields[
'm.type_mouvement'][
'checked'])) {
792 print_liste_field_titre($arrayfields[
'm.type_mouvement'][
'label'], $_SERVER[
"PHP_SELF"],
"m.type_mouvement",
"", $param,
'', $sortfield, $sortorder,
'center ');
793 $totalarray[
'nbfield']++;
795 if (!empty($arrayfields[
'origin'][
'checked'])) {
796 print_liste_field_titre($arrayfields[
'origin'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
"", $sortfield, $sortorder);
797 $totalarray[
'nbfield']++;
799 if (!empty($arrayfields[
'm.fk_projet'][
'checked'])) {
800 print_liste_field_titre($arrayfields[
'm.fk_projet'][
'label'], $_SERVER[
"PHP_SELF"],
"m.fk_projet",
"", $param,
'', $sortfield, $sortorder);
801 $totalarray[
'nbfield']++;
803 if (!empty($arrayfields[
'm.value'][
'checked'])) {
804 print_liste_field_titre($arrayfields[
'm.value'][
'label'], $_SERVER[
"PHP_SELF"],
"m.value",
"", $param,
'', $sortfield, $sortorder,
'right ');
805 $totalarray[
'nbfield']++;
807 if (!empty($arrayfields[
'm.price'][
'checked'])) {
808 print_liste_field_titre($arrayfields[
'm.price'][
'label'], $_SERVER[
"PHP_SELF"],
"m.price",
"", $param,
'', $sortfield, $sortorder,
'right ');
809 $totalarray[
'nbfield']++;
813 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
816 $parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
817 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
818 print $hookmanager->resPrint;
819 if (!empty($arrayfields[
'm.datec'][
'checked'])) {
820 print_liste_field_titre($arrayfields[
'p.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
821 $totalarray[
'nbfield']++;
823 if (!empty($arrayfields[
'm.tms'][
'checked'])) {
824 print_liste_field_titre($arrayfields[
'p.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
825 $totalarray[
'nbfield']++;
827 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
828 $totalarray[
'nbfield']++;
832 $savnbfield = $totalarray[
'nbfield'];
833 $totalarray = array();
834 $totalarray[
'nbfield'] = 0;
835 $imaxinloop = ($limit ? min($num, $limit) : $num);
836 while ($i < $imaxinloop) {
837 $objp = $db->fetch_object($resql);
842 $sql =
"SELECT label";
843 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_lang";
844 $sql .=
" WHERE fk_product = ".((int) $objp->rowid);
845 $sql .=
" AND lang = '".$db->escape($langs->getDefaultLang()).
"'";
848 $result = $db->query($sql);
850 $objtp = $db->fetch_object($result);
851 if (!empty($objtp->label)) {
852 $objp->produit = $objtp->label;
857 $userstatic->id = $objp->fk_user_author;
858 $userstatic->login = $objp->login;
859 $userstatic->lastname = $objp->lastname;
860 $userstatic->firstname = $objp->firstname;
861 $userstatic->photo = $objp->photo;
863 $productstatic->id = $objp->rowid;
864 $productstatic->ref = $objp->product_ref;
865 $productstatic->label = $objp->produit;
866 $productstatic->type = $objp->type;
867 $productstatic->entity = $objp->entity;
868 $productstatic->status_batch = $objp->tobatch;
870 $productlot->id = $objp->lotid;
871 $productlot->batch = $objp->batch;
872 $productlot->eatby = $objp->eatby;
873 $productlot->sellby = $objp->sellby;
875 $warehousestatic->id = $objp->entrepot_id;
876 $warehousestatic->libelle = $objp->warehouse_ref;
877 $warehousestatic->label = $objp->warehouse_ref;
878 $warehousestatic->lieu = $objp->lieu;
880 if (!empty($objp->fk_origin)) {
881 $origin = $objectlist->get_origin($objp->fk_origin, $objp->origintype);
886 print
'<tr class="oddeven">';
888 if (!empty($arrayfields[
'm.rowid'][
'checked'])) {
890 print
'<td>'.dol_escape_htmltag($objp->mid).
'</td>';
892 if (!empty($arrayfields[
'm.datem'][
'checked'])) {
894 print
'<td>'.dol_print_date($db->jdate($objp->datem),
'dayhour').
'</td>';
896 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
898 print
'<td class="nowraponall">';
899 print $productstatic->getNomUrl(1,
'stock', 16);
902 if (!empty($arrayfields[
'p.label'][
'checked'])) {
904 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($productstatic->label).
'">';
905 print $productstatic->label;
908 if (!empty($arrayfields[
'm.batch'][
'checked'])) {
909 print
'<td class="center nowraponall">';
910 if ($productlot->id > 0) {
911 print $productlot->getNomUrl(1);
917 if (!empty($arrayfields[
'pl.eatby'][
'checked'])) {
918 print
'<td class="center">'.dol_print_date($objp->eatby,
'day').
'</td>';
920 if (!empty($arrayfields[
'pl.sellby'][
'checked'])) {
921 print
'<td class="center">'.dol_print_date($objp->sellby,
'day').
'</td>';
924 if (!empty($arrayfields[
'e.ref'][
'checked'])) {
926 print $warehousestatic->getNomUrl(1);
930 if (!empty($arrayfields[
'm.fk_user_author'][
'checked'])) {
931 print
'<td class="tdoverflowmax100">';
932 print $userstatic->getNomUrl(-1);
936 if (!empty($arrayfields[
'm.inventorycode'][
'checked'])) {
937 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($objp->inventorycode).
'">';
944 if (!empty($arrayfields[
'm.label'][
'checked'])) {
945 print
'<td class="tdoverflowmax300" title="'.dol_escape_htmltag($objp->label).
'">'.
dol_escape_htmltag($objp->label).
'</td>';
948 if (!empty($arrayfields[
'm.type_mouvement'][
'checked'])) {
949 switch ($objp->type_mouvement) {
951 print
'<td class="center">'.$langs->trans(
'StockIncreaseAfterCorrectTransfer').
'</td>';
954 print
'<td class="center">'.$langs->trans(
'StockDecreaseAfterCorrectTransfer').
'</td>';
957 print
'<td class="center">'.$langs->trans(
'StockDecrease').
'</td>';
960 print
'<td class="center">'.$langs->trans(
'StockIncrease').
'</td>';
964 if (!empty($arrayfields[
'origin'][
'checked'])) {
966 print
'<td class="nowraponall">'.$origin.
'</td>';
968 if (!empty($arrayfields[
'm.fk_projet'][
'checked'])) {
971 if ($objp->fk_project != 0) {
972 print $movement->get_origin($objp->fk_project,
'project');
976 if (!empty($arrayfields[
'm.value'][
'checked'])) {
978 print
'<td class="right">';
980 print
'<span class="stockmovemententry">+'.$objp->qty.
'</span>';
982 print
'<span class="stockmovementexit">'.$objp->qty.
'<span>';
986 if (!empty($arrayfields[
'm.price'][
'checked'])) {
988 print
'<td class="right">';
989 if ($objp->price != 0) {
990 print
'<span class="opacitymedium">'.price($objp->price).
'</span>';
995 print
'<td class="nowrap center">';
996 if ($massactionbutton || $massaction) {
998 if (in_array($objp->rowid, $arrayofselected)) {
1001 print
'<input id="cb'.$objp->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$objp->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1005 $totalarray[
'nbfield']++;
1012 print
'<tr><td colspan="'.$savnbfield.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage warehouses.
Class to manage stock movements.
Class to manage products or services.
Class with list of lots and properties.
Class to manage projects.
Class to manage Dolibarr users.
dolSqlDateFilter($datefield, $day_date, $month_date, $year_date, $excludefirstand=0, $gm=false)
Generate a SQL string to make a filter into a range (for second of date until last second of date).
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_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
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...
moPrepareHead($object)
Prepare array of tabs for Mo.
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.