29require
'../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/mouvementstock.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/mrp/class/mo.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/mrp/lib/mrp_mo.lib.php';
51$langs->loadLangs(array(
"mrp",
"stocks",
"other"));
56$action =
GETPOST(
'action',
'aZ09');
57$confirm =
GETPOST(
'confirm',
'alpha');
59$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'mostockmovement';
60$backtopage =
GETPOST(
'backtopage',
'alpha');
61$optioncss =
GETPOST(
'optioncss',
'aZ');
62$massaction =
GETPOST(
'massaction',
'aZ09');
70$search_ref =
GETPOST(
'search_ref',
'alpha');
71$search_movement =
GETPOST(
"search_movement",
'alpha');
72$search_product_ref = trim(
GETPOST(
"search_product_ref",
'alpha'));
73$search_product = trim(
GETPOST(
"search_product",
'alpha'));
74$search_warehouse = trim(
GETPOST(
"search_warehouse",
'alpha'));
75$search_inventorycode = trim(
GETPOST(
"search_inventorycode",
'alpha'));
76$search_user = trim(
GETPOST(
"search_user",
'alpha'));
77$search_batch = trim(
GETPOST(
"search_batch",
'alpha'));
78$search_qty = trim(
GETPOST(
"search_qty",
'alpha'));
79$search_type_mouvement =
GETPOST(
'search_type_mouvement',
"intcomma");
83$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
84$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
85if (empty($page) || $page == -1) {
88$offset = $limit * $page;
90 $sortfield =
"m.datem";
99$diroutputmassaction = $conf->mrp->dir_output.
'/temp/massgeneration/'.$user->id;
100$hookmanager->initHooks(array(
'mocard',
'globalcard',
'mocardmovelist' ));
103$extrafields->fetch_name_optionals_label(
$object->table_element);
105$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
108$search_all = trim(
GETPOST(
"search_all",
'alpha'));
110foreach (
$object->fields as $key => $val) {
111 if (
GETPOST(
'search_'.$key,
'alpha')) {
112 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
116if (empty($action) && empty($id) && empty($ref)) {
121include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
126$isdraft = ((
$object->status == $object::STATUS_DRAFT) ? 1 : 0);
133 'm.rowid' => array(
'label' =>
"Ref",
'checked' =>
'1',
'position' => 1),
134 'm.datem' => array(
'label' =>
"Date",
'checked' =>
'1',
'position' => 2),
135 'p.ref' => array(
'label' =>
"ProductRef",
'checked' =>
'1',
'css' =>
'maxwidth100',
'position' => 3),
136 'p.label' => array(
'label' =>
"ProductLabel",
'checked' =>
'0',
'position' => 5),
137 'm.batch' => array(
'label' =>
"BatchNumberShort",
'checked' =>
'1',
'position' => 8,
'enabled' => (
string) (
int) (
isModEnabled(
'productbatch'))),
138 'pl.eatby' => array(
'label' =>
"EatByDate",
'checked' =>
'0',
'position' => 9,
'enabled' => (
string) (
int) (
isModEnabled(
'productbatch'))),
139 'pl.sellby' => array(
'label' =>
"SellByDate",
'checked' =>
'0',
'position' => 10,
'enabled' => (
string) (
int) (
isModEnabled(
'productbatch'))),
140 'e.ref' => array(
'label' =>
"Warehouse",
'checked' =>
'1',
'position' => 100,
'enabled' => (
string) (
int) (!($id > 0))),
141 'm.fk_user_author' => array(
'label' =>
"Author",
'checked' =>
'0',
'position' => 120),
142 'm.inventorycode' => array(
'label' =>
"InventoryCodeShort",
'checked' =>
'1',
'position' => 130),
143 'm.label' => array(
'label' =>
"MovementLabel",
'checked' =>
'1',
'position' => 140),
144 'm.type_mouvement' => array(
'label' =>
"TypeMovement",
'checked' =>
'0',
'position' => 150),
145 'origin' => array(
'label' =>
"Origin",
'checked' =>
'1',
'position' => 155),
146 'm.fk_projet' => array(
'label' =>
'Project',
'checked' =>
'0',
'position' => 180),
147 'm.value' => array(
'label' =>
"Qty",
'checked' =>
'1',
'position' => 200),
148 'm.price' => array(
'label' =>
"UnitPurchaseValue",
'checked' =>
'0',
'position' => 210)
153 unset($arrayfields[
'pl.sellby']);
156 unset($arrayfields[
'pl.eatby']);
158$objectlist->fields =
dol_sort_array($objectlist->fields,
'position');
162$permissionnote = $user->hasRight(
'mrp',
'write');
163$permissiondellink = $user->hasRight(
'mrp',
'write');
164$permissiontoadd = $user->hasRight(
'mrp',
'write');
165$permissiontodelete = $user->hasRight(
'mrp',
'delete') || ($permissiontoadd && isset(
$object->status) &&
$object->status == $object::STATUS_DRAFT);
166$upload_dir = $conf->mrp->multidir_output[isset(
$object->entity) ?
$object->entity : 1];
168$permissiontoproduce = $permissiontoadd;
169$permissiontoupdatecost = $user->hasRight(
'bom',
'write');
171if ($permissiontoupdatecost) {
172 $arrayfields[
'm.price'][
'enabled'] =
'1';
175$arrayofselected = array();
182if (
GETPOST(
'cancel',
'alpha')) {
186if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
190$parameters = array();
191$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
196include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
199if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
203 $search_movement =
"";
204 $search_type_mouvement =
"";
205 $search_inventorycode =
"";
206 $search_product_ref =
"";
207 $search_product =
"";
208 $search_warehouse =
"";
214 $search_array_options = array();
217if (empty($reshook)) {
222 if (empty($backtopage) || ($cancel && empty($id))) {
224 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
225 $backtopage = $backurlforlist;
227 $backtopage = DOL_URL_ROOT.
'/mrp/mo_production.php?id='.(
$id > 0 ?
$id :
'__ID__');
230 $triggermodname =
'MO_MODIFY';
233 include DOL_DOCUMENT_ROOT.
'/core/actions_addupdatedelete.inc.php';
236 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
239 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
242 $triggersendname =
'MO_SENTBYMAIL';
243 $autocopy =
'MAIN_MAIL_AUTOCOPY_MO_TO';
244 $trackid =
'mo'.$object->id;
245 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
250 if ($action ==
'set_thirdparty' && $permissiontoadd) {
251 $object->setValueFrom(
'fk_soc',
GETPOSTINT(
'fk_soc'),
'',
null,
'date',
'', $user, $triggermodname);
253 if ($action ==
'classin' && $permissiontoadd) {
257 if ($action ==
'confirm_reopen' && $permissiontoadd) {
258 $result =
$object->setStatut($object::STATUS_INPROGRESS, 0,
'',
'MRP_REOPEN');
268$form =
new Form($db);
271$productstatic =
new Product($db);
273$warehousestatic =
new Entrepot($db);
274$userstatic =
new User($db);
276$title = $langs->trans(
'Mo');
277$help_url =
'EN:Module_Manufacturing_Orders|FR:Module_Ordres_de_Fabrication|DE:Modul_Fertigungsauftrag';
279llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-mrp page-card_movements');
282if (
$object->id > 0 && (empty($action) || ($action !=
'edit' && $action !=
'create'))) {
283 $res =
$object->fetch_thirdparty();
284 $res =
$object->fetch_optionals();
293 if ($action ==
'delete') {
294 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'DeleteMo'), $langs->trans(
'ConfirmDeleteMo'),
'confirm_delete',
'', 0, 1);
297 if ($action ==
'deleteline') {
298 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&lineid='.$lineid, $langs->trans(
'DeleteLine'), $langs->trans(
'ConfirmDeleteLine'),
'confirm_deleteline',
'', 0, 1);
301 if ($action ==
'clone') {
303 $formquestion = array();
304 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneMo',
$object->ref),
'confirm_clone', $formquestion,
'yes', 1);
308 $parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
309 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
310 if (empty($reshook)) {
311 $formconfirm .= $hookmanager->resPrint;
312 } elseif ($reshook > 0) {
313 $formconfirm = $hookmanager->resPrint;
322 $linkback =
'<a href="'.dol_buildpath(
'/mrp/mo_list.php', 1).
'?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
324 $morehtmlref =
'<div class="refidno">';
330 if (is_object(
$object->thirdparty)) {
331 $morehtmlref .=
$object->thirdparty->getNomUrl(1,
'customer');
333 $morehtmlref .=
' (<a href="'.DOL_URL_ROOT.
'/commande/list.php?socid='.
$object->thirdparty->id.
'&search_societe='.urlencode(
$object->thirdparty->name).
'">'.$langs->trans(
"OtherOrders").
'</a>)';
338 $langs->load(
"projects");
339 if (is_object(
$object->thirdparty)) {
340 $morehtmlref .=
'<br>';
342 if ($permissiontoadd) {
343 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
344 if ($action !=
'classify') {
345 $morehtmlref .=
'<a class="editfielda" href="'.dolBuildUrl($_SERVER[
'PHP_SELF'], [
'action' =>
'classify',
'id' =>
$object->id],
true).
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
347 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->socid, (
string)
$object->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
349 if (!empty(
$object->fk_project)) {
351 $proj->fetch(
$object->fk_project);
352 $morehtmlref .= $proj->getNomUrl(1);
354 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
359 $morehtmlref .=
'</div>';
362 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
365 print
'<div class="fichecenter">';
366 print
'<div class="fichehalfleft">';
367 print
'<div class="underbanner clearboth"></div>';
368 print
'<table class="border centpercent tableforfield">'.
"\n";
371 $keyforbreak =
'fk_warehouse';
372 unset(
$object->fields[
'fk_project']);
373 unset(
$object->fields[
'fk_soc']);
374 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_view.tpl.php';
377 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
383 print
'<div class="clearboth"></div>';
421 $sql =
"SELECT p.rowid, p.ref as product_ref, p.label as produit, p.tobatch, p.fk_product_type as type, p.entity,";
422 $sql .=
" e.ref as warehouse_ref, e.rowid as entrepot_id, e.lieu,";
423 $sql .=
" m.rowid as mid, m.value as qty, m.datem, m.fk_user_author, m.label, m.inventorycode, m.fk_origin, m.origintype,";
424 $sql .=
" m.batch, m.price,";
425 $sql .=
" m.type_mouvement,";
426 $sql .=
" pl.rowid as lotid, pl.eatby, pl.sellby,";
427 $sql .=
" u.login, u.photo, u.lastname, u.firstname";
429 if (!empty($extrafields->attributes[$objectlist->table_element][
'label'])) {
430 foreach ($extrafields->attributes[$objectlist->table_element][
'label'] as $key => $val) {
431 $sql .= ($extrafields->attributes[$objectlist->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
435 $parameters = array();
436 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
437 $sql .= $hookmanager->resPrint;
438 $sql .=
" FROM ".MAIN_DB_PREFIX.
"entrepot as e,";
439 $sql .=
" ".MAIN_DB_PREFIX.
"product as p,";
440 $sql .=
" ".MAIN_DB_PREFIX.
"stock_mouvement as m";
441 if (!empty($extrafields->attributes[$objectlist->table_element]) && is_array($extrafields->attributes[$objectlist->table_element][
'label']) && count($extrafields->attributes[$objectlist->table_element][
'label'])) {
442 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$objectlist->table_element.
"_extrafields as ef on (m.rowid = ef.fk_object)";
444 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"user as u ON m.fk_user_author = u.rowid";
445 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product_lot as pl ON m.batch = pl.batch AND m.fk_product = pl.fk_product";
446 $sql .=
" WHERE m.fk_product = p.rowid";
447 $sql .=
" AND m.origintype = 'mo' AND m.fk_origin = ".(int)
$object->id;
449 $sql .=
" AND m.rowid = ".((int) $msid);
451 $sql .=
" AND m.fk_entrepot = e.rowid";
452 $sql .=
" AND e.entity IN (".getEntity(
'stock').
")";
454 $sql .=
" AND p.fk_product_type = 0";
457 if (!empty($search_ref)) {
460 if (!empty($search_movement)) {
463 if (!empty($search_inventorycode)) {
466 if (!empty($search_product_ref)) {
469 if (!empty($search_product)) {
472 if ($search_warehouse !=
'' && $search_warehouse !=
'-1') {
475 if (!empty($search_user)) {
476 $sql .=
natural_search(array(
'u.lastname',
'u.firstname',
'u.login'), $search_user);
478 if (!empty($search_batch)) {
481 if ($search_qty !=
'') {
484 if ($search_type_mouvement !=
'' && $search_type_mouvement !=
'-1') {
485 $sql .=
natural_search(
'm.type_mouvement', $search_type_mouvement, 2);
488 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
490 $parameters = array();
491 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
492 $sql .= $hookmanager->resPrint;
493 $sql .= $db->order($sortfield, $sortorder);
495 $nbtotalofrecords =
'';
497 $result = $db->query($sql);
498 $nbtotalofrecords = $db->num_rows($result);
499 if (($page * $limit) > (
int) $nbtotalofrecords) {
504 $sql .= $db->plimit($limit + 1, $offset);
506 $resql = $db->query($sql);
510 $num = $db->num_rows($resql);
513 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
514 $param .=
'&contextpage='.urlencode($contextpage);
516 if ($limit > 0 && $limit != $conf->liste_limit) {
517 $param .=
'&limit='.((int) $limit);
520 $param .=
'&id='.urlencode((
string) (
$id));
522 if ($search_movement) {
523 $param .=
'&search_movement='.urlencode($search_movement);
525 if ($search_inventorycode) {
526 $param .=
'&search_inventorycode='.urlencode($search_inventorycode);
528 if ($search_type_mouvement) {
529 $param .=
'&search_type_mouvement='.urlencode($search_type_mouvement);
531 if ($search_product_ref) {
532 $param .=
'&search_product_ref='.urlencode($search_product_ref);
534 if ($search_product) {
535 $param .=
'&search_product='.urlencode($search_product);
538 $param .=
'&search_batch='.urlencode($search_batch);
540 if ($search_warehouse > 0) {
541 $param .=
'&search_warehouse='.urlencode($search_warehouse);
544 $param .=
'&search_user='.urlencode($search_user);
548 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
551 $arrayofmassactions = array(
556 if (in_array($massaction, array(
'presend',
'predelete'))) {
557 $arrayofmassactions = array();
559 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
561 print
'<form method="POST" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
562 if ($optioncss !=
'') {
563 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
565 print
'<input type="hidden" name="token" value="'.newToken().
'">';
566 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
567 print
'<input type="hidden" name="action" value="list">';
568 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
569 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
570 print
'<input type="hidden" name="page" value="'.$page.
'">';
571 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
573 print
'<input type="hidden" name="id" value="'.$id.
'">';
577 print_barre_liste(
'', $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'', 0,
'',
'', $limit);
579 print_barre_liste(
'', $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'generic', 0,
'',
'', $limit);
584 $parameters = array();
585 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
586 if (empty($reshook)) {
587 $moreforfilter .= $hookmanager->resPrint;
589 $moreforfilter = $hookmanager->resPrint;
592 if (!empty($moreforfilter)) {
593 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
594 print $moreforfilter;
598 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
599 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
600 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
602 print
'<div class="div-table-responsive">';
603 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
606 print
'<tr class="liste_titre_filter">';
609 print
'<td class="liste_titre maxwidthsearch">';
610 $searchpicto = $form->showFilterAndCheckAddButtons(0);
614 if (!empty($arrayfields[
'm.rowid'][
'checked'])) {
616 print
'<td class="liste_titre left">';
617 print
'<input class="flat maxwidth25" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
620 if (!empty($arrayfields[
'm.datem'][
'checked'])) {
621 print
'<td class="liste_titre nowraponall">';
622 print
'<input class="flat" type="text" size="2" maxlength="2" placeholder="'.dol_escape_htmltag($langs->trans(
"Month")).
'" name="month" value="'.$month.
'">';
627 $syear = $year ? $year : -1;
628 print
'<input class="flat maxwidth50" type="text" maxlength="4" placeholder="'.dol_escape_htmltag($langs->trans(
"Year")).
'" name="year" value="'.($syear > 0 ? $syear :
'').
'">';
632 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
634 print
'<td class="liste_titre left">';
635 print
'<input class="flat maxwidth75" type="text" name="search_product_ref" value="'.dol_escape_htmltag($search_product_ref).
'">';
638 if (!empty($arrayfields[
'p.label'][
'checked'])) {
640 print
'<td class="liste_titre left">';
641 print
'<input class="flat maxwidth100" type="text" name="search_product" value="'.dol_escape_htmltag($search_product).
'">';
645 if (!empty($arrayfields[
'm.batch'][
'checked'])) {
646 print
'<td class="liste_titre center"><input class="flat maxwidth75" type="text" name="search_batch" value="'.dol_escape_htmltag($search_batch).
'"></td>';
648 if (!empty($arrayfields[
'pl.eatby'][
'checked'])) {
649 print
'<td class="liste_titre left">';
652 if (!empty($arrayfields[
'pl.sellby'][
'checked'])) {
653 print
'<td class="liste_titre left">';
657 if (!empty($arrayfields[
'e.ref'][
'checked'])) {
658 print
'<td class="liste_titre maxwidthonsmartphone left">';
660 print $formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'warehouseopen,warehouseinternal', 1, 0, 0,
'', 0, 0, array(),
'maxwidth200');
663 if (!empty($arrayfields[
'm.fk_user_author'][
'checked'])) {
665 print
'<td class="liste_titre left">';
666 print
'<input class="flat" type="text" size="6" name="search_user" value="'.dol_escape_htmltag($search_user).
'">';
669 if (!empty($arrayfields[
'm.inventorycode'][
'checked'])) {
671 print
'<td class="liste_titre left">';
672 print
'<input class="flat" type="text" size="4" name="search_inventorycode" value="'.dol_escape_htmltag($search_inventorycode).
'">';
675 if (!empty($arrayfields[
'm.label'][
'checked'])) {
677 print
'<td class="liste_titre left">';
678 print
'<input class="flat" type="text" size="8" name="search_movement" value="'.dol_escape_htmltag($search_movement).
'">';
681 if (!empty($arrayfields[
'm.type_mouvement'][
'checked'])) {
683 print
'<td class="liste_titre center">';
685 print
'<select id="search_type_mouvement" name="search_type_mouvement" class="maxwidth150">';
686 print
'<option value="" '.(($search_type_mouvement ==
"") ?
'selected="selected"' :
'').
'> </option>';
687 print
'<option value="0" '.(($search_type_mouvement ==
"0") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockIncreaseAfterCorrectTransfer').
'</option>';
688 print
'<option value="1" '.(($search_type_mouvement ==
"1") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockDecreaseAfterCorrectTransfer').
'</option>';
689 print
'<option value="2" '.(($search_type_mouvement ==
"2") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockDecrease').
'</option>';
690 print
'<option value="3" '.(($search_type_mouvement ==
"3") ?
'selected="selected"' :
'').
'>'.$langs->trans(
'StockIncrease').
'</option>';
697 if (!empty($arrayfields[
'origin'][
'checked'])) {
699 print
'<td class="liste_titre left">';
703 if (!empty($arrayfields[
'm.fk_projet'][
'checked'])) {
705 print
'<td class="liste_titre" align="left">';
709 if (!empty($arrayfields[
'm.value'][
'checked'])) {
711 print
'<td class="liste_titre right">';
712 print
'<input class="flat" type="text" size="4" name="search_qty" value="'.dol_escape_htmltag($search_qty).
'">';
715 if (!empty($arrayfields[
'm.price'][
'checked'])) {
717 print
'<td class="liste_titre left">';
724 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
727 $parameters = array(
'arrayfields' => $arrayfields);
728 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
729 print $hookmanager->resPrint;
731 if (!empty($arrayfields[
'm.datec'][
'checked'])) {
732 print
'<td class="liste_titre">';
736 if (!empty($arrayfields[
'm.tms'][
'checked'])) {
737 print
'<td class="liste_titre">';
742 print
'<td class="liste_titre maxwidthsearch">';
743 $searchpicto = $form->showFilterAndCheckAddButtons(0);
752 print
'<tr class="liste_titre">';
755 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
758 if (!empty($arrayfields[
'm.rowid'][
'checked'])) {
759 print_liste_field_titre($arrayfields[
'm.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'm.rowid',
'', $param,
'', $sortfield, $sortorder);
762 if (!empty($arrayfields[
'm.datem'][
'checked'])) {
763 print_liste_field_titre($arrayfields[
'm.datem'][
'label'], $_SERVER[
"PHP_SELF"],
'm.datem',
'', $param,
'', $sortfield, $sortorder);
766 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
767 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'p.ref',
'', $param,
'', $sortfield, $sortorder);
770 if (!empty($arrayfields[
'p.label'][
'checked'])) {
771 print_liste_field_titre($arrayfields[
'p.label'][
'label'], $_SERVER[
"PHP_SELF"],
'p.label',
'', $param,
'', $sortfield, $sortorder);
774 if (!empty($arrayfields[
'm.batch'][
'checked'])) {
775 print_liste_field_titre($arrayfields[
'm.batch'][
'label'], $_SERVER[
"PHP_SELF"],
'm.batch',
'', $param,
'', $sortfield, $sortorder,
'center ');
778 if (!empty($arrayfields[
'pl.eatby'][
'checked'])) {
779 print_liste_field_titre($arrayfields[
'pl.eatby'][
'label'], $_SERVER[
"PHP_SELF"],
'pl.eatby',
'', $param,
'', $sortfield, $sortorder,
'center ');
782 if (!empty($arrayfields[
'pl.sellby'][
'checked'])) {
783 print_liste_field_titre($arrayfields[
'pl.sellby'][
'label'], $_SERVER[
"PHP_SELF"],
'pl.sellby',
'', $param,
'', $sortfield, $sortorder,
'center ');
786 if (!empty($arrayfields[
'e.ref'][
'checked'])) {
788 print_liste_field_titre($arrayfields[
'e.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"e.ref",
"", $param,
"", $sortfield, $sortorder);
791 if (!empty($arrayfields[
'm.fk_user_author'][
'checked'])) {
792 print_liste_field_titre($arrayfields[
'm.fk_user_author'][
'label'], $_SERVER[
"PHP_SELF"],
"m.fk_user_author",
"", $param,
"", $sortfield, $sortorder);
795 if (!empty($arrayfields[
'm.inventorycode'][
'checked'])) {
796 print_liste_field_titre($arrayfields[
'm.inventorycode'][
'label'], $_SERVER[
"PHP_SELF"],
"m.inventorycode",
"", $param,
"", $sortfield, $sortorder);
799 if (!empty($arrayfields[
'm.label'][
'checked'])) {
800 print_liste_field_titre($arrayfields[
'm.label'][
'label'], $_SERVER[
"PHP_SELF"],
"m.label",
"", $param,
"", $sortfield, $sortorder);
803 if (!empty($arrayfields[
'm.type_mouvement'][
'checked'])) {
804 print_liste_field_titre($arrayfields[
'm.type_mouvement'][
'label'], $_SERVER[
"PHP_SELF"],
"m.type_mouvement",
"", $param,
'', $sortfield, $sortorder,
'center ');
807 if (!empty($arrayfields[
'origin'][
'checked'])) {
808 print_liste_field_titre($arrayfields[
'origin'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
"", $sortfield, $sortorder);
811 if (!empty($arrayfields[
'm.fk_projet'][
'checked'])) {
812 print_liste_field_titre($arrayfields[
'm.fk_projet'][
'label'], $_SERVER[
"PHP_SELF"],
"m.fk_projet",
"", $param,
'', $sortfield, $sortorder);
815 if (!empty($arrayfields[
'm.value'][
'checked'])) {
816 print_liste_field_titre($arrayfields[
'm.value'][
'label'], $_SERVER[
"PHP_SELF"],
"m.value",
"", $param,
'', $sortfield, $sortorder,
'right ');
819 if (!empty($arrayfields[
'm.price'][
'checked'])) {
821 print_liste_field_titre($arrayfields[
'm.price'][
'label'], $_SERVER[
"PHP_SELF"],
"m.price",
"", $param,
'', $sortfield, $sortorder,
'right ');
826 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
829 $parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
830 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
831 print $hookmanager->resPrint;
832 if (!empty($arrayfields[
'm.datec'][
'checked'])) {
833 print_liste_field_titre($arrayfields[
'p.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
836 if (!empty($arrayfields[
'm.tms'][
'checked'])) {
837 print_liste_field_titre($arrayfields[
'p.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"p.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
842 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
851 $imaxinloop = ($limit ? min($num, $limit) : $num);
852 while ($i < $imaxinloop) {
853 $objp = $db->fetch_object($resql);
858 $sql =
"SELECT label";
859 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_lang";
860 $sql .=
" WHERE fk_product = ".((int) $objp->rowid);
861 $sql .=
" AND lang = '".$db->escape($langs->getDefaultLang()).
"'";
864 $result = $db->query($sql);
866 $objtp = $db->fetch_object($result);
867 if (!empty($objtp->label)) {
868 $objp->produit = $objtp->label;
873 $userstatic->id = $objp->fk_user_author;
874 $userstatic->login = $objp->login;
875 $userstatic->lastname = $objp->lastname;
876 $userstatic->firstname = $objp->firstname;
877 $userstatic->photo = $objp->photo;
879 $productstatic->id = $objp->rowid;
880 $productstatic->ref = $objp->product_ref;
881 $productstatic->label = $objp->produit;
882 $productstatic->type = $objp->type;
883 $productstatic->entity = $objp->entity;
884 $productstatic->status_batch = $objp->tobatch;
886 $productlot->id = $objp->lotid;
887 $productlot->batch = $objp->batch;
888 $productlot->eatby = $objp->eatby;
889 $productlot->sellby = $objp->sellby;
891 $warehousestatic->id = $objp->entrepot_id;
892 $warehousestatic->libelle = $objp->warehouse_ref;
893 $warehousestatic->label = $objp->warehouse_ref;
894 $warehousestatic->lieu = $objp->lieu;
896 if (!empty($objp->fk_origin)) {
897 $origin = $objectlist->get_origin($objp->fk_origin, $objp->origintype);
902 print
'<tr class="oddeven">';
905 print
'<td class="nowrap center">';
906 if ($massactionbutton || $massaction) {
908 if (in_array($objp->rowid, $arrayofselected)) {
911 print
'<input id="cb'.$objp->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$objp->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
919 if (!empty($arrayfields[
'm.rowid'][
'checked'])) {
921 print
'<td>'.dol_escape_htmltag($objp->mid).
'</td>';
923 if (!empty($arrayfields[
'm.datem'][
'checked'])) {
925 print
'<td>'.dol_print_date($db->jdate($objp->datem),
'dayhour').
'</td>';
927 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
929 print
'<td class="nowraponall">';
930 print $productstatic->getNomUrl(1,
'stock', 16);
933 if (!empty($arrayfields[
'p.label'][
'checked'])) {
935 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($productstatic->label).
'">';
936 print $productstatic->label;
939 if (!empty($arrayfields[
'm.batch'][
'checked'])) {
940 print
'<td class="center nowraponall">';
941 if ($productlot->id > 0) {
942 print $productlot->getNomUrl(1);
948 if (!empty($arrayfields[
'pl.eatby'][
'checked'])) {
949 print
'<td class="center">'.dol_print_date($objp->eatby,
'day').
'</td>';
951 if (!empty($arrayfields[
'pl.sellby'][
'checked'])) {
952 print
'<td class="center">'.dol_print_date($objp->sellby,
'day').
'</td>';
955 if (!empty($arrayfields[
'e.ref'][
'checked'])) {
957 print $warehousestatic->getNomUrl(1);
961 if (!empty($arrayfields[
'm.fk_user_author'][
'checked'])) {
962 print
'<td class="tdoverflowmax100">';
963 print $userstatic->getNomUrl(-1);
967 if (!empty($arrayfields[
'm.inventorycode'][
'checked'])) {
968 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($objp->inventorycode).
'">';
975 if (!empty($arrayfields[
'm.label'][
'checked'])) {
976 print
'<td class="tdoverflowmax300" title="'.dol_escape_htmltag($objp->label).
'">'.
dol_escape_htmltag($objp->label).
'</td>';
979 if (!empty($arrayfields[
'm.type_mouvement'][
'checked'])) {
980 switch ($objp->type_mouvement) {
982 print
'<td class="center">'.$langs->trans(
'StockIncreaseAfterCorrectTransfer').
'</td>';
985 print
'<td class="center">'.$langs->trans(
'StockDecreaseAfterCorrectTransfer').
'</td>';
988 print
'<td class="center">'.$langs->trans(
'StockDecrease').
'</td>';
991 print
'<td class="center">'.$langs->trans(
'StockIncrease').
'</td>';
995 if (!empty($arrayfields[
'origin'][
'checked'])) {
997 print
'<td class="nowraponall">'.$origin.
'</td>';
999 if (!empty($arrayfields[
'm.fk_projet'][
'checked'])) {
1002 if ($objp->fk_project != 0) {
1003 print $objectlist->get_origin($objp->fk_project,
'project');
1007 if (!empty($arrayfields[
'm.value'][
'checked'])) {
1009 print
'<td class="right">';
1010 if ($objp->qty > 0) {
1011 print
'<span class="stockmovemententry">+'.$objp->qty.
'</span>';
1013 print
'<span class="stockmovementexit">'.$objp->qty.
'<span>';
1017 if (!empty($arrayfields[
'm.price'][
'checked'])) {
1019 print
'<td class="right">';
1020 if ($objp->price != 0) {
1021 print
'<span class="opacitymedium">'.price($objp->price).
'</span>';
1027 print
'<td class="nowrap center">';
1028 if ($massactionbutton || $massaction) {
1030 if (in_array($objp->rowid, $arrayofselected)) {
1033 print
'<input id="cb'.$objp->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$objp->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1045 print
'<tr><td colspan="'.$savnbfield.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
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).
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
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...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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 a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
dol_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.