NEW Add status of warehouse in tooltip of a warehouse.

This commit is contained in:
Laurent Destailleur
2019-08-26 23:54:15 +02:00
parent db6b1b6ffb
commit e8bb84e803
4 changed files with 26 additions and 8 deletions

View File

@@ -687,7 +687,7 @@ class Entrepot extends CommonObject
if (! empty($this->lieu))
$label.= '<br><b>' . $langs->trans('LocationSummary').':</b> '.$this->lieu;
if (isset($this->statut))
$label.= '<br><b>' . $langs->trans("Status").":</b> ".$this->getLibStatut(2);
$label.= '<br><b>' . $langs->trans("Status").":</b> ".$this->getLibStatut(5);
$url = DOL_URL_ROOT.'/product/stock/card.php?id='.$this->id;

View File

@@ -104,13 +104,19 @@ $form=new Form($db);
$warehouse=new Entrepot($db);
$sql = "SELECT e.rowid, e.ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays, e.fk_parent,";
$sql.= " SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue, SUM(ps.reel) as stockqty";
$sql.= " SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue, SUM(ps.reel) as stockqty,";
// Add fields from extrafields
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
if (! empty($extrafields->attributes[$object->table_element]['label']))
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : '');
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql=preg_replace('/, $/', '', $sql);
$sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON e.rowid = ps.fk_entrepot";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid";
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."entrepot_extrafields as ef on (e.rowid = ef.fk_object)";
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (e.rowid = ef.fk_object)";
$sql.= " WHERE e.entity IN (".getEntity('stock').")";
if ($search_ref) $sql.= natural_search("e.ref", $search_ref); // ref
if ($search_label) $sql.= natural_search("e.lieu", $search_label); // label
@@ -118,6 +124,10 @@ if ($search_status != '' && $search_status >= 0) $sql.= " AND e.statut = ".$sear
if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall);
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql.= " GROUP BY e.rowid, e.ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays, e.fk_parent";
$totalnboflines=0;
$result=$db->query($sql);
@@ -241,6 +251,7 @@ if ($result)
$warehouse->label = $obj->ref;
$warehouse->lieu = $obj->lieu;
$warehouse->fk_parent = $obj->fk_parent;
$warehouse->statut = $obj->statut;
print '<tr class="oddeven">';
print '<td>' . $warehouse->getNomUrl(1) . '</td>';

View File

@@ -420,7 +420,7 @@ $formproduct=new FormProduct($db);
if (!empty($conf->projet->enabled)) $formproject=new FormProjets($db);
$sql = "SELECT p.rowid, p.ref as product_ref, p.label as produit, p.tobatch, p.fk_product_type as type, p.entity,";
$sql.= " e.ref as stock, e.rowid as entrepot_id, e.lieu,";
$sql.= " e.ref as warehouse_ref, e.rowid as entrepot_id, e.lieu, e.fk_parent, e.statut,";
$sql.= " m.rowid as mid, m.value as qty, m.datem, m.fk_user_author, m.label, m.inventorycode, m.fk_origin, m.origintype,";
$sql.= " m.batch, m.price,";
$sql.= " m.type_mouvement,";
@@ -988,8 +988,12 @@ if ($resql)
$productlot->sellby= $objp->sellby;
$warehousestatic->id=$objp->entrepot_id;
$warehousestatic->libelle=$objp->stock;
$warehousestatic->ref=$objp->warehouse_ref;
$warehousestatic->libelle=$objp->warehouse_ref;
$warehousestatic->label=$objp->warehouse_ref;
$warehousestatic->lieu=$objp->lieu;
$warehousestatic->fk_parent = $objp->fk_parent;
$warehousestatic->statut = $objp->statut;
$arrayofuniqueproduct[$objp->rowid]=$objp->produit;
if(!empty($objp->fk_origin)) {

View File

@@ -827,7 +827,7 @@ if (! $variants) {
print '</tr>';
}
$sql = "SELECT e.rowid, e.ref as label, e.lieu, e.statut, ps.reel, ps.rowid as product_stock_id, p.pmp";
$sql = "SELECT e.rowid, e.ref, e.lieu, e.fk_parent, e.statut, ps.reel, ps.rowid as product_stock_id, p.pmp";
$sql .= " FROM " . MAIN_DB_PREFIX . "entrepot as e,";
$sql .= " " . MAIN_DB_PREFIX . "product_stock as ps";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = ps.fk_product";
@@ -853,8 +853,11 @@ if (! $variants) {
$obj = $db->fetch_object($resql);
$entrepotstatic->id = $obj->rowid;
$entrepotstatic->libelle = $obj->label;
$entrepotstatic->ref = $obj->ref;
$entrepotstatic->libelle = $obj->ref;
$entrepotstatic->label = $obj->ref;
$entrepotstatic->lieu = $obj->lieu;
$entrepotstatic->fk_parent = $obj->fk_parent;
$entrepotstatic->statut = $obj->statut;
$stock_real = price2num($obj->reel, 'MS');