Gestion des dates par smarty

This commit is contained in:
Rodolphe Quiedeville 2006-12-06 18:52:41 +00:00
parent fda5b39e25
commit 867baecae6
7 changed files with 124 additions and 86 deletions

View File

@ -125,10 +125,7 @@
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">
</td>
<td width="15%">Date d'application</td>
<td width="35%">
<input name="contrat_date_app" type="text" size="7" maxlength="6" value="{$prod_contrat_date_app}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">
</td>
<td width="35%">{html_select_date field_order='DMY' start_year='-10' reverse_years=True}</td>
</tr>
<tr>

View File

@ -1,6 +1,13 @@
<!-- BEGIN SMARTY TEMPLATE -->
</table>
<table class="border" width="100%">
<tr>
<td width="15%">Référence</td>
<td width="35%" style="font-weight: bold;">{$prod_ref}</td>
<td width="50%" colspan="2" align="right">
{$fiche_cursor_prev}{$fiche_cursor_next}
</td>
</tr>
<tr>
<td width="15%">Titre</td>
<td width="85%" colspan="3">{$prod_label}</td>
@ -10,8 +17,8 @@
<td width="35%">{$prod_isbn}</td>
<td width="15%">ISBN-13</td>
<td width="35%">{$prod_isbn13}</td>
</tr>
<tr>
<td width="15%">EAN</td>
<td width="35%">{$prod_ean}</td>

View File

@ -1,14 +1,21 @@
<!-- BEGIN SMARTY TEMPLATE -->
</table>
<table class="border" width="100%">
<tr>
<td width="15%">Référence</td>
<td width="35%" style="font-weight: bold;">{$prod_ref}</td>
<td width="50%" colspan="2" align="right">
{$fiche_cursor_prev}{$fiche_cursor_next}
</td>
</tr>
<tr>
<td width="15%">Titre</td>
<td width="85%" colspan="3">{$prod_label}</td>
</tr>
</table>
<br>
<br/>
<table class="border" width="100%">
<tr>
@ -27,11 +34,17 @@
<td width="35%">{$prod_stock_in_command}</td>
</tr>
</table>
<br />
<table class="border" width="100%">
<tr>
<td width="15%">Durée du contrat : </td>
<td width="35%">{$prod_contrat_duree}</td>
<td width="15%">Date d'application</td>
<td width="35%"></td>
<td width="35%">{$prod_contrat_date_app|date_format:"%e %B %Y"}</td>
</tr>
<tr>
@ -43,4 +56,19 @@
</table>
<br />
<table class="border" width="100%">
<tr>
<td width="15%" valign="top">Description</td>
<td width="85%">{$prod_description|nl2br}</td>
</tr>
<tr>
<td valign="top">Note (non visible sur les factures, propals...)</td>
<td>{$prod_note|nl2br}</td>
</tr>
</table>
<!-- END SMARTY TEMPLATE -->

View File

@ -1,9 +1,16 @@
<!-- BEGIN SMARTY TEMPLATE -->
</table>
<table class="border" width="100%">
<tr>
<td width="15%">Référence</td>
<td width="35%" style="font-weight: bold;">{$prod_ref}</td>
<td width="50%" align="right">
{$fiche_cursor_prev}{$fiche_cursor_next}
</td>
</tr>
<tr>
<td width="15%">Titre du livre</td>
<td width="85%" colspan="3">{$prod_label}</td>
<td width="85%" colspan="2">{$prod_label}</td>
</tr>
</table>
@ -13,9 +20,7 @@
<tr>
<td width="15%">Stock</td>
<td width="35%" {$smarty_stock_dispo_class}>
{$prod_stock_dispo}
</td>
<td width="35%" {$smarty_stock_dispo_class}>{$prod_stock_dispo}</td>
<td width="15%">Seuil d'alerte</td>
<td width="35%">{$prod_stock_alert}</td>
</tr>
@ -32,22 +37,24 @@
<br />
<table class="border" width="100%">
<tr>
<td width="50%" valign="top">Description</td>
<td width="50%" valign="top">Photo</td>
</tr>
<tr>
<td width="15%">Stock</td>
<td width="35%" {$smarty_stock_dispo_class}>
{$prod_stock_dispo}
</td>
<td width="15%">Seuil d'alerte</td>
<td width="35%">{$prod_stock_alert}</td>
</tr>
<tr>
<td width="50%" valign="top">{$prod_description|nl2br}</td>
<td rowspan="3" valign="top"></td>
</tr>
<tr>
<td width="50%" valign="top">Note (non visible sur les factures, propals...)
</tr>
<tr>
<td width="50%" valign="top">{$prod_note|nl2br}</td>
</tr>
</table>
<tr>
<td width="15%">Stock réel</td>
<td width="35%">{$prod_stock_reel}</td>
<td width="15%">Exemplaires en commande</td>
<td width="35%">{$prod_stock_in_command}</td>
</tr>
</table>

View File

@ -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);

View File

@ -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"');
}
}
}
?>

View File

@ -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"');
}
}
}
?>