Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
frederic34 committed Feb 26, 2019
1 parent 675a17a commit e6c3eb0
Show file tree
Hide file tree
Showing 44 changed files with 271 additions and 265 deletions.
8 changes: 4 additions & 4 deletions htdocs/api/class/api.class.php
Expand Up @@ -94,7 +94,7 @@ function index()
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
private function _cleanObjectDatas($object)
protected function _cleanObjectDatas($object)
{

// Remove $db object property for object
Expand Down Expand Up @@ -222,7 +222,7 @@ private function _cleanObjectDatas($object)
* @return bool
* @throws RestException
*/
private static function _checkAccessToResource($resource, $resource_id = 0, $dbtablename = '', $feature2 = '', $dbt_keyfield = 'fk_soc', $dbt_select = 'rowid')
protected static function _checkAccessToResource($resource, $resource_id = 0, $dbtablename = '', $feature2 = '', $dbt_keyfield = 'fk_soc', $dbt_select = 'rowid')
{

// Features/modules to check
Expand All @@ -248,7 +248,7 @@ private static function _checkAccessToResource($resource, $resource_id = 0, $dbt
* @param string $sqlfilters sqlfilter string
* @return boolean True if valid, False if not valid
*/
private function _checkFilters($sqlfilters)
protected function _checkFilters($sqlfilters)
{
//$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
//$tmp=preg_replace_all('/'.$regexstring.'/', '', $sqlfilters);
Expand Down Expand Up @@ -278,7 +278,7 @@ private function _checkFilters($sqlfilters)
* @param array $matches Array of found string by regex search
* @return string Forged criteria. Example: "t.field like 'abc%'"
*/
private static function _forge_criteria_callback($matches)
protected static function _forge_criteria_callback($matches)
{
// phpcs:enable
global $db;
Expand Down
9 changes: 7 additions & 2 deletions htdocs/core/modules/DolibarrModules.class.php
Expand Up @@ -370,6 +370,7 @@ public function __construct($db)
// We need constructor into function unActivateModule into admin.lib.php


// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Enables a module.
* Inserts all informations into database
Expand All @@ -384,6 +385,7 @@ public function __construct($db)
*/
protected function _init($array_sql, $options = '')
{
// phpcs:enable
global $conf;
$err=0;

Expand Down Expand Up @@ -476,6 +478,7 @@ protected function _init($array_sql, $options = '')
}
}

// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Disable function. Deletes the module constants and boxes from the database.
*
Expand All @@ -486,6 +489,7 @@ protected function _init($array_sql, $options = '')
*/
protected function _remove($array_sql, $options = '')
{
// phpcs:enable
$err=0;

$this->db->begin();
Expand Down Expand Up @@ -1044,15 +1048,16 @@ private function _unactive()
* @param string $reldir Relative directory where to scan files
* @return int <=0 if KO, >0 if OK
*/
protected function _load_tables($reldir)
private function _load_tables($reldir)
{
// phpcs:enable
global $conf;

$error=0;
$dirfound=0;

if (empty($reldir)) { return 1;
if (empty($reldir)) {
return 1;
}

include_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/modules/cheque/mod_chequereceipt_mint.php
Expand Up @@ -25,7 +25,7 @@
require_once DOL_DOCUMENT_ROOT .'/core/modules/cheque/modules_chequereceipts.php';

/**
* Class to manage cheque receipts numbering rules Mint
* Class to manage cheque receipts numbering rules Mint
*/
class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts
{
Expand Down Expand Up @@ -145,7 +145,7 @@ public function getNextValue($objsoc, $object)
}


// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free value
*
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/cheque/mod_chequereceipt_thyme.php
Expand Up @@ -133,7 +133,7 @@ public function getNextValue($objsoc, $object)
}


// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free value
*
Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/modules/modAdherent.class.php
Expand Up @@ -382,7 +382,7 @@ public function init($options = '')
global $conf,$langs;

// Permissions
$this->remove($options);
$this->removeFromChild(array(), $options);

//ODT template
/*
Expand All @@ -408,6 +408,6 @@ public function init($options = '')
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','member',".$conf->entity.")"
);

return $this->_init($sql, $options);
return $this->initFromChild($sql, $options);
}
}
26 changes: 14 additions & 12 deletions htdocs/core/modules/modAgenda.class.php
Expand Up @@ -204,18 +204,20 @@ public function __construct($db)
// 'target'=>'',
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
// $r++;
$this->menu[$r]=array('fk_menu'=>0,
'type'=>'top',
'titre'=>'TMenuAgenda',
'mainmenu'=>'agenda',
'url'=>'/comm/action/index.php',
'langs'=>'agenda',
'position'=>86,
'perms'=>'$user->rights->agenda->myactions->read',
'enabled'=>'$conf->agenda->enabled',
'target'=>'',
'user'=>2);
$r++;
$this->menu[$r]=array(
'fk_menu'=>0,
'type'=>'top',
'titre'=>'TMenuAgenda',
'mainmenu'=>'agenda',
'url'=>'/comm/action/index.php',
'langs'=>'agenda',
'position'=>86,
'perms'=>'$user->rights->agenda->myactions->read',
'enabled'=>'$conf->agenda->enabled',
'target'=>'',
'user'=>2,
);
$r++;

$this->menu[$r]=array('fk_menu'=>'r=0',
'type'=>'left',
Expand Down
16 changes: 8 additions & 8 deletions htdocs/core/modules/modApi.class.php
Expand Up @@ -224,14 +224,14 @@ public function __construct($db)
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options = '')
{
$sql = array();
public function init($options = '')
{
$sql = array();

$result=$this->_load_tables('/api/sql/');
$result = $this->_load_tables('/api/sql/');

return $this->_init($sql, $options);
}
return $this->initFromChild($sql, $options);
}

/**
* Function called when module is disabled.
Expand All @@ -241,14 +241,14 @@ function init($options = '')
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options = '')
public function remove($options = '')
{
// Remove old constants with entity fields different of 0
$sql = array(
"DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = ".$this->db->encrypt('MAIN_MODULE_API', 1),
"DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = ".$this->db->encrypt('API_PRODUCTION_MODE', 1)
);

return $this->_remove($sql, $options);
return $this->removeFromChild($sql, $options);
}
}
4 changes: 2 additions & 2 deletions htdocs/core/modules/modAsset.class.php
Expand Up @@ -325,10 +325,10 @@ public function init($options = '')
global $conf;

// Permissions
$this->remove($options);
$this->removeFromChild(array(), $options);

$sql = array();

return $this->_init($sql, $options);
return $this->initFromChild($sql, $options);
}
}
2 changes: 1 addition & 1 deletion htdocs/core/modules/modBanque.class.php
Expand Up @@ -210,7 +210,7 @@ public function __construct($db)
* @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;

Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/modBarcode.class.php
Expand Up @@ -129,7 +129,7 @@ public function __construct($db)
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options = '')
public function init($options = '')
{
// Permissions
$this->remove($options);
Expand Down
9 changes: 4 additions & 5 deletions htdocs/core/modules/modBlockedLog.class.php
Expand Up @@ -145,9 +145,8 @@ public function __construct($db)
*
* @return boolean True if already used, otherwise False
*/
function alreadyUsed()
public function alreadyUsed()
{

require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
$b=new BlockedLog($this->db);
return $b->alreadyUsed(1);
Expand All @@ -162,7 +161,7 @@ function alreadyUsed()
* @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, $user;

Expand Down Expand Up @@ -205,7 +204,7 @@ function init($options = '')
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options = '')
public function remove($options = '')
{

global $conf, $user;
Expand Down Expand Up @@ -233,7 +232,7 @@ function remove($options = '')

if ($b->alreadyUsed(1))
{
$res = $b->create($user, '0000000000'); // If already used for something else than SET or UNSET, we log with error
$res = $b->create($user, '0000000000'); // If already used for something else than SET or UNSET, we log with error
}
else
{
Expand Down
28 changes: 14 additions & 14 deletions htdocs/core/modules/modCashDesk.class.php
Expand Up @@ -121,24 +121,24 @@ public function __construct($db)
// 'target'=>'',
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
// $r++;
}
}


/**
* 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
* 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
*/
function init($options = '')
{
$sql = array();
public function init($options = '')
{
$sql = array();

// Remove permissions and default values
$this->remove($options);
// Remove permissions and default values
$this->remove($options);

return $this->_init($sql, $options);
}
return $this->_init($sql, $options);
}
}
2 changes: 1 addition & 1 deletion htdocs/core/modules/modCategorie.class.php
Expand Up @@ -483,7 +483,7 @@ public function __construct($db)
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options = '')
public function init($options = '')
{
// Permissions
$this->remove($options);
Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/modules/modCommande.class.php
Expand Up @@ -269,7 +269,7 @@ public function __construct($db)
* @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;

Expand Down Expand Up @@ -299,6 +299,6 @@ function init($options = '')
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','order',".$conf->entity.")"
);

return $this->_init($sql, $options);
return $this->_init($sql, $options);
}
}
16 changes: 8 additions & 8 deletions htdocs/core/modules/modComptabilite.class.php
Expand Up @@ -101,16 +101,16 @@ public function __construct($db)
}


/**
* 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
/**
* 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
* @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;

// Nettoyage avant activation
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/modContrat.class.php
Expand Up @@ -212,7 +212,7 @@ public function __construct($db)
* @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;

Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/modDeplacement.class.php
Expand Up @@ -152,7 +152,7 @@ public function __construct($db)
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options = '')
public function init($options = '')
{
// Permissions
$this->remove($options);
Expand Down

0 comments on commit e6c3eb0

Please sign in to comment.