From d0b1b4163e4cee11c6316f38709754e16780fa00 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 Jan 2011 12:48:05 +0000 Subject: [PATCH] Qual: Add TODO to have canvas to comply with MVC rules. --- .../actions_contactcard_common.class.php | 2 -- htdocs/contact/fiche.php | 35 ++++++++++++------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php index 263627391e2..7e9c2c051c1 100644 --- a/htdocs/contact/canvas/actions_contactcard_common.class.php +++ b/htdocs/contact/canvas/actions_contactcard_common.class.php @@ -259,9 +259,7 @@ class ActionsContactCardCommon $this->object->note = $_POST["note"]; $this->object->canvas = $_POST["canvas"]; - // We set pays_id, and pays_code label of the chosen country - // TODO move in business class if ($this->object->fk_pays) { $sql = "SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_pays WHERE rowid = ".$this->object->fk_pays; diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index 8133c1ce0b2..cf8ef281c2a 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -268,20 +268,23 @@ if (! empty($canvas)) if (GETPOST("action") == 'create') { - // Set action type + // Set action type to objcanvas->action $objcanvas->setAction(GETPOST("action")); - // Card header + // Assign _POST data to objcanvas->object->xxx + $objcanvas->assign_post(); + + // Assign template values into objcanvas->control->tpl + $objcanvas->assign_values(); + + // Card header TODO This should be done into canvas_display $title = $objcanvas->getTitle(); print_fiche_titre($title); - // Assign _POST data - $objcanvas->assign_post(); - - // Assign template values - $objcanvas->assign_values(); - - // Show errors + // Show errors TODO This should be done into assign_values() + // that should get string of dol_htmloutput_errors and + // assigne it into objcanvas->control->tpl like other strings to show + // by templates, then output of string should be done into display_canvas dol_htmloutput_errors($objcanvas->error,$objcanvas->errors); // Display canvas @@ -330,13 +333,19 @@ if (! empty($canvas)) $result=$objcanvas->fetch($id); if ($result > 0) { - // Card header - $objcanvas->showHead(); - // Assign values $objcanvas->assign_values(); - //Show errors + // FIXME div of tab is shown by showHead but /div is closed by + // display_canvas. All output should be processed by template so + // showHead and dol_htmloutput_errors should be moved into + // display_canvas. + + // Card header + $objcanvas->showHead(); + + // Show errors TODO This output string should be set by + // assign_values and output by template into display_canvas dol_htmloutput_errors($objcanvas->error,$objcanvas->errors); // Display canvas