\ No newline at end of file
diff --git a/htdocs/product/canvas/livrecouverture/livrecouverture-view.tpl b/htdocs/product/canvas/livrecouverture/livrecouverture-view.tpl
index 99ed7adfa31..afe2ddec5c6 100644
--- a/htdocs/product/canvas/livrecouverture/livrecouverture-view.tpl
+++ b/htdocs/product/canvas/livrecouverture/livrecouverture-view.tpl
@@ -1,9 +1,16 @@
-
+
+
Référence
+
{$prod_ref}
+
+ {$fiche_cursor_prev}{$fiche_cursor_next}
+
+
+
Titre du livre
-
{$prod_label}
+
{$prod_label}
@@ -13,9 +20,7 @@
Stock
-
- {$prod_stock_dispo}
-
+
{$prod_stock_dispo}
Seuil d'alerte
{$prod_stock_alert}
@@ -32,22 +37,24 @@
+
+
Description
+
Photo
+
-
-
Stock
-
- {$prod_stock_dispo}
-
-
Seuil d'alerte
-
{$prod_stock_alert}
-
+
+
{$prod_description|nl2br}
+
+
+
+
+
Note (non visible sur les factures, propals...)
+
+
+
{$prod_note|nl2br}
+
+
-
-
Stock réel
-
{$prod_stock_reel}
-
Exemplaires en commande
-
{$prod_stock_in_command}
-
diff --git a/htdocs/product/canvas/product.livre.class.php b/htdocs/product/canvas/product.livre.class.php
index ad61b66401a..1bc3d518764 100644
--- a/htdocs/product/canvas/product.livre.class.php
+++ b/htdocs/product/canvas/product.livre.class.php
@@ -334,25 +334,25 @@ class ProductLivre extends Product
*/
function assign_values(&$smarty)
{
- $smarty->assign('prod_canvas', 'livre');
- $smarty->assign('prod_id', $this->id);
+ $smarty->assign('prod_id', $this->id);
+ $smarty->assign('prod_ref', $this->ref);
+ $smarty->assign('prod_label', $this->libelle);
+ $smarty->assign('prod_note', $this->note);
+ $smarty->assign('prod_description', $this->description);
+ $smarty->assign('prod_canvas', $this->canvas);
- $smarty->assign('prod_isbn', $this->isbn);
+ $smarty->assign('prod_isbn', $this->isbn);
$isbn_parts = explode('-',$this->isbn);
- $smarty->assign('prod_isbna', $isbn_parts[0]);
- $smarty->assign('prod_isbnb', $isbn_parts[1]);
- $smarty->assign('prod_isbnc', $isbn_parts[2]);
+ $smarty->assign('prod_isbna', $isbn_parts[0]);
+ $smarty->assign('prod_isbnb', $isbn_parts[1]);
+ $smarty->assign('prod_isbnc', $isbn_parts[2]);
+ $smarty->assign('prod_ean', $this->ean);
- $smarty->assign('prod_ean', $this->ean);
+ $smarty->assign('prod_isbn13', '978-'.substr($this->isbn,0,12).substr($this->ean,-1,1));
- $smarty->assign('prod_isbn13', '978-'.substr($this->isbn,0,12).substr($this->ean,-1,1));
-
- $smarty->assign('prod_ref', $this->ref);
$smarty->assign('prod_tva_tx', $this->tva_tx);
- $smarty->assign('prod_description', $this->description);
- $smarty->assign('prod_note', $this->note);
$smarty->assign('prod_pages', $this->pages);
$smarty->assign('prod_format', $this->format);
@@ -362,7 +362,6 @@ class ProductLivre extends Product
$smarty->assign('prod_pxrevient', price($this->px_revient));
$smarty->assign('prod_pxvente', price($this->price));
- $smarty->assign('prod_label', $this->libelle);
$smarty->assign('prod_contrat_taux', $this->contrat->taux);
$smarty->assign('prod_contrat_duree', $this->contrat_duree);
diff --git a/htdocs/product/canvas/product.livrecontrat.class.php b/htdocs/product/canvas/product.livrecontrat.class.php
index 2de836ea679..1510a7ba93d 100644
--- a/htdocs/product/canvas/product.livrecontrat.class.php
+++ b/htdocs/product/canvas/product.livrecontrat.class.php
@@ -26,6 +26,8 @@
\version $Revision$
*/
+require_once(DOL_DOCUMENT_ROOT.'/product/canvas/product.livre.class.php');
+
/**
\class ProductLivreContrat
\brief Classe permettant la gestion des livres, cette classe surcharge la classe produit
@@ -114,6 +116,7 @@ class ProductLivreContrat extends Product
* \brief Lecture des donnees dans la base
* \param id Id livre ('' par defaut)
* \param ref Reference du livre ('' par defaut)
+ * \todo Rodo Resoudre le probleme de boucle infinie avec le livre
*/
function FetchCanvas($id='', $ref='')
{
@@ -121,7 +124,8 @@ class ProductLivreContrat extends Product
if ($result >= 0)
{
- $sql = "SELECT taux,quantite,duree";
+ $sql = "SELECT fk_cnv_livre,taux,quantite,duree,";
+ $sql.= $this->db->pdate('date_app') ." as date_app";
$sql.= " FROM ".MAIN_DB_PREFIX."product_cnv_livre_contrat";
if ($id) $sql.= " WHERE rowid = '".$id."'";
if ($ref) $sql.= " WHERE ref = '".addslashes($ref)."'";
@@ -135,6 +139,12 @@ class ProductLivreContrat extends Product
$this->taux = $result["taux"];
$this->quantite = $result["quantite"];
$this->duree = $result["duree"];
+ $this->date_app = $result["date_app"];
+
+ // On charge le livre pour avoir le titre
+ // ne pas utiliser FetchCanvas qui cree une boucle infinie
+ $this->livre = new ProductLivre($this->db);
+ $this->livre->Fetch($result["fk_cnv_livre"]);
$this->db->free();
}
@@ -152,11 +162,13 @@ class ProductLivreContrat extends Product
$quant = trim($datas["contrat_quant"]);
$duree = trim($datas["contrat_duree"]);
+ $date_app = mktime(1,1,1,$datas["Date_Month"],$datas["Date_Day"],$datas["Date_Year"]);
+
$sql = "UPDATE ".MAIN_DB_PREFIX."product_cnv_livre_contrat ";
$sql .= " SET taux = '$taux'";
$sql .= " , quantite = '$quant'";
$sql .= " , duree = '$duree'";
- $sql .= " , date_app = '$date_app'";
+ $sql .= " , date_app = '".$this->db->idate($date_app)."'";
$sql .= " WHERE rowid = " . $this->id;
if ( $this->db->query($sql) )
@@ -176,24 +188,18 @@ class ProductLivreContrat extends Product
*/
function assign_values(&$smarty)
{
- $smarty->assign('prod_canvas', 'livre');
- $smarty->assign('prod_id', $this->id);
+ $smarty->assign('prod_id', $this->id);
+ $smarty->assign('prod_ref', $this->ref);
+ $smarty->assign('prod_label', $this->livre->libelle);
+ $smarty->assign('prod_note', $this->note);
+ $smarty->assign('prod_description', $this->description);
- $smarty->assign('prod_isbn', $this->isbn);
+ $smarty->assign('prod_canvas', $this->canvas);
- $isbn_parts = explode('-',$this->isbn);
-
- $smarty->assign('prod_isbna', $isbn_parts[0]);
- $smarty->assign('prod_isbnb', $isbn_parts[1]);
- $smarty->assign('prod_isbnc', $isbn_parts[2]);
-
- $smarty->assign('prod_ean', $this->ean);
-
- $smarty->assign('prod_isbn13', '978-'.substr($this->isbn,0,12).substr($this->ean,-1,1));
-
- $smarty->assign('prod_contrat_taux', $this->contrat->taux);
- $smarty->assign('prod_contrat_duree', $this->contrat_duree);
- $smarty->assign('prod_contrat_quant', $this->contrat_quantite);
+ $smarty->assign('prod_contrat_taux', $this->taux);
+ $smarty->assign('prod_contrat_duree', $this->duree);
+ $smarty->assign('prod_contrat_date_app', $this->date_app);
+ $smarty->assign('prod_contrat_quant', $this->quantite);
$smarty->assign('prod_stock_reel', $this->stock_reel);
$smarty->assign('prod_stock_dispo', ($this->stock_reel - $this->stock_in_command));
@@ -205,6 +211,5 @@ class ProductLivreContrat extends Product
$smarty->assign('smarty_stock_dispo_class', 'class="alerte"');
}
}
-
}
?>
diff --git a/htdocs/product/canvas/product.livrecouverture.class.php b/htdocs/product/canvas/product.livrecouverture.class.php
index fe1006b3d8b..f3971983183 100644
--- a/htdocs/product/canvas/product.livrecouverture.class.php
+++ b/htdocs/product/canvas/product.livrecouverture.class.php
@@ -26,6 +26,8 @@
\version $Revision$
*/
+require_once(DOL_DOCUMENT_ROOT.'/product/canvas/product.livre.class.php');
+
/**
\class ProductLivreCouverture
\brief Classe permettant la gestion des livres, cette classe surcharge la classe produit
@@ -80,6 +82,11 @@ class ProductLivreCouverture extends Product
{
$result = $this->fetch($id,$ref);
+ // On charge le livre pour avoir le titre
+ // ne pas utiliser FetchCanvas qui cree une boucle infinie
+ $this->livre = new ProductLivre($this->db);
+ //$this->livre->Fetch($result["fk_cnv_livre"]);
+
return $result;
}
/**
@@ -98,36 +105,24 @@ class ProductLivreCouverture extends Product
*/
function assign_values(&$smarty)
{
- $smarty->assign('prod_canvas', 'livre');
- $smarty->assign('prod_id', $this->id);
+ $smarty->assign('prod_id', $this->id);
+ $smarty->assign('prod_ref', $this->ref);
+ $smarty->assign('prod_label', $this->livre->libelle);
+ $smarty->assign('prod_note', $this->note);
+ $smarty->assign('prod_description', $this->description);
+ $smarty->assign('prod_canvas', $this->canvas);
- $smarty->assign('prod_isbn', $this->isbn);
+ $this->stock_dispo = ($this->stock_reel - $this->stock_in_command);
- $isbn_parts = explode('-',$this->isbn);
-
- $smarty->assign('prod_isbna', $isbn_parts[0]);
- $smarty->assign('prod_isbnb', $isbn_parts[1]);
- $smarty->assign('prod_isbnc', $isbn_parts[2]);
+ $smarty->assign('prod_stock_reel', $this->stock_reel);
+ $smarty->assign('prod_stock_dispo', $this->stock_dispo);
+ $smarty->assign('prod_stock_in_command', $this->stock_in_command);
+ $smarty->assign('prod_stock_alert', $this->seuil_stock_alerte);
- $smarty->assign('prod_ean', $this->ean);
-
- $smarty->assign('prod_isbn13', '978-'.substr($this->isbn,0,12).substr($this->ean,-1,1));
-
- $smarty->assign('prod_contrat_taux', $this->contrat->taux);
- $smarty->assign('prod_contrat_duree', $this->contrat_duree);
- $smarty->assign('prod_contrat_quant', $this->contrat_quantite);
-
- $smarty->assign('prod_stock_reel', $this->stock_reel);
- $smarty->assign('prod_stock_dispo', ($this->stock_reel - $this->stock_in_command));
- $smarty->assign('prod_stock_in_command', $this->stock_in_command);
- $smarty->assign('prod_stock_alert', $this->seuil_stock_alerte);
-
- if ($this->seuil_stock_alerte > ($this->stock_reel - $this->stock_in_command) && $this->status == 1)
+ if ( ($this->seuil_stock_alerte > $this->stock_dispo) && ($this->status == 1) )
{
$smarty->assign('smarty_stock_dispo_class', 'class="alerte"');
}
}
-
-
}
?>