Skip to content

Commit

Permalink
fix construct in vtlib base module code.
Browse files Browse the repository at this point in the history
In Construct function we have tu use the class name, not
the currentModule global variable.
We can have the case that from an other module call to a related module without retrive_entity_info,
and try to call getColumnFields(With a incorrect module name).
  • Loading branch information
omarllorens committed Nov 10, 2015
1 parent dc46f0b commit 1e07132
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions vtlib/ModuleDir/ModuleFile.php
Expand Up @@ -94,12 +94,13 @@ class ModuleClass extends CRMEntity {
var $mandatory_fields = Array('createdtime', 'modifiedtime', 'payslipname');

function __construct() {
global $log, $currentModule;
$this->column_fields = getColumnFields($currentModule);
global $log;
$this_module = get_class($this);
$this->column_fields = getColumnFields($this_module);
$this->db = PearDatabase::getInstance();
$this->log = $log;
$sql = 'SELECT 1 FROM vtiger_field WHERE uitype=69 and tabid = ?';
$tabid = getTabid($currentModule);
$tabid = getTabid($this_module);
$result = $this->db->pquery($sql, array($tabid));
if ($result and $this->db->num_rows($result)==1) {
$this->HasDirectImageField = true;
Expand Down

0 comments on commit 1e07132

Please sign in to comment.