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