Update modMyModule.class.php
This commit is contained in:
parent
79b6a3ed40
commit
8117fb7cb2
@ -410,7 +410,9 @@ class modMyModule extends DolibarrModules
|
|||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
$result = $this->_load_tables('/mymodule/sql/');
|
$result = $this->_load_tables('/mymodule/sql/');
|
||||||
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')
|
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';
|
||||||
@ -432,19 +434,19 @@ class modMyModule extends DolibarrModules
|
|||||||
$myTmpObjects['MyObject'] = array('includerefgeneration'=>0, 'includedocgeneration'=>0);
|
$myTmpObjects['MyObject'] = array('includerefgeneration'=>0, 'includedocgeneration'=>0);
|
||||||
|
|
||||||
foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
|
foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
|
||||||
if ($myTmpObjectKey == 'MyObject') continue;
|
if ($myTmpObjectKey == 'MyObject') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if ($myTmpObjectArray['includerefgeneration']) {
|
if ($myTmpObjectArray['includerefgeneration']) {
|
||||||
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/mymodule/template_myobjects.odt';
|
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/mymodule/template_myobjects.odt';
|
||||||
$dirodt = DOL_DATA_ROOT.'/doctemplates/mymodule';
|
$dirodt = DOL_DATA_ROOT.'/doctemplates/mymodule';
|
||||||
$dest = $dirodt.'/template_myobjects.odt';
|
$dest = $dirodt.'/template_myobjects.odt';
|
||||||
|
|
||||||
if (file_exists($src) && !file_exists($dest))
|
if (file_exists($src) && !file_exists($dest)) {
|
||||||
{
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
dol_mkdir($dirodt);
|
dol_mkdir($dirodt);
|
||||||
$result = dol_copy($src, $dest, 0, 0);
|
$result = dol_copy($src, $dest, 0, 0);
|
||||||
if ($result < 0)
|
if ($result < 0) {
|
||||||
{
|
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$this->error = $langs->trans('ErrorFailToCopyFile', $src, $dest);
|
$this->error = $langs->trans('ErrorFailToCopyFile', $src, $dest);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user