This commit is contained in:
Frédéric FRANCE 2019-02-25 22:50:19 +01:00
parent c89e4d79b8
commit 915841eeb9
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
10 changed files with 184 additions and 154 deletions

View File

@ -32,15 +32,15 @@ class Utils
*/
public $db;
var $output; // Used by Cron method to return message
var $result; // Used by Cron method to return data
public $output; // Used by Cron method to return message
public $result; // Used by Cron method to return data
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
function __construct($db)
public function __construct($db)
{
$this->db = $db;
}
@ -53,7 +53,7 @@ class Utils
* @param string $choice Choice of purge mode ('tempfiles', '' or 'tempfilesold' to purge temp older than 24h, 'allfiles', 'logfile')
* @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK)
*/
function purgeFiles($choice = 'tempfilesold')
public function purgeFiles($choice = 'tempfilesold')
{
global $conf, $langs, $dolibarr_main_data_root;
@ -182,7 +182,7 @@ class Utils
* @param int $execmethod 0=Use default method (that is 1 by default), 1=Use the PHP 'exec', 2=Use the 'popen' method
* @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK)
*/
function dumpDatabase($compression = 'none', $type = 'auto', $usedefault = 1, $file = 'auto', $keeplastnfiles = 0, $execmethod = 0)
public function dumpDatabase($compression = 'none', $type = 'auto', $usedefault = 1, $file = 'auto', $keeplastnfiles = 0, $execmethod = 0)
{
global $db, $conf, $langs, $dolibarr_main_data_root;
global $dolibarr_main_db_name, $dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_port, $dolibarr_main_db_pass;
@ -501,7 +501,7 @@ class Utils
* @param int $execmethod 0=Use default method (that is 1 by default), 1=Use the PHP 'exec', 2=Use the 'popen' method
* @return array array('result'=>...,'output'=>...,'error'=>...). result = 0 means OK.
*/
function executeCLI($command, $outputfile, $execmethod = 0)
public function executeCLI($command, $outputfile, $execmethod = 0)
{
global $conf, $langs;
@ -570,7 +570,7 @@ class Utils
* @param string $module Module name
* @return int <0 if KO, >0 if OK
*/
function generateDoc($module)
public function generateDoc($module)
{
global $conf, $langs;
global $dirins;
@ -737,7 +737,7 @@ class Utils
*
* @return int 0 if OK, < 0 if KO
*/
function compressSyslogs()
public function compressSyslogs()
{
global $conf;
@ -855,7 +855,7 @@ class Utils
* @param string $tables Table name or '*' for all
* @return int <0 if KO, >0 if OK
*/
function backupTables($outputfile, $tables = '*')
public function backupTables($outputfile, $tables = '*')
{
global $db, $langs;
global $errormsg;

View File

@ -7,6 +7,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2018 Josep Lluís Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
*
* 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
@ -334,7 +335,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
/**
* @var array() Minimum version of PHP required by module.
* @var array Minimum version of PHP required by module.
* e.g.: PHP 5.4 = array(5, 4)
*/
public $phpmin;
@ -381,7 +382,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*
* @return int 1 if OK, 0 if KO
*/
function _init($array_sql, $options = '')
private function _init($array_sql, $options = '')
{
global $conf;
$err=0;
@ -389,39 +390,48 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
$this->db->begin();
// Insert activation module constant
if (! $err) { $err+=$this->_active();
if (! $err) {
$err+=$this->_active();
}
// Insert new pages for tabs (into llx_const)
if (! $err) { $err+=$this->insert_tabs();
if (! $err) {
$err+=$this->insert_tabs();
}
// Insert activation of module's parts
if (! $err) { $err+=$this->insert_module_parts();
if (! $err) {
$err+=$this->insert_module_parts();
}
// Insert constant defined by modules (into llx_const)
if (! $err && ! preg_match('/newboxdefonly/', $options)) { $err+=$this->insert_const(); // Test on newboxdefonly to avoid to erase value during upgrade
if (! $err && ! preg_match('/newboxdefonly/', $options)) {
$err+=$this->insert_const(); // Test on newboxdefonly to avoid to erase value during upgrade
}
// Insert boxes def into llx_boxes_def and boxes setup (into llx_boxes)
if (! $err && ! preg_match('/noboxes/', $options)) { $err+=$this->insert_boxes($options);
if (! $err && ! preg_match('/noboxes/', $options)) {
$err+=$this->insert_boxes($options);
}
// Insert cron job entries (entry in llx_cronjobs)
if (! $err) { $err+=$this->insert_cronjobs();
if (! $err) {
$err+=$this->insert_cronjobs();
}
// Insert permission definitions of module into llx_rights_def. If user is admin, grant this permission to user.
if (! $err) { $err+=$this->insert_permissions(1, null, 1);
if (! $err) {
$err+=$this->insert_permissions(1, null, 1);
}
// Insert specific menus entries into database
if (! $err) { $err+=$this->insert_menus();
if (! $err) {
$err+=$this->insert_menus();
}
// Create module's directories
if (! $err) { $err+=$this->create_dirs();
if (! $err) {
$err+=$this->create_dirs();
}
// Execute addons requests
@ -474,46 +484,55 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*
* @return int 1 if OK, 0 if KO
*/
function _remove($array_sql, $options = '')
private function _remove($array_sql, $options = '')
{
$err=0;
$this->db->begin();
// Remove activation module line (constant MAIN_MODULE_MYMODULE in llx_const)
if (! $err) { $err+=$this->_unactive();
if (! $err) {
$err+=$this->_unactive();
}
// Remove activation of module's new tabs (MAIN_MODULE_MYMODULE_TABS_XXX in llx_const)
if (! $err) { $err+=$this->delete_tabs();
if (! $err) {
$err+=$this->delete_tabs();
}
// Remove activation of module's parts (MAIN_MODULE_MYMODULE_XXX in llx_const)
if (! $err) { $err+=$this->delete_module_parts();
if (! $err) {
$err+=$this->delete_module_parts();
}
// Remove constants defined by modules
if (! $err) { $err+=$this->delete_const();
if (! $err) {
$err+=$this->delete_const();
}
// Remove list of module's available boxes (entry in llx_boxes)
if (! $err && ! preg_match('/(newboxdefonly|noboxes)/', $options)) { $err+=$this->delete_boxes(); // We don't have to delete if option ask to keep boxes safe or ask to add new box def only
if (! $err && ! preg_match('/(newboxdefonly|noboxes)/', $options)) {
$err+=$this->delete_boxes(); // We don't have to delete if option ask to keep boxes safe or ask to add new box def only
}
// Remove list of module's cron job entries (entry in llx_cronjobs)
if (! $err) { $err+=$this->delete_cronjobs();
if (! $err) {
$err+=$this->delete_cronjobs();
}
// Remove module's permissions from list of available permissions (entries in llx_rights_def)
if (! $err) { $err+=$this->delete_permissions();
if (! $err) {
$err+=$this->delete_permissions();
}
// Remove module's menus (entries in llx_menu)
if (! $err) { $err+=$this->delete_menus();
if (! $err) {
$err+=$this->delete_menus();
}
// Remove module's directories
if (! $err) { $err+=$this->delete_dirs();
if (! $err) {
$err+=$this->delete_dirs();
}
// Run complementary sql requests
@ -549,7 +568,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*
* @return string Translated module name
*/
function getName()
public function getName()
{
global $langs;
$langs->load("admin");
@ -585,7 +604,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*
* @return string Translated module description
*/
function getDesc()
public function getDesc()
{
global $langs;
$langs->load("admin");
@ -621,7 +640,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*
* @return string Long description of a module from README.md of from property.
*/
function getDescLong()
public function getDescLong()
{
global $langs;
$langs->load("admin");
@ -675,7 +694,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*
* @return string Path of file if a README file was found.
*/
function getDescLongReadmeFound()
public function getDescLongReadmeFound()
{
global $langs;
@ -710,7 +729,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*
* @return string Content of ChangeLog
*/
function getChangeLog()
public function getChangeLog()
{
global $langs;
$langs->load("admin");
@ -755,7 +774,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*
* @return string Publisher name
*/
function getPublisher()
public function getPublisher()
{
return $this->editor_name;
}
@ -765,7 +784,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*
* @return string Publisher url
*/
function getPublisherUrl()
public function getPublisherUrl()
{
return $this->editor_url;
}
@ -778,7 +797,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
* @param int $translated 1=Special version keys are translated, 0=Special version keys are not translated
* @return string Module version
*/
function getVersion($translated = 1)
public function getVersion($translated = 1)
{
global $langs;
$langs->load("admin");
@ -804,7 +823,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*
* @return string 'core', 'external' or 'unknown'
*/
function isCoreOrExternalModule()
public function isCoreOrExternalModule()
{
if ($this->version == 'dolibarr' || $this->version == 'dolibarr_deprecated') { return 'core';
}
@ -823,7 +842,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*
* @return string[] Language files list
*/
function getLangFilesArray()
public function getLangFilesArray()
{
return $this->langfiles;
}
@ -835,7 +854,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*
* @return string Translated databaset label
*/
function getExportDatasetLabel($r)
public function getExportDatasetLabel($r)
{
global $langs;
@ -859,7 +878,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*
* @return string Translated dataset label
*/
function getImportDatasetLabel($r)
public function getImportDatasetLabel($r)
{
global $langs;
@ -882,7 +901,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*
* @return timestamp Date of last activation
*/
function getLastActivationDate()
public function getLastActivationDate()
{
global $conf;
@ -909,7 +928,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*
* @return array Array array('authorid'=>Id of last activation user, 'lastactivationdate'=>Date of last activation)
*/
function getLastActivationInfo()
public function getLastActivationInfo()
{
global $conf;
@ -940,7 +959,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*
* @return int Error count (0 if OK)
*/
function _active()
private function _active()
{
global $conf, $user;
@ -980,7 +999,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*
* @return int Error count (0 if OK)
*/
function _unactive()
private function _unactive()
{
global $conf;
@ -1000,7 +1019,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create tables and keys required by module.
* Files module.sql and module.key.sql with create table and create keys
@ -1010,7 +1029,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
* @param string $reldir Relative directory where to scan files
* @return int <=0 if KO, >0 if OK
*/
function _load_tables($reldir)
private function _load_tables($reldir)
{
// phpcs:enable
global $conf;
@ -1119,7 +1138,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Adds boxes
*
@ -1127,7 +1146,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*
* @return int Error count (0 if OK)
*/
function insert_boxes($option = '')
public function insert_boxes($option = '')
{
// phpcs:enable
include_once DOL_DOCUMENT_ROOT . '/core/class/infobox.class.php';
@ -1219,13 +1238,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Removes boxes
*
* @return int Error count (0 if OK)
*/
function delete_boxes()
public function delete_boxes()
{
// phpcs:enable
global $conf;
@ -1292,13 +1311,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
return $err;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Adds cronjobs
*
* @return int Error count (0 if OK)
*/
function insert_cronjobs()
public function insert_cronjobs()
{
// phpcs:enable
include_once DOL_DOCUMENT_ROOT . '/core/class/infobox.class.php';
@ -1332,13 +1351,17 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
// Search if cron entry already present
$sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."cronjob";
$sql.= " WHERE module_name = '".$this->db->escape(empty($this->rights_class)?strtolower($this->name):$this->rights_class)."'";
if ($class) { $sql.= " AND classesname = '".$this->db->escape($class)."'";
if ($class) {
$sql.= " AND classesname = '".$this->db->escape($class)."'";
}
if ($objectname) { $sql.= " AND objectname = '".$this->db->escape($objectname)."'";
if ($objectname) {
$sql.= " AND objectname = '".$this->db->escape($objectname)."'";
}
if ($method) { $sql.= " AND methodename = '".$this->db->escape($method)."'";
if ($method) {
$sql.= " AND methodename = '".$this->db->escape($method)."'";
}
if ($command) { $sql.= " AND command = '".$this->db->escape($command)."'";
if ($command) {
$sql.= " AND command = '".$this->db->escape($command)."'";
}
$sql.= " AND entity = ".$entity; // Must be exact entity
@ -1410,13 +1433,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Removes boxes
*
* @return int Error count (0 if OK)
*/
function delete_cronjobs()
public function delete_cronjobs()
{
// phpcs:enable
global $conf;
@ -1441,13 +1464,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
return $err;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Removes tabs
*
* @return int Error count (0 if OK)
*/
function delete_tabs()
public function delete_tabs()
{
// phpcs:enable
global $conf;
@ -1467,13 +1490,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
return $err;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Adds tabs
*
* @return int Error count (0 if ok)
*/
function insert_tabs()
public function insert_tabs()
{
// phpcs:enable
global $conf;
@ -1533,13 +1556,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
return $err;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Adds constants
*
* @return int Error count (0 if OK)
*/
function insert_const()
public function insert_const()
{
// phpcs:enable
global $conf;
@ -1605,13 +1628,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
return $err;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Removes constants tagged 'deleteonunactive'
*
* @return int <0 if KO, 0 if OK
*/
function delete_const()
public function delete_const()
{
// phpcs:enable
global $conf;
@ -1641,7 +1664,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
return $err;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Adds access rights
*
@ -1650,7 +1673,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int Error count (0 if OK)
*/
function insert_permissions($reinitadminperms = 0, $force_entity = null, $notrigger = 0)
public function insert_permissions($reinitadminperms = 0, $force_entity = null, $notrigger = 0)
{
// phpcs:enable
global $conf,$user;
@ -1680,7 +1703,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
$r_def = $this->rights[$key][3];
$r_perms = $this->rights[$key][4];
$r_subperms = isset($this->rights[$key][5])?$this->rights[$key][5]:'';
$r_modul = empty($this->rights_class)?strtolower($this->name):$this->rights_class;
$r_modul = empty($this->rights_class)?strtolower($this->name):$this->rights_class;
if (empty($r_type)) { $r_type='w';
}
@ -1788,13 +1811,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Removes access rights
*
* @return int Error count (0 if OK)
*/
function delete_permissions()
public function delete_permissions()
{
// phpcs:enable
global $conf;
@ -1814,13 +1837,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Adds menu entries
*
* @return int Error count (0 if OK)
*/
function insert_menus()
public function insert_menus()
{
// phpcs:enable
global $user;
@ -1918,13 +1941,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Removes menu entries
*
* @return int Error count (0 if OK)
*/
function delete_menus()
public function delete_menus()
{
// phpcs:enable
global $conf;
@ -1948,13 +1971,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
return $err;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Creates directories
*
* @return int Error count (0 if OK)
*/
function create_dirs()
public function create_dirs()
{
// phpcs:enable
global $langs, $conf;
@ -2008,7 +2031,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Adds directories definitions
*
@ -2017,7 +2040,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*
* @return int Error count (0 if OK)
*/
function insert_dirs($name, $dir)
public function insert_dirs($name, $dir)
{
// phpcs:enable
global $conf;
@ -2052,13 +2075,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Removes directories
*
* @return int Error count (0 if OK)
*/
function delete_dirs()
public function delete_dirs()
{
// phpcs:enable
global $conf;
@ -2078,13 +2101,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
return $err;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Adds generic parts
*
* @return int Error count (0 if OK)
*/
function insert_module_parts()
public function insert_module_parts()
{
// phpcs:enable
global $conf;
@ -2155,13 +2178,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
return $error;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Removes generic parts
*
* @return int Error count (0 if OK)
*/
function delete_module_parts()
public function delete_module_parts()
{
// phpcs:enable
global $conf;

View File

@ -377,7 +377,7 @@ class modAdherent extends DolibarrModules
* @param string $options Options when enabling module ('', 'newboxdefonly', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options = '')
public function init($options = '')
{
global $conf,$langs;

View File

@ -61,12 +61,13 @@ class modFournisseur extends DolibarrModules
$this->picto='company';
// Data directories to create when module is enabled
$this->dirs = array("/fournisseur/temp",
"/fournisseur/commande",
"/fournisseur/commande/temp",
"/fournisseur/facture",
"/fournisseur/facture/temp"
);
$this->dirs = array(
"/fournisseur/temp",
"/fournisseur/commande",
"/fournisseur/commande/temp",
"/fournisseur/facture",
"/fournisseur/facture/temp"
);
// Dependencies
$this->depends = array("modSociete");
@ -622,7 +623,7 @@ class modFournisseur extends DolibarrModules
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options = '')
public function init($options = '')
{
global $conf;

View File

@ -37,8 +37,8 @@ class modOpenSurvey extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
{
public function __construct($db)
{
global $langs,$conf;
$this->db = $db;
@ -119,51 +119,57 @@ class modOpenSurvey extends DolibarrModules
$r++;
// Menus
//-------
// Menus
//-------
$r=0;
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=tools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'left',
'titre'=>'Survey',
'mainmenu'=>'tools',
'leftmenu'=>'opensurvey',
'url'=>'/opensurvey/index.php?mainmenu=tools&leftmenu=opensurvey',
'langs'=>'opensurvey',
'position'=>200,
'enabled'=>'$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled.
'perms'=>'$user->rights->opensurvey->read',
'target'=>'',
'user'=>0);
$r++;
$this->menu[$r]=array(
'fk_menu'=>'fk_mainmenu=tools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'left',
'titre'=>'Survey',
'mainmenu'=>'tools',
'leftmenu'=>'opensurvey',
'url'=>'/opensurvey/index.php?mainmenu=tools&leftmenu=opensurvey',
'langs'=>'opensurvey',
'position'=>200,
'enabled'=>'$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled.
'perms'=>'$user->rights->opensurvey->read',
'target'=>'',
'user'=>0,
);
$r++;
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=tools,fk_leftmenu=opensurvey', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'left',
'titre'=>'NewSurvey',
'mainmenu'=>'tools',
'leftmenu'=>'opensurvey_new',
'url'=>'/opensurvey/wizard/index.php',
'langs'=>'opensurvey',
'position'=>210,
'enabled'=>'$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled.
'perms'=>'$user->rights->opensurvey->write',
'target'=>'',
'user'=>0);
$r++;
$this->menu[$r]=array(
'fk_menu'=>'fk_mainmenu=tools,fk_leftmenu=opensurvey', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'left',
'titre'=>'NewSurvey',
'mainmenu'=>'tools',
'leftmenu'=>'opensurvey_new',
'url'=>'/opensurvey/wizard/index.php',
'langs'=>'opensurvey',
'position'=>210,
'enabled'=>'$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled.
'perms'=>'$user->rights->opensurvey->write',
'target'=>'',
'user'=>0,
);
$r++;
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=tools,fk_leftmenu=opensurvey', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'left',
'titre'=>'List',
'mainmenu'=>'tools',
'leftmenu'=>'opensurvey_list',
'url'=>'/opensurvey/list.php',
'langs'=>'opensurvey',
'position'=>220,
'enabled'=>'$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled.
'perms'=>'$user->rights->opensurvey->read',
'target'=>'',
'user'=>0);
$r++;
}
$this->menu[$r]=array(
'fk_menu'=>'fk_mainmenu=tools,fk_leftmenu=opensurvey', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'left',
'titre'=>'List',
'mainmenu'=>'tools',
'leftmenu'=>'opensurvey_list',
'url'=>'/opensurvey/list.php',
'langs'=>'opensurvey',
'position'=>220,
'enabled'=>'$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled.
'perms'=>'$user->rights->opensurvey->read',
'target'=>'',
'user'=>0,
);
$r++;
}
/**
* Function called when module is enabled.
@ -173,13 +179,13 @@ class modOpenSurvey extends DolibarrModules
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options = '')
{
// Permissions
$this->remove($options);
public function init($options = '')
{
// Permissions
$this->remove($options);
$sql = array();
$sql = array();
return $this->_init($sql, $options);
}
return $this->_init($sql, $options);
}
}

View File

@ -146,7 +146,7 @@ class modPrelevement extends DolibarrModules
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options = '')
public function init($options = '')
{
global $conf;

View File

@ -114,7 +114,7 @@ class modProductBatch extends DolibarrModules
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options = '')
public function init($options = '')
{
global $db,$conf;

View File

@ -43,7 +43,7 @@ class modSalaries extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
function __construct($db)
public function __construct($db)
{
global $conf;
@ -166,7 +166,7 @@ class modSalaries extends DolibarrModules
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options = '')
public function init($options = '')
{
global $conf;

View File

@ -727,8 +727,8 @@ class modSociete extends DolibarrModules
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options = '')
{
public function init($options = '')
{
global $conf, $langs;
// We disable this to prevent pb of modules not correctly disabled

View File

@ -206,7 +206,7 @@ class Export
}
return 1;
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@ -368,7 +368,7 @@ class Export
return $Condition;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Build an input field used to filter the query
*