Restore lost file and better generation of modules
This commit is contained in:
parent
5e29817910
commit
66420d0e80
86
htdocs/core/actions_setmoduleoptions.inc.php
Normal file
86
htdocs/core/actions_setmoduleoptions.inc.php
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* or see http://www.gnu.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/core/actions_setnotes.inc.php
|
||||||
|
* \brief Code for actions on setting notes of object page
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// $action must be defined
|
||||||
|
// $_FILES may be defined
|
||||||
|
// $nomessageinsetmoduleoptions can be set to 1
|
||||||
|
|
||||||
|
// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...)
|
||||||
|
if ($action == 'setModuleOptions')
|
||||||
|
{
|
||||||
|
$db->begin();
|
||||||
|
|
||||||
|
// Process common param fields
|
||||||
|
foreach($_POST as $key => $val)
|
||||||
|
{
|
||||||
|
if (preg_match('/^param(\d*)$/', $key, $reg)) // Works for POST['param'], POST['param1'], POST['param2'], ...
|
||||||
|
{
|
||||||
|
$param=GETPOST("param".$reg[1],'alpha');
|
||||||
|
$value=GETPOST("value".$reg[1],'alpha');
|
||||||
|
if ($param)
|
||||||
|
{
|
||||||
|
$res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
|
||||||
|
if (! $res > 0) $error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Process upload fields
|
||||||
|
if (GETPOST('upload','alpha') && GETPOST('keyforuploaddir','aZ09'))
|
||||||
|
{
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
$keyforuploaddir=GETPOST('keyforuploaddir','aZ09');
|
||||||
|
$listofdir=explode(',',preg_replace('/[\r\n]+/',',',trim($conf->global->$keyforuploaddir)));
|
||||||
|
foreach($listofdir as $key=>$tmpdir)
|
||||||
|
{
|
||||||
|
$tmpdir=trim($tmpdir);
|
||||||
|
$tmpdir=preg_replace('/DOL_DATA_ROOT/',DOL_DATA_ROOT,$tmpdir);
|
||||||
|
if (! $tmpdir) {
|
||||||
|
unset($listofdir[$key]); continue;
|
||||||
|
}
|
||||||
|
if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$upload_dir=$tmpdir;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($upload_dir)
|
||||||
|
{
|
||||||
|
$result = dol_add_file_process($upload_dir, 0, 1, 'uploadfile', '');
|
||||||
|
if ($result <= 0) $error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$db->commit();
|
||||||
|
if (empty($nomessageinsetmoduleoptions)) setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$db->rollback();
|
||||||
|
if (empty($nomessageinsetmoduleoptions)) setEventMessages($langs->trans("SetupNotSaved"), null, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -133,10 +133,12 @@ class HookManager
|
|||||||
if (in_array(
|
if (in_array(
|
||||||
$method,
|
$method,
|
||||||
array(
|
array(
|
||||||
'addMoreActionsButtons',
|
'addCalendarChoice',
|
||||||
|
'addMoreActionsButtons',
|
||||||
|
'addMoreMassActions',
|
||||||
'addSearchEntry',
|
'addSearchEntry',
|
||||||
'addStatisticLine',
|
'addStatisticLine',
|
||||||
'deleteFile',
|
'deleteFile',
|
||||||
'doActions',
|
'doActions',
|
||||||
'formCreateThirdpartyOptions',
|
'formCreateThirdpartyOptions',
|
||||||
'formObjectOptions',
|
'formObjectOptions',
|
||||||
@ -169,7 +171,6 @@ class HookManager
|
|||||||
'printSearchForm',
|
'printSearchForm',
|
||||||
'printTabsHead',
|
'printTabsHead',
|
||||||
'formatEvent',
|
'formatEvent',
|
||||||
'addCalendarChoice',
|
|
||||||
'printObjectLine',
|
'printObjectLine',
|
||||||
'printObjectSubLine',
|
'printObjectSubLine',
|
||||||
'createDictionaryFieldList',
|
'createDictionaryFieldList',
|
||||||
@ -181,14 +182,16 @@ class HookManager
|
|||||||
|
|
||||||
if ($method == 'insertExtraFields')
|
if ($method == 'insertExtraFields')
|
||||||
{
|
{
|
||||||
$hooktype='returnvalue'; // deprecated. TODO Remove all code with "executeHooks('insertExtraFields'" as soon as there is a trigger available.
|
$hooktype='returnvalue'; // @deprecated. TODO Remove all code with "executeHooks('insertExtraFields'" as soon as there is a trigger available.
|
||||||
dol_syslog("Warning: The hook 'insertExtraFields' is deprecated and must not be used. Use instead trigger on CRUD event (ask it to dev team if not implemented)", LOG_WARNING);
|
dol_syslog("Warning: The hook 'insertExtraFields' is deprecated and must not be used. Use instead trigger on CRUD event (ask it to dev team if not implemented)", LOG_WARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Init return properties
|
||||||
|
$this->resPrint=''; $this->resArray=array();
|
||||||
|
|
||||||
// Loop on each hook to qualify modules that have declared context
|
// Loop on each hook to qualify modules that have declared context
|
||||||
$modulealreadyexecuted=array();
|
$modulealreadyexecuted=array();
|
||||||
$resaction=0; $error=0; $result='';
|
$resaction=0; $error=0; $result='';
|
||||||
$this->resPrint=''; $this->resArray=array();
|
|
||||||
foreach($this->hooks as $context => $modules) // $this->hooks is an array with context as key and value is an array of modules that handle this context
|
foreach($this->hooks as $context => $modules) // $this->hooks is an array with context as key and value is an array of modules that handle this context
|
||||||
{
|
{
|
||||||
if (! empty($modules))
|
if (! empty($modules))
|
||||||
@ -202,9 +205,9 @@ class HookManager
|
|||||||
|
|
||||||
// test to avoid running twice a hook, when a module implements several active contexts
|
// test to avoid running twice a hook, when a module implements several active contexts
|
||||||
if (in_array($module,$modulealreadyexecuted)) continue;
|
if (in_array($module,$modulealreadyexecuted)) continue;
|
||||||
|
|
||||||
dol_syslog(get_class($this).'::executeHooks a qualified hook was found for method='.$method.' module='.$module." action=".$action." context=".$context);
|
dol_syslog(get_class($this).'::executeHooks a qualified hook was found for method='.$method.' module='.$module." action=".$action." context=".$context);
|
||||||
|
|
||||||
$modulealreadyexecuted[$module]=$module; // Use the $currentcontext in method to avoid running twice
|
$modulealreadyexecuted[$module]=$module; // Use the $currentcontext in method to avoid running twice
|
||||||
|
|
||||||
// Clean class (an error may have been set from a previous call of another method for same module/hook)
|
// Clean class (an error may have been set from a previous call of another method for same module/hook)
|
||||||
|
|||||||
@ -545,11 +545,20 @@ class Form
|
|||||||
$disabled=0;
|
$disabled=0;
|
||||||
$ret='<div class="centpercent center">';
|
$ret='<div class="centpercent center">';
|
||||||
$ret.='<select data-role="none" class="flat'.(empty($conf->use_javascript_ajax)?'':' hideobject').' massaction massactionselect" name="massaction"'.($disabled?' disabled="disabled"':'').'>';
|
$ret.='<select data-role="none" class="flat'.(empty($conf->use_javascript_ajax)?'':' hideobject').' massaction massactionselect" name="massaction"'.($disabled?' disabled="disabled"':'').'>';
|
||||||
$ret.='<option value="0"'.($disabled?' disabled="disabled"':'').'>-- '.$langs->trans("SelectAction").' --</option>';
|
|
||||||
foreach($arrayofaction as $code => $label)
|
// Complete list with data from external modules. THe module can use $_SERVER['PHP_SELF'] to know on which page we are, or use the $parameters['context'] completed by executeHooks.
|
||||||
{
|
$parameters=array();
|
||||||
$ret.='<option value="'.$code.'"'.($disabled?' disabled="disabled"':'').'>'.$label.'</option>';
|
$reshook=$hookmanager->executeHooks('addMoreMassActions',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
}
|
if (empty($reshook))
|
||||||
|
{
|
||||||
|
$ret.='<option value="0"'.($disabled?' disabled="disabled"':'').'>-- '.$langs->trans("SelectAction").' --</option>';
|
||||||
|
foreach($arrayofaction as $code => $label)
|
||||||
|
{
|
||||||
|
$ret.='<option value="'.$code.'"'.($disabled?' disabled="disabled"':'').'>'.$label.'</option>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$ret.=$hookmanager->resPrint;
|
||||||
|
|
||||||
$ret.='</select>';
|
$ret.='</select>';
|
||||||
// Warning: if you set submit button to disabled, post using 'Enter' will no more work.
|
// Warning: if you set submit button to disabled, post using 'Enter' will no more work.
|
||||||
$ret.='<input type="submit" data-role="none" name="confirmmassaction" class="button'.(empty($conf->use_javascript_ajax)?'':' hideobject').' massaction massactionconfirmed" value="'.dol_escape_htmltag($langs->trans("Confirm")).'">';
|
$ret.='<input type="submit" data-role="none" name="confirmmassaction" class="button'.(empty($conf->use_javascript_ajax)?'':' hideobject').' massaction massactionconfirmed" value="'.dol_escape_htmltag($langs->trans("Confirm")).'">';
|
||||||
|
|||||||
@ -50,13 +50,13 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
|||||||
* @since 4.0.0
|
* @since 4.0.0
|
||||||
*/
|
*/
|
||||||
public $editor_name;
|
public $editor_name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string URL of module at publisher site
|
* @var string URL of module at publisher site
|
||||||
* @since 4.0.0
|
* @since 4.0.0
|
||||||
*/
|
*/
|
||||||
public $editor_url;
|
public $editor_url;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string Family
|
* @var string Family
|
||||||
* @see familyinfo
|
* @see familyinfo
|
||||||
@ -80,13 +80,13 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public $familyinfo;
|
public $familyinfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int Module position
|
* @var int Module position
|
||||||
* @since 3.9.0
|
* @since 3.9.0
|
||||||
*/
|
*/
|
||||||
public $module_position=500;
|
public $module_position=500;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string Module name
|
* @var string Module name
|
||||||
*
|
*
|
||||||
@ -214,7 +214,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
|||||||
* HTML content supported.
|
* HTML content supported.
|
||||||
*/
|
*/
|
||||||
public $descriptionlong;
|
public $descriptionlong;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string Module export code
|
* @var string Module export code
|
||||||
*/
|
*/
|
||||||
@ -249,7 +249,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
|||||||
* @var bool Module is enabled globally (Multicompany support)
|
* @var bool Module is enabled globally (Multicompany support)
|
||||||
*/
|
*/
|
||||||
public $core_enabled;
|
public $core_enabled;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string Relative path to module style sheet
|
* @var string Relative path to module style sheet
|
||||||
* @deprecated
|
* @deprecated
|
||||||
@ -286,7 +286,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
|||||||
*/
|
*/
|
||||||
public $config_page_url;
|
public $config_page_url;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string[] List of module class names that must be enabled if this module is enabled.
|
* @var string[] List of module class names that must be enabled if this module is enabled.
|
||||||
*
|
*
|
||||||
@ -309,22 +309,22 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
|||||||
* @var string[] Module language files
|
* @var string[] Module language files
|
||||||
*/
|
*/
|
||||||
public $langfiles;
|
public $langfiles;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string[] Array of warnings to show when we activate the module
|
* @var string[] Array of warnings to show when we activate the module
|
||||||
*
|
*
|
||||||
* array('always'='text') or array('FR'='text')
|
* array('always'='text') or array('FR'='text')
|
||||||
*/
|
*/
|
||||||
public $warnings_activation;
|
public $warnings_activation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string[] Array of warnings to show when we activate an external module
|
* @var string[] Array of warnings to show when we activate an external module
|
||||||
*
|
*
|
||||||
* array('always'='text') or array('FR'='text')
|
* array('always'='text') or array('FR'='text')
|
||||||
*/
|
*/
|
||||||
public $warnings_activation_ext;
|
public $warnings_activation_ext;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array() Minimum version of PHP required by module.
|
* @var array() Minimum version of PHP required by module.
|
||||||
* e.g.: PHP ≥ 5.3 = array(5, 3)
|
* e.g.: PHP ≥ 5.3 = array(5, 3)
|
||||||
@ -342,7 +342,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
|||||||
*/
|
*/
|
||||||
public $hidden = false;
|
public $hidden = false;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor. Define names, constants, directories, boxes, permissions
|
* Constructor. Define names, constants, directories, boxes, permissions
|
||||||
*
|
*
|
||||||
@ -538,8 +538,8 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
|||||||
return $langs->trans("Module".$this->numero."Name");
|
return $langs->trans("Module".$this->numero."Name");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// If module name translation using it's unique id does not exists, we take use its name to find translation
|
// If module name translation using it's unique id does not exists, we try to use its name to find translation
|
||||||
if (is_array($this->langfiles))
|
if (is_array($this->langfiles))
|
||||||
{
|
{
|
||||||
foreach($this->langfiles as $val)
|
foreach($this->langfiles as $val)
|
||||||
@ -547,6 +547,14 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
|||||||
if ($val) $langs->load($val);
|
if ($val) $langs->load($val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($langs->trans("Module".$this->name."Name") != ("Module".$this->name."Name"))
|
||||||
|
{
|
||||||
|
// If module name translation exists
|
||||||
|
return $langs->trans("Module".$this->name."Name");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Last change with simple product label
|
||||||
return $langs->trans($this->name);
|
return $langs->trans($this->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -591,13 +599,13 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
|||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
$langs->load("admin");
|
$langs->load("admin");
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
|
||||||
|
|
||||||
$filefound= false;
|
$filefound= false;
|
||||||
|
|
||||||
// Define path to file README.md.
|
// Define path to file README.md.
|
||||||
// First check README-la_LA.md then README.md
|
// First check README-la_LA.md then README.md
|
||||||
$pathoffile = dol_buildpath(strtolower($this->name).'/README-'.$langs->defaultlang.'.md', 0);
|
$pathoffile = dol_buildpath(strtolower($this->name).'/README-'.$langs->defaultlang.'.md', 0);
|
||||||
if (dol_is_file($pathoffile))
|
if (dol_is_file($pathoffile))
|
||||||
@ -612,11 +620,11 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
|||||||
$filefound = true;
|
$filefound = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($filefound) // Mostly for external modules
|
if ($filefound) // Mostly for external modules
|
||||||
{
|
{
|
||||||
$content = file_get_contents($pathoffile);
|
$content = file_get_contents($pathoffile);
|
||||||
|
|
||||||
if ((float) DOL_VERSION >= 6.0)
|
if ((float) DOL_VERSION >= 6.0)
|
||||||
{
|
{
|
||||||
@include_once DOL_DOCUMENT_ROOT.'/core/lib/parsemd.lib.php';
|
@include_once DOL_DOCUMENT_ROOT.'/core/lib/parsemd.lib.php';
|
||||||
@ -638,14 +646,14 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
|||||||
if ($val) $langs->load($val);
|
if ($val) $langs->load($val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$content = $langs->trans($this->descriptionlong);
|
$content = $langs->trans($this->descriptionlong);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gives the publisher name
|
* Gives the publisher name
|
||||||
*
|
*
|
||||||
@ -655,7 +663,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
|||||||
{
|
{
|
||||||
return $this->editor_name;
|
return $this->editor_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gives the publisher url
|
* Gives the publisher url
|
||||||
*
|
*
|
||||||
@ -665,7 +673,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
|||||||
{
|
{
|
||||||
return $this->editor_url;
|
return $this->editor_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gives module version (translated if param $translated is on)
|
* Gives module version (translated if param $translated is on)
|
||||||
* For 'experimental' modules, gives 'experimental' translation
|
* For 'experimental' modules, gives 'experimental' translation
|
||||||
@ -768,7 +776,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gives the last date of activation
|
* Gives the last date of activation
|
||||||
*
|
*
|
||||||
@ -777,11 +785,11 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
|||||||
function getLastActivationDate()
|
function getLastActivationDate()
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$sql = "SELECT tms FROM ".MAIN_DB_PREFIX."const";
|
$sql = "SELECT tms FROM ".MAIN_DB_PREFIX."const";
|
||||||
$sql.= " WHERE ".$this->db->decrypt('name')." = '".$this->db->escape($this->const_name)."'";
|
$sql.= " WHERE ".$this->db->decrypt('name')." = '".$this->db->escape($this->const_name)."'";
|
||||||
$sql.= " AND entity IN (0, ".$conf->entity.")";
|
$sql.= " AND entity IN (0, ".$conf->entity.")";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::getLastActiveDate", LOG_DEBUG);
|
dol_syslog(get_class($this)."::getLastActiveDate", LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if (! $resql) $err++;
|
if (! $resql) $err++;
|
||||||
@ -790,11 +798,11 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
|||||||
$obj=$this->db->fetch_object($resql);
|
$obj=$this->db->fetch_object($resql);
|
||||||
if ($obj) return $this->db->jdate($obj->tms);
|
if ($obj) return $this->db->jdate($obj->tms);
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gives the last author of activation
|
* Gives the last author of activation
|
||||||
*
|
*
|
||||||
@ -803,11 +811,11 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
|||||||
function getLastActivationInfo()
|
function getLastActivationInfo()
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$sql = "SELECT tms, note FROM ".MAIN_DB_PREFIX."const";
|
$sql = "SELECT tms, note FROM ".MAIN_DB_PREFIX."const";
|
||||||
$sql.= " WHERE ".$this->db->decrypt('name')." = '".$this->db->escape($this->const_name)."'";
|
$sql.= " WHERE ".$this->db->decrypt('name')." = '".$this->db->escape($this->const_name)."'";
|
||||||
$sql.= " AND entity IN (0, ".$conf->entity.")";
|
$sql.= " AND entity IN (0, ".$conf->entity.")";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::getLastActiveDate", LOG_DEBUG);
|
dol_syslog(get_class($this)."::getLastActiveDate", LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if (! $resql) $err++;
|
if (! $resql) $err++;
|
||||||
@ -821,11 +829,11 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
|||||||
}
|
}
|
||||||
if ($obj) return array('authorid'=>$tmp['authorid'], 'ip'=>$tmp['ip'], 'lastactivationdate'=>$this->db->jdate($obj->tms));
|
if ($obj) return array('authorid'=>$tmp['authorid'], 'ip'=>$tmp['ip'], 'lastactivationdate'=>$this->db->jdate($obj->tms));
|
||||||
}
|
}
|
||||||
|
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert constants for module activation
|
* Insert constants for module activation
|
||||||
*
|
*
|
||||||
@ -929,7 +937,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
|||||||
$files[] = $file;
|
$files[] = $file;
|
||||||
}
|
}
|
||||||
sort($files);
|
sort($files);
|
||||||
foreach ($files as $file)
|
foreach ($files as $file)
|
||||||
{
|
{
|
||||||
if (preg_match('/\.sql$/i',$file) && ! preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'llx_' && substr($file,0,4) != 'data')
|
if (preg_match('/\.sql$/i',$file) && ! preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'llx_' && substr($file,0,4) != 'data')
|
||||||
{
|
{
|
||||||
@ -947,7 +955,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
|||||||
$files[] = $file;
|
$files[] = $file;
|
||||||
}
|
}
|
||||||
sort($files);
|
sort($files);
|
||||||
foreach ($files as $file)
|
foreach ($files as $file)
|
||||||
{
|
{
|
||||||
if (preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'llx_' && substr($file,0,4) != 'data')
|
if (preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'llx_' && substr($file,0,4) != 'data')
|
||||||
{
|
{
|
||||||
@ -965,7 +973,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
|||||||
$files[] = $file;
|
$files[] = $file;
|
||||||
}
|
}
|
||||||
sort($files);
|
sort($files);
|
||||||
foreach ($files as $file)
|
foreach ($files as $file)
|
||||||
{
|
{
|
||||||
if (preg_match('/\.sql$/i',$file) && ! preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'data')
|
if (preg_match('/\.sql$/i',$file) && ! preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'data')
|
||||||
{
|
{
|
||||||
@ -983,7 +991,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
|||||||
$files[] = $file;
|
$files[] = $file;
|
||||||
}
|
}
|
||||||
sort($files);
|
sort($files);
|
||||||
foreach ($files as $file)
|
foreach ($files as $file)
|
||||||
{
|
{
|
||||||
if (preg_match('/\.sql$/i',$file) && ! preg_match('/\.key\.sql$/i',$file) && substr($file,0,6) == 'update')
|
if (preg_match('/\.sql$/i',$file) && ! preg_match('/\.key\.sql$/i',$file) && substr($file,0,6) == 'update')
|
||||||
{
|
{
|
||||||
@ -1123,19 +1131,19 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
|||||||
//$titre = $this->boxes[$key][0];
|
//$titre = $this->boxes[$key][0];
|
||||||
$file = $this->boxes[$key]['file'];
|
$file = $this->boxes[$key]['file'];
|
||||||
//$note = $this->boxes[$key][2];
|
//$note = $this->boxes[$key][2];
|
||||||
|
|
||||||
// TODO If the box is also included by another module and the other module is still on, we should not remove it.
|
// TODO If the box is also included by another module and the other module is still on, we should not remove it.
|
||||||
// For the moment, we manage this with hard coded exception
|
// For the moment, we manage this with hard coded exception
|
||||||
//print "Remove box ".$file.'<br>';
|
//print "Remove box ".$file.'<br>';
|
||||||
if ($file == 'box_graph_product_distribution.php')
|
if ($file == 'box_graph_product_distribution.php')
|
||||||
{
|
{
|
||||||
if (! empty($conf->produit->enabled) || ! empty($conf->service->enabled))
|
if (! empty($conf->produit->enabled) || ! empty($conf->service->enabled))
|
||||||
{
|
{
|
||||||
dol_syslog("We discard disabling of module ".$file." because another module still active require it.");
|
dol_syslog("We discard disabling of module ".$file." because another module still active require it.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($file)) $file = isset($this->boxes[$key][1])?$this->boxes[$key][1]:''; // For backward compatibility
|
if (empty($file)) $file = isset($this->boxes[$key][1])?$this->boxes[$key][1]:''; // For backward compatibility
|
||||||
|
|
||||||
if ($this->db->type == 'sqlite3') {
|
if ($this->db->type == 'sqlite3') {
|
||||||
@ -1210,7 +1218,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
|||||||
$status = isset($this->cronjobs[$key]['status'])?$this->cronjobs[$key]['status']:'';
|
$status = isset($this->cronjobs[$key]['status'])?$this->cronjobs[$key]['status']:'';
|
||||||
$priority = isset($this->cronjobs[$key]['priority'])?$this->cronjobs[$key]['priority']:'';
|
$priority = isset($this->cronjobs[$key]['priority'])?$this->cronjobs[$key]['priority']:'';
|
||||||
$test = isset($this->cronjobs[$key]['test'])?$this->cronjobs[$key]['test']:''; // Line must be visible
|
$test = isset($this->cronjobs[$key]['test'])?$this->cronjobs[$key]['test']:''; // Line must be visible
|
||||||
|
|
||||||
// Search if boxes def already present
|
// Search if boxes def already present
|
||||||
$sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."cronjob";
|
$sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."cronjob";
|
||||||
$sql.= " WHERE module_name = '".$this->db->escape($this->rights_class)."'";
|
$sql.= " WHERE module_name = '".$this->db->escape($this->rights_class)."'";
|
||||||
@ -1645,7 +1653,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes access rights
|
* Removes access rights
|
||||||
*
|
*
|
||||||
* @return int Error count (0 if OK)
|
* @return int Error count (0 if OK)
|
||||||
*/
|
*/
|
||||||
function delete_permissions()
|
function delete_permissions()
|
||||||
@ -1678,7 +1686,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
|||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
if (! is_array($this->menu) || empty($this->menu)) return 0;
|
if (! is_array($this->menu) || empty($this->menu)) return 0;
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/menubase.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/menubase.class.php';
|
||||||
|
|
||||||
$err=0;
|
$err=0;
|
||||||
|
|||||||
@ -18,12 +18,10 @@
|
|||||||
# Generic
|
# Generic
|
||||||
#
|
#
|
||||||
|
|
||||||
# Module label 'ModuleXXXName'
|
# Module label 'ModuleMyModuleName'
|
||||||
# (where XXX is value of numeric property 'numero' of module)
|
ModuleMyModuleName = My module
|
||||||
Module500000Name = My module
|
# Module description 'ModuleMyModuleDesc'
|
||||||
# Module description 'ModuleXXXDesc'
|
ModuleMyModuleDesc = My module description
|
||||||
# (where XXX is value of numeric property 'numero' of module)
|
|
||||||
Module500000Desc = My module description
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Admin page
|
# Admin page
|
||||||
|
|||||||
@ -18,12 +18,10 @@
|
|||||||
# Générique
|
# Générique
|
||||||
#
|
#
|
||||||
|
|
||||||
# Module label 'ModuleXXXName'
|
# Module label 'ModuleMyModuleName'
|
||||||
# (where XXX is value of numeric property 'numero' of module)
|
ModuleMyModuleName = Mon module
|
||||||
Module500000Name = Mon module
|
# Module description 'ModuleMyModuleDesc'
|
||||||
# Module description 'ModuleXXXDesc'
|
ModuleMyModuleDesc = Description de mon module
|
||||||
# (where XXX is value of numeric property 'numero' of module)
|
|
||||||
Module500000Desc = Description de mon module
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Page d'administration
|
# Page d'administration
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user