Fix: missing actiontype of canvas

This commit is contained in:
Regis Houssin 2012-03-23 22:44:59 +08:00
parent 1bcbe02562
commit 89be120764
3 changed files with 12 additions and 19 deletions

View File

@ -132,7 +132,7 @@ class Canvas
{ {
if (empty($this->template_dir)) return 0; if (empty($this->template_dir)) return 0;
if (file_exists($this->template_dir.($this->card?$this->card.'_':'').$this->action.'.tpl.php')) return 1; if (file_exists($this->template_dir.($this->card?$this->card.'_':'').$this->actiontype.'.tpl.php')) return 1;
else return 0; else return 0;
} }
@ -148,7 +148,7 @@ class Canvas
global $db, $conf, $langs, $user, $canvas; global $db, $conf, $langs, $user, $canvas;
global $form, $formfile; global $form, $formfile;
include($this->template_dir.($this->card?$this->card.'_':'').$this->action.'.tpl.php'); // Include native PHP template include($this->template_dir.($this->card?$this->card.'_':'').$this->actiontype.'.tpl.php'); // Include native PHP template
} }

View File

@ -80,18 +80,10 @@ abstract class ActionsCardCommon
{ {
$ret = $this->getInstanceDao(); $ret = $this->getInstanceDao();
if (is_object($this->object) && method_exists($this->object,'fetch'))
{
if (! empty($id) || ! empty($ref)) $this->object->fetch($id,$ref);
}
else
{
// TODO Keep only this part of code. Previous in this method is useless
$object = new Societe($this->db); $object = new Societe($this->db);
if (! empty($id) || ! empty($ref)) $object->fetch($id,$ref); if (! empty($id) || ! empty($ref)) $object->fetch($id,$ref);
$this->object = $object; $this->object = $object;
} }
}
/** /**
* Load data control * Load data control
@ -398,14 +390,14 @@ abstract class ActionsCardCommon
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
$this->tpl['ajax_selecttype'] = "\n".'<script type="text/javascript" language="javascript"> $this->tpl['ajax_selecttype'] = "\n".'<script type="text/javascript" language="javascript">
jQuery(document).ready(function () { $(document).ready(function () {
jQuery("#radiocompany").click(function() { $("#radiocompany").click(function() {
document.formsoc.action.value="create"; document.formsoc.action.value="create";
document.formsoc.canvas.value="company"; document.formsoc.canvas.value="company";
document.formsoc.private.value=0; document.formsoc.private.value=0;
document.formsoc.submit(); document.formsoc.submit();
}); });
jQuery("#radioprivate").click(function() { $("#radioprivate").click(function() {
document.formsoc.action.value="create"; document.formsoc.action.value="create";
document.formsoc.canvas.value="individual"; document.formsoc.canvas.value="individual";
document.formsoc.private.value=1; document.formsoc.private.value=1;
@ -421,8 +413,8 @@ abstract class ActionsCardCommon
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
$this->tpl['ajax_selectcountry'] = "\n".'<script type="text/javascript" language="javascript"> $this->tpl['ajax_selectcountry'] = "\n".'<script type="text/javascript" language="javascript">
jQuery(document).ready(function () { $(document).ready(function () {
jQuery("#selectcountry_id").change(function() { $("#selectcountry_id").change(function() {
document.formsoc.action.value="'.$action.'"; document.formsoc.action.value="'.$action.'";
document.formsoc.canvas.value="'.$canvas.'"; document.formsoc.canvas.value="'.$canvas.'";
document.formsoc.submit(); document.formsoc.submit();

View File

@ -636,7 +636,7 @@ class Societe extends CommonObject
$sql .= ', s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur, s.parent, s.barcode'; $sql .= ', s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur, s.parent, s.barcode';
$sql .= ', s.fk_departement, s.fk_pays as country_id, s.fk_stcomm, s.remise_client, s.mode_reglement, s.cond_reglement, s.tva_assuj'; $sql .= ', s.fk_departement, s.fk_pays as country_id, s.fk_stcomm, s.remise_client, s.mode_reglement, s.cond_reglement, s.tva_assuj';
$sql .= ', s.localtax1_assuj, s.localtax2_assuj, s.fk_prospectlevel, s.default_lang, s.logo'; $sql .= ', s.localtax1_assuj, s.localtax2_assuj, s.fk_prospectlevel, s.default_lang, s.logo';
$sql .= ', s.import_key'; $sql .= ', s.import_key, s.canvas';
$sql .= ', fj.libelle as forme_juridique'; $sql .= ', fj.libelle as forme_juridique';
$sql .= ', e.libelle as effectif'; $sql .= ', e.libelle as effectif';
$sql .= ', p.code as country_code, p.libelle as country'; $sql .= ', p.code as country_code, p.libelle as country';
@ -676,6 +676,7 @@ class Societe extends CommonObject
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->entity = $obj->entity; $this->entity = $obj->entity;
$this->canvas = $obj->canvas;
$this->ref = $obj->rowid; $this->ref = $obj->rowid;
$this->name = $obj->name; $this->name = $obj->name;