/**
	 *    \brief      Assigne les valeurs pour les templates
	 *    \param      object     object
	 */
	function assign_values($action='')
	{
		global $conf,$langs;

		parent::assign_values($action);

		// Duration
		$this->tpl['duration_value'] = $this->duration_value;

		if ($action == 'create')
		{
			// Title
			$this->tpl['title'] = load_fiche_titre($langs->trans("NewService"));
		}

		if ($action == 'edit')
		{
			$this->tpl['title'] = load_fiche_titre($langs->trans('Modify').' '.$langs->trans('Service').' : '.$this->ref, "");
		}

		if ($action == 'create' || $action == 'edit')
		{
			// Duration unit
			// TODO creer fonction
			$duration_unit = '<input name="duration_unit" type="radio" value="h"'.($this->duration_unit=='h'?' checked':'').'>'.$langs->trans("Hour");
			$duration_unit.= '&nbsp; ';
			$duration_unit.= '<input name="duration_unit" type="radio" value="d"'.($this->duration_unit=='d'?' checked':'').'>'.$langs->trans("Day");
			$duration_unit.= '&nbsp; ';
			$duration_unit.= '<input name="duration_unit" type="radio" value="w"'.($this->duration_unit=='w'?' checked':'').'>'.$langs->trans("Week");
			$duration_unit.= '&nbsp; ';
			$duration_unit.= '<input name="duration_unit" type="radio" value="m"'.($this->duration_unit=='m'?' checked':'').'>'.$langs->trans("Month");
			$duration_unit.= '&nbsp; ';
			$duration_unit.= '<input name="duration_unit" type="radio" value="y"'.($this->duration_unit=='y'?' checked':'').'>'.$langs->trans("Year");
			$this->tpl['duration_unit'] = $duration_unit;
		}

		if ($action == 'view')
		{
			// Photo
			$this->tpl['nblignes'] = 4;
			if ($this->is_photo_available($conf->service->dir_output))
			{
				$this->tpl['photos'] = $this->show_photos($conf->service->dir_output,1,1,0,0,0,80);
			}

			// 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_unit'] = $langs->trans($dur[$this->duration_unit]);
		}
	}
	/**
	 *    \brief      Assigne les valeurs pour les templates
	 *    \param      object     object
	 */
	function assign_values($action='')
	{
		global $conf,$langs;
		global $html;
		global $formproduct;

		parent::assign_values($action);

		// Stock alert
		$this->tpl['seuil_stock_alerte'] = $this->seuil_stock_alerte;

		if ($action == 'create')
		{
			// Title
			$this->tpl['title'] = load_fiche_titre($langs->trans("NewProduct"));
		}

		if ($action == 'edit')
		{
			$this->tpl['title'] = load_fiche_titre($langs->trans('Modify').' '.$langs->trans('Product').' : '.$this->ref, "");
		}

		if ($action == 'create' || $action == 'edit')
		{
			// Finished
			$statutarray=array('1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial"));
			$this->tpl['finished'] = $html->selectarray('finished',$statutarray,$this->finished);

			// Weight
			$this->tpl['weight'] = $this->weight;
			$this->tpl['weight_units'] = $formproduct->load_measuring_units("weight_units","weight",$this->weight_units);

			// Length
			$this->tpl['length'] = $this->length;
			$this->tpl['length_units'] = $formproduct->load_measuring_units("length_units","size",$this->length_units);

			// Surface
			$this->tpl['surface'] = $this->surface;
			$this->tpl['surface_units'] = $formproduct->load_measuring_units("surface_units","surface",$this->surface_units);

			// Volume
			$this->tpl['volume'] = $this->volume;
			$this->tpl['volume_units'] = $formproduct->load_measuring_units("volume_units","volume",$this->volume_units);
		}

		if ($action == 'view')
		{
			// Photo
			$this->tpl['nblignes'] = 4;
			if ($this->is_photo_available($conf->product->dir_output))
			{
				$this->tpl['photos'] = $this->show_photos($conf->product->dir_output,1,1,0,0,0,80);
			}

			// Nature
			$this->tpl['finished'] = $this->getLibFinished();

			// Weight
			if ($this->weight != '')
			{
				$this->tpl['weight'] = $this->weight." ".measuring_units_string($this->weight_units,"weight");
			}

			// 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");
			}
		}
	}