forked from Wavyzz/dolibarr
NEW Some core tables are created only at module activation
This commit is contained in:
@@ -159,6 +159,11 @@ class modDeplacement extends DolibarrModules
|
|||||||
*/
|
*/
|
||||||
public function init($options = '')
|
public function init($options = '')
|
||||||
{
|
{
|
||||||
|
$result = $this->_load_tables('/install/mysql/tables/', 'deplacement');
|
||||||
|
if ($result < 0) {
|
||||||
|
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
|
||||||
|
}
|
||||||
|
|
||||||
// Permissions
|
// Permissions
|
||||||
$this->remove($options);
|
$this->remove($options);
|
||||||
|
|
||||||
|
|||||||
@@ -155,6 +155,11 @@ class modDon extends DolibarrModules
|
|||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
|
$result = $this->_load_tables('/install/mysql/tables/', 'deplacement');
|
||||||
|
if ($result < 0) {
|
||||||
|
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
|
||||||
|
}
|
||||||
|
|
||||||
$sql = array(
|
$sql = array(
|
||||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'donation' AND entity = ".((int) $conf->entity),
|
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'donation' AND entity = ".((int) $conf->entity),
|
||||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','donation',".((int) $conf->entity).")",
|
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','donation',".((int) $conf->entity).")",
|
||||||
|
|||||||
@@ -125,4 +125,26 @@ class modIntracommreport extends DolibarrModules
|
|||||||
// Exports
|
// Exports
|
||||||
$r = 1;
|
$r = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function called when module is enabled.
|
||||||
|
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||||
|
* It also creates data directories
|
||||||
|
*
|
||||||
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
|
* @return int 1 if OK, 0 if KO
|
||||||
|
*/
|
||||||
|
public function init($options = '')
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
$result = $this->_load_tables('/install/mysql/tables/', 'intracommreport');
|
||||||
|
if ($result < 0) {
|
||||||
|
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = array();
|
||||||
|
|
||||||
|
return $this->_init($sql, $options);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -442,6 +442,11 @@ class modKnowledgeManagement extends DolibarrModules
|
|||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
|
$result = $this->_load_tables('/install/mysql/tables/', 'knowledgemanagement');
|
||||||
|
if ($result < 0) {
|
||||||
|
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
|
||||||
|
}
|
||||||
|
|
||||||
// Create extrafields during init
|
// Create extrafields during init
|
||||||
//include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
//include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||||
//$extrafields = new ExtraFields($this->db);
|
//$extrafields = new ExtraFields($this->db);
|
||||||
|
|||||||
@@ -160,6 +160,11 @@ class modLoan extends DolibarrModules
|
|||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
|
$result = $this->_load_tables('/install/mysql/tables/', 'loan');
|
||||||
|
if ($result < 0) {
|
||||||
|
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
|
||||||
|
}
|
||||||
|
|
||||||
// Clean before activation
|
// Clean before activation
|
||||||
$this->remove($options);
|
$this->remove($options);
|
||||||
|
|
||||||
|
|||||||
@@ -408,6 +408,11 @@ class modPartnership extends DolibarrModules
|
|||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
|
$result = $this->_load_tables('/install/mysql/tables/', 'partnership');
|
||||||
|
if ($result < 0) {
|
||||||
|
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
|
||||||
|
}
|
||||||
|
|
||||||
// Create extrafields during init
|
// Create extrafields during init
|
||||||
//include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
//include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||||
//$extrafields = new ExtraFields($this->db);
|
//$extrafields = new ExtraFields($this->db);
|
||||||
|
|||||||
@@ -403,6 +403,11 @@ class modRecruitment extends DolibarrModules
|
|||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
|
$result = $this->_load_tables('/install/mysql/tables/', 'recruitment');
|
||||||
|
if ($result < 0) {
|
||||||
|
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
|
||||||
|
}
|
||||||
|
|
||||||
// Create extrafields during init
|
// Create extrafields during init
|
||||||
//include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
//include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||||
//$extrafields = new ExtraFields($this->db);
|
//$extrafields = new ExtraFields($this->db);
|
||||||
|
|||||||
@@ -434,6 +434,11 @@ class modStock extends DolibarrModules
|
|||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
|
$result = $this->_load_tables('/install/mysql/tables/', 'stock');
|
||||||
|
if ($result < 0) {
|
||||||
|
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
|
||||||
|
}
|
||||||
|
|
||||||
// Permissions
|
// Permissions
|
||||||
$this->remove($options);
|
$this->remove($options);
|
||||||
|
|
||||||
|
|||||||
@@ -390,6 +390,11 @@ class modWorkstation extends DolibarrModules
|
|||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
|
$result = $this->_load_tables('/install/mysql/tables/', 'workstation');
|
||||||
|
if ($result < 0) {
|
||||||
|
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
|
||||||
|
}
|
||||||
|
|
||||||
// Create extrafields during init
|
// Create extrafields during init
|
||||||
//include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
//include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||||
//$extrafields = new ExtraFields($this->db);
|
//$extrafields = new ExtraFields($this->db);
|
||||||
|
|||||||
@@ -281,6 +281,11 @@ class modZapier extends DolibarrModules
|
|||||||
*/
|
*/
|
||||||
public function init($options = '')
|
public function init($options = '')
|
||||||
{
|
{
|
||||||
|
$result = $this->_load_tables('/install/mysql/tables/', 'zapier');
|
||||||
|
if ($result < 0) {
|
||||||
|
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
|
||||||
|
}
|
||||||
|
|
||||||
// Create extrafields
|
// Create extrafields
|
||||||
//include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
//include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||||
//$extrafields = new ExtraFields($this->db);
|
//$extrafields = new ExtraFields($this->db);
|
||||||
@@ -289,7 +294,9 @@ class modZapier extends DolibarrModules
|
|||||||
//$result3=$extrafields->addExtraField('myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', 0, 0, '', '', 'zapier@zapier', '$conf->zapier->enabled');
|
//$result3=$extrafields->addExtraField('myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', 0, 0, '', '', 'zapier@zapier', '$conf->zapier->enabled');
|
||||||
//$result4=$extrafields->addExtraField('myattr4', "New Attr 4 label", 'select', 1, 3, 'thirdparty', 0, 1, '', array('options'=>array('code1'=>'Val1','code2'=>'Val2','code3'=>'Val3')), 1,'', 0, 0, '', '', 'zapier@zapier', '$conf->zapier->enabled');
|
//$result4=$extrafields->addExtraField('myattr4', "New Attr 4 label", 'select', 1, 3, 'thirdparty', 0, 1, '', array('options'=>array('code1'=>'Val1','code2'=>'Val2','code3'=>'Val3')), 1,'', 0, 0, '', '', 'zapier@zapier', '$conf->zapier->enabled');
|
||||||
//$result5=$extrafields->addExtraField('myattr5', "New Attr 5 label", 'text', 1, 10, 'user', 0, 0, '', '', 1, '', 0, 0, '', '', 'zapier@zapier', '$conf->zapier->enabled');
|
//$result5=$extrafields->addExtraField('myattr5', "New Attr 5 label", 'text', 1, 10, 'user', 0, 0, '', '', 1, '', 0, 0, '', '', 'zapier@zapier', '$conf->zapier->enabled');
|
||||||
|
|
||||||
$sql = array();
|
$sql = array();
|
||||||
|
|
||||||
return $this->_init($sql, $options);
|
return $this->_init($sql, $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user