Try to comment deprecated code to reduce code and keep only one pattern of development for canvas.

This commit is contained in:
Laurent Destailleur 2010-11-11 11:15:06 +00:00
parent 3d1d607158
commit f6dade1093
5 changed files with 52 additions and 80 deletions

View File

@ -209,12 +209,12 @@ class Canvas
} }
/** /**
* Assign templates values * Shared method for canvas to assign values of templates
* @param action Type of action * @param action Type of action
*/ */
function assign_values() function assign_values()
{ {
if (!empty($this->smarty)) /*if (!empty($this->smarty))
{ {
global $smarty; global $smarty;
@ -222,10 +222,9 @@ class Canvas
$smarty->template_dir = $this->template_dir; $smarty->template_dir = $this->template_dir;
} }
else else
{ {*/
$this->control->assign_values($this->action); $this->control->assign_values($this->action);
} /*}*/
} }
/** /**
@ -235,16 +234,16 @@ class Canvas
{ {
global $conf, $langs, $user, $canvas; global $conf, $langs, $user, $canvas;
if (!empty($this->smarty)) /*if (!empty($this->smarty))
{ {
global $smarty; global $smarty;
$smarty->display($this->action.'.tpl'); $smarty->display($this->action.'.tpl');
} }
else else
{ {*/
include($this->template_dir.$this->card.'_'.$this->action.'.tpl.php'); include($this->template_dir.$this->card.'_'.$this->action.'.tpl.php'); // Include native PHP template
} /*}*/
} }
} }

View File

@ -44,11 +44,11 @@ class ProductDefault extends Product
$this->db = $DB; $this->db = $DB;
$this->id = $id ; $this->id = $id ;
$this->user = $user; $this->user = $user;
$this->smarty = 0; //$this->smarty = 0;
$this->module = "produit"; $this->module = "produit";
$this->canvas = "default"; $this->canvas = "default";
$this->name = "default"; $this->name = "default";
$this->definition = "Canvas des produits (défaut)"; $this->definition = "Product canvas (défaut)";
$this->fieldListName = "product_default"; $this->fieldListName = "product_default";
$this->next_prev_filter = "canvas='default'"; $this->next_prev_filter = "canvas='default'";

View File

@ -44,11 +44,11 @@ class ProductService extends Product
$this->db = $DB; $this->db = $DB;
$this->id = $id ; $this->id = $id ;
$this->user = $user; $this->user = $user;
$this->smarty = 0; //$this->smarty = 0;
$this->module = "service"; $this->module = "service";
$this->canvas = "service"; $this->canvas = "service";
$this->name = "service"; $this->name = "service";
$this->definition = "Canvas des services"; $this->definition = "Services canvas";
$this->fieldListName = "product_service"; $this->fieldListName = "product_service";
$this->next_prev_filter = "canvas='service'"; $this->next_prev_filter = "canvas='service'";

View File

@ -2856,31 +2856,6 @@ class Product extends CommonObject
$this->tpl['description'] = $this->description; $this->tpl['description'] = $this->description;
$this->tpl['note'] = $this->note; $this->tpl['note'] = $this->note;
/* Fix: La presentation ne doit pas etre gérée dans une classe métier
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC)
{
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
$doleditor=new DolEditor('desc',$this->description,160,'dolibarr_notes','',false);
$this->tpl['doleditor_description'] = $doleditor;
$doleditor=new DolEditor('note',$this->note,180,'dolibarr_notes','',false);
$this->tpl['doleditor_note'] = $doleditor;
}
else
{
$textarea = '<textarea name="desc" rows="4" cols="90">';
$textarea.= $this->description;
$textarea.= '</textarea>';
$this->tpl['description'] = $this->description
$textarea = '<textarea name="note" rows="8" cols="70">';
$textarea.= $this->note;
$textarea.= '</textarea>';
$this->tpl['textarea_note'] = $textarea;
}
*/
} }
if ($action == 'view') if ($action == 'view')
@ -2898,16 +2873,10 @@ class Product extends CommonObject
} }
} }
/** /**
* \brief Affecte les valeurs smarty * Return if object is a product
* \remarks Rodolphe : pour l'instant la fonction est vide mais necessaire pour compatibilite * @return boolean True if it's a product
* avec les canvas A terme la fiche produit utilisera aussi smarty */
*/
function assign_smarty_values(&$smarty)
{
}
function isproduct() function isproduct()
{ {
if ($this->type != 1) if ($this->type != 1)
@ -2920,6 +2889,10 @@ class Product extends CommonObject
} }
} }
/**
* Return if object is a product
* @return boolean True if it's a service
*/
function isservice() function isservice()
{ {
if ($this->type==1) if ($this->type==1)

View File

@ -243,7 +243,7 @@ if ($resql)
$template_dir = DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/tpl/product/'.$_GET["canvas"].'/'; $template_dir = DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/tpl/product/'.$_GET["canvas"].'/';
} }
if ($object->smarty) /*if ($object->smarty)
{ {
$template = 'list.tpl'; $template = 'list.tpl';
$smarty->template_dir = $template_dir; $smarty->template_dir = $template_dir;
@ -267,9 +267,9 @@ if ($resql)
$smarty->clear_compiled_tpl($template); $smarty->clear_compiled_tpl($template);
} }
else else
{ {*/
include($template_dir.'list.tpl.php'); // To use native PHP include($template_dir.'list.tpl.php'); // Include native PHP templates
} /*}*/
} }
else else
{ {