diff --git a/htdocs/product/canvas/default/product.default.class.php b/htdocs/product/canvas/product/actions_card_product.class.php old mode 100644 new mode 100755 similarity index 64% rename from htdocs/product/canvas/default/product.default.class.php rename to htdocs/product/canvas/product/actions_card_product.class.php index 85ccafd2cdbb4..a3da1a475a9bc --- a/htdocs/product/canvas/default/product.default.class.php +++ b/htdocs/product/canvas/product/actions_card_product.class.php @@ -16,21 +16,24 @@ */ /** - * \file htdocs/product/canvas/default/product.default.class.php + * \file htdocs/product/canvas/product/actions_card_product.class.php * \ingroup produit * \brief Fichier de la classe des produits par defaut */ include_once(DOL_DOCUMENT_ROOT.'/product/class/product.class.php'); /** - * \class ProductDefault - * \brief Classe permettant la gestion produits par defaut, cette classe surcharge la classe produit + * \class ActionsCardProduct + * \brief Class with controller methods for product canvas */ -class ProductDefault extends Product +class ActionsCardProduct { - //! Numero d'erreur Plage 1280-1535 - var $errno = 0; - //! Template container + var $db; + var $targetmodule; + var $canvas; + var $card; + + //! Template container var $tpl = array(); /** @@ -38,7 +41,7 @@ class ProductDefault extends Product * \param DB Handler acces base de donnees * \param id Id produit (0 par defaut) */ - function ProductDefault($DB=0, $id=0, $user=0) + function ActionsCardProduct($DB=0, $id=0, $user=0) { $this->db = $DB; $this->id = $id ; @@ -71,89 +74,110 @@ function fetch($id='', $ref='', $action='') } /** - * \brief Assigne les valeurs pour les templates - * \param object object + * Assign custom values for canvas (for example into this->tpl to be used by templates) + * + * @param action Type of action */ function assign_values($action='') { - global $conf,$langs; - global $html; - global $formproduct; - - parent::assign_values($action); + global $conf,$langs,$user; + global $html, $formproduct; - // Stock alert - $this->tpl['seuil_stock_alerte'] = $this->seuil_stock_alerte; + $this->tpl['finished'] = $this->object->finished; + $this->tpl['ref'] = $this->object->ref; + $this->tpl['label'] = $this->object->label; + $this->tpl['id'] = $this->object->id; + $this->tpl['type'] = $this->object->type; + $this->tpl['note'] = $this->object->note; + $this->tpl['seuil_stock_alerte'] = $this->object->seuil_stock_alerte; if ($action == 'create') { // Title - $this->tpl['title'] = load_fiche_titre($langs->trans("NewProduct")); + $this->tpl['title'] = $langs->trans("NewProduct"); } if ($action == 'edit') { - $this->tpl['title'] = load_fiche_titre($langs->trans('Modify').' '.$langs->trans('Product').' : '.$this->ref, ""); + $this->tpl['title'] = $langs->trans('Modify').' '.$langs->trans('Product').' : '.$this->object->ref; } if ($action == 'create' || $action == 'edit') { - // Finished + // Status + $statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell")); + $this->tpl['status'] = $html->selectarray('statut',$statutarray,$_POST["statut"]); + + $statutarray=array('1' => $langs->trans("ProductStatusOnBuy"), '0' => $langs->trans("ProductStatusNotOnBuy")); + $this->tpl['status_buy'] = $html->selectarray('statut_buy',$statutarray,$_POST["statut_buy"]); + + // Finished $statutarray=array('1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial")); - $this->tpl['finished'] = $html->selectarray('finished',$statutarray,$this->finished); + $this->tpl['finished'] = $html->selectarray('finished',$statutarray,$this->object->finished); // Weight - $this->tpl['weight'] = $this->weight; - $this->tpl['weight_units'] = $formproduct->load_measuring_units("weight_units","weight",$this->weight_units); + $this->tpl['weight'] = $this->object->weight; + $this->tpl['weight_units'] = $formproduct->load_measuring_units("weight_units","weight",$this->object->weight_units); // Length - $this->tpl['length'] = $this->length; - $this->tpl['length_units'] = $formproduct->load_measuring_units("length_units","size",$this->length_units); + $this->tpl['length'] = $this->object->length; + $this->tpl['length_units'] = $formproduct->load_measuring_units("length_units","size",$this->object->length_units); // Surface - $this->tpl['surface'] = $this->surface; - $this->tpl['surface_units'] = $formproduct->load_measuring_units("surface_units","surface",$this->surface_units); + $this->tpl['surface'] = $this->object->surface; + $this->tpl['surface_units'] = $formproduct->load_measuring_units("surface_units","surface",$this->object->surface_units); // Volume - $this->tpl['volume'] = $this->volume; - $this->tpl['volume_units'] = $formproduct->load_measuring_units("volume_units","volume",$this->volume_units); + $this->tpl['volume'] = $this->object->volume; + $this->tpl['volume_units'] = $formproduct->load_measuring_units("volume_units","volume",$this->object->volume_units); } if ($action == 'view') { - // Photo + $head=product_prepare_head($this->object, $user); + $titre=$langs->trans("CardProduct".$this->object->type); + $picto=($this->object->type==1?'service':'product'); + $this->tpl['fiche_head']=dol_get_fiche_head($head, 'card', $titre, 0, $picto); + + // Status + $this->tpl['status'] = $this->object->getLibStatut(2,0); + $this->tpl['status_buy'] = $this->object->getLibStatut(2,1); + + // Photo $this->tpl['nblignes'] = 4; - if ($this->is_photo_available($conf->product->dir_output)) + if ($this->object->is_photo_available($conf->product->dir_output)) { - $this->tpl['photos'] = $this->show_photos($conf->product->dir_output,1,1,0,0,0,80); + $this->tpl['photos'] = $this->object->show_photos($conf->product->dir_output,1,1,0,0,0,80); } // Nature - $this->tpl['finished'] = $this->getLibFinished(); + $this->tpl['finished'] = $this->object->getLibFinished(); // Weight - if ($this->weight != '') + if ($this->object->weight != '') { - $this->tpl['weight'] = $this->weight." ".measuring_units_string($this->weight_units,"weight"); + $this->tpl['weight'] = $this->object->weight." ".measuring_units_string($this->object->weight_units,"weight"); } // Length - if ($this->length != '') + if ($this->object->length != '') { - $this->tpl['length'] = $this->length." ".measuring_units_string($this->length_units,"size"); + $this->tpl['length'] = $this->object->length." ".measuring_units_string($this->object->length_units,"size"); } // Surface - if ($this->surface != '') + if ($this->object->surface != '') { - $this->tpl['surface'] = $this->surface." ".measuring_units_string($this->surface_units,"surface"); + $this->tpl['surface'] = $this->object->surface." ".measuring_units_string($this->object->surface_units,"surface"); } // Volume - if ($this->volume != '') + if ($this->object->volume != '') { - $this->tpl['volume'] = $this->volume." ".measuring_units_string($this->volume_units,"volume"); + $this->tpl['volume'] = $this->object->volume." ".measuring_units_string($this->object->volume_units,"volume"); } + + $this->tpl['fiche_end']=dol_get_fiche_end(); } } diff --git a/htdocs/product/canvas/default/index.php b/htdocs/product/canvas/product/index.php old mode 100644 new mode 100755 similarity index 100% rename from htdocs/product/canvas/default/index.php rename to htdocs/product/canvas/product/index.php diff --git a/htdocs/product/canvas/default/tpl/create.tpl.php b/htdocs/product/canvas/product/tpl/card_create.tpl.php old mode 100644 new mode 100755 similarity index 59% rename from htdocs/product/canvas/default/tpl/create.tpl.php rename to htdocs/product/canvas/product/tpl/card_create.tpl.php index fbb2aa949cf10..14bbb83e03c9f --- a/htdocs/product/canvas/default/tpl/create.tpl.php +++ b/htdocs/product/canvas/product/tpl/card_create.tpl.php @@ -19,85 +19,80 @@ -object->tpl['title']; ?> +control->tpl['title']); ?> - -

- +control->tpl['error'],$this->control->tpl['errors']); ?>
" method="post"> - + - - + + + + + + - - + +stock->enabled) { ?> - +
trans("Ref"); ?> + trans("RefAlreadyExists"); ?>
trans("Label"); ?>
trans("Status").' ('.$langs->trans("Sell").')'; ?>control->tpl['status']; ?>
trans("Status"); ?>object->tpl['status']; ?>trans("Status").' ('.$langs->trans("Buy").')'; ?>control->tpl['status_buy']; ?>
trans("StockLimit"); ?> - +
trans("Description"); ?> -object->tpl['textarea_description']) { -$this->object->tpl['doleditor_description']->Create(); -}else{ -echo $this->object->tpl['textarea_description']; -}?> +control->tpl['textarea_description']; ?>
trans("Nature"); ?> -object->tpl['finished']; ?> +control->tpl['finished']; ?>
trans("Weight"); ?> - -object->tpl['weight_units']; ?> + +control->tpl['weight_units']; ?>
trans("Length"); ?> - -object->tpl['length_units']; ?> + +control->tpl['length_units']; ?>
trans("Surface"); ?> - -object->tpl['surface_units']; ?> + +control->tpl['surface_units']; ?>
trans("Volume"); ?> - -object->tpl['volume_units']; ?> + +control->tpl['volume_units']; ?>
trans("Hidden"); ?>object->tpl['hidden']; ?>
control->tpl['hidden']; ?>
trans("NoteNotVisibleOnBill"); ?> -object->tpl['textarea_note']) { -$this->object->tpl['doleditor_note']->Create(); -}else{ -echo $this->object->tpl['textarea_note']; -}?> +control->tpl['textarea_note']; ?>
@@ -108,16 +103,16 @@ - -
trans("SellingPrice"); ?> -object->tpl['price_base_type']; ?> + +control->tpl['price_base_type']; ?>
trans("MinPrice"); ?> +
trans("VATRate"); ?> -object->tpl['tva_tx']; ?> +control->tpl['tva_tx']; ?>
diff --git a/htdocs/product/canvas/default/tpl/edit.tpl.php b/htdocs/product/canvas/product/tpl/card_edit.tpl.php old mode 100644 new mode 100755 similarity index 59% rename from htdocs/product/canvas/default/tpl/edit.tpl.php rename to htdocs/product/canvas/product/tpl/card_edit.tpl.php index 2e80feb566d5f..c8865a1926270 --- a/htdocs/product/canvas/default/tpl/edit.tpl.php +++ b/htdocs/product/canvas/product/tpl/card_edit.tpl.php @@ -19,85 +19,74 @@ -object->tpl['title']; ?> +control->tpl['title']); - -

- +dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']); +?> " method="post"> - - + + - - + - +stock->enabled) { ?> - - -
trans("Ref"); ?> +
trans("Label"); ?>
trans("Status"); ?>object->tpl['status']; ?>control->tpl['status']; ?>
trans("StockLimit"); ?> - +
trans("Description"); ?> -object->tpl['textarea_description']) { -$this->object->tpl['doleditor_description']->Create(); -}else{ -echo $this->object->tpl['textarea_description']; -}?> +control->tpl['textarea_description']; ?>
trans("Nature"); ?> -object->tpl['finished']; ?> +control->tpl['finished']; ?>
trans("Weight"); ?> - -object->tpl['weight_units']; ?> + +control->tpl['weight_units']; ?>
trans("Length"); ?> - -object->tpl['length_units']; ?> + +control->tpl['length_units']; ?>
trans("Surface"); ?> - -object->tpl['surface_units']; ?> + +control->tpl['surface_units']; ?>
trans("Volume"); ?> - -object->tpl['volume_units']; ?> + +control->tpl['volume_units']; ?>
trans("Hidden"); ?>object->tpl['hidden']; ?>
trans("NoteNotVisibleOnBill"); ?> -object->tpl['textarea_note']) { -$this->object->tpl['doleditor_note']->Create(); -}else{ -echo $this->object->tpl['textarea_note']; -}?> +control->tpl['textarea_note']; ?>
diff --git a/htdocs/product/canvas/default/tpl/view.tpl.php b/htdocs/product/canvas/product/tpl/card_view.tpl.php old mode 100644 new mode 100755 similarity index 54% rename from htdocs/product/canvas/default/tpl/view.tpl.php rename to htdocs/product/canvas/product/tpl/card_view.tpl.php index 49b6046468c8b..e22d529772bec --- a/htdocs/product/canvas/default/tpl/view.tpl.php +++ b/htdocs/product/canvas/product/tpl/card_view.tpl.php @@ -18,81 +18,76 @@ ?> +control->tpl['fiche_head']; ?> + +control->tpl['error'],$this->control->tpl['errors']); ?> - + - + -object->tpl['photos']) { ?> - - - - - - - - + + - - + + - + - + - + - + - + - - - - - - + - +
trans("Ref"); ?>object->tpl['ref']; ?>control->tpl['ref']; ?>
trans("Label") ?>object->tpl['label']; ?>control->tpl['label']; ?> -object->tpl['photos']; ?> +control->tpl['photos']) { ?> + +control->tpl['photos']; ?>
object->tpl['accountancyBuyCodeKey']; ?>object->tpl['accountancyBuyCodeVal']; ?>
object->tpl['accountancySellCodeKey']; ?>object->tpl['accountancySellCodeVal']; ?>trans("Status").' ('.$langs->trans("Sell").')'; ?>control->tpl['status']; ?>
trans("Status"); ?>object->tpl['status']; ?>trans("Status").' ('.$langs->trans("Buy").')'; ?>control->tpl['status_buy']; ?>
trans("Description"); ?>object->tpl['description']; ?>control->tpl['description']; ?>
trans("Nature"); ?>object->tpl['finished']; ?>control->tpl['finished']; ?>
trans("Weight"); ?>object->tpl['weight']; ?>control->tpl['weight']; ?>
trans("Length"); ?>object->tpl['length']; ?>control->tpl['length']; ?>
trans("Surface"); ?>object->tpl['surface']; ?>control->tpl['surface']; ?>
trans("Volume"); ?>object->tpl['volume']; ?>
trans("Hidden"); ?>object->tpl['hidden']; ?>control->tpl['volume']; ?>
trans("Note"); ?>object->tpl['note']; ?>control->tpl['note']; ?>
+control->tpl['fiche_end']; ?> + \ No newline at end of file diff --git a/htdocs/product/canvas/default/tpl/index.php b/htdocs/product/canvas/product/tpl/index.php old mode 100644 new mode 100755 similarity index 100% rename from htdocs/product/canvas/default/tpl/index.php rename to htdocs/product/canvas/product/tpl/index.php diff --git a/htdocs/product/canvas/default/tpl/list.tpl.php b/htdocs/product/canvas/product/tpl/list.tpl.php old mode 100644 new mode 100755 similarity index 100% rename from htdocs/product/canvas/default/tpl/list.tpl.php rename to htdocs/product/canvas/product/tpl/list.tpl.php diff --git a/htdocs/product/canvas/service/product.service.class.php b/htdocs/product/canvas/service/actions_card_service.class.php old mode 100644 new mode 100755 similarity index 68% rename from htdocs/product/canvas/service/product.service.class.php rename to htdocs/product/canvas/service/actions_card_service.class.php index 9ef8f5297c12e..ad9f1cb5666bb --- a/htdocs/product/canvas/service/product.service.class.php +++ b/htdocs/product/canvas/service/actions_card_service.class.php @@ -23,13 +23,16 @@ /** * \class ProductService - * \brief Classe permettant la gestion services par defaut, cette classe surcharge la classe produit + * \brief Class with controller methods for product canvas */ -class ProductService extends Product +class ActionsCardService { - //! Numero d'erreur Plage 1280-1535 - var $errno = 0; + var $db; + var $targetmodule; + var $canvas; + var $card; + //! Template container var $tpl = array(); /** @@ -37,7 +40,7 @@ class ProductService extends Product * \param DB Handler acces base de donnees * \param id Id service (0 par defaut) */ - function ProductService($DB=0, $id=0, $user=0) + function ActionsCardService($DB=0, $id=0, $user=0) { $this->db = $DB; $this->id = $id ; @@ -73,59 +76,84 @@ function fetch($id='', $ref='', $action='') */ function assign_values($action='') { - global $conf,$langs; + global $conf,$langs,$user; + global $html, $formproduct; - parent::assign_values($action); + $this->tpl['finished'] = $this->object->finished; + $this->tpl['ref'] = $this->object->ref; + $this->tpl['label'] = $this->object->label; + $this->tpl['id'] = $this->object->id; + $this->tpl['type'] = $this->object->type; + $this->tpl['note'] = $this->object->note; + $this->tpl['seuil_stock_alerte'] = $this->object->seuil_stock_alerte; // Duration - $this->tpl['duration_value'] = $this->duration_value; + $this->tpl['duration_value'] = $this->object->duration_value; if ($action == 'create') { // Title - $this->tpl['title'] = load_fiche_titre($langs->trans("NewService")); + $this->tpl['title'] = $langs->trans("NewService"); } if ($action == 'edit') { - $this->tpl['title'] = load_fiche_titre($langs->trans('Modify').' '.$langs->trans('Service').' : '.$this->ref, ""); + $this->tpl['title'] = $langs->trans('Modify').' '.$langs->trans('Service').' : '.$this->object->ref; } if ($action == 'create' || $action == 'edit') { - // Duration unit + // Status + $statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell")); + $this->tpl['status'] = $html->selectarray('statut',$statutarray,$_POST["statut"]); + + $statutarray=array('1' => $langs->trans("ProductStatusOnBuy"), '0' => $langs->trans("ProductStatusNotOnBuy")); + $this->tpl['status_buy'] = $html->selectarray('statut_buy',$statutarray,$_POST["statut_buy"]); + + // Duration unit // TODO creer fonction - $duration_unit = 'duration_unit=='h'?' checked':'').'>'.$langs->trans("Hour"); + $duration_unit = 'object->duration_unit=='h'?' checked':'').'>'.$langs->trans("Hour"); $duration_unit.= '  '; - $duration_unit.= 'duration_unit=='d'?' checked':'').'>'.$langs->trans("Day"); + $duration_unit.= 'object->duration_unit=='d'?' checked':'').'>'.$langs->trans("Day"); $duration_unit.= '  '; - $duration_unit.= 'duration_unit=='w'?' checked':'').'>'.$langs->trans("Week"); + $duration_unit.= 'object->duration_unit=='w'?' checked':'').'>'.$langs->trans("Week"); $duration_unit.= '  '; - $duration_unit.= 'duration_unit=='m'?' checked':'').'>'.$langs->trans("Month"); + $duration_unit.= 'object->duration_unit=='m'?' checked':'').'>'.$langs->trans("Month"); $duration_unit.= '  '; - $duration_unit.= 'duration_unit=='y'?' checked':'').'>'.$langs->trans("Year"); + $duration_unit.= 'object->duration_unit=='y'?' checked':'').'>'.$langs->trans("Year"); $this->tpl['duration_unit'] = $duration_unit; } if ($action == 'view') { - // Photo + $head=product_prepare_head($this->object, $user); + $titre=$langs->trans("CardProduct".$this->object->type); + $picto=($this->object->type==1?'service':'product'); + $this->tpl['fiche_head']=dol_get_fiche_head($head, 'card', $titre, 0, $picto); + + // Status + $this->tpl['status'] = $this->object->getLibStatut(2,0); + $this->tpl['status_buy'] = $this->object->getLibStatut(2,1); + + // Photo $this->tpl['nblignes'] = 4; - if ($this->is_photo_available($conf->service->dir_output)) + if ($this->object->is_photo_available($conf->service->dir_output)) { - $this->tpl['photos'] = $this->show_photos($conf->service->dir_output,1,1,0,0,0,80); + $this->tpl['photos'] = $this->object->show_photos($conf->service->dir_output,1,1,0,0,0,80); } // Duration - if ($this->duration_value > 1) + if ($this->object->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) + else if ($this->object->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]); + $this->tpl['duration_unit'] = $langs->trans($dur[$this->object->duration_unit]); + + $this->tpl['fiche_end']=dol_get_fiche_end(); } } diff --git a/htdocs/product/canvas/service/tpl/create.tpl.php b/htdocs/product/canvas/service/tpl/card_create.tpl.php old mode 100644 new mode 100755 similarity index 80% rename from htdocs/product/canvas/service/tpl/create.tpl.php rename to htdocs/product/canvas/service/tpl/card_create.tpl.php index 64619a0bcb926..c09a3e1e91571 --- a/htdocs/product/canvas/service/tpl/create.tpl.php +++ b/htdocs/product/canvas/service/tpl/card_create.tpl.php @@ -19,17 +19,15 @@ -object->tpl['title']; ?> +control->tpl['title']); ?> - -

- +control->tpl['error'],$this->control->tpl['errors']); ?> " method="post"> - + @@ -45,16 +43,17 @@ - - + + + + + + + @@ -66,11 +65,7 @@
trans("Status"); ?>object->tpl['status']; ?>trans("Status").' ('.$langs->trans("Sell").')'; ?>control->tpl['status']; ?>
trans("Status").' ('.$langs->trans("Buy").')'; ?>control->tpl['status_buy']; ?>
trans("Description"); ?> -object->tpl['textarea_description']) { -$this->object->tpl['doleditor_description']->Create(); -}else{ -echo $this->object->tpl['textarea_description']; -}?> +object->tpl['textarea_description']; ?>
trans("Duration"); ?>object->tpl['hidden']; ?>
trans("NoteNotVisibleOnBill"); ?> -object->tpl['textarea_note']) { -$this->object->tpl['doleditor_note']->Create(); -}else{ -echo $this->object->tpl['textarea_note']; -}?> +object->tpl['textarea_note']; ?>
diff --git a/htdocs/product/canvas/service/tpl/edit.tpl.php b/htdocs/product/canvas/service/tpl/card_edit.tpl.php old mode 100644 new mode 100755 similarity index 88% rename from htdocs/product/canvas/service/tpl/edit.tpl.php rename to htdocs/product/canvas/service/tpl/card_edit.tpl.php index ebff27a3167c8..7522e49fde786 --- a/htdocs/product/canvas/service/tpl/edit.tpl.php +++ b/htdocs/product/canvas/service/tpl/card_edit.tpl.php @@ -50,7 +50,7 @@ trans("Description"); ?> -object->tpl['textarea_description']) { +object->tpl['textarea_description']) { $this->object->tpl['doleditor_description']->Create(); }else{ echo $this->object->tpl['textarea_description']; @@ -62,15 +62,8 @@ object->tpl['duration_unit']; ?> -trans("Hidden"); ?> -object->tpl['hidden']; ?> - trans("NoteNotVisibleOnBill"); ?> -object->tpl['textarea_note']) { -$this->object->tpl['doleditor_note']->Create(); -}else{ -echo $this->object->tpl['textarea_note']; -}?> +object->tpl['textarea_note']; ?> diff --git a/htdocs/product/canvas/service/tpl/view.tpl.php b/htdocs/product/canvas/service/tpl/card_view.tpl.php old mode 100644 new mode 100755 similarity index 55% rename from htdocs/product/canvas/service/tpl/view.tpl.php rename to htdocs/product/canvas/service/tpl/card_view.tpl.php index 81619b87750a0..e46548c032aeb --- a/htdocs/product/canvas/service/tpl/view.tpl.php +++ b/htdocs/product/canvas/service/tpl/card_view.tpl.php @@ -18,61 +18,60 @@ ?> +control->tpl['fiche_head']; ?> + +control->tpl['error'],$this->control->tpl['errors']); ?> - + - + -object->tpl['photos']) { ?> - - - - - - - - + + - - + + - + - - + - +
trans("Ref"); ?>object->tpl['ref']; ?>control->tpl['ref']; ?>
trans("Label") ?>object->tpl['label']; ?>control->tpl['label']; ?> -object->tpl['photos']; ?> +control->tpl['photos']) { ?> + +control->tpl['photos']; ?>
object->tpl['accountancyBuyCodeKey']; ?>object->tpl['accountancyBuyCodeVal']; ?>
object->tpl['accountancySellCodeKey']; ?>object->tpl['accountancySellCodeVal']; ?>trans("Status").' ('.$langs->trans("Sell").')'; ?>control->tpl['status']; ?>
trans("Status"); ?>object->tpl['status']; ?>trans("Status").' ('.$langs->trans("Buy").')'; ?>control->tpl['status_buy']; ?>
trans("Description"); ?>object->tpl['description']; ?>control->tpl['description']; ?>
trans("Duration"); ?>object->tpl['duration_value']; ?>  -object->tpl['duration_unit']; ?>  +control->tpl['duration_value']; ?>  +control->tpl['duration_unit']; ?> 
trans("Hidden"); ?>object->tpl['hidden']; ?>control->tpl['hidden']; ?>
trans("Note"); ?>object->tpl['note']; ?>control->tpl['note']; ?>
+control->tpl['fiche_end']; ?> \ No newline at end of file diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index ff3eb5bd3da5e..599302fe580e8 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -149,12 +149,6 @@ $product=new Product($db); - if (! empty($canvas)) // Overwrite product here - { - $objcanvas = new Canvas($db,$user); - $product = $objcanvas->load_canvas('product',$canvas); - } - if (! $error) { $product->ref = $ref; @@ -220,7 +214,6 @@ { $mesg='
'.$langs->trans($product->error).'
'; $action = "create"; - $_GET["canvas"] = $product->canvas; $_GET["type"] = $_POST["type"]; } } @@ -236,13 +229,6 @@ else { $product=new Product($db); - - if (! empty($canvas)) // Overwrite product here - { - $objcanvas = new Canvas($db,$user); - $product = $objcanvas->load_canvas('product',$_POST["canvas"]); - } - if ($product->fetch($id)) { $product->ref = $ref; @@ -637,9 +623,19 @@ * View */ +// fetch optionals attributes and labels +$extralabels=$extrafields->fetch_name_optionals_label('product'); + +$helpurl=''; +if (GETPOST("type") == '0') $helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; +if (GETPOST("type") == '1') $helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; + +llxHeader('',$langs->trans("CardProduct".$_GET["type"]),$helpurl); + $html = new Form($db); $formproduct = new FormProduct($db); + // TODO Mutualize this part of code (same than societe/soc.php and contact/fiche.php) if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { @@ -657,8 +653,8 @@ $objcanvas->control->object=$objcanvas->getObject($socid); // TODO: Getting and storing object should be done into assign_values (for template with no code) or into tpl if (empty($objcanvas->control->object)) { - $object = new Societe($db); - $object->fetch($socid); + $object = new Product($db); + $object->fetch($id); $objcanvas->control->object=$object; } $objcanvas->assign_post(); // TODO: Put code of assign_post into assign_values to keep only assign_values @@ -670,8 +666,8 @@ $objcanvas->control->object=$objcanvas->getObject($socid); // TODO: Getting and storing object should be done into assign_values (for template with no code) or into tpl if (empty($objcanvas->control->object)) { - $object = new Societe($db); - $object->fetch($socid); + $object = new Product($db); + $object->fetch($id); $objcanvas->control->object=$object; } $objcanvas->assign_values('view'); @@ -685,12 +681,6 @@ // ----------------------------------------- if ($action == 'create' && ($user->rights->produit->creer || $user->rights->service->creer)) { - $helpurl=''; - if (isset($_GET["type"]) && $_GET["type"] == 0) $helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; - if (isset($_GET["type"]) && $_GET["type"] == 1) $helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; - - llxHeader('',$langs->trans("CardProduct".$_GET["type"]),$helpurl); - print ''; print ''; print ''; @@ -853,10 +843,8 @@ if ($id || $ref) { - $product=new Product($db); - $product->fetch($id,$ref); - - llxHeader('',$langs->trans("CardProduct".$product->type)); + $object=new Product($db); + $object->fetch($id,$ref); /* * Fiche en mode edition @@ -864,8 +852,8 @@ if ($action == 'edit' && ($user->rights->produit->creer || $user->rights->service->creer)) { $type = $langs->trans('Product'); - if ($product->isservice()) $type = $langs->trans('Service'); - print_fiche_titre($langs->trans('Modify').' '.$type.' : '.$product->ref, ""); + if ($object->isservice()) $type = $langs->trans('Service'); + print_fiche_titre($langs->trans('Modify').' '.$type.' : '.$object->ref, ""); dol_htmloutput_errors($mesg); @@ -873,20 +861,20 @@ print ''."\n"; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; // Ref - print ''; + print ''; // Label - print ''; + print ''; // Status print '"; print "\n"; // Nature - if($product->type!=1) + if($object->type!=1) { print ''; } - if ($product->isproduct() && $conf->stock->enabled) + if ($object->isproduct() && $conf->stock->enabled) { print "".''; } else { - print ''; + print ''; } - if ($product->isservice()) + if ($object->isservice()) { // Duration - print ''; } @@ -964,39 +952,39 @@ { // Weight print ''; // Length print ''; // Surface print ''; // Volume print ''; } // Custom code - print ''; + print ''; // Origin country print ''; // Note print '"; print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").'
'.$langs->trans("Label").'
'.$langs->trans("Label").'
'.$langs->trans("Status").' ('.$langs->trans("Sell").')'.''; print '
'.$langs->trans("Status").' ('.$langs->trans("Buy").')'.''; print '
'.$langs->trans("Description").''; require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); - $doleditor=new DolEditor('desc',$product->description,'',160,'dolibarr_notes','',false,true,$conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,4,90); + $doleditor=new DolEditor('desc',$object->description,'',160,'dolibarr_notes','',false,true,$conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,4,90); $doleditor->Create(); print "
'.$langs->trans("Nature").''; $statutarray=array('-1'=>' ', '1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial")); - print $html->selectarray('finished',$statutarray,$product->finished); + print $html->selectarray('finished',$statutarray,$object->finished); print '
'.$langs->trans("StockLimit").''; - print ''; + print ''; print '
'.$langs->trans("Duration").''; + print '
'.$langs->trans("Duration").''; print '  '; - print 'duration_unit=='h'?' checked':'').'>'.$langs->trans("Hour"); + print 'duration_unit=='h'?' checked':'').'>'.$langs->trans("Hour"); print '  '; - print 'duration_unit=='d'?' checked':'').'>'.$langs->trans("Day"); + print 'duration_unit=='d'?' checked':'').'>'.$langs->trans("Day"); print '  '; - print 'duration_unit=='w'?' checked':'').'>'.$langs->trans("Week"); + print 'duration_unit=='w'?' checked':'').'>'.$langs->trans("Week"); print '  '; - print 'duration_unit=='m'?' checked':'').'>'.$langs->trans("Month"); + print 'duration_unit=='m'?' checked':'').'>'.$langs->trans("Month"); print '  '; - print 'duration_unit=='y'?' checked':'').'>'.$langs->trans("Year"); + print 'duration_unit=='y'?' checked':'').'>'.$langs->trans("Year"); print '
'.$langs->trans("Weight").''; - print ' '; - print $formproduct->select_measuring_units("weight_units", "weight", $product->weight_units); + print ' '; + print $formproduct->select_measuring_units("weight_units", "weight", $object->weight_units); print '
'.$langs->trans("Length").''; - print ' '; - print $formproduct->select_measuring_units("size_units", "size", $product->length_units); + print ' '; + print $formproduct->select_measuring_units("size_units", "size", $object->length_units); print '
'.$langs->trans("Surface").''; - print ' '; - print $formproduct->select_measuring_units("surface_units", "surface", $product->surface_units); + print ' '; + print $formproduct->select_measuring_units("surface_units", "surface", $object->surface_units); print '
'.$langs->trans("Volume").''; - print ' '; - print $formproduct->select_measuring_units("volume_units", "volume", $product->volume_units); + print ' '; + print $formproduct->select_measuring_units("volume_units", "volume", $object->volume_units); print '
'.$langs->trans("CustomCode").'
'.$langs->trans("CustomCode").'
'.$langs->trans("CountryOrigin").''; - $html->select_pays($product->country_id,'country_id'); + $html->select_pays($object->country_id,'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); print '
'.$langs->trans("NoteNotVisibleOnBill").''; require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); - $doleditor=new DolEditor('note',$product->note,'',200,'dolibarr_notes','',false,true,$conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,8,70); + $doleditor=new DolEditor('note',$object->note,'',200,'dolibarr_notes','',false,true,$conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,8,70); $doleditor->Create(); print "
'; @@ -1013,92 +1001,92 @@ */ else { - $head=product_prepare_head($product, $user); - $titre=$langs->trans("CardProduct".$product->type); - $picto=($product->type==1?'service':'product'); + $head=product_prepare_head($object, $user); + $titre=$langs->trans("CardProduct".$object->type); + $picto=($object->type==1?'service':'product'); dol_fiche_head($head, 'card', $titre, 0, $picto); // Confirm delete product if ($action == 'delete' || $conf->use_javascript_ajax) { - $ret=$html->form_confirm("fiche.php?id=".$product->id,$langs->trans("DeleteProduct"),$langs->trans("ConfirmDeleteProduct"),"confirm_delete",'',0,"action-delete"); + $ret=$html->form_confirm("fiche.php?id=".$object->id,$langs->trans("DeleteProduct"),$langs->trans("ConfirmDeleteProduct"),"confirm_delete",'',0,"action-delete"); if ($ret == 'html') print '
'; } - $isphoto=$product->is_photo_available($conf->product->dir_output); + $isphoto=$object->is_photo_available($conf->product->dir_output); // En mode visu print ''; // Ref print ''; print ''; // Label - print ''; + print ''; $nblignes=9; - if ($product->type!=1) $nblignes++; - if ($product->isservice()) $nblignes++; + if ($object->type!=1) $nblignes++; + if ($object->isservice()) $nblignes++; else $nblignes+=4; if ($isphoto) { // Photo print ''; } print ''; // Accountancy sell code - print ''; // Accountancy buy code - print ''; // Status (to sell) print ''; // Status (to buy) print ''; // Description - print ''; + print ''; // Nature - if($product->type!=1) + if($object->type!=1) { print ''; } - if ($product->isservice()) + if ($object->isservice()) { // Duration - print ''; } @@ -1106,9 +1094,9 @@ { // Weight print '\n"; // Length print '\n"; // Surface print '\n"; // Volume print ''; + print ''; // Origin country code - print ''; + print ''; // Note - print ''; + print ''; print "
'.$langs->trans("Ref").''; - print $html->showrefnav($product,'ref','',1,'ref'); + print $html->showrefnav($object,'ref','',1,'ref'); print '
'.$langs->trans("Label").''.$product->libelle.'
'.$langs->trans("Label").''.$object->libelle.''; - print $product->show_photos($conf->product->dir_output,1,1,0,0,0,80); + print $object->show_photos($conf->product->dir_output,1,1,0,0,0,80); print '
'.$html->editfieldkey("ProductAccountancySellCode",'productaccountancycodesell',$product->accountancy_code_sell,'id',$product->id,$user->rights->produit->creer).''; - print $html->editfieldval("ProductAccountancySellCode",'productaccountancycodesell',$product->accountancy_code_sell,'id',$product->id,$user->rights->produit->creer); + print '
'.$html->editfieldkey("ProductAccountancySellCode",'productaccountancycodesell',$object->accountancy_code_sell,'id',$object->id,$user->rights->produit->creer).''; + print $html->editfieldval("ProductAccountancySellCode",'productaccountancycodesell',$object->accountancy_code_sell,'id',$object->id,$user->rights->produit->creer); print '
'.$html->editfieldkey("ProductAccountancyBuyCode",'productaccountancycodebuy',$product->accountancy_code_buy,'id',$product->id,$user->rights->produit->creer).''; - print $html->editfieldval("ProductAccountancyBuyCode",'productaccountancycodebuy',$product->accountancy_code_buy,'id',$product->id,$user->rights->produit->creer); + print '
'.$html->editfieldkey("ProductAccountancyBuyCode",'productaccountancycodebuy',$object->accountancy_code_buy,'id',$object->id,$user->rights->produit->creer).''; + print $html->editfieldval("ProductAccountancyBuyCode",'productaccountancycodebuy',$object->accountancy_code_buy,'id',$object->id,$user->rights->produit->creer); print '
'.$langs->trans("Status").' ('.$langs->trans("Sell").')'.''; - print $product->getLibStatut(2,0); + print $object->getLibStatut(2,0); print '
'.$langs->trans("Status").' ('.$langs->trans("Buy").')'.''; - print $product->getLibStatut(2,1); + print $object->getLibStatut(2,1); print '
'.$langs->trans("Description").''.(dol_textishtml($product->description)?$product->description:dol_nl2br($product->description,1,true)).'
'.$langs->trans("Description").''.(dol_textishtml($object->description)?$object->description:dol_nl2br($object->description,1,true)).'
'.$langs->trans("Nature").''; - print $product->getLibFinished(); + print $object->getLibFinished(); print '
'.$langs->trans("Duration").''.$product->duration_value.' '; - if ($product->duration_value > 1) + print '
'.$langs->trans("Duration").''.$object->duration_value.' '; + if ($object->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) + else if ($object->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($dur[$object->duration_unit])." "; print '
'.$langs->trans("Weight").''; - if ($product->weight != '') + if ($object->weight != '') { - print $product->weight." ".measuring_units_string($product->weight_units,"weight"); + print $object->weight." ".measuring_units_string($object->weight_units,"weight"); } else { @@ -1117,9 +1105,9 @@ print "
'.$langs->trans("Length").''; - if ($product->length != '') + if ($object->length != '') { - print $product->length." ".measuring_units_string($product->length_units,"size"); + print $object->length." ".measuring_units_string($object->length_units,"size"); } else { @@ -1128,9 +1116,9 @@ print "
'.$langs->trans("Surface").''; - if ($product->surface != '') + if ($object->surface != '') { - print $product->surface." ".measuring_units_string($product->surface_units,"surface"); + print $object->surface." ".measuring_units_string($object->surface_units,"surface"); } else { @@ -1139,9 +1127,9 @@ print "
'.$langs->trans("Volume").''; - if ($product->volume != '') + if ($object->volume != '') { - print $product->volume." ".measuring_units_string($product->volume_units,"volume"); + print $object->volume." ".measuring_units_string($object->volume_units,"volume"); } else { @@ -1151,14 +1139,14 @@ } // Custom code - print '
'.$langs->trans("CustomCode").''.$product->customcode.'
'.$langs->trans("CustomCode").''.$object->customcode.'
'.$langs->trans("CountryOrigin").''.getCountry($product->country_id,0,$db).'
'.$langs->trans("CountryOrigin").''.getCountry($object->country_id,0,$db).'
'.$langs->trans("Note").''.(dol_textishtml($product->note)?$product->note:dol_nl2br($product->note,1,true)).'
'.$langs->trans("Note").''.(dol_textishtml($object->note)?$object->note:dol_nl2br($object->note,1,true)).'
\n"; @@ -1180,12 +1168,12 @@ // Create an array for form $formquestion=array( 'text' => $langs->trans("ConfirmClone"), - array('type' => 'text', 'name' => 'clone_ref','label' => $langs->trans("NewRefForClone"), 'value' => $langs->trans("CopyOf").' '.$product->ref, 'size'=>24), + array('type' => 'text', 'name' => 'clone_ref','label' => $langs->trans("NewRefForClone"), 'value' => $langs->trans("CopyOf").' '.$object->ref, 'size'=>24), array('type' => 'checkbox', 'name' => 'clone_content','label' => $langs->trans("CloneContentProduct"), 'value' => 1), array('type' => 'checkbox', 'name' => 'clone_prices', 'label' => $langs->trans("ClonePricesProduct").' ('.$langs->trans("FeatureNotYetAvailable").')', 'value' => 0, 'disabled' => true) ); // Paiement incomplet. On demande si motif = escompte ou autre - $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$product->id,$langs->trans('CloneProduct'),$langs->trans('ConfirmCloneProduct',$product->ref),'confirm_clone',$formquestion,'yes','action-clone',230,600); + $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('CloneProduct'),$langs->trans('ConfirmCloneProduct',$object->ref),'confirm_clone',$formquestion,'yes','action-clone',230,600); } @@ -1201,23 +1189,23 @@ { if ($user->rights->produit->creer || $user->rights->service->creer) { - if ($product->no_button_edit <> 1) - print 'id.'">'.$langs->trans("Modify").''; + if ($object->no_button_edit <> 1) + print 'id.'">'.$langs->trans("Modify").''; - if ($product->no_button_copy <> 1) { + if ($object->no_button_copy <> 1) { if ($conf->use_javascript_ajax) { print ''.$langs->trans('ToClone').''."\n"; } else { - print 'id.'">'.$langs->trans("ToClone").''; + print 'id.'">'.$langs->trans("ToClone").''; } } } - $product_is_used = $product->isObjectUsed($product->id); - if (($product->type == 0 && $user->rights->produit->supprimer) - || ($product->type == 1 && $user->rights->service->supprimer)) + $object_is_used = $object->isObjectUsed($object->id); + if (($object->type == 0 && $user->rights->produit->supprimer) + || ($object->type == 1 && $user->rights->service->supprimer)) { - if (! $product_is_used && $product->no_button_delete <> 1) + if (! $object_is_used && $object->no_button_delete <> 1) { if ($conf->use_javascript_ajax) { @@ -1225,7 +1213,7 @@ } else { - print 'id.'">'.$langs->trans("Delete").''; + print 'id.'">'.$langs->trans("Delete").''; } } else @@ -1246,7 +1234,7 @@ * All the "Add to" areas */ -if ($product->id && $action == '' && $product->status) +if ($object->id && $action == '' && $object->status) { print ''; @@ -1296,7 +1284,7 @@ { $objp = $db->fetch_object($result); $var=!$var; - print ''; + print ''; print ''; print ''; print ""; @@ -1307,7 +1295,7 @@ print ''; @@ -1334,7 +1322,7 @@ $var=true; $otherprop = $propal->liste_array(1,1,1); - print ''; + print ''; print ''; print '
'; print ''.$langs->trans("ReductionShort"); print '%'; - print " ".$product->stock_proposition; + print " ".$object->stock_proposition; print ''; print ''; print '
'; if (is_array($otherprop) && sizeof($otherprop)) @@ -1413,7 +1401,7 @@ { $objc = $db->fetch_object($result); $var=!$var; - print ''; + print ''; print ''; print ''; print ""; @@ -1424,7 +1412,7 @@ print ''; @@ -1452,7 +1440,7 @@ $var=true; $othercom = $commande->liste_array(1, $user); - print ''; + print ''; print ''; print '
'; print ''.$langs->trans("ReductionShort"); print '%'; - print " ".$product->stock_proposition; + print " ".$object->stock_proposition; print ''; print ''; print '
'; if (is_array($othercom) && sizeof($othercom)) @@ -1527,7 +1515,7 @@ { $objp = $db->fetch_object($result); $var=!$var; - print ''; + print ''; print ''; print ''; print ""; @@ -1592,7 +1580,7 @@ $objp = $db->fetch_object($result); $var=!$var; - print ''; + print ''; print ''; print ''; print ""; diff --git a/htdocs/societe/canvas/default/actions_card_default.class.php b/htdocs/societe/canvas/default/actions_card_default.class.php index df9df0ed3afe5..6d35fcb83304c 100644 --- a/htdocs/societe/canvas/default/actions_card_default.class.php +++ b/htdocs/societe/canvas/default/actions_card_default.class.php @@ -25,7 +25,7 @@ /** * \class ActionsCardDefault - * \brief Classe permettant la gestion des tiers par defaut + * \brief Class with controller methods for thirdparty canvas */ class ActionsCardDefault extends ActionsCardCommon { @@ -86,7 +86,8 @@ function doActions($socid) } /** - * Assign custom values for canvas + * Assign custom values for canvas (for example into this->tpl to be used by templates) + * * @param action Type of action */ function assign_values($action='') diff --git a/htdocs/societe/canvas/default/tpl/card_create.tpl.php b/htdocs/societe/canvas/default/tpl/card_create.tpl.php index 2ec271b7d72ae..fbcec1822f69a 100644 --- a/htdocs/societe/canvas/default/tpl/card_create.tpl.php +++ b/htdocs/societe/canvas/default/tpl/card_create.tpl.php @@ -19,11 +19,9 @@ -control->tpl['title']); +control->tpl['title']); ?> -dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']); -?> +control->tpl['error'],$this->control->tpl['errors']); ?> use_javascript_ajax) { ?> control->tpl['ajax_selecttype']; ?> diff --git a/htdocs/societe/canvas/individual/actions_card_individual.class.php b/htdocs/societe/canvas/individual/actions_card_individual.class.php index f667ff9b577b8..5538c7d87441c 100644 --- a/htdocs/societe/canvas/individual/actions_card_individual.class.php +++ b/htdocs/societe/canvas/individual/actions_card_individual.class.php @@ -24,7 +24,7 @@ /** * \class ActionsCardIndividual - * \brief Classe permettant la gestion des particuliers + * \brief Class with controller methods for individual canvas */ class ActionsCardIndividual extends ActionsCardCommon { @@ -86,7 +86,8 @@ function doActions($socid) } /** - * Assign custom values for canvas + * Assign custom values for canvas (for example into this->tpl to be used by templates) + * * @param action Type of action */ function assign_values($action='') @@ -98,7 +99,7 @@ function assign_values($action='') if ($action == 'create' || $action == 'edit') { - $this->tpl['select_civility'] = $formcompany->select_civility($contact->civilite_id); + $this->tpl['select_civility'] = $formcompany->select_civility(GETPOST('civilite_id')); } else {