diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index b0b5bdbe19a..546cd046c49 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -1135,10 +1135,12 @@ class MouvementStock extends CommonObject $result = ''; - $label = img_picto('', 'stock', 'class="pictofixedwidth"').''.$langs->trans("Movement").' '.$this->id.''; + $label = img_picto('', 'stock', 'class="pictofixedwidth"').''.$langs->trans("StockMovement").''; $label .= '
'; - $label .= ''.$langs->trans('Label').': '.$this->label; - $label .= '
'.$langs->trans('Qty').': '.($this->qty > 0 ? '+' : '').$this->qty; + $label .= ''.$langs->trans('Ref').': '.$this->id; + $label .= '
'.$langs->trans('Label').': '.$this->label; + $qtylabel = (($this->qty > 0) ? '+' : '') . $this->qty . ''; + $label .= '
'.$langs->trans('Qty').': ' . $qtylabel; if ($this->batch) { $label .= '
'.$langs->trans('Batch').': '.$this->batch; } diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index 44e55d95554..a666e4ac5b3 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -65,6 +65,7 @@ $ref = GETPOST('ref', 'alpha'); $msid = GETPOST('msid', 'int'); $idproduct = GETPOST('idproduct', 'int'); $product_id = GETPOST("product_id", 'int'); +$show_files = GETPOST('show_files', 'int'); $search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $search_date_startday = GETPOST('search_date_startday', 'int'); @@ -250,10 +251,10 @@ if (empty($reshook)) { require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; - $objecttmp = new $objectclass($db); + $objecttmp = new MouvementStock($db); $listofobjectid = array(); foreach ($toselect as $toselectid) { - $objecttmp = new $objectclass($db); // must create new instance because instance is saved into $listofobjectref array for future use + $objecttmp = new MouvementStock($db); // must create new instance because instance is saved into $listofobjectref array for future use $result = $objecttmp->fetch($toselectid); if ($result > 0) { $listofobjectid[$toselectid] = $toselectid; @@ -310,7 +311,8 @@ if (empty($reshook)) { if (!$error) { $langs->load("exports"); - setEventMessages($langs->trans('FileSuccessfullyBuilt', $filename.'_'.dol_print_date($now, 'dayhourlog')), null, 'mesgs'); + setEventMessage($langs->trans('FeatureNotYetAvailable')); + //setEventMessages($langs->trans('FileSuccessfullyBuilt', $filename.'_'.dol_print_date($now, 'dayhourlog')), null, 'mesgs'); } $massaction = ''; @@ -465,8 +467,8 @@ if ($action == "transfert_stock" && !$cancel) { if (!$error) { if ($id) { - $object = new Entrepot($db); - $result = $object->fetch($id); + $warehouse = new Entrepot($db); + $result = $warehouse->fetch($id); $db->begin(); @@ -574,7 +576,7 @@ if ($action == "transfert_stock" && !$cancel) { header("Location: ".$backtopage); exit; } else { - header("Location: movement_list.php?id=".$object->id); + header("Location: movement_list.php?id=".$warehouse->id); exit; } } else { @@ -638,7 +640,7 @@ if (isModEnabled('project')) { $productlot = new Productlot($db); $productstatic = new Product($db); $warehousestatic = new Entrepot($db); -$movement = new MouvementStock($db); + $userstatic = new User($db); $now = dol_now(); @@ -782,13 +784,13 @@ $num = $db->num_rows($resql); $product = new Product($db); -$object = new Entrepot($db); +$warehouse = new Entrepot($db); if ($idproduct > 0) { $product->fetch($idproduct); } if ($id > 0 || $ref) { - $result = $object->fetch($id, $ref); + $result = $warehouse->fetch($id, $ref); if ($result < 0) { dol_print_error($db); } @@ -805,8 +807,8 @@ if ($msid) { } else { $title = $langs->trans("ListOfStockMovements"); if ($id) { - if (!empty($object->ref)) { - $title .= ' ('.$object->ref.')'; + if (!empty($warehouse->ref)) { + $title .= ' ('.$warehouse->ref.')'; } else { $title .= ' ('.$langs->trans("ForThisWarehouse").')'; } @@ -822,8 +824,8 @@ llxHeader('', $title, $help_url); /* * Show tab only if we ask a particular warehouse */ -if ($object->id > 0) { - $head = stock_prepare_head($object); +if ($warehouse->id > 0) { + $head = stock_prepare_head($warehouse); print dol_get_fiche_head($head, 'movements', $langs->trans("Warehouse"), -1, 'stock'); @@ -831,7 +833,7 @@ if ($object->id > 0) { $linkback = ''.$langs->trans("BackToList").''; $morehtmlref = '
'; - $morehtmlref .= $langs->trans("LocationSummary").' : '.$object->lieu; + $morehtmlref .= $langs->trans("LocationSummary").' : '.$warehouse->lieu; // Project if (isModEnabled('project')) { @@ -839,23 +841,23 @@ if ($object->id > 0) { $morehtmlref .= '
'.img_picto('', 'project').' '.$langs->trans('Project').' '; if ($usercancreate && 1 == 2) { if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; } if ($action == 'classify') { - $projectid = $object->fk_project; - $morehtmlref .= '
'; + $projectid = $warehouse->fk_project; + $morehtmlref .= ''; $morehtmlref .= ''; $morehtmlref .= ''; $morehtmlref .= $formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500'); $morehtmlref .= ''; $morehtmlref .= '
'; } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300'); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$warehouse->id, $warehouse->socid, $warehouse->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300'); } } else { - if (!empty($object->fk_project)) { + if (!empty($warehouse->fk_project)) { $proj = new Project($db); - $proj->fetch($object->fk_project); + $proj->fetch($warehouse->fk_project); $morehtmlref .= ' : '.$proj->getNomUrl(1); if ($proj->title) { $morehtmlref .= ' - '.$proj->title; @@ -872,7 +874,7 @@ if ($object->id > 0) { $shownav = 0; } - dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref', 'ref', $morehtmlref); + dol_banner_tab($warehouse, 'ref', $linkback, $shownav, 'ref', 'ref', $morehtmlref); print '
'; @@ -884,10 +886,10 @@ if ($object->id > 0) { print ''; // Description - print ''.$langs->trans("Description").''.dol_htmlentitiesbr($object->description).''; + print ''.$langs->trans("Description").''.dol_htmlentitiesbr($warehouse->description).''; - $calcproductsunique = $object->nb_different_products(); - $calcproducts = $object->nb_products(); + $calcproductsunique = $warehouse->nb_different_products(); + $calcproducts = $warehouse->nb_products(); // Total nb of different products print ''.$langs->trans("NumberOfDifferentProducts").''; @@ -916,7 +918,7 @@ if ($object->id > 0) { // Last movement $sql = "SELECT MAX(m.datem) as datem"; $sql .= " FROM ".MAIN_DB_PREFIX."stock_mouvement as m"; - $sql .= " WHERE m.fk_entrepot = ".((int) $object->id); + $sql .= " WHERE m.fk_entrepot = ".((int) $warehouse->id); $resqlbis = $db->query($sql); if ($resqlbis) { $objbis = $db->fetch_object($resqlbis); @@ -939,7 +941,7 @@ if ($object->id > 0) { // Categories if (isModEnabled('categorie')) { print ''.$langs->trans("Categories").''; - print $form->showCategories($object->id, Categorie::TYPE_WAREHOUSE, 1); + print $form->showCategories($warehouse->id, Categorie::TYPE_WAREHOUSE, 1); print ""; } @@ -972,7 +974,7 @@ if ((empty($action) || $action == 'list') && $id > 0) { print "
\n"; $parameters = array(); - $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been + $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $warehouse, $action); // Note that $action and $warehouse may have been // modified by hook if (empty($reshook)) { if ($user->hasRight('stock', 'mouvement', 'creer')) { @@ -1002,6 +1004,9 @@ if ($limit > 0 && $limit != $conf->liste_limit) { if ($id > 0) { $param .= '&id='.urlencode($id); } +if ($show_files) { + $param .= '&show_files='.urlencode($show_files); +} if ($search_date_startday) { $param .= '&search_date_startday='.urlencode($search_date_startday); } @@ -1054,7 +1059,7 @@ if ($search_fk_project != '' && $search_fk_project != '-1') { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; // Add $param from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $warehouse, $action); // Note that $action and $warehouse may have been modified by hook $param .= $hookmanager->resPrint; // List of mass actions available @@ -1106,7 +1111,7 @@ if ($id > 0) { $topicmail = "SendStockMovement"; $modelmail = "movementstock"; $objecttmp = new MouvementStock($db); -$trackid = 'mov'.$object->id; +$trackid = 'mov'.$warehouse->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($massaction == 'prereverse') { print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassReverse"), $langs->trans("ConfirmMassReverseQuestion", count($toselect)), "confirm_reverse", null, '', 0, 200, 500, 1, 'Yes'); @@ -1126,7 +1131,7 @@ if ($search_all) { $moreforfilter = ''; $parameters = array('arrayfields'=>&$arrayfields); -$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $warehouse, $action); // Note that $action and $warehouse may have been modified by hook if (empty($reshook)) { $moreforfilter .= $hookmanager->resPrint; } else { @@ -1231,7 +1236,7 @@ if (!empty($arrayfields['origin']['checked'])) { if (!empty($arrayfields['m.fk_projet']['checked'])) { // fk_project print ''; - print $object->showInputField($object->fields['fk_project'], 'fk_project', $search_fk_project, '', '', 'search_', 'maxwidth125', 1); + print $warehouse->showInputField($warehouse->fields['fk_project'], 'fk_project', $search_fk_project, '', '', 'search_', 'maxwidth125', 1); print ''; } if (!empty($arrayfields['m.type_mouvement']['checked'])) { @@ -1268,7 +1273,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook $parameters = array('arrayfields'=>$arrayfields); -$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $warehouse, $action); // Note that $action and $warehouse may have been modified by hook print $hookmanager->resPrint; // Date creation if (!empty($arrayfields['m.datec']['checked'])) { @@ -1355,7 +1360,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray); -$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $warehouse, $action); // Note that $action and $warehouse may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['m.datec']['checked'])) { print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); @@ -1393,7 +1398,7 @@ while ($i < $imaxinloop) { $userstatic->firstname = $obj->firstname; $userstatic->photo = $obj->photo; $userstatic->email = $obj->user_email; - $userstatic->statut = $obj->user_status; + $userstatic->status = $obj->user_status; // Multilangs if (getDolGlobalInt('MAIN_MULTILANGS')) { // If multilang is enabled @@ -1434,11 +1439,16 @@ while ($i < $imaxinloop) { $warehousestatic->fk_parent = $obj->fk_parent; $warehousestatic->statut = $obj->statut; - $movement->type = $obj->type_mouvement; + $object->id = $obj->mid; + $object->qty = $obj->qty; + $object->label = $obj->label; + $object->batch = $obj->batch; + $object->warehouse_id = $obj->entrepot_id; + $object->type = $obj->type_mouvement; $arrayofuniqueproduct[$obj->rowid] = $obj->produit; if (!empty($obj->fk_origin)) { - $origin = $movement->get_origin($obj->fk_origin, $obj->origintype); + $origin = $object->get_origin($obj->fk_origin, $obj->origintype); } else { $origin = ''; } @@ -1452,11 +1462,11 @@ while ($i < $imaxinloop) { $selected = -1; if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined $selected = 0; - if (in_array($object->id, $arrayofselected)) { + if (in_array($warehouse->id, $arrayofselected)) { $selected = 1; } } - print $object->getKanbanView('', array('selected' => $selected)); + print $warehouse->getKanbanView('', array('selected' => $selected)); if ($i == ($imaxinloop - 1)) { print '
'; print ''; @@ -1464,7 +1474,7 @@ while ($i < $imaxinloop) { } else { // Show here line of result $j = 0; - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; @@ -1483,8 +1493,8 @@ while ($i < $imaxinloop) { // Id movement if (!empty($arrayfields['m.rowid']['checked'])) { print ''; - print img_picto($langs->trans("StockMovement"), 'movement', 'class="pictofixedwidth"'); - print $obj->mid; + //print img_picto($langs->trans("StockMovement"), 'movement', 'class="pictofixedwidth"'); + print $object->getNomUrl(1);; print ''; // This is primary not movement id } if (!empty($arrayfields['m.datem']['checked'])) { @@ -1546,14 +1556,14 @@ while ($i < $imaxinloop) { // fk_project print ''; if ($obj->fk_project != 0) { - print $movement->get_origin($obj->fk_project, 'project'); + print $object->get_origin($obj->fk_project, 'project'); } print ''; } if (!empty($arrayfields['m.type_mouvement']['checked'])) { // Type of movement print ''; - print $movement->getTypeMovement(); + print $object->getTypeMovement(); print ''; } if (!empty($arrayfields['m.value']['checked'])) { @@ -1581,7 +1591,6 @@ while ($i < $imaxinloop) { } // Extra fields - $object = $movement; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); @@ -1643,8 +1652,8 @@ if (count($arrayofuniqueproduct) == 1 && !empty($year) && is_numeric($year)) { } $datebefore = dol_get_first_day($year ? $year : dol_print_date(time(), "%Y"), $month ? $month : 1, true); $dateafter = dol_get_last_day($year ? $year : dol_print_date(time(), "%Y"), $month ? $month : 12, true); - $balancebefore = $movement->calculateBalanceForProductBefore($productidselected, $datebefore); - $balanceafter = $movement->calculateBalanceForProductBefore($productidselected, $dateafter); + $balancebefore = $object->calculateBalanceForProductBefore($productidselected, $datebefore); + $balanceafter = $object->calculateBalanceForProductBefore($productidselected, $dateafter); //print ''; print $langs->trans("NbOfProductBeforePeriod", $productlabelselected, dol_print_date($datebefore, 'day', 'gmt')); @@ -1679,7 +1688,7 @@ if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords $genallowed = $permissiontoread; $delallowed = $permissiontoadd; - print $formfile->showdocuments('massfilesarea_'.$object->module, '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); + print $formfile->showdocuments('massfilesarea_stock', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); } // End of page