Merge pull request #16139 from aspangaro/14a14
NEW: Stock movement list - Add more complete date field
This commit is contained in:
commit
5fc36ab736
@ -66,8 +66,8 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected
|
||||
$result = restrictedArea($user, 'stock');
|
||||
|
||||
$idproduct = GETPOST('idproduct', 'int');
|
||||
$year = GETPOST("year");
|
||||
$month = GETPOST("month");
|
||||
$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int'), 'tzuserrel');
|
||||
$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int'), 'tzuserrel');
|
||||
$search_ref = GETPOST('search_ref', 'alpha');
|
||||
$search_movement = GETPOST("search_movement");
|
||||
$search_product_ref = trim(GETPOST("search_product_ref"));
|
||||
@ -162,8 +162,8 @@ if (empty($reshook))
|
||||
// Do we click on purge search criteria ?
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
$year = '';
|
||||
$month = '';
|
||||
$search_date_start = '';
|
||||
$search_date_end = '';
|
||||
$search_ref = '';
|
||||
$search_movement = "";
|
||||
$search_type_mouvement = "";
|
||||
@ -482,17 +482,18 @@ $sql .= " AND m.fk_entrepot = e.rowid";
|
||||
$sql .= " AND e.entity IN (".getEntity('stock').")";
|
||||
if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) $sql .= " AND p.fk_product_type = 0";
|
||||
if ($id > 0) $sql .= " AND e.rowid ='".$id."'";
|
||||
$sql .= dolSqlDateFilter('m.datem', 0, $month, $year);
|
||||
if (!empty($search_date_start)) $sql .= " AND m.datem >= '" . $db->idate($search_date_start) . "'";
|
||||
if (!empty($search_date_end)) $sql .= " AND m.datem <= '" . $db->idate($search_date_end) . "'";
|
||||
if ($idproduct > 0) $sql .= " AND p.rowid = ".((int) $idproduct);
|
||||
if (!empty($search_ref)) $sql .= natural_search('m.rowid', $search_ref, 1);
|
||||
if (!empty($search_movement)) $sql .= natural_search('m.label', $search_movement);
|
||||
if (!empty($search_inventorycode)) $sql .= natural_search('m.inventorycode', $search_inventorycode);
|
||||
if (!empty($search_product_ref)) $sql .= natural_search('p.ref', $search_product_ref);
|
||||
if (!empty($search_product)) $sql .= natural_search('p.label', $search_product);
|
||||
if (!empty($search_movement)) $sql .= natural_search('m.label', $search_movement);
|
||||
if (!empty($search_inventorycode)) $sql .= natural_search('m.inventorycode', $search_inventorycode);
|
||||
if (!empty($search_product_ref)) $sql .= natural_search('p.ref', $search_product_ref);
|
||||
if (!empty($search_product)) $sql .= natural_search('p.label', $search_product);
|
||||
if ($search_warehouse != '' && $search_warehouse != '-1') $sql .= natural_search('e.rowid', $search_warehouse, 2);
|
||||
if (!empty($search_user)) $sql .= natural_search('u.login', $search_user);
|
||||
if (!empty($search_batch)) $sql .= natural_search('m.batch', $search_batch);
|
||||
if (!empty($product_id)) $sql .= natural_search('p.rowid', $product_id);
|
||||
if (!empty($search_user)) $sql .= natural_search('u.login', $search_user);
|
||||
if (!empty($search_batch)) $sql .= natural_search('m.batch', $search_batch);
|
||||
if (!empty($product_id)) $sql .= natural_search('p.rowid', $product_id);
|
||||
if ($search_qty != '') $sql .= natural_search('m.value', $search_qty, 1);
|
||||
if ($search_type_mouvement != '' && $search_type_mouvement != '-1') $sql .= natural_search('m.type_mouvement', $search_type_mouvement, 2);
|
||||
// Add where from extra fields
|
||||
@ -711,6 +712,8 @@ if ($resql)
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
||||
if ($id > 0) $param .= '&id='.urlencode($id);
|
||||
if ($search_date_start) $param .= '&search_date_start='.urlencode($search_date_start);
|
||||
if ($search_date_end) $param .= '&search_date_end='.urlencode($search_date_end);
|
||||
if ($search_movement) $param .= '&search_movement='.urlencode($search_movement);
|
||||
if ($search_inventorycode) $param .= '&search_inventorycode='.urlencode($search_inventorycode);
|
||||
if ($search_type_mouvement) $param .= '&search_type_mouvement='.urlencode($search_type_mouvement);
|
||||
@ -789,16 +792,17 @@ if ($resql)
|
||||
print '<input class="flat maxwidth25" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['m.datem']['checked']))
|
||||
if (! empty($arrayfields['m.datem']['checked']))
|
||||
{
|
||||
// Date
|
||||
print '<td class="liste_titre nowraponall">';
|
||||
print '<input class="flat" type="text" size="2" maxlength="2" placeholder="'.dol_escape_htmltag($langs->trans("Month")).'" name="month" value="'.$month.'">';
|
||||
if (empty($conf->productbatch->enabled)) print ' ';
|
||||
//else print '<br>';
|
||||
$syear = $year ? $year : -1;
|
||||
print '<input class="flat maxwidth50" type="text" maxlength="4" placeholder="'.dol_escape_htmltag($langs->trans("Year")).'" name="year" value="'.($syear > 0 ? $syear : '').'">';
|
||||
//print $formother->selectyear($syear,'year',1, 20, 5);
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ' ';
|
||||
print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel');
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ' ';
|
||||
print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel');
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['p.ref']['checked']))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user