From af2e30010064d9d08b95fa0321c163b2ac3fdf2b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 24 Sep 2011 20:50:57 +0000 Subject: [PATCH] Fix: Little fix after canvas changes to be able to have "pure canvas" (canvas with no controller, only templates). --- htdocs/contact/fiche.php | 8 +++++++- htdocs/societe/soc.php | 11 ++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index 4f66bbdfc92b1..745d0c3d6e74b 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -277,7 +277,11 @@ // ----------------------------------------- // When used with CANVAS // ----------------------------------------- - + if (! $objcanvas->hasActions() && $id) + { + $object = new Societe($db); + $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 } @@ -324,6 +328,8 @@ /* * Fiche en mode creation */ + $object->canvas=$canvas; + $object->fk_departement = $_POST["departement_id"]; // We set pays_id, pays_code and label for the selected country diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index b289e334c6074..66097323008d6 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -104,6 +104,7 @@ require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php"); if ($action == 'update') $object->fetch($socid); + else $object->canvas=$canvas; if (GETPOST("private") == 1) { @@ -474,9 +475,13 @@ // ----------------------------------------- // When used with CANVAS // ----------------------------------------- - - $objcanvas->assign_values($action, $socid); // Set value for templates - $objcanvas->display_canvas(); // Show template + if (! $objcanvas->hasActions() && $socid) + { + $object = new Societe($db); + $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 } else {