NEW The lot of a product uses the link and picto when shown into list.
This commit is contained in:
parent
3b40c95107
commit
8f5206accf
@ -189,7 +189,7 @@ function dol_loginfunction($langs,$conf,$mysoc)
|
||||
if (GETPOST('urlfrom','alpha')) $_SESSION["urlfrom"]=GETPOST('urlfrom','alpha');
|
||||
else unset($_SESSION["urlfrom"]);
|
||||
|
||||
if (! GETPOST("username")) $focus_element='username';
|
||||
if (! GETPOST("username",'alpha')) $focus_element='username';
|
||||
else $focus_element='password';
|
||||
|
||||
$demologin='';
|
||||
|
||||
@ -152,7 +152,7 @@ else if (! empty($_ENV["dol_entity"])) // Entity inside a CLI script
|
||||
{
|
||||
$conf->entity = $_ENV["dol_entity"];
|
||||
}
|
||||
else if (isset($_POST["loginfunction"]) && GETPOST("entity")) // Just after a login page
|
||||
else if (isset($_POST["loginfunction"]) && GETPOST("entity",'int')) // Just after a login page
|
||||
{
|
||||
$conf->entity = GETPOST("entity",'int');
|
||||
}
|
||||
|
||||
@ -154,7 +154,7 @@ class Productbatch extends CommonObject
|
||||
$sql.= " pl.sellby";
|
||||
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_batch as t INNER JOIN ".MAIN_DB_PREFIX."product_stock w on t.fk_product_stock = w.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_lot as pl on pl.fk_product = w.fk_product and pl.batch = t.batch";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_lot as pl on pl.fk_product = w.fk_product and pl.batch = t.batch";
|
||||
$sql.= " WHERE t.rowid = ".$id;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
@ -205,9 +205,9 @@ class Productbatch extends CommonObject
|
||||
// TODO Check qty is ok for stock move. Negative may not be allowed.
|
||||
if ($this->qty < 0)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.self::$_table_element." SET";
|
||||
$sql.= " fk_product_stock=".(isset($this->fk_product_stock)?$this->fk_product_stock:"null").",";
|
||||
@ -435,7 +435,7 @@ class Productbatch extends CommonObject
|
||||
|
||||
if (! empty($eatby)) array_push($where," eatby = '".$this->db->idate($eatby)."'"); // deprecated
|
||||
if (! empty($sellby)) array_push($where," sellby = '".$this->db->idate($sellby)."'"); // deprecated
|
||||
|
||||
|
||||
if (! empty($batch_number)) $sql.= " AND batch = '".$this->db->escape($batch_number)."'";
|
||||
|
||||
if (! empty($where)) $sql.= " AND (".implode(" OR ",$where).")";
|
||||
@ -493,7 +493,7 @@ class Productbatch extends CommonObject
|
||||
$sql.= " t.import_key";
|
||||
if ($fk_product > 0)
|
||||
{
|
||||
$sql.= ", pl.eatby as eatby, pl.sellby as sellby";
|
||||
$sql.= ", pl.rowid as lotid, pl.eatby as eatby, pl.sellby as sellby";
|
||||
// TODO May add extrafields to ?
|
||||
}
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_batch as t";
|
||||
@ -517,6 +517,7 @@ class Productbatch extends CommonObject
|
||||
|
||||
$tmp = new Productbatch($db);
|
||||
$tmp->id = $obj->rowid;
|
||||
$tmp->lotid = $obj->lotid;
|
||||
$tmp->tms = $db->jdate($obj->tms);
|
||||
$tmp->fk_product_stock = $obj->fk_product_stock;
|
||||
$tmp->sellby = $db->jdate($obj->sellby ? $obj->sellby : $obj->oldsellby);
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
|
||||
@ -115,7 +116,7 @@ $sql.= ' p.duration, p.tosell as statut, p.tobuy, p.seuil_stock_alerte, p.desire
|
||||
$sql.= ' ps.fk_entrepot,';
|
||||
$sql.= ' e.label as warehouse_ref, e.lieu as warehouse_lieu, e.fk_parent as warehouse_parent,';
|
||||
$sql.= ' pb.batch, pb.eatby as oldeatby, pb.sellby as oldsellby,';
|
||||
$sql.= ' pl.eatby, pl.sellby,';
|
||||
$sql.= ' pl.rowid as lotid, pl.eatby, pl.sellby,';
|
||||
$sql.= ' SUM(pb.qty) as stock_physique, COUNT(pb.rowid) as nbinbatchtable';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as ps on p.rowid = ps.fk_product'; // Detail for each warehouse
|
||||
@ -157,7 +158,7 @@ $sql.= " p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock, p.
|
||||
$sql.= " ps.fk_entrepot,";
|
||||
$sql.= " e.label, e.lieu, e.fk_parent,";
|
||||
$sql.= " pb.batch, pb.eatby, pb.sellby,";
|
||||
$sql.= " pl.eatby, pl.sellby";
|
||||
$sql.= " pl.rowid, pl.eatby, pl.sellby";
|
||||
if ($toolowstock) $sql.= " HAVING SUM(".$db->ifsql('ps.reel IS NULL', '0', 'ps.reel').") < p.seuil_stock_alerte"; // Not used yet
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
|
||||
@ -306,6 +307,7 @@ if ($resql)
|
||||
print "</tr>\n";
|
||||
|
||||
$product_static=new Product($db);
|
||||
$product_lot_static=new Productlot($db);
|
||||
$warehousetmp=new Entrepot($db);
|
||||
|
||||
while ($i < min($num,$limit))
|
||||
@ -336,6 +338,13 @@ if ($resql)
|
||||
$product_static->type=$objp->fk_product_type;
|
||||
$product_static->entity=$objp->entity;
|
||||
|
||||
$product_lot_static->batch=$objp->batch;
|
||||
$product_lot_static->product_id=$objp->rowid;
|
||||
$product_lot_static->id=$objp->lotid;
|
||||
$product_lot_static->eatby=$objp->eatby;
|
||||
$product_lot_static->sellby=$objp->sellby;
|
||||
|
||||
|
||||
$warehousetmp->id=$objp->fk_entrepot;
|
||||
$warehousetmp->ref=$objp->warehouse_ref;
|
||||
$warehousetmp->label=$objp->warehouse_ref;
|
||||
@ -372,7 +381,15 @@ if ($resql)
|
||||
print $warehousetmp->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
print '<td align="center">'.$objp->batch.'</td>';
|
||||
|
||||
// Lot
|
||||
print '<td align="center">';
|
||||
if ($product_lot_static->batch)
|
||||
{
|
||||
print $product_lot_static->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print '<td align="center">'.dol_print_date($db->jdate($objp->eatby), 'day').'</td>';
|
||||
print '<td align="center">'.dol_print_date($db->jdate($objp->sellby), 'day').'</td>';
|
||||
print '<td align="right">';
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
||||
@ -823,6 +824,8 @@ $sql.= " AND ps.fk_product = ".$object->id;
|
||||
$sql.= " ORDER BY e.label";
|
||||
|
||||
$entrepotstatic=new Entrepot($db);
|
||||
$product_lot_static=new Productlot($db);
|
||||
|
||||
$total=0;
|
||||
$totalvalue=$totalvaluesell=0;
|
||||
|
||||
@ -867,6 +870,11 @@ if ($resql)
|
||||
if ($details<0) dol_print_error($db);
|
||||
foreach ($details as $pdluo)
|
||||
{
|
||||
$product_lot_static->id = $pdluo->lotid;
|
||||
$product_lot_static->batch = $pdluo->batch;
|
||||
$product_lot_static->eatby = $pdluo->eatby;
|
||||
$product_lot_static->sellby = $pdluo->sellby;
|
||||
|
||||
if ($action == 'editline' && GETPOST('lineid','int') == $pdluo->id)
|
||||
{ //Current line edit
|
||||
print "\n".'<tr>';
|
||||
@ -896,7 +904,9 @@ if ($resql)
|
||||
// Do not use this, or data will be wrong (bad tracking of movement label, inventory code, ...
|
||||
//print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$id.'&action=editline&lineid='.$pdluo->id.'#'.$pdluo->id.'">';
|
||||
//print img_edit().'</a></td>';
|
||||
print '<td align="right">'.$pdluo->batch.'</td>';
|
||||
print '<td align="right">';
|
||||
print $product_lot_static->getNomUrl(1);
|
||||
print '</td>';
|
||||
print '<td align="center">'. dol_print_date($pdluo->eatby,'day') .'</td>';
|
||||
print '<td align="center">'. dol_print_date($pdluo->sellby,'day') .'</td>';
|
||||
print '<td align="right">'.$pdluo->qty.($pdluo->qty<0?' '.img_warning():'').'</td>';
|
||||
|
||||
@ -284,7 +284,6 @@ if ($action == 'create')
|
||||
print '<table class="border centpercent">'."\n";
|
||||
// print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input class="flat" type="text" size="36" name="label" value="'.$label.'"></td></tr>';
|
||||
//
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Fieldentity").'</td><td><input class="flat" type="text" name="entity" value="'.GETPOST('entity').'"></td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Fieldfk_product").'</td><td><input class="flat" type="text" name="fk_product" value="'.GETPOST('fk_product').'"></td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Fieldbatch").'</td><td><input class="flat" type="text" name="batch" value="'.GETPOST('batch').'"></td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Fieldfk_user_creat").'</td><td><input class="flat" type="text" name="fk_user_creat" value="'.GETPOST('fk_user_creat').'"></td></tr>';
|
||||
|
||||
@ -48,19 +48,19 @@ $action=GETPOST('action', 'alpha');
|
||||
$mode=$dolibarr_main_authentication;
|
||||
if (! $mode) $mode='http';
|
||||
|
||||
$username = GETPOST('username');
|
||||
$passwordhash = GETPOST('passwordhash');
|
||||
$conf->entity = (GETPOST('entity') ? GETPOST('entity') : 1);
|
||||
$username = GETPOST('username','alpha');
|
||||
$passwordhash = GETPOST('passwordhash','alpha');
|
||||
$conf->entity = (GETPOST('entity','int') ? GETPOST('entity','int') : 1);
|
||||
|
||||
// Instantiate hooks of thirdparty module only if not already define
|
||||
$hookmanager->initHooks(array('passwordforgottenpage'));
|
||||
|
||||
|
||||
if (GETPOST('dol_hide_leftmenu') || ! empty($_SESSION['dol_hide_leftmenu'])) $conf->dol_hide_leftmenu=1;
|
||||
if (GETPOST('dol_hide_topmenu') || ! empty($_SESSION['dol_hide_topmenu'])) $conf->dol_hide_topmenu=1;
|
||||
if (GETPOST('dol_optimize_smallscreen') || ! empty($_SESSION['dol_optimize_smallscreen'])) $conf->dol_optimize_smallscreen=1;
|
||||
if (GETPOST('dol_no_mouse_hover') || ! empty($_SESSION['dol_no_mouse_hover'])) $conf->dol_no_mouse_hover=1;
|
||||
if (GETPOST('dol_use_jmobile') || ! empty($_SESSION['dol_use_jmobile'])) $conf->dol_use_jmobile=1;
|
||||
if (GETPOST('dol_hide_leftmenu','alpha') || ! empty($_SESSION['dol_hide_leftmenu'])) $conf->dol_hide_leftmenu=1;
|
||||
if (GETPOST('dol_hide_topmenu','alpha') || ! empty($_SESSION['dol_hide_topmenu'])) $conf->dol_hide_topmenu=1;
|
||||
if (GETPOST('dol_optimize_smallscreen','alpha') || ! empty($_SESSION['dol_optimize_smallscreen'])) $conf->dol_optimize_smallscreen=1;
|
||||
if (GETPOST('dol_no_mouse_hover','alpha') || ! empty($_SESSION['dol_no_mouse_hover'])) $conf->dol_no_mouse_hover=1;
|
||||
if (GETPOST('dol_use_jmobile','alpha') || ! empty($_SESSION['dol_use_jmobile'])) $conf->dol_use_jmobile=1;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user