';
print '';
print '| '.$langs->trans("Ref").' | ';
print ''.$langs->trans("Description").' | ';
- print ''.$langs->trans("QtyShipped").' | ';
+ print ''.$langs->trans("Qty").' | ';
print ''.$langs->trans("Date").' | ';
print "
\n";
@@ -632,13 +694,13 @@ else
$product->fetch($objp->fk_product);
print '';
- print ''.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.' - '.$product->libelle;
- if ($objp->description) print nl2br($objp->description);
+ print ''.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.' - '.dolibarr_trunc($product->libelle,20);
+ if ($objp->description) print nl2br(dolibarr_trunc($objp->description,24));
print ' | ';
}
else
{
- print "".stripslashes(nl2br($objp->description))." | \n";
+ print "".nl2br(dolibarr_trunc($objp->description,24))." | \n";
}
print ''.$objp->qty_livre.' | ';
print ''.dolibarr_print_date($objp->date_expedition).' | ';
@@ -682,11 +744,12 @@ else
print '';
- print_titre("Actions");
/*
* Liste des actions
*
*/
+ print_titre("Actions");
+
$sql = "SELECT ".$db->pdate("a.datea")." as da, a.note";
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
$sql .= " WHERE a.fk_soc = ".$commande->socidp." AND a.fk_action in (9,10)";
diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php
index d3dbe36f70e..4311295542d 100644
--- a/htdocs/html.form.class.php
+++ b/htdocs/html.form.class.php
@@ -2162,7 +2162,7 @@ class Form
\param htmlname Nom de la zone select
\param array Tableau de key+valeur
\param id Key pré-sélectionnée
- \param show_empty 1 si il faut ajouter une valeur " " dans la liste, 0 sinon
+ \param show_empty 1 si il faut ajouter une valeur vide dans la liste, 0 sinon
\param key_in_label 1 pour afficher la key dans la valeur "[key] value"
\param value_as_key 1 pour utiliser la valeur comme clé
*/
diff --git a/htdocs/langs/en_US/sendings.lang b/htdocs/langs/en_US/sendings.lang
index 857b11742c8..65a61c2e4ac 100644
--- a/htdocs/langs/en_US/sendings.lang
+++ b/htdocs/langs/en_US/sendings.lang
@@ -16,6 +16,7 @@ CreateSending=Create sending
QtyOrdered=Qty ordered
QtyShipped=Qty shipped
QtyReceived=Qty received
+QtyToShip=Qty to ship
KeepToShip=Keep to ship
OtherSendingsForSameOrder=Other sendings already shipped
SendingsToValidate=Sending to validate
\ No newline at end of file
diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang
index 44f6641cfdc..a6290718ccb 100644
--- a/htdocs/langs/en_US/stocks.lang
+++ b/htdocs/langs/en_US/stocks.lang
@@ -24,4 +24,5 @@ Units=Units
StockCorrection=Stock correction
StockMovement=Transfer
NumberOfUnit=Number of units
-TotalStock=Total in stock
\ No newline at end of file
+TotalStock=Total in stock
+StockTooLow=Stock too low
\ No newline at end of file
diff --git a/htdocs/langs/fr_FR/sendings.lang b/htdocs/langs/fr_FR/sendings.lang
index 7823b85142a..c8157f89ddb 100644
--- a/htdocs/langs/fr_FR/sendings.lang
+++ b/htdocs/langs/fr_FR/sendings.lang
@@ -15,6 +15,7 @@ CreateASending=Cr
CreateSending=Créer expedition
QtyOrdered=Qté commandée
QtyShipped=Qté expédiée
+QtyToShip=Qté à expédier
QtyReceived=Qté reçue
KeepToShip=Reste à expédier
OtherSendingsForSameOrder=Autres expéditions déjà envoyés
diff --git a/htdocs/langs/fr_FR/stocks.lang b/htdocs/langs/fr_FR/stocks.lang
index da55bc7103b..66bb8a9ceb5 100644
--- a/htdocs/langs/fr_FR/stocks.lang
+++ b/htdocs/langs/fr_FR/stocks.lang
@@ -24,4 +24,5 @@ Units=Unit
StockCorrection=Correction stock
StockMovement=Transfert
NumberOfUnit=Nombre de pièces
-TotalStock=Total en stock
\ No newline at end of file
+TotalStock=Total en stock
+StockTooLow=Stock insuffisant
\ No newline at end of file
diff --git a/htdocs/product.class.php b/htdocs/product.class.php
index 641454833b4..1f693d1527f 100644
--- a/htdocs/product.class.php
+++ b/htdocs/product.class.php
@@ -769,150 +769,121 @@ class Product
* \param ref Ref du produit/service à charger
* \return int <0 si ko, >0 si ok
*/
- function fetch($id='',$ref='')
- {
- global $langs;
+ function fetch($id='',$ref='')
+ {
+ global $langs;
global $conf;
-
+
dolibarr_syslog("Product::fetch id=$id ref=$ref");
-
- // Verification parametres
- if (! $id && ! $ref)
- {
- $this->error=$langs->trans('ErrorWrongParameters');
+
+ // Verification parametres
+ if (! $id && ! $ref)
+ {
+ $this->error=$langs->trans('ErrorWrongParameters');
dolibarr_print_error("Product::fetch ".$this->error);
- return -1;
- }
-
- $sql = "SELECT rowid, ref, label, description, note, price, tva_tx, envente,";
- $sql.= " nbvente, fk_product_type, duration, seuil_stock_alerte";
- $sql.= " FROM ".MAIN_DB_PREFIX."product";
- if ($id) $sql.= " WHERE rowid = '".$id."'";
- if ($ref) $sql.= " WHERE ref = '".addslashes($ref)."'";
-
- $result = $this->db->query($sql) ;
- if ( $result )
- {
- $result = $this->db->fetch_array();
-
- $this->id = $result["rowid"];
- $this->ref = $result["ref"];
- $this->libelle = stripslashes($result["label"]);
- $this->description = stripslashes($result["description"]);
- $this->note = stripslashes($result["note"]);
- $this->price = $result["price"];
- $this->tva_tx = $result["tva_tx"];
- $this->type = $result["fk_product_type"];
- $this->nbvente = $result["nbvente"];
- $this->status = $result["envente"];
- $this->duration = $result["duration"];
- $this->duration_value = substr($result["duration"],0,strlen($result["duration"])-1);
- $this->duration_unit = substr($result["duration"],-1);
- $this->seuil_stock_alerte = $result["seuil_stock_alerte"];
-
- $this->label_url = ''.$this->libelle.'';
-
- if ($this->type == 0)
- {
- $this->isproduct = 1;
- $this->isservice = 0;
- }
- else
- {
- $this->isproduct = 0;
- $this->isservice = 1;
- }
-
- $this->db->free();
+ return -1;
+ }
+
+ $sql = "SELECT rowid, ref, label, description, note, price, tva_tx, envente,";
+ $sql.= " nbvente, fk_product_type, duration, seuil_stock_alerte";
+ $sql.= " FROM ".MAIN_DB_PREFIX."product";
+ if ($id) $sql.= " WHERE rowid = '".$id."'";
+ if ($ref) $sql.= " WHERE ref = '".addslashes($ref)."'";
+
+ $result = $this->db->query($sql) ;
+ if ( $result )
+ {
+ $result = $this->db->fetch_array();
+
+ $this->id = $result["rowid"];
+ $this->ref = $result["ref"];
+ $this->libelle = stripslashes($result["label"]);
+ $this->description = stripslashes($result["description"]);
+ $this->note = stripslashes($result["note"]);
+ $this->price = $result["price"];
+ $this->tva_tx = $result["tva_tx"];
+ $this->type = $result["fk_product_type"];
+ $this->nbvente = $result["nbvente"];
+ $this->status = $result["envente"];
+ $this->duration = $result["duration"];
+ $this->duration_value = substr($result["duration"],0,strlen($result["duration"])-1);
+ $this->duration_unit = substr($result["duration"],-1);
+ $this->seuil_stock_alerte = $result["seuil_stock_alerte"];
+
+ $this->label_url = ''.$this->libelle.'';
+
+ if ($this->type == 0)
+ {
+ $this->isproduct = 1;
+ $this->isservice = 0;
+ }
+ else
+ {
+ $this->isproduct = 0;
+ $this->isservice = 1;
+ }
+
+ $this->db->free();
// multilangs
if( $conf->global->MAIN_MULTILANGS) $this->getMultiLangs();
-
-
+
+
// multiprix
if($conf->global->PRODUIT_MULTIPRICES == 1)
{
- if ($ref)
+ if ($ref)
+ {
+ $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product ";
+ $sql.= "WHERE ref = '".addslashes($ref)."'";
+ $result = $this->db->query($sql) ;
+ if ($result)
{
- $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product ";
- $sql.= "WHERE ref = '".addslashes($ref)."'";
- $result = $this->db->query($sql) ;
- if ($result)
- {
- $result = $this->db->fetch_array();
- $prodid = $result["rowid"];
- }
- else
- {
- dolibarr_print_error($this->db);
- return -1;
- }
+ $result = $this->db->fetch_array();
+ $prodid = $result["rowid"];
}
- $this -> multiprices[1] = $this->price;
- for($i=2;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++)
+ else
{
- $sql= "SELECT price, tva_tx, envente ";
- $sql.= "FROM ".MAIN_DB_PREFIX."product_price ";
- $sql.= "where price_level=".$i." and ";
- if ($id) $sql.= "fk_product = '".$id."' ";
- if ($ref) $sql.= "fk_product = '".$prodid."' ";
- $sql.= "order by date_price DESC limit 1";
- $result = $this->db->query($sql) ;
- if ( $result )
- {
- $result = $this->db->fetch_array();
- if($result["price"] != "" && $result["price"] != "0.00")
- $this -> multiprices[$i]=$result["price"];
- else
- $this -> multiprices[$i]=$this->price;
- }
- else
- {
- dolibarr_print_error($this->db);
- return -1;
- }
+ dolibarr_print_error($this->db);
+ return -1;
}
-
- }
-
- $sql = "SELECT reel, fk_entrepot";
- $sql .= " FROM ".MAIN_DB_PREFIX."product_stock WHERE fk_product = '".$this->id."'";
- $result = $this->db->query($sql) ;
- if ($result)
- {
- $num = $this->db->num_rows($result);
- $i=0;
- if ($num > 0)
- {
- while ($i < $num )
- {
- $row = $this->db->fetch_row($result);
- $this->stock_entrepot[$row[1]] = $row[0];
-
- $this->stock_reel = $this->stock_reel + $row[0];
- $i++;
- }
-
- $this->no_stock = 0;
- }
- else
- {
- $this->no_stock = 1;
- }
- $this->db->free($result);
- return 1;
- }
- else
- {
- $this->error=$this->db->error();
- return -2;
- }
- }
- else
- {
- dolibarr_print_error($this->db);
- return -1;
- }
- }
+ }
+ $this -> multiprices[1] = $this->price;
+ for($i=2;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++)
+ {
+ $sql= "SELECT price, tva_tx, envente ";
+ $sql.= "FROM ".MAIN_DB_PREFIX."product_price ";
+ $sql.= "where price_level=".$i." and ";
+ if ($id) $sql.= "fk_product = '".$id."' ";
+ if ($ref) $sql.= "fk_product = '".$prodid."' ";
+ $sql.= "order by date_price DESC limit 1";
+ $result = $this->db->query($sql) ;
+ if ( $result )
+ {
+ $result = $this->db->fetch_array();
+ if($result["price"] != "" && $result["price"] != "0.00")
+ $this -> multiprices[$i]=$result["price"];
+ else
+ $this -> multiprices[$i]=$this->price;
+ }
+ else
+ {
+ dolibarr_print_error($this->db);
+ return -1;
+ }
+ }
+
+ }
+
+ $res=$this->load_stock();
+
+ return $res;
+ }
+ else
+ {
+ dolibarr_print_error($this->db);
+ return -1;
+ }
+ }
/**
@@ -1825,7 +1796,6 @@ function get_each_prod()
* \param nbpiece nombre de pieces
* \param mouvement 0 = ajout, 1 = suppression
*/
-
function ajust_stock($user, $id_entrepot, $nbpiece, $mouvement)
{
$op[0] = "+" . trim($nbpiece);
@@ -1877,13 +1847,52 @@ function get_each_prod()
}
}
+ /**
+ * \brief Charge les informations en stock du produit
+ * \return int < 0 si erreur, > 0 si ok
+ */
+ function load_stock()
+ {
+ $sql = "SELECT reel, fk_entrepot";
+ $sql.= " FROM ".MAIN_DB_PREFIX."product_stock";
+ $sql.= " WHERE fk_product = '".$this->id."'";
+ $result = $this->db->query($sql) ;
+ if ($result)
+ {
+ $num = $this->db->num_rows($result);
+ $i=0;
+ if ($num > 0)
+ {
+ while ($i < $num )
+ {
+ $row = $this->db->fetch_row($result);
+ $this->stock_entrepot[$row[1]] = $row[0];
+ $this->stock_reel = $this->stock_reel + $row[0];
+ $i++;
+ }
- /**
- * \brief Charge les informations relatives à un fournisseur
- * \param fournid id du fournisseur
- * \return int < 0 si erreur, > 0 si ok
- */
- function fetch_fourn_data($fournid)
+ $this->no_stock = 0;
+ }
+ else
+ {
+ $this->no_stock = 1;
+ }
+ $this->db->free($result);
+ return 1;
+ }
+ else
+ {
+ $this->error=$this->db->error();
+ return -1;
+ }
+ }
+
+ /**
+ * \brief Charge les informations relatives à un fournisseur
+ * \param fournid id du fournisseur
+ * \return int < 0 si erreur, > 0 si ok
+ */
+ function fetch_fourn_data($fournid)
{
$sql = "SELECT rowid, ref_fourn";
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur ";
diff --git a/htdocs/product/stock/entrepot.class.php b/htdocs/product/stock/entrepot.class.php
index 16e2546c403..2f2042cb041 100644
--- a/htdocs/product/stock/entrepot.class.php
+++ b/htdocs/product/stock/entrepot.class.php
@@ -18,7 +18,6 @@
*
* $Id$
* $Source$
- *
*/
/**
|