Works on canvas integration in third party module

This commit is contained in:
Regis Houssin 2010-09-05 12:03:35 +00:00
parent f604e7eaac
commit f6057890bd

View File

@ -1587,20 +1587,13 @@ else
// When used with CANVAS // When used with CANVAS
// ----------------------------------------- // -----------------------------------------
//$_GET["canvas"] = 'default@thirdparty';
//$canvas = 'default@thirdparty';
//if ($_REQUEST["private"]==1) $_GET["canvas"] = 'individual'; To switch to other canvas, we must use another value for canvas
$soccanvas = new Canvas($db); $soccanvas = new Canvas($db);
$soccanvas->getCanvas('card',$canvas); $soccanvas->getCanvas('card',$canvas);
// Load data control
/*
* Actions
*/
$soccanvas->loadControl($socid); $soccanvas->loadControl($socid);
/* /*
* View * View
*/ */
@ -1612,8 +1605,7 @@ else
$formadmin = new FormAdmin($db); $formadmin = new FormAdmin($db);
$formcompany = new FormCompany($db); $formcompany = new FormCompany($db);
if ($_POST["getcustomercode"] || $_POST["getsuppliercode"] || if ($_POST["getcustomercode"] || $_POST["getsuppliercode"] || GETPOST("action") == 'create')
$_GET["action"] == 'create' || $_POST["action"] == 'create')
{ {
/* /*
* Sheet mode creation * Sheet mode creation
@ -1623,12 +1615,14 @@ else
// Set action type // Set action type
$soccanvas->setAction(GETPOST("action")); $soccanvas->setAction(GETPOST("action"));
// Card header
$title = $soccanvas->getTitle(); $title = $soccanvas->getTitle();
print_fiche_titre($title); print_fiche_titre($title);
// Assign _POST data
$soccanvas->assign_post(); $soccanvas->assign_post();
// Assign values // Assign template values
$soccanvas->assign_values(); $soccanvas->assign_values();
dol_htmloutput_errors($soccanvas->error,$soccanvas->errors); dol_htmloutput_errors($soccanvas->error,$soccanvas->errors);
@ -1638,7 +1632,7 @@ else
} }
} }
elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit') elseif (GETPOST("action") == 'edit')
{ {
/* /*
* Company Fact Mode edition * Company Fact Mode edition
@ -1647,6 +1641,7 @@ else
// Set action type // Set action type
$soccanvas->setAction(GETPOST("action")); $soccanvas->setAction(GETPOST("action"));
// Card header
$title = $soccanvas->getTitle(); $title = $soccanvas->getTitle();
print_fiche_titre($title); print_fiche_titre($title);
@ -1654,11 +1649,12 @@ else
{ {
if ($reload || ! $_POST["nom"]) if ($reload || ! $_POST["nom"])
{ {
$soc->id = $socid; //Reload object
$soccanvas->fetch($socid); $soccanvas->fetch($socid);
} }
else else
{ {
// Assign _POST data
$soccanvas->assign_post(); $soccanvas->assign_post();
} }
@ -1680,6 +1676,7 @@ else
// Set action type // Set action type
$soccanvas->setAction('view'); $soccanvas->setAction('view');
// Fetch object
$result=$soccanvas->fetch($socid); $result=$soccanvas->fetch($socid);
if ($result < 0) if ($result < 0)
{ {
@ -1687,9 +1684,9 @@ else
exit; exit;
} }
// Card header
$head = societe_prepare_head($soccanvas->control->object); $head = societe_prepare_head($soccanvas->control->object);
$title = $soccanvas->getTitle(); $title = $soccanvas->getTitle();
dol_fiche_head($head, 'company', $title, 0, 'company'); dol_fiche_head($head, 'company', $title, 0, 'company');
// Assign values // Assign values