';
-
- // Reference
- print '| '.$langs->trans("Ref").' | ';
- print $html->showrefnav($product,'ref');
- print ' | ';
-
- $nblignes=6;
- if ($product->isproduct() && $conf->stock->enabled) $nblignes++;
- if ($product->isservice()) $nblignes++;
- if ($product->is_photo_available($conf->produit->dir_output))
- {
- // Photo
- print '';
- $nbphoto=$product->show_photos($conf->produit->dir_output,1,1,0);
- print ' | ';
- }
- print '
';
-
- // Libelle
- print '| '.$langs->trans("Label").' | '.$product->libelle.' |
';
-
- // MultiPrix
- if($conf->global->PRODUIT_MULTIPRICES == 1)
- {
- print '| '.$langs->trans("SellingPrice").' 1 | ';
+ $class = 'Product'.ucfirst($product->canvas);
+ include_once('canvas/product.'.$product->canvas.'.class.php');
+ $product = new $class($db);
- if ($product->price_base_type == 'TTC')
- {
- print ''.price($product->price_ttc);
- }
- else
- {
- print ' | '.price($product->price);
- }
+ $result = $product->FetchCanvas($_GET["id"],'',$_GET["action"]);
- print ' '.$langs->trans($product->price_base_type);
- print ' |
';
- for($i=2;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++)
- {
- print '| '.$langs->trans("SellingPrice").' '.$i.' | ';
-
- if ($product->multiprices_base_type["$i"] == 'TTC')
- {
- print ''.price($product->multiprices_ttc["$i"]);
- }
- else
- {
- print ' | '.price($product->multiprices["$i"]);
- }
-
- if ($product->multiprices_base_type["$i"])
- {
- print ' '.$langs->trans($product->multiprices_base_type["$i"]);
- }
- else
- {
- print ' '.$langs->trans($product->price_base_type);
- }
-
- print ' |
';
- }
- }
- // Prix
- else
- {
- print '| '.$langs->trans("SellingPrice").' | ';
- if ($product->price_base_type == 'TTC')
- {
- print price($product->price_ttc).' '.$langs->trans($product->price_base_type);
- }
- else
- {
- print price($product->price).' '.$langs->trans($product->price_base_type);
- }
- print ' |
';
+ $smarty->template_dir = DOL_DOCUMENT_ROOT.'/product/canvas/'.$product->canvas.'/';
+
+ $product->assign_smarty_values($smarty,$_GET["action"]);
}
- // Statut
- print '| '.$langs->trans("Status").' | ';
- print $product->getLibStatut(2);
- print ' |
';
-
- // TVA
- print '| '.$langs->trans("VATRate").' | '.price2num($product->tva_tx,'MU').'% |
';
-
- // Stock
- if ($product->isproduct() && $conf->stock->enabled)
- {
- print '| '.$langs->trans("Stock").' | ';
- if ($product->no_stock)
+ }
+ // END TODO RODO FINISH THIS PART
+
+ llxHeader("","",$langs->trans("CardProduct".$product->type));
+
+ if ( $result )
+ {
+ if ($_GET["action"] <> 'edit')
{
- print "".$langs->trans("NoStockForThisProduct");
- }
- else
- {
- if ($product->stock_reel <= $product->seuil_stock_alerte)
- {
- print ' | '.img_warning().' '.$product->stock_reel.' Seuil : '.$product->seuil_stock_alerte;
- }
- else
- {
- print " | ".$product->stock_reel;
- }
- }
- print ' |
';
+ $head=product_prepare_head($product, $user);
+ $titre=$langs->trans("CardProduct".$product->type);
+ dolibarr_fiche_head($head, 'card', $titre);
+ print "\n\n";
+ // Confirmation de la suppression de la facture
+ if ($_GET["action"] == 'delete')
+ {
+ $html = new Form($db);
+ $html->form_confirm("fiche.php?id=".$product->id,$langs->trans("DeleteProduct"),$langs->trans("ConfirmDeleteProduct"),"confirm_delete");
+ print "
\n";
}
-
- // Description
- print '| '.$langs->trans("Description").' | '.nl2br($product->description).' |
';
-
- // Durée
- if ($product->isservice())
- {
- print '| '.$langs->trans("Duration").' | '.$product->duration_value.' ';
- if ($product->duration_value > 1)
- {
- $dur=array("h"=>$langs->trans("Hours"),"d"=>$langs->trans("Days"),"w"=>$langs->trans("Weeks"),"m"=>$langs->trans("Months"),"y"=>$langs->trans("Years"));
- }
- else
- {
- $dur=array("h"=>$langs->trans("Hour"),"d"=>$langs->trans("Day"),"w"=>$langs->trans("Week"),"m"=>$langs->trans("Month"),"y"=>$langs->trans("Year"));
- }
- print $langs->trans($dur[$product->duration_unit])." ";
-
- print ' |
';
- }
- else
- {
- print '| '.$langs->trans("Weight").' | ';
- if ($product->weight != '')
- {
- print $product->weight." ".measuring_units_string($product->weight_units,"weight");
- }
- else
- {
- print ' ';
- }
- print " |
\n";
- print '| '.$langs->trans("Volume").' | ';
- if ($product->volume != '')
- {
- print $product->volume." ".measuring_units_string($product->volume_units,"volume");
- }
- else
- {
- print ' ';
- }
- print " |
\n";
- }
- // Note
- print '| '.$langs->trans("Note").' | '.nl2br($product->note).' |
';
- print "
\n";
- print "\n\n";
- }
+
+ print($mesg);
+ }
+ if ($_GET["action"] <> 'edit' && $product->canvas <> '')
+ {
+ /*
+ * Smarty en mode visu
+ */
+ $smarty->assign('fiche_cursor_prev',$previous_ref);
+ $smarty->assign('fiche_cursor_next',$next_ref);
+
+ // Photo
+ //$nbphoto=$product->show_photos($conf->produit->dir_output,1,1,0);
+
+ $smarty->display($product->canvas.'-view.tpl');
+
+ print "\n\n";
+ }
+
+ if ($_GET["action"] <> 'edit' && $product->canvas == '')
+ {
+ // En mode visu
+ print '';
+
+ // Reference
+ print '| '.$langs->trans("Ref").' | ';
+ print $html->showrefnav($product,'ref');
+ print ' | ';
+
+ $nblignes=6;
+ if ($product->isproduct() && $conf->stock->enabled) $nblignes++;
+ if ($product->isservice()) $nblignes++;
+ if ($product->is_photo_available($conf->produit->dir_output))
+ {
+ // Photo
+ print '';
+ $nbphoto=$product->show_photos($conf->produit->dir_output,1,1,0);
+ print ' | ';
+ }
+ print '
';
+
+ // Libelle
+ print '| '.$langs->trans("Label").' | '.$product->libelle.' |
';
+
+ // MultiPrix
+ if($conf->global->PRODUIT_MULTIPRICES == 1)
+ {
+ print '| '.$langs->trans("SellingPrice").' 1 | ';
+
+ if ($product->price_base_type == 'TTC')
+ {
+ print ''.price($product->price_ttc);
+ }
+ else
+ {
+ print ' | '.price($product->price);
+ }
+
+ print ' '.$langs->trans($product->price_base_type);
+ print ' |
';
+ for($i=2;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++)
+ {
+ print '| '.$langs->trans("SellingPrice").' '.$i.' | ';
+
+ if ($product->multiprices_base_type["$i"] == 'TTC')
+ {
+ print ''.price($product->multiprices_ttc["$i"]);
+ }
+ else
+ {
+ print ' | '.price($product->multiprices["$i"]);
+ }
+
+ if ($product->multiprices_base_type["$i"])
+ {
+ print ' '.$langs->trans($product->multiprices_base_type["$i"]);
+ }
+ else
+ {
+ print ' '.$langs->trans($product->price_base_type);
+ }
+
+ print ' |
';
+ }
+ }
+ // Prix
+ else
+ {
+ print '| '.$langs->trans("SellingPrice").' | ';
+ if ($product->price_base_type == 'TTC')
+ {
+ print price($product->price_ttc).' '.$langs->trans($product->price_base_type);
+ }
+ else
+ {
+ print price($product->price).' '.$langs->trans($product->price_base_type);
+ }
+ print ' |
';
+ }
+ // Statut
+ print '| '.$langs->trans("Status").' | ';
+ print $product->getLibStatut(2);
+ print ' |
';
+
+ // TVA
+ print '| '.$langs->trans("VATRate").' | '.price2num($product->tva_tx,'MU').'% |
';
+
+ // Stock
+ if ($product->isproduct() && $conf->stock->enabled)
+ {
+ print '| '.$langs->trans("Stock").' | ';
+ if ($product->no_stock)
+ {
+ print "".$langs->trans("NoStockForThisProduct");
+ }
+ else
+ {
+ if ($product->stock_reel <= $product->seuil_stock_alerte)
+ {
+ print ' | '.img_warning().' '.$product->stock_reel.' Seuil : '.$product->seuil_stock_alerte;
+ }
+ else
+ {
+ print " | ".$product->stock_reel;
+ }
+ }
+ print ' |
';
+ }
+
+ // Description
+ print '| '.$langs->trans("Description").' | '.nl2br($product->description).' |
';
+
+ // Durée
+ if ($product->isservice())
+ {
+ print '| '.$langs->trans("Duration").' | '.$product->duration_value.' ';
+ if ($product->duration_value > 1)
+ {
+ $dur=array("h"=>$langs->trans("Hours"),"d"=>$langs->trans("Days"),"w"=>$langs->trans("Weeks"),"m"=>$langs->trans("Months"),"y"=>$langs->trans("Years"));
+ }
+ else
+ {
+ $dur=array("h"=>$langs->trans("Hour"),"d"=>$langs->trans("Day"),"w"=>$langs->trans("Week"),"m"=>$langs->trans("Month"),"y"=>$langs->trans("Year"));
+ }
+ print $langs->trans($dur[$product->duration_unit])." ";
+
+ print ' |
';
+ }
+ else
+ {
+ print '| '.$langs->trans("Weight").' | ';
+ if ($product->weight != '')
+ {
+ print $product->weight." ".measuring_units_string($product->weight_units,"weight");
+ }
+ else
+ {
+ print ' ';
+ }
+ print " |
\n";
+ print '| '.$langs->trans("Volume").' | ';
+ if ($product->volume != '')
+ {
+ print $product->volume." ".measuring_units_string($product->volume_units,"volume");
+ }
+ else
+ {
+ print ' ';
+ }
+ print " |
\n";
+ }
+ // Note
+ print '| '.$langs->trans("Note").' | '.nl2br($product->note).' |
';
+ print "
\n";
+ print "\n\n";
+ }
}
/*