Works on canvas integration in third party module

This commit is contained in:
Regis Houssin 2010-09-05 16:35:46 +00:00
parent 1ee4b2214d
commit eaff7f6358
2 changed files with 14 additions and 13 deletions

View File

@ -105,27 +105,29 @@ class Canvas
*/ */
function getCanvas($module,$card,$canvas) function getCanvas($module,$card,$canvas)
{ {
global $langs; global $conf, $langs;
$error=''; $error='';
$this->card = $card; $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)) if (preg_match('/^([^@]+)@([^@]+)$/i',$canvas,$regs))
{ {
$this->aliasmodule = $this->module = $regs[2]; $childmodule = $this->aliasmodule = $this->module = $regs[2];
$this->canvas = $regs[1]; $this->canvas = $regs[1];
// For compatibility // For compatibility
if ($this->module == 'thirdparty') $this->aliasmodule = 'societe'; if ($this->module == 'thirdparty') $childmodule = $this->aliasmodule = 'societe';
if ($this->targetmodule == 'thirdparty') $this->aliastargetmodule = 'societe'; if ($this->targetmodule == 'thirdparty') $targetmodule = $this->aliastargetmodule = 'societe';
}
else
{
$this->error = $langs->trans('CanvasIsInvalid');
return 0;
} }
//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') && 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')) file_exists(DOL_DOCUMENT_ROOT.'/'.$this->aliasmodule.'/canvas/'.$this->canvas.'/'.$this->card.'.'.$this->canvas.'.class.php'))
{ {
@ -160,8 +162,7 @@ class Canvas
} }
else else
{ {
$this->error = $langs->trans('CanvasIsInvalid'); accessforbidden();
return 0;
} }
return 1; return 1;

View File

@ -98,7 +98,7 @@ class CardIndividual extends CardCommon
// Confirm delete third party // Confirm delete third party
if ($_GET["action"] == 'delete') 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);
} }
} }
} }