Skip to content
Snippets Groups Projects
Commit eaff7f63 authored by Regis Houssin's avatar Regis Houssin
Browse files

Works on canvas integration in third party module

parent 1ee4b221
No related branches found
No related tags found
No related merge requests found
......@@ -105,27 +105,29 @@ class Canvas
*/
function getCanvas($module,$card,$canvas)
{
global $langs;
global $conf, $langs;
$error='';
$this->card = $card;
$this->aliastargetmodule = $this->targetmodule = $module;
$this->canvas = $canvas;
$childmodule = $this->aliasmodule = $this->module = $module;
$targetmodule = $this->aliastargetmodule = $this->targetmodule = $module;
if (preg_match('/^([^@]+)@([^@]+)$/i',$canvas,$regs))
{
$this->aliasmodule = $this->module = $regs[2];
$childmodule = $this->aliasmodule = $this->module = $regs[2];
$this->canvas = $regs[1];
// For compatibility
if ($this->module == 'thirdparty') $this->aliasmodule = 'societe';
if ($this->targetmodule == 'thirdparty') $this->aliastargetmodule = 'societe';
}
else
{
$this->error = $langs->trans('CanvasIsInvalid');
return 0;
if ($this->module == 'thirdparty') $childmodule = $this->aliasmodule = 'societe';
if ($this->targetmodule == 'thirdparty') $targetmodule = $this->aliastargetmodule = 'societe';
}
//print 'childmodule='.$childmodule.' targetmodule='.$targetmodule.'<br>';
//print 'childmodule='.$conf->$childmodule->enabled.' targetmodule='.$conf->$targetmodule->enabled.'<br>';
if (! $conf->$childmodule->enabled || ! $conf->$targetmodule->enabled) accessforbidden();
if (file_exists(DOL_DOCUMENT_ROOT.'/'.$this->aliasmodule.'/canvas/'.$this->canvas.'/'.$this->targetmodule.'.'.$this->canvas.'.class.php') &&
file_exists(DOL_DOCUMENT_ROOT.'/'.$this->aliasmodule.'/canvas/'.$this->canvas.'/'.$this->card.'.'.$this->canvas.'.class.php'))
{
......@@ -160,8 +162,7 @@ class Canvas
}
else
{
$this->error = $langs->trans('CanvasIsInvalid');
return 0;
accessforbidden();
}
return 1;
......
......@@ -98,7 +98,7 @@ class CardIndividual extends CardCommon
// Confirm delete third party
if ($_GET["action"] == 'delete')
{
$this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$this->id,$langs->trans("DeleteAnIndividual"),$langs->trans("ConfirmDeleteIndividual"),"confirm_delete",'',0,2);
$this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$this->object->id,$langs->trans("DeleteAnIndividual"),$langs->trans("ConfirmDeleteIndividual"),"confirm_delete",'',0,2);
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment