diff --git a/htdocs/product/canvas/default/product.default.class.php b/htdocs/product/canvas/default/product.default.class.php index 34fe98c7cf5..9827b4eb018 100644 --- a/htdocs/product/canvas/default/product.default.class.php +++ b/htdocs/product/canvas/default/product.default.class.php @@ -64,9 +64,9 @@ class ProductDefault extends Product * \brief Lecture des donnees dans la base * \param id Product id */ - function fetchCanvas($id='', $action='') + function fetch($id='', $action='') { - $result = $this->fetch($id); + $result = parent::fetch($id); return $result; } @@ -106,54 +106,34 @@ class ProductDefault extends Product $this->tpl['description'] = nl2br($this->description); // Nature - if($this->type!=1) + $this->tpl['finishedLabel'] = $this->getLibFinished(); + + // Weight + if ($this->weight != '') { - $this->tpl['finishedLabel'] = $this->getLibFinished(); + $this->tpl['weight'] = $this->weight." ".measuring_units_string($this->weight_units,"weight"); } - if ($this->isservice()) + // Length + if ($this->length != '') { - // Duration - if ($this->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 if ($this->duration_value > 0) - { - $dur=array("h"=>$langs->trans("Hour"),"d"=>$langs->trans("Day"),"w"=>$langs->trans("Week"),"m"=>$langs->trans("Month"),"y"=>$langs->trans("Year")); - } - $this->tpl['duration'] = $langs->trans($dur[$this->duration_unit]); + $this->tpl['length'] = $this->length." ".measuring_units_string($this->length_units,"size"); } - else + + // Surface + if ($this->surface != '') { - // Weight - if ($this->weight != '') - { - $this->tpl['weight'] = $this->weight." ".measuring_units_string($this->weight_units,"weight"); - } + $this->tpl['surface'] = $this->surface." ".measuring_units_string($this->surface_units,"surface"); + } - // Length - if ($this->length != '') - { - $this->tpl['length'] = $this->length." ".measuring_units_string($this->length_units,"size"); - } - - // Surface - if ($this->surface != '') - { - $this->tpl['surface'] = $this->surface." ".measuring_units_string($this->surface_units,"surface"); - } - - // Volume - if ($this->volume != '') - { - $this->tpl['volume'] = $this->volume." ".measuring_units_string($this->volume_units,"volume"); - } + // Volume + if ($this->volume != '') + { + $this->tpl['volume'] = $this->volume." ".measuring_units_string($this->volume_units,"volume"); } // Hidden - if ((! $this->isservice() && $user->rights->produit->hidden) - || ($this->isservice() && $user->rights->service->hidden)) + if ($user->rights->produit->hidden) { $this->tpl['hidden'] = yn($this->hidden); } diff --git a/htdocs/product/canvas/default/tpl/create.tpl.php b/htdocs/product/canvas/default/tpl/create.tpl.php new file mode 100644 index 00000000000..95f96f603e1 --- /dev/null +++ b/htdocs/product/canvas/default/tpl/create.tpl.php @@ -0,0 +1,174 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + */ +?> + + + +
+ + \ No newline at end of file diff --git a/htdocs/product/canvas/service/product.service.class.php b/htdocs/product/canvas/service/product.service.class.php index 5df6861f0a0..8f411217e49 100644 --- a/htdocs/product/canvas/service/product.service.class.php +++ b/htdocs/product/canvas/service/product.service.class.php @@ -55,6 +55,77 @@ class ProductService extends Product return 'Services'; } + /** + * \brief Lecture des donnees dans la base + * \param id Product id + */ + function fetch($id='', $action='') + { + $result = parent::fetch($id); + + return $result; + } + + /** + * \brief Assigne les valeurs pour les templates + * \param object object + */ + function assign_values($action='') + { + global $conf,$html; + + // Ref + $this->tpl['showrefnav'] = $html->showrefnav($this,'ref','',1,'ref'); + // Label + $this->tpl['label'] = $this->libelle; + // Statut + $this->tpl['status'] = $this->getLibStatut(2); + + if ($action == 'view') + { + $this->tpl['nblignes'] = 4; + if ($this->is_photo_available($conf->produit->dir_output)) + { + $this->tpl['photos'] = $this->show_photos($conf->produit->dir_output,1,1,0,0,0,80); + } + + // Accountancy buy code + $this->tpl['accountancyBuyCodeKey'] = $html->editfieldkey("ProductAccountancyBuyCode",'productaccountancycodesell',$this->accountancy_code_sell,'id',$this->id,$user->rights->produit->creer); + $this->tpl['accountancyBuyCodeVal'] = $html->editfieldval("ProductAccountancyBuyCode",'productaccountancycodesell',$this->accountancy_code_sell,'id',$this->id,$user->rights->produit->creer); + + // Accountancy sell code + $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); + + // Duration + if ($this->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 if ($this->duration_value > 0) + { + $dur=array("h"=>$langs->trans("Hour"),"d"=>$langs->trans("Day"),"w"=>$langs->trans("Week"),"m"=>$langs->trans("Month"),"y"=>$langs->trans("Year")); + } + $this->tpl['duration'] = $langs->trans($dur[$this->duration_unit]); + + // Hidden + if ($user->rights->service->hidden) + { + $this->tpl['hidden'] = yn($this->hidden); + } + else + { + $this->tpl['hidden'] = yn("No"); + } + + // Note + $this->tpl['note'] = nl2br($this->note); + } + } + /** * \brief Fetch datas list */ diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index bba7b2744fe..ed211a33305 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -620,7 +620,7 @@ $formproduct = new FormProduct($db); */ if ($_GET["action"] == 'create' && ($user->rights->produit->creer || $user->rights->service->creer)) { - if ($_GET["canvas"] <> '' && file_exists('canvas/'.$_GET["canvas"].'/product.'.$_GET["canvas"].'.class.php')) + if ($_GET["canvas"] <> '' && file_exists(DOL_DOCUMENT_ROOT.'/product/canvas/'.$_GET["canvas"].'/product.'.$_GET["canvas"].'.class.php')) { if (! isset($product)) { @@ -855,7 +855,7 @@ if ($_GET["id"] || $_GET["ref"]) include_once(DOL_DOCUMENT_ROOT.'/product/canvas/'.$productstatic->canvas.'/product.'.$productstatic->canvas.'.class.php'); $product = new $classname($db); - $result = $product->fetchCanvas($productstatic->id,'',$_GET["action"]); + $result = $product->fetch($productstatic->id,'',$_GET["action"]); $template_dir = DOL_DOCUMENT_ROOT.'/product/canvas/'.$product->canvas.'/tpl/'; }