diff --git a/htdocs/core/class/canvas.class.php b/htdocs/core/class/canvas.class.php index c27742721177c29883282436d705c312aee9ae5a..0aa999bfee690f7b3def5b6fad92a281cc0d3295 100644 --- a/htdocs/core/class/canvas.class.php +++ b/htdocs/core/class/canvas.class.php @@ -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; diff --git a/htdocs/societe/canvas/individual/card.individual.class.php b/htdocs/societe/canvas/individual/card.individual.class.php index ad534aeede4e2a74d51b3ae7be23829ee2241979..eab65a1881a3961c94b68a6c9df606c2959f16e7 100644 --- a/htdocs/societe/canvas/individual/card.individual.class.php +++ b/htdocs/societe/canvas/individual/card.individual.class.php @@ -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); } } }