Works on canvas integration in third party module
This commit is contained in:
parent
2d552df6be
commit
2b42ea4904
@ -68,7 +68,7 @@ class Canvas
|
||||
|
||||
if (preg_match('/^([^@]+)@([^@]+)$/i',$canvas,$regs))
|
||||
{
|
||||
$part1=$part3=$regs[2];
|
||||
$part1=$regs[2];
|
||||
$part2=$regs[1];
|
||||
}
|
||||
|
||||
|
||||
@ -50,11 +50,17 @@ class ThirdPartyDefault extends Societe
|
||||
$this->fieldListName = "thirdparty_default";
|
||||
}
|
||||
|
||||
function getTitle()
|
||||
function getTitle($action)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
return $langs->trans("ThirdParty");
|
||||
$out='';
|
||||
|
||||
if ($action == 'view') $out.= $langs->trans("ThirdParty");
|
||||
if ($action == 'edit') $out.= $langs->trans("EditCompany");
|
||||
if ($action == 'create') $out.= $langs->trans("NewCompany");
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -51,11 +51,17 @@ class ThirdPartyIndividual extends Societe
|
||||
$this->fieldListName = "thirdparty_individual";
|
||||
}
|
||||
|
||||
function getTitle()
|
||||
function getTitle($action)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$out='';
|
||||
|
||||
return $langs->trans("Individual");
|
||||
if ($action == 'view') $out.= $langs->trans("Individual");
|
||||
if ($action == 'edit') $out.= $langs->trans("EditIndividual");
|
||||
if ($action == 'create') $out.= $langs->trans("NewIndividual");
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -55,13 +55,13 @@ if (empty($_GET["canvas"]))
|
||||
{
|
||||
$_GET["canvas"] = 'default';
|
||||
if ($_REQUEST["private"]==1) $_GET["canvas"] = 'individual';
|
||||
|
||||
// Get object canvas
|
||||
$socstatic = new Societe($db);
|
||||
if (!empty($socid)) $socstatic->getCanvas($socid);
|
||||
}
|
||||
|
||||
// Initialization Company Object
|
||||
$socstatic = new Societe($db);
|
||||
|
||||
// Initialization Company Canvas
|
||||
if (!empty($socid)) $socstatic->getCanvas($socid);
|
||||
$canvas = (!empty($socstatic->canvas)?$socstatic->canvas:$_GET["canvas"]);
|
||||
$soc = new Canvas($db);
|
||||
$soc->load_canvas('thirdparty@societe',$canvas);
|
||||
@ -375,7 +375,8 @@ $_GET["action"] == 'create' || $_POST["action"] == 'create')
|
||||
*/
|
||||
if ($user->rights->societe->creer)
|
||||
{
|
||||
print_fiche_titre($langs->trans("NewCompany"));
|
||||
$title = $soc->object->getTitle('create');
|
||||
print_fiche_titre($title);
|
||||
|
||||
$soc->object->assign_post();
|
||||
|
||||
@ -394,7 +395,9 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit')
|
||||
/*
|
||||
* Company Fact Mode edition
|
||||
*/
|
||||
print_fiche_titre($langs->trans("EditCompany"));
|
||||
|
||||
$title = $soc->object->getTitle('edit');
|
||||
print_fiche_titre($title);
|
||||
|
||||
if ($socid)
|
||||
{
|
||||
@ -403,7 +406,7 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit')
|
||||
$soc = new Canvas($db);
|
||||
$soc->load_canvas('thirdparty@societe',$canvas);
|
||||
$soc->object->id = $socid;
|
||||
$soc->fetch($socid, $_GET["action"]);
|
||||
$soc->fetch($socid, 'edit');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -434,11 +437,13 @@ else
|
||||
}
|
||||
|
||||
$head = societe_prepare_head($soc);
|
||||
$title = $soc->object->getTitle('view');
|
||||
|
||||
dol_fiche_head($head, 'company', $langs->trans("ThirdParty"),0,'company');
|
||||
dol_fiche_head($head, 'company', $title, 0, 'company');
|
||||
|
||||
// Assign values
|
||||
$soc->assign_values('view');
|
||||
|
||||
// Display canvas
|
||||
$soc->display_canvas();
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user