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 (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;
}
@ -148,7 +148,7 @@ class Canvas
global $db, $conf, $langs, $user, $canvas;
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,17 +80,9 @@ abstract class ActionsCardCommon
{
$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);
if (! empty($id) || ! empty($ref)) $object->fetch($id,$ref);
$this->object = $object;
}
$object = new Societe($this->db);
if (! empty($id) || ! empty($ref)) $object->fetch($id,$ref);
$this->object = $object;
}
/**
@ -398,14 +390,14 @@ abstract class ActionsCardCommon
if ($conf->use_javascript_ajax)
{
$this->tpl['ajax_selecttype'] = "\n".'<script type="text/javascript" language="javascript">
jQuery(document).ready(function () {
jQuery("#radiocompany").click(function() {
$(document).ready(function () {
$("#radiocompany").click(function() {
document.formsoc.action.value="create";
document.formsoc.canvas.value="company";
document.formsoc.private.value=0;
document.formsoc.submit();
});
jQuery("#radioprivate").click(function() {
$("#radioprivate").click(function() {
document.formsoc.action.value="create";
document.formsoc.canvas.value="individual";
document.formsoc.private.value=1;
@ -421,8 +413,8 @@ abstract class ActionsCardCommon
if ($conf->use_javascript_ajax)
{
$this->tpl['ajax_selectcountry'] = "\n".'<script type="text/javascript" language="javascript">
jQuery(document).ready(function () {
jQuery("#selectcountry_id").change(function() {
$(document).ready(function () {
$("#selectcountry_id").change(function() {
document.formsoc.action.value="'.$action.'";
document.formsoc.canvas.value="'.$canvas.'";
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.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.import_key';
$sql .= ', s.import_key, s.canvas';
$sql .= ', fj.libelle as forme_juridique';
$sql .= ', e.libelle as effectif';
$sql .= ', p.code as country_code, p.libelle as country';
@ -676,6 +676,7 @@ class Societe extends CommonObject
$this->id = $obj->rowid;
$this->entity = $obj->entity;
$this->canvas = $obj->canvas;
$this->ref = $obj->rowid;
$this->name = $obj->name;