Update modMyModule.class.php

This commit is contained in:
Frédéric FRANCE
2021-01-06 20:27:45 +01:00
committed by GitHub
parent 79b6a3ed40
commit 8117fb7cb2

View File

@@ -410,7 +410,9 @@ class modMyModule extends DolibarrModules
global $conf, $langs;
$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
//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);
foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
if ($myTmpObjectKey == 'MyObject') continue;
if ($myTmpObjectKey == 'MyObject') {
continue;
}
if ($myTmpObjectArray['includerefgeneration']) {
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/mymodule/template_myobjects.odt';
$dirodt = DOL_DATA_ROOT.'/doctemplates/mymodule';
$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';
dol_mkdir($dirodt);
$result = dol_copy($src, $dest, 0, 0);
if ($result < 0)
{
if ($result < 0) {
$langs->load("errors");
$this->error = $langs->trans('ErrorFailToCopyFile', $src, $dest);
return 0;