diff --git a/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php b/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php
index 20e8f544bb4..53531c72d0e 100644
--- a/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php
+++ b/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php
@@ -17,7 +17,6 @@
*/
$contact = $GLOBALS['objcanvas']->control->object;
-
?>
@@ -98,7 +97,7 @@ dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']
control->tpl['email']; ?> |
control->tpl['nb_emailing']) { ?>
trans("NbOfEMailingsReceived"); ?> |
- control->tpl['nb_emailing']; ?> |
+ control->tpl['nb_emailing']; ?> |
|
diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php
index 6021767dbae..d50dd537181 100644
--- a/htdocs/contact/fiche.php
+++ b/htdocs/contact/fiche.php
@@ -249,10 +249,12 @@ if (empty($reshook))
{
$object->old_name='';
$object->old_firstname='';
+ $action = 'view';
}
else
{
$error=$object->error; $errors=$object->errors;
+ $action = 'edit';
}
}
}
@@ -277,7 +279,7 @@ if ($socid > 0)
$objsoc->fetch($socid);
}
-if (is_object($objcanvas) && $objcanvas->displayCanvasExists())
+if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
{
// -----------------------------------------
// When used with CANVAS
@@ -288,7 +290,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists())
$object->fetch($id); // For use with "pure canvas" (canvas that contains templates only)
}
$objcanvas->assign_values($action, $id); // Set value for templates
- $objcanvas->display_canvas(); // Show template
+ $objcanvas->display_canvas($action); // Show template
}
else
{
diff --git a/htdocs/core/class/canvas.class.php b/htdocs/core/class/canvas.class.php
index a2b88dc7572..6caf410ee85 100644
--- a/htdocs/core/class/canvas.class.php
+++ b/htdocs/core/class/canvas.class.php
@@ -50,9 +50,9 @@ class Canvas
* @param DoliDB $DB Database handler
* @param string $actiontype Action type ('create', 'view', 'edit', 'list')
*/
- function __construct($DB, $actiontype='view')
+ function __construct($db, $actiontype='view')
{
- $this->db = $DB;
+ $this->db = $db;
$this->actiontype = $actiontype;
if ($this->actiontype == 'add') $this->actiontype='create';
@@ -128,11 +128,11 @@ class Canvas
*
* @return int 0=Canvas template file does not exist, 1=Canvas template file exists
*/
- function displayCanvasExists()
- {
+ function displayCanvasExists($action)
+ {
if (empty($this->template_dir)) return 0;
- //print $this->template_dir.($this->card?$this->card.'_':'').$this->actiontype.'.tpl.php';
- if (file_exists($this->template_dir.($this->card?$this->card.'_':'').$this->actiontype.'.tpl.php')) return 1;
+
+ if (file_exists($this->template_dir.($this->card?$this->card.'_':'').$this->action.'.tpl.php')) return 1;
else return 0;
}
@@ -142,12 +142,12 @@ class Canvas
*
* @return void
*/
- function display_canvas()
+ function display_canvas($action)
{
global $db, $conf, $langs, $user, $canvas;
global $form, $formfile;
- include($this->template_dir.($this->card?$this->card.'_':'').$this->actiontype.'.tpl.php'); // Include native PHP template
+ include($this->template_dir.($this->card?$this->card.'_':'').$this->action.'.tpl.php'); // Include native PHP template
}
diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php
index 5f5e5074e7f..d6360b1dd6f 100644
--- a/htdocs/product/fiche.php
+++ b/htdocs/product/fiche.php
@@ -661,7 +661,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
$object->fetch($id, $ref); // For use with "pure canvas" (canvas that contains templates only)
}
$objcanvas->assign_values($action, $id, $ref); // Set value for templates
- $objcanvas->display_canvas(); // Show template
+ $objcanvas->display_canvas($action); // Show template
}
else
{
diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php
index 6145155fafa..0ba5c8e23fb 100644
--- a/htdocs/societe/soc.php
+++ b/htdocs/societe/soc.php
@@ -468,7 +468,7 @@ $formcompany = new FormCompany($db);
$countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
-if (is_object($objcanvas) && $objcanvas->displayCanvasExists())
+if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
{
// -----------------------------------------
// When used with CANVAS
@@ -479,7 +479,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists())
$object->fetch($socid); // For use with "pure canvas" (canvas that contains templates only)
}
$objcanvas->assign_values($action, $socid); // Set value for templates
- $objcanvas->display_canvas(); // Show template
+ $objcanvas->display_canvas($action); // Show template
}
else
{