';
foreach ($alreadysent as $key => $val)
{
- if ($lines[$i]->fk_origin_line == $key)
+ if ($lines[$i]->fk_commandefourndet == $key)
{
$j = 0;
foreach($val as $receptionline_id=> $receptionline_var)
@@ -2042,6 +2043,7 @@ else if ($id || $ref)
$reception_static->fetch($receptionline_var['reception_id']);
print $reception_static->getNomUrl(1);
print ' - '.$receptionline_var['qty_shipped'];
+
$htmltext=$langs->trans("DateValidation").' : '.(empty($receptionline_var['date_valid'])?$langs->trans("Draft"):dol_print_date($receptionline_var['date_valid'], 'dayhour'));
if (! empty($conf->stock->enabled) && $receptionline_var['warehouse'] > 0)
{
@@ -2059,72 +2061,24 @@ else if ($id || $ref)
{
// edit mode
print '
';
- if (is_array($lines[$i]->detail_batch) && count($lines[$i]->detail_batch) > 0)
- {
- print '';
- $line = new CommandeFournisseurDispatch($db);
- foreach ($lines[$i]->detail_batch as $detail_batch)
- {
- print '
';
- // Qty to ship or shipped
- print '
' . '' . '
';
- // Batch number managment
- if ($lines[$i]->entrepot_id == 0)
- {
- // only show lot numbers from src warehouse when reception from multiple warehouses
- $line->fetch($detail_batch->fk_receptiondet);
- }
- print '
';
diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php
index ddd7165a3b9..9a557a9a50c 100644
--- a/htdocs/reception/class/reception.class.php
+++ b/htdocs/reception/class/reception.class.php
@@ -1190,7 +1190,7 @@ class Reception extends CommonObject
function fetch_lines()
{
global $db;
-
+ dol_include_once('/fourn/class/fournisseur.commande.dispatch.class.php');
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'commande_fournisseur_dispatch WHERE fk_reception='.$this->id;
$resql = $db->query($sql);
if(!empty($resql)){
@@ -1199,7 +1199,14 @@ class Reception extends CommonObject
$line = new CommandeFournisseurDispatch($db);
$line->fetch($obj->rowid);
$line->fetch_product();
-
+ $sql_qtyasked = 'SELECT qty FROM llx_commande_fournisseurdet WHERE rowid='.$line->fk_commandefourndet;
+ $resql_qtyasked = $db->query($sql_qtyasked);
+ if(!empty($resql_qtyasked)){
+ $obj = $db->fetch_object($resql_qtyasked);
+ $line->qty_asked = $obj->qty;
+ }else {
+ $line->qty_asked = 0;
+ }
$this->lines[]=$line;
}
@@ -1464,7 +1471,7 @@ class Reception extends CommonObject
$i=0;
$sql = "SELECT em.rowid, em.code, em.libelle, em.description, em.tracking, em.active";
- $sql.= " FROM ".MAIN_DB_PREFIX."c_reception_mode as em";
+ $sql.= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as em";
if ($id!='') $sql.= " WHERE em.rowid=".$id;
$resql = $this->db->query($sql);
@@ -1495,13 +1502,13 @@ class Reception extends CommonObject
{
if ($id=='')
{
- $sql = "INSERT INTO ".MAIN_DB_PREFIX."c_reception_mode (code, libelle, description, tracking)";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."c_shipment_mode (code, libelle, description, tracking)";
$sql.=" VALUES ('".$this->update['code']."','".$this->update['libelle']."','".$this->update['description']."','".$this->update['tracking']."')";
$resql = $this->db->query($sql);
}
else
{
- $sql = "UPDATE ".MAIN_DB_PREFIX."c_reception_mode SET";
+ $sql = "UPDATE ".MAIN_DB_PREFIX."c_shipment_mode SET";
$sql.= " code='".$this->db->escape($this->update['code'])."'";
$sql.= ",libelle='".$this->db->escape($this->update['libelle'])."'";
$sql.= ",description='".$this->db->escape($this->update['description'])."'";
@@ -1521,7 +1528,7 @@ class Reception extends CommonObject
*/
function activ_delivery_method($id)
{
- $sql = 'UPDATE '.MAIN_DB_PREFIX.'c_reception_mode SET active=1';
+ $sql = 'UPDATE '.MAIN_DB_PREFIX.'c_shipment_mode SET active=1';
$sql.= ' WHERE rowid='.$id;
$resql = $this->db->query($sql);
@@ -1537,7 +1544,7 @@ class Reception extends CommonObject
*/
function disable_delivery_method($id)
{
- $sql = 'UPDATE '.MAIN_DB_PREFIX.'c_reception_mode SET active=0';
+ $sql = 'UPDATE '.MAIN_DB_PREFIX.'c_shipment_mode SET active=0';
$sql.= ' WHERE rowid='.$id;
$resql = $this->db->query($sql);
@@ -1556,7 +1563,7 @@ class Reception extends CommonObject
if (! empty($this->shipping_method_id))
{
$sql = "SELECT em.code, em.tracking";
- $sql.= " FROM ".MAIN_DB_PREFIX."c_reception_mode as em";
+ $sql.= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as em";
$sql.= " WHERE em.rowid = ".$this->shipping_method_id;
$resql = $this->db->query($sql);
diff --git a/htdocs/reception/index.php b/htdocs/reception/index.php
index 7eaba0b29ad..04fe5bc969a 100644
--- a/htdocs/reception/index.php
+++ b/htdocs/reception/index.php
@@ -18,30 +18,30 @@
*/
/**
- * \file htdocs/expedition/index.php
- * \ingroup expedition
- * \brief Home page of shipping area.
+ * \file htdocs/reception/index.php
+ * \ingroup reception
+ * \brief Home page of reception area.
*/
require '../main.inc.php';
-require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
-require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
+require_once DOL_DOCUMENT_ROOT.'/reception/class/reception.class.php';
$langs->load("orders");
-$langs->load("sendings");
+$langs->load("receptions");
/*
* View
*/
-$orderstatic=new Commande($db);
+$orderstatic=new CommandeFournisseur($db);
$companystatic=new Societe($db);
-$shipment=new Expedition($db);
+$reception=new Reception($db);
-$helpurl='EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones';
-llxHeader('',$langs->trans("Shipment"),$helpurl);
+$helpurl='EN:Module_Receptions|FR:Module_Receptions|ES:Módulo_Receptiones';
+llxHeader('',$langs->trans("Reception"),$helpurl);
-print load_fiche_titre($langs->trans("SendingsArea"));
+print load_fiche_titre($langs->trans("ReceptionsArea"));
print '
';
@@ -54,21 +54,21 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
print '
';
print '
'.$langs->trans("Search").'
';
print '
';
- print $langs->trans("Shipment").':
';
+ print $langs->trans("Reception").':
';
print "
\n";
}
/*
- * Shipments to validate
+ * Receptions to validate
*/
$clause = " WHERE ";
-$sql = "SELECT e.rowid, e.ref, e.ref_customer,";
+$sql = "SELECT e.rowid, e.ref, e.ref_supplier,";
$sql.= " s.nom as name, s.rowid as socid,";
-$sql.= " c.ref as commande_ref, c.rowid as commande_id";
-$sql.= " FROM ".MAIN_DB_PREFIX."expedition as e";
-$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON e.rowid = el.fk_target AND el.targettype = 'shipping'";
-$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON el.fk_source = c.rowid";
+$sql.= " c.ref as commande_fournisseur_ref, c.rowid as commande_fournisseur_id";
+$sql.= " FROM ".MAIN_DB_PREFIX."reception as e";
+$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON e.rowid = el.fk_target AND el.targettype = 'reception'";
+$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."commande_fournisseur as c ON el.fk_source = c.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc";
if (!$user->rights->societe->client->voir && !$socid)
{
@@ -77,7 +77,7 @@ if (!$user->rights->societe->client->voir && !$socid)
$clause = " AND ";
}
$sql.= $clause." e.fk_statut = 0";
-$sql.= " AND e.entity IN (".getEntity('expedition').")";
+$sql.= " AND e.entity IN (".getEntity('reception').")";
if ($socid) $sql.= " AND c.fk_soc = ".$socid;
$resql=$db->query($sql);
@@ -88,24 +88,24 @@ if ($resql)
{
print '
';
/*
- * Commandes en traitement
+ * CommandeFournisseurs en traitement
*/
-$sql = "SELECT c.rowid, c.ref, c.ref_client as ref_customer, c.fk_statut as status, c.facture as billed, s.nom as name, s.rowid as socid";
-$sql.= " FROM ".MAIN_DB_PREFIX."commande as c,";
+$sql = "SELECT c.rowid, c.ref, c.ref_supplier as ref_supplier, c.fk_statut as status, c.billed as billed, s.nom as name, s.rowid as socid";
+$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c,";
$sql.= " ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE c.fk_soc = s.rowid";
$sql.= " AND c.entity = ".$conf->entity;
-$sql.= " AND c.fk_statut = 2";
+$sql.= " AND c.fk_statut IN (3,4)";
if ($socid) $sql.= " AND c.fk_soc = ".$socid;
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
@@ -199,14 +198,14 @@ if ( $resql )
$i = 0;
print '
';
print '
';
- print '
'.$langs->trans("OrdersInProcess").'
';
+ print '
'.$langs->trans("SuppliersOrdersInProcess").'
';
while ($i < $num)
{
$obj = $db->fetch_object($resql);
$orderstatic->id=$obj->rowid;
$orderstatic->ref=$obj->ref;
- $orderstatic->ref_customer=$obj->ref_customer;
+ $orderstatic->ref_supplier=$obj->ref_supplier;
$orderstatic->statut=$obj->status;
$orderstatic->facturee=$obj->billed;
@@ -232,17 +231,17 @@ else dol_print_error($db);
/*
- * Last shipments
+ * Last receptions
*/
-$sql = "SELECT e.rowid, e.ref, e.ref_customer,";
+$sql = "SELECT e.rowid, e.ref, e.ref_supplier,";
$sql.= " s.nom as name, s.rowid as socid,";
-$sql.= " c.ref as commande_ref, c.rowid as commande_id";
-$sql.= " FROM ".MAIN_DB_PREFIX."expedition as e";
-$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON e.rowid = el.fk_target AND el.targettype = 'shipping' AND el.sourcetype IN ('commande')";
-$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON el.fk_source = c.rowid AND el.sourcetype IN ('commande') AND el.targettype = 'shipping'";
+$sql.= " c.ref as commande_fournisseur_ref, c.rowid as commande_fournisseur_id";
+$sql.= " FROM ".MAIN_DB_PREFIX."reception as e";
+$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON e.rowid = el.fk_target AND el.targettype = 'reception' AND el.sourcetype IN ('commande_fournisseur')";
+$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."commande_fournisseur as c ON el.fk_source = c.rowid AND el.sourcetype IN ('commande_fournisseur') AND el.targettype = 'reception'";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON e.fk_soc = sc.fk_soc";
-$sql.= " WHERE e.entity IN (".getEntity('expedition').")";
+$sql.= " WHERE e.entity IN (".getEntity('reception').")";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND sc.fk_user = " .$user->id;
$sql.= " AND e.fk_statut = 1";
if ($socid) $sql.= " AND c.fk_soc = ".$socid;
@@ -258,24 +257,24 @@ if ($resql)
$i = 0;
print '