diff --git a/htdocs/core/class/canvas.class.php b/htdocs/core/class/canvas.class.php index 23d85952c9e..1fb05192f44 100644 --- a/htdocs/core/class/canvas.class.php +++ b/htdocs/core/class/canvas.class.php @@ -58,7 +58,7 @@ class Canvas $part1=$part3=$element; $part2=$canvas; - + // For compatibility if (preg_match('/^([^@]+)@([^@]+)$/i',$element,$regs)) { @@ -99,7 +99,7 @@ class Canvas function fetch($id,$action='') { $this->action = $action; - + $ret = $this->object->fetch($id,$action); return $ret; } @@ -131,7 +131,7 @@ class Canvas */ function display_canvas() { - global $conf, $langs, $user; + global $conf, $langs, $user, $canvas; if (!empty($this->smarty)) { diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index e2addb98ded..8c335135ee0 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2160,7 +2160,7 @@ class Societe extends CommonObject */ function assign_values($action='') { - global $conf, $langs, $user, $mysoc; + global $conf, $langs, $user, $mysoc, $canvas; global $form, $formadmin, $formcompany; if ($_GET["type"]=='f') { $this->fournisseur=1; } @@ -2177,8 +2177,8 @@ class Societe extends CommonObject if ($action == 'create' || $action == 'edit') { // Chargement ajax - $this->tpl['ajax_select_thirdpartytype'] = $this->ajax_selectThirdPartyType(); - $this->tpl['ajax_select_country'] = $this->ajax_selectCountry($action); + $this->tpl['ajax_select_thirdpartytype'] = $this->ajax_selectThirdPartyType($canvas); + $this->tpl['ajax_select_country'] = $this->ajax_selectCountry($action,$canvas); // Load object modCodeClient $module=$conf->global->SOCIETE_CODECLIENT_ADDON; @@ -2446,7 +2446,7 @@ class Societe extends CommonObject * FIXME Do not use presentation code on a business class * This code is used by non standard feature of canvas */ - function ajax_selectThirdPartyType() + function ajax_selectThirdPartyType($canvas) { global $conf, $langs; @@ -2458,12 +2458,14 @@ class Societe extends CommonObject $out.= 'jQuery(document).ready(function () { jQuery("#radiocompany").click(function() { document.formsoc.action.value="create"; + document.formsoc.canvas.value="'.$canvas.'"; document.formsoc.private.value=0; document.formsoc.cleartype.value=1; document.formsoc.submit(); }); jQuery("#radioprivate").click(function() { document.formsoc.action.value="create"; + document.formsoc.canvas.value="'.$canvas.'"; document.formsoc.private.value=1; document.formsoc.cleartype.value=1; document.formsoc.submit(); @@ -2490,7 +2492,7 @@ class Societe extends CommonObject * FIXME Do not use presentation code on a business class * This code is used by non standard feature of canvas */ - function ajax_selectCountry($action) + function ajax_selectCountry($action,$canvas) { global $conf; @@ -2502,6 +2504,7 @@ class Societe extends CommonObject $out.= 'jQuery(document).ready(function () { jQuery("#selectpays_id").change(function() { document.formsoc.action.value="'.$action.'"; + document.formsoc.canvas.value="'.$canvas.'"; document.formsoc.submit(); }); })'; diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 193961c2219..9517a6d5278 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -1568,8 +1568,8 @@ else // When used with CANVAS // ----------------------------------------- - //$_GET["canvas"] = 'default'; - //if ($_REQUEST["private"]==1) $_GET["canvas"] = 'individual'; + $_GET["canvas"] = 'default'; + //if ($_REQUEST["private"]==1) $_GET["canvas"] = 'individual'; To switch to other canvas, we must use another value for canvas // Get object canvas $socstatic = new Societe($db); @@ -1577,7 +1577,7 @@ else // Initialization Company Canvas - $canvas = (!empty($socstatic->canvas)?$socstatic->canvas:$_GET["canvas"]); + $canvas = (!empty($socstatic->canvas)?$socstatic->canvas:GETPOST("canvas")); $soccanvas = new Canvas($db); $soccanvas->load_canvas('thirdparty@societe',$canvas); @@ -1874,7 +1874,6 @@ else /* * View */ - $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; llxHeader('','',$help_url); @@ -1972,17 +1971,17 @@ else if ($user->rights->societe->creer) { - print ''.$langs->trans("Modify").''; + print ''.$langs->trans("Modify").''; } if ($user->rights->societe->contact->creer) { - print ''.$langs->trans("AddContact").''; + print ''.$langs->trans("AddContact").''; } if ($user->rights->societe->supprimer) { - print ''.$langs->trans('Delete').''; + print ''.$langs->trans('Delete').''; } print '';