28require
'../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/mouvementstock.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/mrp/class/mo.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/mrp/lib/mrp_mo.lib.php';
42$langs->loadLangs(array(
"mrp",
"stocks",
"other"));
47$action =
GETPOST(
'action',
'aZ09');
48$confirm =
GETPOST(
'confirm',
'alpha');
49$cancel =
GETPOST(
'cancel',
'aZ09');
50$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'mostockmovement';
51$backtopage =
GETPOST(
'backtopage',
'alpha');
52$optioncss =
GETPOST(
'optioncss',
'aZ');
53$massaction =
GETPOST(
'massaction',
'aZ09');
61$search_ref =
GETPOST(
'search_ref',
'alpha');
62$search_movement =
GETPOST(
"search_movement",
'alpha');
63$search_product_ref = trim(
GETPOST(
"search_product_ref",
'alpha'));
64$search_product = trim(
GETPOST(
"search_product",
'alpha'));
65$search_warehouse = trim(
GETPOST(
"search_warehouse",
'alpha'));
66$search_inventorycode = trim(
GETPOST(
"search_inventorycode",
'alpha'));
67$search_user = trim(
GETPOST(
"search_user",
'alpha'));
68$search_batch = trim(
GETPOST(
"search_batch",
'alpha'));
69$search_qty = trim(
GETPOST(
"search_qty",
'alpha'));
70$search_type_mouvement =
GETPOST(
'search_type_mouvement',
"intcomma");
73$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOSTINT(
"page");
74$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
75$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
76if (empty($page) || $page == -1) {
79$offset = $limit * $page;
81 $sortfield =
"m.datem";
90$diroutputmassaction = $conf->mrp->dir_output.
'/temp/massgeneration/'.$user->id;
91$hookmanager->initHooks(array(
'mocard',
'globalcard'));
94$extrafields->fetch_name_optionals_label(
$object->table_element);
96$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
99$search_all = trim(
GETPOST(
"search_all",
'alpha'));
101foreach (
$object->fields as $key => $val) {
102 if (
GETPOST(
'search_'.$key,
'alpha')) {
103 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
107if (empty($action) && empty($id) && empty($ref)) {
112include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
117$isdraft = ((
$object->status == $object::STATUS_DRAFT) ? 1 : 0);
124 'm.rowid' => array(
'label' =>
"Ref",
'checked' => 1,
'position' => 1),
125 'm.datem' => array(
'label' =>
"Date",
'checked' => 1,
'position' => 2),
126 'p.ref' => array(
'label' =>
"ProductRef",
'checked' => 1,
'css' =>
'maxwidth100',
'position' => 3),
127 'p.label' => array(
'label' =>
"ProductLabel",
'checked' => 0,
'position' => 5),
128 'm.batch' => array(
'label' =>
"BatchNumberShort",
'checked' => 1,
'position' => 8,
'enabled' => (isModEnabled(
'productbatch'))),
129 'pl.eatby' => array(
'label' =>
"EatByDate",
'checked' => 0,
'position' => 9,
'enabled' => (isModEnabled(
'productbatch'))),
130 'pl.sellby' => array(
'label' =>
"SellByDate",
'checked' => 0,
'position' => 10,
'enabled' => (isModEnabled(
'productbatch'))),
131 'e.ref' => array(
'label' =>
"Warehouse",
'checked' => 1,
'position' => 100,
'enabled' => (!($id > 0))),
132 'm.fk_user_author' => array(
'label' =>
"Author",
'checked' => 0,
'position' => 120),
133 'm.inventorycode' => array(
'label' =>
"InventoryCodeShort",
'checked' => 1,
'position' => 130),
134 'm.label' => array(
'label' =>
"MovementLabel",
'checked' => 1,
'position' => 140),
135 'm.type_mouvement' => array(
'label' =>
"TypeMovement",
'checked' => 0,
'position' => 150),
136 'origin' => array(
'label' =>
"Origin",
'checked' => 1,
'position' => 155),
137 'm.fk_projet' => array(
'label' =>
'Project',
'checked' => 0,
'position' => 180),
138 'm.value' => array(
'label' =>
"Qty",
'checked' => 1,
'position' => 200),
139 'm.price' => array(
'label' =>
"UnitPurchaseValue",
'checked' => 0,
'position' => 210)
144 unset($arrayfields[
'pl.sellby']);
147 unset($arrayfields[
'pl.eatby']);
149$objectlist->fields =
dol_sort_array($objectlist->fields,
'position');
153$permissionnote = $user->hasRight(
'mrp',
'write');
154$permissiondellink = $user->hasRight(
'mrp',
'write');
155$permissiontoadd = $user->hasRight(
'mrp',
'write');
156$permissiontodelete = $user->hasRight(
'mrp',
'delete') || ($permissiontoadd && isset(
$object->status) &&
$object->status == $object::STATUS_DRAFT);
157$upload_dir = $conf->mrp->multidir_output[isset(
$object->entity) ?
$object->entity : 1];
159$permissiontoproduce = $permissiontoadd;
160$permissiontoupdatecost = $user->hasRight(
'bom',
'write');
162if ($permissiontoupdatecost) {
163 $arrayfields[
'm.price'][
'enabled'] = 1;
166$arrayofselected = array();
173if (
GETPOST(
'cancel',
'alpha')) {
177if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
181$parameters = array();
182$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
187include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
190if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
194 $search_movement =
"";
195 $search_type_mouvement =
"";
196 $search_inventorycode =
"";
197 $search_product_ref =
"";
198 $search_product =
"";
199 $search_warehouse =
"";
205 $search_array_options = array();
208if (empty($reshook)) {
213 if (empty($backtopage) || ($cancel && empty($id))) {
215 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
216 $backtopage = $backurlforlist;
218 $backtopage = DOL_URL_ROOT.
'/mrp/mo_production.php?id='.($id > 0 ? $id :
'__ID__');
221 $triggermodname =
'MO_MODIFY';
224 include DOL_DOCUMENT_ROOT.
'/core/actions_addupdatedelete.inc.php';
227 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
230 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
233 $triggersendname =
'MO_SENTBYMAIL';
234 $autocopy =
'MAIN_MAIL_AUTOCOPY_MO_TO';
235 $trackid =
'mo'.$object->id;
236 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
241 if ($action ==
'set_thirdparty' && $permissiontoadd) {
242 $object->setValueFrom(
'fk_soc',
GETPOSTINT(
'fk_soc'),
'',
'',
'date',
'', $user, $triggermodname);
244 if ($action ==
'classin' && $permissiontoadd) {
248 if ($action ==
'confirm_reopen') {
249 $result =
$object->setStatut($object::STATUS_INPROGRESS, 0,
'',
'MRP_REOPEN');
259$form =
new Form($db);
262$productstatic =
new Product($db);
264$warehousestatic =
new Entrepot($db);
265$userstatic =
new User($db);
267$help_url =
'EN:Module_Manufacturing_Orders|FR:Module_Ordres_de_Fabrication|DE:Modul_Fertigungsauftrag';
269llxHeader(
'', $langs->trans(
'Mo'), $help_url);
272if (
$object->id > 0 && (empty($action) || ($action !=
'edit' && $action !=
'create'))) {
273 $res =
$object->fetch_thirdparty();
274 $res =
$object->fetch_optionals();
283 if ($action ==
'delete') {
284 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'DeleteMo'), $langs->trans(
'ConfirmDeleteMo'),
'confirm_delete',
'', 0, 1);
287 if ($action ==
'deleteline') {
288 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&lineid='.$lineid, $langs->trans(
'DeleteLine'), $langs->trans(
'ConfirmDeleteLine'),
'confirm_deleteline',
'', 0, 1);
291 if ($action ==
'clone') {
293 $formquestion = array();
294 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneMo',
$object->ref),
'confirm_clone', $formquestion,
'yes', 1);
298 if ($action ==
'xxx') {
299 $formquestion = array();
310 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'XXX'), $text,
'confirm_xxx', $formquestion, 0, 1, 220);
314 $parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
315 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
316 if (empty($reshook)) {
317 $formconfirm .= $hookmanager->resPrint;
318 } elseif ($reshook > 0) {
319 $formconfirm = $hookmanager->resPrint;
328 $linkback =
'<a href="'.dol_buildpath(
'/mrp/mo_list.php', 1).
'?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
330 $morehtmlref =
'<div class="refidno">';
336 if (is_object(
$object->thirdparty)) {
337 $morehtmlref .=
$object->thirdparty->getNomUrl(1,
'customer');
339 $morehtmlref .=
' (<a href="'.DOL_URL_ROOT.
'/commande/list.php?socid='.
$object->thirdparty->id.
'&search_societe='.urlencode(
$object->thirdparty->name).
'">'.$langs->trans(
"OtherOrders").
'</a>)';
343 if (isModEnabled(
'project')) {
344 $langs->load(
"projects");
345 if (is_object(
$object->thirdparty)) {
346 $morehtmlref .=
'<br>';
348 if ($permissiontoadd) {
349 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
350 if ($action !=
'classify') {
351 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
353 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->socid,
$object->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
355 if (!empty(
$object->fk_project)) {
357 $proj->fetch(
$object->fk_project);
358 $morehtmlref .= $proj->getNomUrl(1);
360 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
365 $morehtmlref .=
'</div>';
368 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
371 print
'<div class="fichecenter">';
372 print
'<div class="fichehalfleft">';
373 print
'<div class="underbanner clearboth"></div>';
374 print
'<table class="border centpercent tableforfield">'.
"\n";
377 $keyforbreak =
'fk_warehouse';
378 unset(
$object->fields[
'fk_project']);
379 unset(
$object->fields[
'fk_soc']);
380 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_view.tpl.php';
383 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
389 print
'<div class="clearboth"></div>';
427 $sql =
"SELECT p.rowid, p.ref as product_ref, p.label as produit, p.tobatch, p.fk_product_type as type, p.entity,";
428 $sql .=
" e.ref as warehouse_ref, e.rowid as entrepot_id, e.lieu,";
429 $sql .=
" m.rowid as mid, m.value as qty, m.datem, m.fk_user_author, m.label, m.inventorycode, m.fk_origin, m.origintype,";
430 $sql .=
" m.batch, m.price,";
431 $sql .=
" m.type_mouvement,";
432 $sql .=
" pl.rowid as lotid, pl.eatby, pl.sellby,";
433 $sql .=
" u.login, u.photo, u.lastname, u.firstname";
435 if (!empty($extrafields->attributes[$objectlist->table_element][
'label'])) {
436 foreach ($extrafields->attributes[$objectlist->table_element][
'label'] as $key => $val) {
437 $sql .= ($extrafields->attributes[$objectlist->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
441 $parameters = array();
442 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
443 $sql .= $hookmanager->resPrint;
444 $sql .=
" FROM ".MAIN_DB_PREFIX.
"entrepot as e,";
445 $sql .=
" ".MAIN_DB_PREFIX.
"product as p,";
446 $sql .=
" ".MAIN_DB_PREFIX.
"stock_mouvement as m";
447 if (!empty($extrafields->attributes[$objectlist->table_element]) && is_array($extrafields->attributes[$objectlist->table_element][
'label']) && count($extrafields->attributes[$objectlist->table_element][
'label'])) {
448 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$objectlist->table_element.
"_extrafields as ef on (m.rowid = ef.fk_object)";
450 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"user as u ON m.fk_user_author = u.rowid";
451 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product_lot as pl ON m.batch = pl.batch AND m.fk_product = pl.fk_product";
452 $sql .=
" WHERE m.fk_product = p.rowid";
453 $sql .=
" AND m.origintype = 'mo' AND m.fk_origin = ".(int)
$object->id;
455 $sql .=
" AND m.rowid = ".((int) $msid);
457 $sql .=
" AND m.fk_entrepot = e.rowid";
458 $sql .=
" AND e.entity IN (".getEntity(
'stock').
")";
460 $sql .=
" AND p.fk_product_type = 0";
463 if (!empty($search_ref)) {
466 if (!empty($search_movement)) {
469 if (!empty($search_inventorycode)) {
472 if (!empty($search_product_ref)) {
475 if (!empty($search_product)) {
478 if ($search_warehouse !=
'' && $search_warehouse !=
'-1') {
481 if (!empty($search_user)) {
482 $sql .=
natural_search(array(
'u.lastname',
'u.firstname',
'u.login'), $search_user);
484 if (!empty($search_batch)) {
487 if ($search_qty !=
'') {
490 if ($search_type_mouvement !=
'' && $search_type_mouvement !=
'-1') {
491 $sql .=
natural_search(
'm.type_mouvement', $search_type_mouvement, 2);
494 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
496 $parameters = array();
497 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
498 $sql .= $hookmanager->resPrint;
499 $sql .= $db->order($sortfield, $sortorder);
501 $nbtotalofrecords =
'';
503 $result = $db->query($sql);
504 $nbtotalofrecords = $db->num_rows($result);
505 if (($page * $limit) > $nbtotalofrecords) {
510 $sql .= $db->plimit($limit + 1, $offset);
512 $resql = $db->query($sql);
516 $num = $db->num_rows($resql);
519 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
520 $param .=
'&contextpage='.urlencode($contextpage);
522 if ($limit > 0 && $limit != $conf->liste_limit) {
523 $param .=
'&limit='.((int) $limit);
526 $param .=
'&id='.urlencode((
string) ($id));
528 if ($search_movement) {
529 $param .=
'&search_movement='.urlencode($search_movement);
531 if ($search_inventorycode) {
532 $param .=
'&search_inventorycode='.urlencode($search_inventorycode);
534 if ($search_type_mouvement) {
535 $param .=
'&search_type_mouvement='.urlencode($search_type_mouvement);
537 if ($search_product_ref) {
538 $param .=
'&search_product_ref='.urlencode($search_product_ref);
540 if ($search_product) {
541 $param .=
'&search_product='.urlencode($search_product);
544 $param .=
'&search_batch='.urlencode($search_batch);
546 if ($search_warehouse > 0) {
547 $param .=
'&search_warehouse='.urlencode($search_warehouse);
550 $param .=
'&search_user='.urlencode($search_user);
554 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
557 $arrayofmassactions = array(
562 if (in_array($massaction, array(
'presend',
'predelete'))) {
563 $arrayofmassactions = array();
565 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
567 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
568 if ($optioncss !=
'') {
569 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
571 print
'<input type="hidden" name="token" value="'.newToken().
'">';
572 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
573 print
'<input type="hidden" name="action" value="list">';
574 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
575 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
576 print
'<input type="hidden" name="page" value="'.$page.
'">';
577 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
579 print
'<input type="hidden" name="id" value="'.$id.
'">';
583 print_barre_liste(
'', $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'', 0,
'',
'', $limit);
585 print_barre_liste(
'', $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'generic', 0,
'',
'', $limit);
590 $parameters = array();
591 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
592 if (empty($reshook)) {
593 $moreforfilter .= $hookmanager->resPrint;
595 $moreforfilter = $hookmanager->resPrint;
598 if (!empty($moreforfilter)) {
599 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
600 print $moreforfilter;
604 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
605 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
606 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
608 print
'<div class="div-table-responsive">';
609 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
612 print
'<tr class="liste_titre_filter">';
615 print
'<td class="liste_titre maxwidthsearch">';
616 $searchpicto = $form->showFilterAndCheckAddButtons(0);
620 if (!empty($arrayfields[
'm.rowid'][
'checked'])) {
622 print
'<td class="liste_titre left">';
623 print
'<input class="flat maxwidth25" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
626 if (!empty($arrayfields[
'm.datem'][
'checked'])) {
627 print
'<td class="liste_titre nowraponall">';
628 print
'<input class="flat" type="text" size="2" maxlength="2" placeholder="'.dol_escape_htmltag($langs->trans(
"Month")).
'" name="month" value="'.$month.
'">';
629 if (!isModEnabled(
'productbatch')) {
633 $syear = $year ? $year : -1;
634 print
'<input class="flat maxwidth50" type="text" maxlength="4" placeholder="'.dol_escape_htmltag($langs->trans(
"Year")).
'" name="year" value="'.($syear > 0 ? $syear :
'').
'">';
638 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
640 print
'<td class="liste_titre left">';
641 print
'<input class="flat maxwidth75" type="text" name="search_product_ref" value="'.dol_escape_htmltag($search_product_ref).
'">';
644 if (!empty($arrayfields[
'p.label'][
'checked'])) {
646 print
'<td class="liste_titre left">';
647 print
'<input class="flat maxwidth100" type="text" name="search_product" value="'.dol_escape_htmltag($search_product).
'">';
651 if (!empty($arrayfields[
'm.batch'][
'checked'])) {
652 print
'<td class="liste_titre center"><input class="flat maxwidth75" type="text" name="search_batch" value="'.dol_escape_htmltag($search_batch).
'"></td>';
654 if (!empty($arrayfields[
'pl.eatby'][
'checked'])) {
655 print
'<td class="liste_titre left">';
658 if (!empty($arrayfields[
'pl.sellby'][
'checked'])) {
659 print
'<td class="liste_titre left">';
663 if (!empty($arrayfields[
'e.ref'][
'checked'])) {
664 print
'<td class="liste_titre maxwidthonsmartphone left">';
666 print $formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'warehouseopen,warehouseinternal', 1, 0, 0,
'', 0, 0,
null,
'maxwidth200');
669 if (!empty($arrayfields[
'm.fk_user_author'][
'checked'])) {
671 print
'<td class="liste_titre left">';
672 print
'<input class="flat" type="text" size="6" name="search_user" value="'.dol_escape_htmltag($search_user).
'">';
675 if (!empty($arrayfields[
'm.inventorycode'][
'checked'])) {
677 print
'<td class="liste_titre left">';
678 print
'<input class="flat" type="text" size="4" name="search_inventorycode" value="'.dol_escape_htmltag($search_inventorycode).
'">';
681 if (!empty($arrayfields[
'm.label'][
'checked'])) {
683 print
'<td class="liste_titre left">';
684 print
'<input class="flat" type="text" size="8" name="search_movement" value="'.dol_escape_htmltag($search_movement).
'">';
687 if (!empty($arrayfields[
'm.type_mouvement'][
'checked'])) {
689 print
'<td class="liste_titre center">';
691 print
'<select id="search_type_mouvement" name="search_type_mouvement" class="maxwidth150">';
692 print
'<option value="" '.(($search_type_mouvement ==
"") ?
'selected="selected"' :
'').
'> </option>';
693 print
'<option value="0" '.(($search_type_mouvement ==
"0") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockIncreaseAfterCorrectTransfer').
'</option>';
694 print
'<option value="1" '.(($search_type_mouvement ==
"1") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockDecreaseAfterCorrectTransfer').
'</option>';
695 print
'<option value="2" '.(($search_type_mouvement ==
"2") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockDecrease').
'</option>';
696 print
'<option value="3" '.(($search_type_mouvement ==
"3") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockIncrease').
'</option>';
703 if (!empty($arrayfields[
'origin'][
'checked'])) {
705 print
'<td class="liste_titre left">';
709 if (!empty($arrayfields[
'm.fk_projet'][
'checked'])) {
711 print
'<td class="liste_titre" align="left">';
715 if (!empty($arrayfields[
'm.value'][
'checked'])) {
717 print
'<td class="liste_titre right">';
718 print
'<input class="flat" type="text" size="4" name="search_qty" value="'.dol_escape_htmltag($search_qty).
'">';
721 if (!empty($arrayfields[
'm.price'][
'checked'])) {
723 print
'<td class="liste_titre left">';
730 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
733 $parameters = array(
'arrayfields' => $arrayfields);
734 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
735 print $hookmanager->resPrint;
737 if (!empty($arrayfields[
'm.datec'][
'checked'])) {
738 print
'<td class="liste_titre">';
742 if (!empty($arrayfields[
'm.tms'][
'checked'])) {
743 print
'<td class="liste_titre">';
748 print
'<td class="liste_titre maxwidthsearch">';
749 $searchpicto = $form->showFilterAndCheckAddButtons(0);
755 $totalarray = array();
756 $totalarray[
'nbfield'] = 0;
758 print
'<tr class="liste_titre">';
761 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
762 $totalarray[
'nbfield']++;
764 if (!empty($arrayfields[
'm.rowid'][
'checked'])) {
765 print_liste_field_titre($arrayfields[
'm.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'm.rowid',
'', $param,
'', $sortfield, $sortorder);
766 $totalarray[
'nbfield']++;
768 if (!empty($arrayfields[
'm.datem'][
'checked'])) {
769 print_liste_field_titre($arrayfields[
'm.datem'][
'label'], $_SERVER[
"PHP_SELF"],
'm.datem',
'', $param,
'', $sortfield, $sortorder);
770 $totalarray[
'nbfield']++;
772 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
773 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'p.ref',
'', $param,
'', $sortfield, $sortorder);
774 $totalarray[
'nbfield']++;
776 if (!empty($arrayfields[
'p.label'][
'checked'])) {
777 print_liste_field_titre($arrayfields[
'p.label'][
'label'], $_SERVER[
"PHP_SELF"],
'p.label',
'', $param,
'', $sortfield, $sortorder);
778 $totalarray[
'nbfield']++;
780 if (!empty($arrayfields[
'm.batch'][
'checked'])) {
781 print_liste_field_titre($arrayfields[
'm.batch'][
'label'], $_SERVER[
"PHP_SELF"],
'm.batch',
'', $param,
'', $sortfield, $sortorder,
'center ');
782 $totalarray[
'nbfield']++;
784 if (!empty($arrayfields[
'pl.eatby'][
'checked'])) {
785 print_liste_field_titre($arrayfields[
'pl.eatby'][
'label'], $_SERVER[
"PHP_SELF"],
'pl.eatby',
'', $param,
'', $sortfield, $sortorder,
'center ');
786 $totalarray[
'nbfield']++;
788 if (!empty($arrayfields[
'pl.sellby'][
'checked'])) {
789 print_liste_field_titre($arrayfields[
'pl.sellby'][
'label'], $_SERVER[
"PHP_SELF"],
'pl.sellby',
'', $param,
'', $sortfield, $sortorder,
'center ');
790 $totalarray[
'nbfield']++;
792 if (!empty($arrayfields[
'e.ref'][
'checked'])) {
794 print_liste_field_titre($arrayfields[
'e.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"e.ref",
"", $param,
"", $sortfield, $sortorder);
795 $totalarray[
'nbfield']++;
797 if (!empty($arrayfields[
'm.fk_user_author'][
'checked'])) {
798 print_liste_field_titre($arrayfields[
'm.fk_user_author'][
'label'], $_SERVER[
"PHP_SELF"],
"m.fk_user_author",
"", $param,
"", $sortfield, $sortorder);
799 $totalarray[
'nbfield']++;
801 if (!empty($arrayfields[
'm.inventorycode'][
'checked'])) {
802 print_liste_field_titre($arrayfields[
'm.inventorycode'][
'label'], $_SERVER[
"PHP_SELF"],
"m.inventorycode",
"", $param,
"", $sortfield, $sortorder);
803 $totalarray[
'nbfield']++;
805 if (!empty($arrayfields[
'm.label'][
'checked'])) {
806 print_liste_field_titre($arrayfields[
'm.label'][
'label'], $_SERVER[
"PHP_SELF"],
"m.label",
"", $param,
"", $sortfield, $sortorder);
807 $totalarray[
'nbfield']++;
809 if (!empty($arrayfields[
'm.type_mouvement'][
'checked'])) {
810 print_liste_field_titre($arrayfields[
'm.type_mouvement'][
'label'], $_SERVER[
"PHP_SELF"],
"m.type_mouvement",
"", $param,
'', $sortfield, $sortorder,
'center ');
811 $totalarray[
'nbfield']++;
813 if (!empty($arrayfields[
'origin'][
'checked'])) {
814 print_liste_field_titre($arrayfields[
'origin'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
"", $sortfield, $sortorder);
815 $totalarray[
'nbfield']++;
817 if (!empty($arrayfields[
'm.fk_projet'][
'checked'])) {
818 print_liste_field_titre($arrayfields[
'm.fk_projet'][
'label'], $_SERVER[
"PHP_SELF"],
"m.fk_projet",
"", $param,
'', $sortfield, $sortorder);
819 $totalarray[
'nbfield']++;
821 if (!empty($arrayfields[
'm.value'][
'checked'])) {
822 print_liste_field_titre($arrayfields[
'm.value'][
'label'], $_SERVER[
"PHP_SELF"],
"m.value",
"", $param,
'', $sortfield, $sortorder,
'right ');
823 $totalarray[
'nbfield']++;
825 if (!empty($arrayfields[
'm.price'][
'checked'])) {
826 print_liste_field_titre($arrayfields[
'm.price'][
'label'], $_SERVER[
"PHP_SELF"],
"m.price",
"", $param,
'', $sortfield, $sortorder,
'right ');
827 $totalarray[
'nbfield']++;
831 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
834 $parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
835 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
836 print $hookmanager->resPrint;
837 if (!empty($arrayfields[
'm.datec'][
'checked'])) {
838 print_liste_field_titre($arrayfields[
'p.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
839 $totalarray[
'nbfield']++;
841 if (!empty($arrayfields[
'm.tms'][
'checked'])) {
842 print_liste_field_titre($arrayfields[
'p.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
843 $totalarray[
'nbfield']++;
847 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
848 $totalarray[
'nbfield']++;
853 $savnbfield = $totalarray[
'nbfield'];
854 $totalarray = array();
855 $totalarray[
'nbfield'] = 0;
856 $imaxinloop = ($limit ? min($num, $limit) : $num);
857 while ($i < $imaxinloop) {
858 $objp = $db->fetch_object($resql);
863 $sql =
"SELECT label";
864 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_lang";
865 $sql .=
" WHERE fk_product = ".((int) $objp->rowid);
866 $sql .=
" AND lang = '".$db->escape($langs->getDefaultLang()).
"'";
869 $result = $db->query($sql);
871 $objtp = $db->fetch_object($result);
872 if (!empty($objtp->label)) {
873 $objp->produit = $objtp->label;
878 $userstatic->id = $objp->fk_user_author;
879 $userstatic->login = $objp->login;
880 $userstatic->lastname = $objp->lastname;
881 $userstatic->firstname = $objp->firstname;
882 $userstatic->photo = $objp->photo;
884 $productstatic->id = $objp->rowid;
885 $productstatic->ref = $objp->product_ref;
886 $productstatic->label = $objp->produit;
887 $productstatic->type = $objp->type;
888 $productstatic->entity = $objp->entity;
889 $productstatic->status_batch = $objp->tobatch;
891 $productlot->id = $objp->lotid;
892 $productlot->batch = $objp->batch;
893 $productlot->eatby = $objp->eatby;
894 $productlot->sellby = $objp->sellby;
896 $warehousestatic->id = $objp->entrepot_id;
897 $warehousestatic->libelle = $objp->warehouse_ref;
898 $warehousestatic->label = $objp->warehouse_ref;
899 $warehousestatic->lieu = $objp->lieu;
901 if (!empty($objp->fk_origin)) {
902 $origin = $objectlist->get_origin($objp->fk_origin, $objp->origintype);
907 print
'<tr class="oddeven">';
910 print
'<td class="nowrap center">';
911 if ($massactionbutton || $massaction) {
913 if (in_array($objp->rowid, $arrayofselected)) {
916 print
'<input id="cb'.$objp->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$objp->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
920 $totalarray[
'nbfield']++;
924 if (!empty($arrayfields[
'm.rowid'][
'checked'])) {
926 print
'<td>'.dol_escape_htmltag($objp->mid).
'</td>';
928 if (!empty($arrayfields[
'm.datem'][
'checked'])) {
930 print
'<td>'.dol_print_date($db->jdate($objp->datem),
'dayhour').
'</td>';
932 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
934 print
'<td class="nowraponall">';
935 print $productstatic->getNomUrl(1,
'stock', 16);
938 if (!empty($arrayfields[
'p.label'][
'checked'])) {
940 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($productstatic->label).
'">';
941 print $productstatic->label;
944 if (!empty($arrayfields[
'm.batch'][
'checked'])) {
945 print
'<td class="center nowraponall">';
946 if ($productlot->id > 0) {
947 print $productlot->getNomUrl(1);
953 if (!empty($arrayfields[
'pl.eatby'][
'checked'])) {
954 print
'<td class="center">'.dol_print_date($objp->eatby,
'day').
'</td>';
956 if (!empty($arrayfields[
'pl.sellby'][
'checked'])) {
957 print
'<td class="center">'.dol_print_date($objp->sellby,
'day').
'</td>';
960 if (!empty($arrayfields[
'e.ref'][
'checked'])) {
962 print $warehousestatic->getNomUrl(1);
966 if (!empty($arrayfields[
'm.fk_user_author'][
'checked'])) {
967 print
'<td class="tdoverflowmax100">';
968 print $userstatic->getNomUrl(-1);
972 if (!empty($arrayfields[
'm.inventorycode'][
'checked'])) {
973 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($objp->inventorycode).
'">';
980 if (!empty($arrayfields[
'm.label'][
'checked'])) {
981 print
'<td class="tdoverflowmax300" title="'.dol_escape_htmltag($objp->label).
'">'.
dol_escape_htmltag($objp->label).
'</td>';
984 if (!empty($arrayfields[
'm.type_mouvement'][
'checked'])) {
985 switch ($objp->type_mouvement) {
987 print
'<td class="center">'.$langs->trans(
'StockIncreaseAfterCorrectTransfer').
'</td>';
990 print
'<td class="center">'.$langs->trans(
'StockDecreaseAfterCorrectTransfer').
'</td>';
993 print
'<td class="center">'.$langs->trans(
'StockDecrease').
'</td>';
996 print
'<td class="center">'.$langs->trans(
'StockIncrease').
'</td>';
1000 if (!empty($arrayfields[
'origin'][
'checked'])) {
1002 print
'<td class="nowraponall">'.$origin.
'</td>';
1004 if (!empty($arrayfields[
'm.fk_projet'][
'checked'])) {
1007 if ($objp->fk_project != 0) {
1008 print $movement->get_origin($objp->fk_project,
'project');
1012 if (!empty($arrayfields[
'm.value'][
'checked'])) {
1014 print
'<td class="right">';
1015 if ($objp->qty > 0) {
1016 print
'<span class="stockmovemententry">+'.$objp->qty.
'</span>';
1018 print
'<span class="stockmovementexit">'.$objp->qty.
'<span>';
1022 if (!empty($arrayfields[
'm.price'][
'checked'])) {
1024 print
'<td class="right">';
1025 if ($objp->price != 0) {
1026 print
'<span class="opacitymedium">'.price($objp->price).
'</span>';
1032 print
'<td class="nowrap center">';
1033 if ($massactionbutton || $massaction) {
1035 if (in_array($objp->rowid, $arrayofselected)) {
1038 print
'<input id="cb'.$objp->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$objp->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1042 $totalarray[
'nbfield']++;
1050 print
'<tr><td colspan="'.$savnbfield.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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).
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
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.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
newToken()
Return the value of token currently saved into session with name 'newtoken'.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
print_barre_liste($title, $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.
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_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify 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.