From 5cc40ab6f4e5c96940ec1ef1f619973e35e5c29e Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 2 May 2010 05:39:43 +0000 Subject: [PATCH] Works on product canvas and templates !! WARNING : not stable !! --- .../canvas/default/product.default.class.php | 75 ++++++++++++++----- .../product/canvas/default/tpl/create.tpl.php | 50 ++++--------- .../product/canvas/default/tpl/view.tpl.php | 4 +- 3 files changed, 74 insertions(+), 55 deletions(-) diff --git a/htdocs/product/canvas/default/product.default.class.php b/htdocs/product/canvas/default/product.default.class.php index 814dc618460..0e326ad94aa 100644 --- a/htdocs/product/canvas/default/product.default.class.php +++ b/htdocs/product/canvas/default/product.default.class.php @@ -80,19 +80,72 @@ class ProductDefault extends Product global $conf,$langs,$html; // Ref - $this->tpl['showrefnav'] = $html->showrefnav($this,'ref','',1,'ref'); + $this->tpl['ref'] = $this->ref; + // Label $this->tpl['label'] = $this->libelle; + + // Description + $this->tpl['description'] = nl2br($this->description); + // Statut $this->tpl['status'] = $this->getLibStatut(2); + // Note + $this->tpl['note'] = nl2br($this->note); + + // Hidden + if ($user->rights->produit->hidden) + { + $this->tpl['hidden'] = yn($this->hidden); + } + else + { + $this->tpl['hidden'] = yn("No"); + } + + // Stock alert + $this->tpl['seuil_stock_alerte'] = $this->seuil_stock_alerte; + if ($action == 'create') { - $this->tpl['cardTitle'] = load_fiche_titre($langs->trans("NewProduct")); + // Title + $this->tpl['title'] = load_fiche_titre($langs->trans("NewProduct")); + + // Status + $statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell")); + $this->tpl['status'] = $html->selectarray('statut',$statutarray,$this->status); + + // Finished + $statutarray=array('1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial")); + $this->tpl['finished'] = $html->selectarray('finished',$statutarray,$this->finished); + } + + if ($action == 'create' || $action == 'edit') + { + // TODO creer fonction + if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC) + { + require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); + $doleditor=new DolEditor('desc',$product->description,160,'dolibarr_notes','',false); + $this->tpl['doleditor'] = $doleditor; + } + else + { + $textarea = ''; + + $this->tpl['textarea'] = $textarea; + } } if ($action == 'view') { + // Ref + $this->tpl['ref'] = $html->showrefnav($this,'ref','',1,'ref'); + + // Photo $this->tpl['nblignes'] = 4; if ($this->is_photo_available($conf->produit->dir_output)) { @@ -107,11 +160,8 @@ class ProductDefault extends Product $this->tpl['accountancySellCodeKey'] = $html->editfieldkey("ProductAccountancySellCode",'productaccountancycodebuy',$this->accountancy_code_buy,'id',$this->id,$user->rights->produit->creer); $this->tpl['accountancySellCodeVal'] = $html->editfieldval("ProductAccountancySellCode",'productaccountancycodebuy',$this->accountancy_code_buy,'id',$this->id,$user->rights->produit->creer); - // Description - $this->tpl['description'] = nl2br($this->description); - // Nature - $this->tpl['finishedLabel'] = $this->getLibFinished(); + $this->tpl['finished'] = $this->getLibFinished(); // Weight if ($this->weight != '') @@ -136,19 +186,6 @@ class ProductDefault extends Product { $this->tpl['volume'] = $this->volume." ".measuring_units_string($this->volume_units,"volume"); } - - // Hidden - if ($user->rights->produit->hidden) - { - $this->tpl['hidden'] = yn($this->hidden); - } - else - { - $this->tpl['hidden'] = yn("No"); - } - - // Note - $this->tpl['note'] = nl2br($this->note); } } diff --git a/htdocs/product/canvas/default/tpl/create.tpl.php b/htdocs/product/canvas/default/tpl/create.tpl.php index eba87afce1f..252f894b16f 100644 --- a/htdocs/product/canvas/default/tpl/create.tpl.php +++ b/htdocs/product/canvas/default/tpl/create.tpl.php @@ -26,62 +26,44 @@ -tpl['cardTitle']; ?> +tpl['title']; ?> - - + - + + - if ($_GET["type"] != 1 && $conf->stock->enabled) - { +stock->enabled) { ?> - } - else - { + - } + - + @@ -62,7 +62,7 @@ - +
trans("Ref"); ?>"> - if ($_error == 1) - { - print $langs->trans("RefAlreadyExists"); - } + +trans("RefAlreadyExists"); ?>
trans("Label"); ?>">
trans("Status"); ?> - $statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell")); - $html->select_array('statut',$statutarray,$_POST["statut"]); -trans("Status"); ?>tpl['status']; ?>
trans("StockLimit"); ?> -"> +
trans("Description"); ?> - - if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC) - { - require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); - $doleditor=new DolEditor('desc',$_POST["desc"],160,'dolibarr_notes','',false); - $doleditor->Create(); - } - else - { - print ''; - } - +tpl['textarea']) { +$product->tpl['doleditor']->Create(); +}else{ +echo $product->tpl['textarea']; +}?>
trans("Nature"); ?> - $statutarray=array('1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial")); - $html->select_array('finished',$statutarray,$_POST["finished"]); +tpl['finished']; ?>
trans("Weight"); ?> diff --git a/htdocs/product/canvas/default/tpl/view.tpl.php b/htdocs/product/canvas/default/tpl/view.tpl.php index ddce2e0388a..ffb70e312b5 100644 --- a/htdocs/product/canvas/default/tpl/view.tpl.php +++ b/htdocs/product/canvas/default/tpl/view.tpl.php @@ -25,7 +25,7 @@
trans("Ref"); ?>tpl['showrefnav']; ?>tpl['ref']; ?>
trans("Nature"); ?>tpl['finishedLabel']; ?>tpl['finished']; ?>