diff --git a/htdocs/core/class/canvas.class.php b/htdocs/core/class/canvas.class.php index 3d3fbf11d06..1a1f3879c14 100644 --- a/htdocs/core/class/canvas.class.php +++ b/htdocs/core/class/canvas.class.php @@ -35,7 +35,7 @@ class Canvas var $template_dir; // Directory with all core and external templates files var $action; var $smarty; - + var $error; /** @@ -47,42 +47,44 @@ class Canvas $this->db = $DB ; $this->user = $user; } - + /** * \brief Load canvas + * \param Name of first part of canvas + * \canvas Name of second part of canvas */ function load_canvas($object,$canvas) { global $langs; + $part1=$object; + $part2=$canvas; + if (preg_match('/^([^@]+)@([^@]+)$/i',$canvas,$regs)) { - if (file_exists(DOL_DOCUMENT_ROOT.'/'.$regs[2].'/canvas/'.$regs[1].'/'.$object.'.'.$regs[1].'.class.php')) - { - $filecanvas = DOL_DOCUMENT_ROOT.'/'.$regs[2].'/canvas/'.$regs[1].'/'.$object.'.'.$regs[1].'.class.php'; - $classname = ucfirst($object).ucfirst($regs[1]); - $this->template_dir = DOL_DOCUMENT_ROOT.'/'.$regs[2].'/canvas/'.$regs[1].'/tpl/'; - - include_once($filecanvas); - $this->object = new $classname($this->db,0,$this->user); - $this->smarty = $this->object->smarty; - - return $this->object; - } - else - { - $this->error = $langs->trans('CanvasIsInvalid'); - return 0; - } - + $part1=$regs[2]; + $part2=$regs[1]; + } + + if (file_exists(DOL_DOCUMENT_ROOT.'/'.$part1.'/canvas/'.$part2.'/'.$part1.'.'.$part2.'.class.php')) + { + $filecanvas = DOL_DOCUMENT_ROOT.'/'.$part1.'/canvas/'.$part2.'/'.$part1.'.'.$part2.'.class.php'; + $classname = ucfirst($part1).ucfirst($part2); + $this->template_dir = DOL_DOCUMENT_ROOT.'/'.$part1.'/canvas/'.$part2.'/tpl/'; + + include_once($filecanvas); + $this->object = new $classname($this->db,0,$this->user); + $this->smarty = $this->object->smarty; + + return $this->object; } else { - $this->error = $langs->trans('BadCanvasName'); + $this->error = $langs->trans('CanvasIsInvalid'); return 0; } } - + /** * \brief Fetch object values */ @@ -102,7 +104,7 @@ class Canvas if (!empty($this->smarty)) { global $smarty; - + $this->object->assign_smarty_values($smarty, $this->action); $smarty->template_dir = $this->template_dir; } @@ -110,20 +112,20 @@ class Canvas { $this->object->assign_values($this->action); } - + } - + /** * \brief Display canvas */ function display_canvas() { global $conf, $langs; - + if (!empty($this->smarty)) { global $smarty; - + $smarty->display($this->action.'.tpl'); } else diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index b673ed41f19..3e507151f66 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -127,7 +127,7 @@ class Translate { * \brief Load translation key-value for a particular file, into a memory array. * If data for file already loaded, do nothing. * All data in translation array are stored in UTF-8 format. - * \param domain File name to load (.lang file). Use @ before value if domain is in a module directory. + * \param domain File name to load (.lang file). Use file@module if file is in a module directory. * \param alt 0,1,2 * \param soptafterdirection Stop when the DIRECTION tag is found (optimize) * \param forcelangdir To force a lang directory diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index 3f0666906a1..0ce13468e7e 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -382,6 +382,15 @@ function dol_fiche_head($links, $active='0', $title='', $notab=0, $picto='') if (! $notab) print "\n".'
| '.$langs->trans("Ref").' | '; + print $html->showrefnav($product,'ref','',1,'ref'); + print ' | '; + + print '|
| '.$langs->trans("Label").' | '.$product->libelle.' | '; + + $nblignes=4; + if ($product->is_photo_available($conf->produit->dir_output)) { - $ret=$html->form_confirm("fiche.php?id=".$product->id,$langs->trans("DeleteProduct"),$langs->trans("ConfirmDeleteProduct"),"confirm_delete",'',0,2); - if ($ret == 'html') print ''; + print $product->show_photos($conf->produit->dir_output,1,1,0,0,0,80); + print ' | '; } + print '
| '.$html->editfieldkey("ProductAccountancyBuyCode",'productaccountancycodesell',$product->accountancy_code_sell,'id',$product->id,$user->rights->produit->creer).' | '; + print $html->editfieldval("ProductAccountancyBuyCode",'productaccountancycodesell',$product->accountancy_code_sell,'id',$product->id,$user->rights->produit->creer); + print ' | |
| '.$html->editfieldkey("ProductAccountancySellCode",'productaccountancycodebuy',$product->accountancy_code_buy,'id',$product->id,$user->rights->produit->creer).' | '; + print $html->editfieldval("ProductAccountancySellCode",'productaccountancycodebuy',$product->accountancy_code_buy,'id',$product->id,$user->rights->produit->creer); + print ' | |
| '.$langs->trans("Status").' | '; + print $product->getLibStatut(2); + print ' | |
| '.$langs->trans("Description").' | '.nl2br($product->description).' | |
| '.$langs->trans("Nature").' | '; + print $product->getLibFinished(); + 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 if ($product->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")); + } + print $langs->trans($dur[$product->duration_unit])." "; + + print ' | |
| '.$langs->trans("Weight").' | '; + if ($product->weight != '') + { + print $product->weight." ".measuring_units_string($product->weight_units,"weight"); + } + else + { + print ' '; + } + print " | |
| '.$langs->trans("Length").' | '; + if ($product->length != '') + { + print $product->length." ".measuring_units_string($product->length_units,"size"); + } + else + { + print ' '; + } + print " | |
| '.$langs->trans("Surface").' | '; + if ($product->surface != '') + { + print $product->surface." ".measuring_units_string($product->surface_units,"surface"); + } + else + { + print ' '; + } + print " | |
| '.$langs->trans("Volume").' | '; + if ($product->volume != '') + { + print $product->volume." ".measuring_units_string($product->volume_units,"volume"); + } + else + { + print ' '; + } + print " | |
| '.$langs->trans("Hidden").' | '; + print yn($product->hidden); + print " | |
| '.$langs->trans("Hidden").' | '; + print yn("No"); + print ' | |
| '.$langs->trans("Note").' | '.nl2br($product->note).' | |