Fix: The child class must do itself the include of its mother class file.
This commit is contained in:
parent
c0a5c3f428
commit
c02dc30b68
@ -32,7 +32,7 @@
|
||||
class Canvas
|
||||
{
|
||||
var $db;
|
||||
|
||||
|
||||
var $card;
|
||||
var $canvas;
|
||||
var $object;
|
||||
@ -55,7 +55,7 @@ class Canvas
|
||||
{
|
||||
$this->db = $DB;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the title of card
|
||||
*/
|
||||
@ -63,7 +63,7 @@ class Canvas
|
||||
{
|
||||
return $this->control->getTitle($this->action);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Assigne les valeurs POST dans l'objet
|
||||
*/
|
||||
@ -71,7 +71,7 @@ class Canvas
|
||||
{
|
||||
return $this->control->assign_post();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set action type
|
||||
*/
|
||||
@ -79,7 +79,7 @@ class Canvas
|
||||
{
|
||||
return $this->action = $action;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load data control
|
||||
*/
|
||||
@ -87,7 +87,7 @@ class Canvas
|
||||
{
|
||||
return $this->control->loadControl($socid);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetch object values
|
||||
* @param id Element id
|
||||
@ -117,7 +117,7 @@ class Canvas
|
||||
{
|
||||
$childmodule = $this->aliasmodule = $this->module = $regs[2];
|
||||
$this->canvas = $regs[1];
|
||||
|
||||
|
||||
// For compatibility
|
||||
if ($this->module == 'thirdparty') $childmodule = $this->aliasmodule = 'societe';
|
||||
if ($this->targetmodule == 'thirdparty') $targetmodule = $this->aliastargetmodule = 'societe';
|
||||
@ -125,38 +125,34 @@ class Canvas
|
||||
|
||||
//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'))
|
||||
{
|
||||
// Include model class
|
||||
// Include dataservice class (model)
|
||||
$modelclassfile = DOL_DOCUMENT_ROOT.'/'.$this->aliasmodule.'/canvas/'.$this->canvas.'/'.$this->targetmodule.'.'.$this->canvas.'.class.php';
|
||||
include_once($modelclassfile);
|
||||
|
||||
// Include common controller class
|
||||
$controlclassfile = DOL_DOCUMENT_ROOT.'/'.$this->aliastargetmodule.'/canvas/'.$this->card.'.common.class.php';
|
||||
include_once($controlclassfile);
|
||||
|
||||
// Include canvas controller class
|
||||
|
||||
// Include actions class (controller)
|
||||
$controlclassfile = DOL_DOCUMENT_ROOT.'/'.$this->aliasmodule.'/canvas/'.$this->canvas.'/'.$this->card.'.'.$this->canvas.'.class.php';
|
||||
include_once($controlclassfile);
|
||||
|
||||
|
||||
// Instantiate canvas controller class
|
||||
$controlclassname = ucfirst($this->card).ucfirst($this->canvas);
|
||||
$this->control = new $controlclassname($this->db);
|
||||
|
||||
|
||||
// Instantiate model class
|
||||
$modelclassname = ucfirst($this->targetmodule).ucfirst($this->canvas);
|
||||
$this->control->object = new $modelclassname($this->db);
|
||||
|
||||
|
||||
// Canvas
|
||||
$this->control->canvas = $canvas;
|
||||
|
||||
|
||||
// Template dir
|
||||
$this->template_dir = DOL_DOCUMENT_ROOT.'/'.$this->aliasmodule.'/canvas/'.$this->canvas.'/tpl/';
|
||||
|
||||
|
||||
// Need smarty
|
||||
$this->smarty = $this->control->smarty;
|
||||
}
|
||||
@ -164,7 +160,7 @@ class Canvas
|
||||
{
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
* \brief Fichier de la classe Thirdparty card controller (default canvas)
|
||||
* \version $Id$
|
||||
*/
|
||||
include_once(DOL_DOCUMENT_ROOT.'/societe/canvas/card.common.class.php');
|
||||
|
||||
/**
|
||||
* \class ThirdPartyCardDefault
|
||||
@ -30,10 +31,10 @@
|
||||
class CardDefault extends CardCommon
|
||||
{
|
||||
var $db;
|
||||
|
||||
|
||||
//! Canvas
|
||||
var $canvas;
|
||||
|
||||
|
||||
/**
|
||||
* Constructeur de la classe
|
||||
* @param DB Handler acces base de donnees
|
||||
@ -55,10 +56,10 @@ class CardDefault extends CardCommon
|
||||
if ($action == 'view') $out.= $langs->trans("ThirdParty");
|
||||
if ($action == 'edit') $out.= $langs->trans("EditCompany");
|
||||
if ($action == 'create') $out.= $langs->trans("NewCompany");
|
||||
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Assigne les valeurs POST dans l'objet
|
||||
*/
|
||||
@ -66,17 +67,17 @@ class CardDefault extends CardCommon
|
||||
{
|
||||
parent::assign_post();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load data control
|
||||
*/
|
||||
function loadControl($socid)
|
||||
{
|
||||
$return = parent::loadControl($socid);
|
||||
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Assign custom values for canvas
|
||||
* @param action Type of action
|
||||
@ -85,14 +86,14 @@ class CardDefault extends CardCommon
|
||||
{
|
||||
global $conf, $langs, $user, $mysoc;
|
||||
global $form, $formadmin, $formcompany;
|
||||
|
||||
|
||||
parent::assign_values($action);
|
||||
|
||||
|
||||
$this->tpl['profid1'] = $this->object->siren;
|
||||
$this->tpl['profid2'] = $this->object->siret;
|
||||
$this->tpl['profid3'] = $this->object->ape;
|
||||
$this->tpl['profid4'] = $this->object->idprof4;
|
||||
|
||||
|
||||
if ($action == 'create' || $action == 'edit')
|
||||
{
|
||||
for ($i=1; $i<=4; $i++)
|
||||
@ -100,16 +101,16 @@ class CardDefault extends CardCommon
|
||||
$this->tpl['langprofid'.$i] = $langs->transcountry('ProfId'.$i,$this->object->pays_code);
|
||||
$this->tpl['showprofid'.$i] = $this->object->get_input_id_prof($i,'idprof'.$i,$this->tpl['profid'.$i]);
|
||||
}
|
||||
|
||||
|
||||
// Type
|
||||
$this->tpl['select_companytype'] = $form->selectarray("typent_id",$formcompany->typent_array(0), $this->object->typent_id);
|
||||
|
||||
|
||||
// Juridical Status
|
||||
$this->tpl['select_juridicalstatus'] = $formcompany->select_juridicalstatus($this->object->forme_juridique_code,$this->object->pays_code);
|
||||
|
||||
|
||||
// Workforce
|
||||
$this->tpl['select_workforce'] = $form->selectarray("effectif_id",$formcompany->effectif_array(0), $this->object->effectif_id);
|
||||
|
||||
|
||||
// VAT intra
|
||||
$s ='<input type="text" class="flat" name="tva_intra" size="12" maxlength="20" value="'.$this->object->tva_intra.'">';
|
||||
$s.=' ';
|
||||
@ -122,9 +123,9 @@ class CardDefault extends CardCommon
|
||||
{
|
||||
$this->tpl['tva_intra'] = $s.'<a href="'.$langs->transcountry("VATIntraCheckURL",$this->object->id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').'</a>';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'view')
|
||||
{
|
||||
// Confirm delete third party
|
||||
@ -132,14 +133,14 @@ class CardDefault extends CardCommon
|
||||
{
|
||||
$this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$this->object->id,$langs->trans("DeleteACompany"),$langs->trans("ConfirmDeleteCompany"),"confirm_delete",'',0,2);
|
||||
}
|
||||
|
||||
|
||||
for ($i=1; $i<=4; $i++)
|
||||
{
|
||||
$this->tpl['langprofid'.$i] = $langs->transcountry('ProfId'.$i,$this->object->pays_code);
|
||||
$this->tpl['checkprofid'.$i] = $this->object->id_prof_check($i,$this->object);
|
||||
$this->tpl['urlprofid'.$i] = $this->object->id_prof_url($i,$this->object);
|
||||
}
|
||||
|
||||
|
||||
// TVA intra
|
||||
if ($this->tva_intra)
|
||||
{
|
||||
@ -161,7 +162,7 @@ class CardDefault extends CardCommon
|
||||
{
|
||||
$this->tpl['tva_intra'] = ' ';
|
||||
}
|
||||
|
||||
|
||||
// Parent company
|
||||
if ($this->object->parent)
|
||||
{
|
||||
@ -176,7 +177,7 @@ class CardDefault extends CardCommon
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@ -22,6 +22,7 @@
|
||||
* \brief Fichier de la classe Thirdparty card controller (individual canvas)
|
||||
* \version $Id$
|
||||
*/
|
||||
include_once(DOL_DOCUMENT_ROOT.'/societe/canvas/card.common.class.php');
|
||||
|
||||
/**
|
||||
* \class CardIndividual
|
||||
@ -30,10 +31,10 @@
|
||||
class CardIndividual extends CardCommon
|
||||
{
|
||||
var $db;
|
||||
|
||||
|
||||
//! Canvas
|
||||
var $canvas;
|
||||
|
||||
|
||||
/**
|
||||
* Constructeur de la classe
|
||||
* @param DB Handler acces base de donnees
|
||||
@ -49,16 +50,16 @@ class CardIndividual extends CardCommon
|
||||
function getTitle($action)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
|
||||
$out='';
|
||||
|
||||
if ($action == 'view') $out.= $langs->trans("Individual");
|
||||
if ($action == 'edit') $out.= $langs->trans("EditIndividual");
|
||||
if ($action == 'create') $out.= $langs->trans("NewIndividual");
|
||||
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Assigne les valeurs POST dans l'objet
|
||||
*/
|
||||
@ -66,17 +67,17 @@ class CardIndividual extends CardCommon
|
||||
{
|
||||
parent::assign_post();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load data control
|
||||
*/
|
||||
function loadControl($socid)
|
||||
{
|
||||
$return = parent::loadControl($socid);
|
||||
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Assign custom values for canvas
|
||||
* @param action Type of action
|
||||
@ -85,14 +86,14 @@ class CardIndividual extends CardCommon
|
||||
{
|
||||
global $langs;
|
||||
global $form, $formcompany;
|
||||
|
||||
|
||||
parent::assign_values($action);
|
||||
|
||||
|
||||
if ($action == 'create' || $action == 'edit')
|
||||
{
|
||||
$this->tpl['select_civility'] = $formcompany->select_civility($contact->civilite_id);
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'view')
|
||||
{
|
||||
// Confirm delete third party
|
||||
@ -102,7 +103,7 @@ class CardIndividual extends CardCommon
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
Loading…
Reference in New Issue
Block a user