Qual: Add TODO to have canvas to comply with MVC rules.

This commit is contained in:
Laurent Destailleur 2011-01-12 12:48:05 +00:00
parent 137e4e99dc
commit d0b1b4163e
2 changed files with 22 additions and 15 deletions

View File

@ -259,9 +259,7 @@ class ActionsContactCardCommon
$this->object->note = $_POST["note"]; $this->object->note = $_POST["note"];
$this->object->canvas = $_POST["canvas"]; $this->object->canvas = $_POST["canvas"];
// We set pays_id, and pays_code label of the chosen country // We set pays_id, and pays_code label of the chosen country
// TODO move in business class
if ($this->object->fk_pays) if ($this->object->fk_pays)
{ {
$sql = "SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_pays WHERE rowid = ".$this->object->fk_pays; $sql = "SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_pays WHERE rowid = ".$this->object->fk_pays;

View File

@ -268,20 +268,23 @@ if (! empty($canvas))
if (GETPOST("action") == 'create') if (GETPOST("action") == 'create')
{ {
// Set action type // Set action type to objcanvas->action
$objcanvas->setAction(GETPOST("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(); $title = $objcanvas->getTitle();
print_fiche_titre($title); print_fiche_titre($title);
// Assign _POST data // Show errors TODO This should be done into assign_values()
$objcanvas->assign_post(); // that should get string of dol_htmloutput_errors and
// assigne it into objcanvas->control->tpl like other strings to show
// Assign template values // by templates, then output of string should be done into display_canvas
$objcanvas->assign_values();
// Show errors
dol_htmloutput_errors($objcanvas->error,$objcanvas->errors); dol_htmloutput_errors($objcanvas->error,$objcanvas->errors);
// Display canvas // Display canvas
@ -330,13 +333,19 @@ if (! empty($canvas))
$result=$objcanvas->fetch($id); $result=$objcanvas->fetch($id);
if ($result > 0) if ($result > 0)
{ {
// Card header
$objcanvas->showHead();
// Assign values // Assign values
$objcanvas->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); dol_htmloutput_errors($objcanvas->error,$objcanvas->errors);
// Display canvas // Display canvas