diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index c45d30c3a45..15ce93a35e4 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -94,7 +94,7 @@ class DolibarrApi * @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 @@ -222,7 +222,7 @@ class DolibarrApi * @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 @@ -248,7 +248,7 @@ class DolibarrApi * @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); @@ -278,7 +278,7 @@ class DolibarrApi * @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; diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index e5c3c2c63da..2e9af363d08 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -370,6 +370,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it // We need constructor into function unActivateModule into admin.lib.php + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Enables a module. * Inserts all informations into database @@ -384,6 +385,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it */ protected function _init($array_sql, $options = '') { + // phpcs:enable global $conf; $err=0; @@ -476,6 +478,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Disable function. Deletes the module constants and boxes from the database. * @@ -486,6 +489,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it */ protected function _remove($array_sql, $options = '') { + // phpcs:enable $err=0; $this->db->begin(); @@ -1044,7 +1048,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 */ - protected function _load_tables($reldir) + private function _load_tables($reldir) { // phpcs:enable global $conf; @@ -1052,7 +1056,8 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $error=0; $dirfound=0; - if (empty($reldir)) { return 1; + if (empty($reldir)) { + return 1; } include_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; diff --git a/htdocs/core/modules/cheque/mod_chequereceipt_mint.php b/htdocs/core/modules/cheque/mod_chequereceipt_mint.php index e696f086269..0183300c4ad 100644 --- a/htdocs/core/modules/cheque/mod_chequereceipt_mint.php +++ b/htdocs/core/modules/cheque/mod_chequereceipt_mint.php @@ -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 { @@ -145,7 +145,7 @@ class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return next free value * diff --git a/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php b/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php index c33699a1a27..da1ec40620c 100644 --- a/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php +++ b/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php @@ -133,7 +133,7 @@ class mod_chequereceipt_thyme extends ModeleNumRefChequeReceipts } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return next free value * diff --git a/htdocs/core/modules/modAdherent.class.php b/htdocs/core/modules/modAdherent.class.php index c0d5e8f4116..1786b32c1e0 100644 --- a/htdocs/core/modules/modAdherent.class.php +++ b/htdocs/core/modules/modAdherent.class.php @@ -382,7 +382,7 @@ class modAdherent extends DolibarrModules global $conf,$langs; // Permissions - $this->remove($options); + $this->removeFromChild(array(), $options); //ODT template /* @@ -408,6 +408,6 @@ class modAdherent extends DolibarrModules "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); } } diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index 20b3c74ee40..9877cb8bacb 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -204,18 +204,20 @@ class modAgenda extends DolibarrModules // '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', diff --git a/htdocs/core/modules/modApi.class.php b/htdocs/core/modules/modApi.class.php index 0ed62e76627..f7f4a57a90d 100644 --- a/htdocs/core/modules/modApi.class.php +++ b/htdocs/core/modules/modApi.class.php @@ -224,14 +224,14 @@ class modApi extends DolibarrModules * @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. @@ -241,7 +241,7 @@ class modApi extends DolibarrModules * @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( @@ -249,6 +249,6 @@ class modApi extends DolibarrModules "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); } } diff --git a/htdocs/core/modules/modAsset.class.php b/htdocs/core/modules/modAsset.class.php index b162fabc559..041d5620ae5 100644 --- a/htdocs/core/modules/modAsset.class.php +++ b/htdocs/core/modules/modAsset.class.php @@ -325,10 +325,10 @@ class modAsset extends DolibarrModules global $conf; // Permissions - $this->remove($options); + $this->removeFromChild(array(), $options); $sql = array(); - return $this->_init($sql, $options); + return $this->initFromChild($sql, $options); } } diff --git a/htdocs/core/modules/modBanque.class.php b/htdocs/core/modules/modBanque.class.php index b578b783ace..fb2c818043e 100644 --- a/htdocs/core/modules/modBanque.class.php +++ b/htdocs/core/modules/modBanque.class.php @@ -210,7 +210,7 @@ class modBanque 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; diff --git a/htdocs/core/modules/modBarcode.class.php b/htdocs/core/modules/modBarcode.class.php index 8f2023b4a36..d3efcd1dbdd 100644 --- a/htdocs/core/modules/modBarcode.class.php +++ b/htdocs/core/modules/modBarcode.class.php @@ -129,7 +129,7 @@ class modBarcode 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 = '') { // Permissions $this->remove($options); diff --git a/htdocs/core/modules/modBlockedLog.class.php b/htdocs/core/modules/modBlockedLog.class.php index 1ef90f8cc3f..d9833e2978e 100644 --- a/htdocs/core/modules/modBlockedLog.class.php +++ b/htdocs/core/modules/modBlockedLog.class.php @@ -145,9 +145,8 @@ class modBlockedLog extends DolibarrModules * * @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); @@ -162,7 +161,7 @@ class modBlockedLog 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, $user; @@ -205,7 +204,7 @@ class modBlockedLog extends DolibarrModules * @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; @@ -233,7 +232,7 @@ class modBlockedLog extends DolibarrModules 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 { diff --git a/htdocs/core/modules/modCashDesk.class.php b/htdocs/core/modules/modCashDesk.class.php index 5a809302ea4..68dda5a94f2 100644 --- a/htdocs/core/modules/modCashDesk.class.php +++ b/htdocs/core/modules/modCashDesk.class.php @@ -121,24 +121,24 @@ class modCashDesk extends DolibarrModules // '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); + } } diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index b61ab34f05d..d8f8b6915f3 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -483,7 +483,7 @@ class modCategorie 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 = '') { // Permissions $this->remove($options); diff --git a/htdocs/core/modules/modCommande.class.php b/htdocs/core/modules/modCommande.class.php index 631f80c1075..025bbf0a50c 100644 --- a/htdocs/core/modules/modCommande.class.php +++ b/htdocs/core/modules/modCommande.class.php @@ -269,7 +269,7 @@ class modCommande 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; @@ -299,6 +299,6 @@ class modCommande extends DolibarrModules "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); } } diff --git a/htdocs/core/modules/modComptabilite.class.php b/htdocs/core/modules/modComptabilite.class.php index cf30480a8df..01692979c13 100644 --- a/htdocs/core/modules/modComptabilite.class.php +++ b/htdocs/core/modules/modComptabilite.class.php @@ -101,16 +101,16 @@ class modComptabilite extends DolibarrModules } - /** - * 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 diff --git a/htdocs/core/modules/modContrat.class.php b/htdocs/core/modules/modContrat.class.php index 628ca6183f5..b3053cceae0 100644 --- a/htdocs/core/modules/modContrat.class.php +++ b/htdocs/core/modules/modContrat.class.php @@ -212,7 +212,7 @@ class modContrat 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; diff --git a/htdocs/core/modules/modDeplacement.class.php b/htdocs/core/modules/modDeplacement.class.php index c48aaf44449..61b725f1d8e 100644 --- a/htdocs/core/modules/modDeplacement.class.php +++ b/htdocs/core/modules/modDeplacement.class.php @@ -152,7 +152,7 @@ class modDeplacement 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 = '') { // Permissions $this->remove($options); diff --git a/htdocs/core/modules/modDocumentGeneration.class.php b/htdocs/core/modules/modDocumentGeneration.class.php index 99c7e0ffbdf..8b1ad690efe 100644 --- a/htdocs/core/modules/modDocumentGeneration.class.php +++ b/htdocs/core/modules/modDocumentGeneration.class.php @@ -96,15 +96,15 @@ class modDocumentGeneration extends DolibarrModules /** - * 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 - */ - function init($options = '') - { + * @param string $options Options when enabling module ('', 'noboxes') + * @return int 1 if OK, 0 if KO + */ + public function init($options = '') + { global $conf; // Permissions diff --git a/htdocs/core/modules/modDon.class.php b/htdocs/core/modules/modDon.class.php index c9cd7c417e4..d196cdb1c0e 100644 --- a/htdocs/core/modules/modDon.class.php +++ b/htdocs/core/modules/modDon.class.php @@ -151,7 +151,7 @@ class modDon 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; diff --git a/htdocs/core/modules/modExpedition.class.php b/htdocs/core/modules/modExpedition.class.php index 1aa04bb18c8..e096d840864 100644 --- a/htdocs/core/modules/modExpedition.class.php +++ b/htdocs/core/modules/modExpedition.class.php @@ -308,14 +308,14 @@ class modExpedition extends DolibarrModules /** - * 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,$langs; diff --git a/htdocs/core/modules/modExpenseReport.class.php b/htdocs/core/modules/modExpenseReport.class.php index 977ded085c2..d6ef55fe646 100644 --- a/htdocs/core/modules/modExpenseReport.class.php +++ b/htdocs/core/modules/modExpenseReport.class.php @@ -203,14 +203,14 @@ class modExpenseReport extends DolibarrModules } /** - * 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 - * @return int 1 if OK, 0 if KO + * @param string $options Options + * @return int 1 if OK, 0 if KO */ - function init($options = '') + public function init($options = '') { global $conf; diff --git a/htdocs/core/modules/modExternalRss.class.php b/htdocs/core/modules/modExternalRss.class.php index 7925a6c4369..4e271b4573f 100644 --- a/htdocs/core/modules/modExternalRss.class.php +++ b/htdocs/core/modules/modExternalRss.class.php @@ -86,7 +86,7 @@ class modExternalRss 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; @@ -126,7 +126,7 @@ class modExternalRss extends DolibarrModules * @param string $options Options when enabling module ('', 'noboxes') * @return int 1 if OK, 0 if KO */ - function remove($options = '') + public function remove($options = '') { $sql = array(); diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index 80a3fe5f8c6..106de48e96d 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -347,14 +347,14 @@ class modFacture extends DolibarrModules /** - * 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 ('', 'newboxdefonly', 'noboxes') - * @return int 1 if OK, 0 if KO + * @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; diff --git a/htdocs/core/modules/modFicheinter.class.php b/htdocs/core/modules/modFicheinter.class.php index ed2add33648..8267000297b 100644 --- a/htdocs/core/modules/modFicheinter.class.php +++ b/htdocs/core/modules/modFicheinter.class.php @@ -201,14 +201,14 @@ class modFicheinter extends DolibarrModules /** - * 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; diff --git a/htdocs/core/modules/modHRM.class.php b/htdocs/core/modules/modHRM.class.php index 68aad4e3533..ea4ff52f473 100644 --- a/htdocs/core/modules/modHRM.class.php +++ b/htdocs/core/modules/modHRM.class.php @@ -131,7 +131,7 @@ class modHRM extends DolibarrModules * @param string $options Enabling module ('', 'noboxes') * @return int if OK, 0 if KO */ - function init($options = '') + public function init($options = '') { // Permissions $this->remove($options); diff --git a/htdocs/core/modules/modLoan.class.php b/htdocs/core/modules/modLoan.class.php index 8bd5d194068..e4d1a048c6f 100644 --- a/htdocs/core/modules/modLoan.class.php +++ b/htdocs/core/modules/modLoan.class.php @@ -149,14 +149,14 @@ class modLoan extends DolibarrModules /** - * 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; diff --git a/htdocs/core/modules/modMailing.class.php b/htdocs/core/modules/modMailing.class.php index b978b8cb214..36893ddfa13 100644 --- a/htdocs/core/modules/modMailing.class.php +++ b/htdocs/core/modules/modMailing.class.php @@ -142,14 +142,14 @@ class modMailing extends DolibarrModules /** - * 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 = '') { // Permissions $this->remove($options); diff --git a/htdocs/core/modules/modOauth.class.php b/htdocs/core/modules/modOauth.class.php index ec12a6a2c6c..f4f52eae80a 100644 --- a/htdocs/core/modules/modOauth.class.php +++ b/htdocs/core/modules/modOauth.class.php @@ -130,7 +130,7 @@ class modOauth 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; diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php index b50ad86e1e8..f100e8629e7 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -310,7 +310,7 @@ class modProjet 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; diff --git a/htdocs/core/modules/modPropale.class.php b/htdocs/core/modules/modPropale.class.php index c297cef47ec..b28477f3719 100644 --- a/htdocs/core/modules/modPropale.class.php +++ b/htdocs/core/modules/modPropale.class.php @@ -265,7 +265,7 @@ class modPropale 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; diff --git a/htdocs/core/modules/modReceiptPrinter.class.php b/htdocs/core/modules/modReceiptPrinter.class.php index 51313d5b1db..2694b852b7a 100644 --- a/htdocs/core/modules/modReceiptPrinter.class.php +++ b/htdocs/core/modules/modReceiptPrinter.class.php @@ -130,7 +130,7 @@ class modReceiptPrinter 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; // Clean before activation diff --git a/htdocs/core/modules/modService.class.php b/htdocs/core/modules/modService.class.php index eb1b55000b9..9efab10ca9f 100644 --- a/htdocs/core/modules/modService.class.php +++ b/htdocs/core/modules/modService.class.php @@ -363,7 +363,7 @@ class modService 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 = '') { $this->remove($options); diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 4014e2176e0..32b3b4b97fc 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -720,12 +720,12 @@ class modSociete extends DolibarrModules /** - * 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 */ public function init($options = '') { diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index 153634f795e..230d9dd5fbe 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -351,14 +351,14 @@ class modStock extends DolibarrModules /** - * 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,$langs; diff --git a/htdocs/core/modules/modTax.class.php b/htdocs/core/modules/modTax.class.php index 56983bbb207..c113f9a339a 100644 --- a/htdocs/core/modules/modTax.class.php +++ b/htdocs/core/modules/modTax.class.php @@ -185,7 +185,7 @@ class modTax 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; diff --git a/htdocs/core/modules/modWebsite.class.php b/htdocs/core/modules/modWebsite.class.php index 3fd1166b171..6f882f082ad 100644 --- a/htdocs/core/modules/modWebsite.class.php +++ b/htdocs/core/modules/modWebsite.class.php @@ -138,14 +138,14 @@ class modWebsite extends DolibarrModules /** - * 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,$langs; diff --git a/htdocs/core/modules/modWorkflow.class.php b/htdocs/core/modules/modWorkflow.class.php index 5c1a2163537..7d2e833a4fc 100644 --- a/htdocs/core/modules/modWorkflow.class.php +++ b/htdocs/core/modules/modWorkflow.class.php @@ -137,9 +137,9 @@ class modWorkflow extends DolibarrModules * It also creates data directories * * @param string $options Options when enabling module ('', 'noboxes') - * @return int 1 if OK, 0 if KO + * @return int 1 if OK, 0 if KO */ - function init($options = '') + public function init($options = '') { // Permissions $this->remove($options); diff --git a/htdocs/core/modules/printing/modules_printing.php b/htdocs/core/modules/printing/modules_printing.php index f4c10aa5952..3bbf1c879ea 100644 --- a/htdocs/core/modules/printing/modules_printing.php +++ b/htdocs/core/modules/printing/modules_printing.php @@ -47,7 +47,7 @@ class PrintingDriver * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db = $db; } @@ -59,7 +59,7 @@ class PrintingDriver * @param integer $maxfilenamelength Max length of value to show * @return array List of drivers */ - static function listDrivers($db, $maxfilenamelength = 0) + public static function listDrivers($db, $maxfilenamelength = 0) { global $conf; @@ -80,7 +80,7 @@ class PrintingDriver * * @return string Return translation of key PrintingModuleDescXXX where XXX is module name, or $this->desc if not exists */ - function getDesc() + public function getDesc() { global $langs; $langs->load("printing"); diff --git a/htdocs/core/modules/printing/printgcp.modules.php b/htdocs/core/modules/printing/printgcp.modules.php index d061fc33b7d..b8bccf0280b 100644 --- a/htdocs/core/modules/printing/printgcp.modules.php +++ b/htdocs/core/modules/printing/printgcp.modules.php @@ -70,7 +70,7 @@ class printing_printgcp extends PrintingDriver * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { global $conf, $langs, $dolibarr_main_url_root; @@ -89,47 +89,47 @@ class printing_printgcp extends PrintingDriver ); } else { - $this->google_id = $conf->global->OAUTH_GOOGLE_ID; - $this->google_secret = $conf->global->OAUTH_GOOGLE_SECRET; - // Token storage - $storage = new DoliStorage($this->db, $this->conf); - //$storage->clearToken($this->OAUTH_SERVICENAME_GOOGLE); - // Setup the credentials for the requests + $this->google_id = $conf->global->OAUTH_GOOGLE_ID; + $this->google_secret = $conf->global->OAUTH_GOOGLE_SECRET; + // Token storage + $storage = new DoliStorage($this->db, $this->conf); + //$storage->clearToken($this->OAUTH_SERVICENAME_GOOGLE); + // Setup the credentials for the requests $credentials = new Credentials( - $this->google_id, - $this->google_secret, - $urlwithroot.'/core/modules/oauth/google_oauthcallback.php' - ); - $access = ($storage->hasAccessToken($this->OAUTH_SERVICENAME_GOOGLE)?'HasAccessToken':'NoAccessToken'); - $serviceFactory = new \OAuth\ServiceFactory(); - $apiService = $serviceFactory->createService($this->OAUTH_SERVICENAME_GOOGLE, $credentials, $storage, array()); - $token_ok=true; - try { - $token = $storage->retrieveAccessToken($this->OAUTH_SERVICENAME_GOOGLE); - } catch (Exception $e) { - $this->errors[] = $e->getMessage(); - $token_ok = false; - } - //var_dump($this->errors);exit; + $this->google_id, + $this->google_secret, + $urlwithroot.'/core/modules/oauth/google_oauthcallback.php' + ); + $access = ($storage->hasAccessToken($this->OAUTH_SERVICENAME_GOOGLE)?'HasAccessToken':'NoAccessToken'); + $serviceFactory = new \OAuth\ServiceFactory(); + $apiService = $serviceFactory->createService($this->OAUTH_SERVICENAME_GOOGLE, $credentials, $storage, array()); + $token_ok=true; + try { + $token = $storage->retrieveAccessToken($this->OAUTH_SERVICENAME_GOOGLE); + } catch (Exception $e) { + $this->errors[] = $e->getMessage(); + $token_ok = false; + } + //var_dump($this->errors);exit; - $expire = false; - // Is token expired or will token expire in the next 30 seconds - if ($token_ok) { - $expire = ($token->getEndOfLife() !== -9002 && $token->getEndOfLife() !== -9001 && time() > ($token->getEndOfLife() - 30)); - } + $expire = false; + // Is token expired or will token expire in the next 30 seconds + if ($token_ok) { + $expire = ($token->getEndOfLife() !== -9002 && $token->getEndOfLife() !== -9001 && time() > ($token->getEndOfLife() - 30)); + } - // Token expired so we refresh it - if ($token_ok && $expire) { - try { - // il faut sauvegarder le refresh token car google ne le donne qu'une seule fois - $refreshtoken = $token->getRefreshToken(); - $token = $apiService->refreshAccessToken($token); - $token->setRefreshToken($refreshtoken); - $storage->storeAccessToken($this->OAUTH_SERVICENAME_GOOGLE, $token); - } catch (Exception $e) { - $this->errors[] = $e->getMessage(); - } - } + // Token expired so we refresh it + if ($token_ok && $expire) { + try { + // il faut sauvegarder le refresh token car google ne le donne qu'une seule fois + $refreshtoken = $token->getRefreshToken(); + $token = $apiService->refreshAccessToken($token); + $token->setRefreshToken($refreshtoken); + $storage->storeAccessToken($this->OAUTH_SERVICENAME_GOOGLE, $token); + } catch (Exception $e) { + $this->errors[] = $e->getMessage(); + } + } if ($this->google_id != '' && $this->google_secret != '') { $this->conf[] = array('varname'=>'PRINTGCP_INFO', 'info'=>'GoogleAuthConfigured', 'type'=>'info'); $this->conf[] = array( diff --git a/htdocs/core/modules/printing/printipp.modules.php b/htdocs/core/modules/printing/printipp.modules.php index af650b1695e..f5ebbdd53de 100644 --- a/htdocs/core/modules/printing/printipp.modules.php +++ b/htdocs/core/modules/printing/printipp.modules.php @@ -62,7 +62,7 @@ class printing_printipp extends PrintingDriver * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { global $conf; @@ -152,7 +152,7 @@ class printing_printipp extends PrintingDriver * * @return int 0 if OK, >0 if KO */ - function listAvailablePrinters() + public function listAvailablePrinters() { global $conf, $langs; $error = 0; diff --git a/htdocs/core/modules/propale/mod_propale_marbre.php b/htdocs/core/modules/propale/mod_propale_marbre.php index abbc4df42b6..0e03574a3d4 100644 --- a/htdocs/core/modules/propale/mod_propale_marbre.php +++ b/htdocs/core/modules/propale/mod_propale_marbre.php @@ -62,7 +62,7 @@ class mod_propale_marbre extends ModeleNumRefPropales * * @return string Text with description */ - function info() + public function info() { global $langs; return $langs->trans("SimpleNumRefModelDesc", $this->prefix); @@ -74,7 +74,7 @@ class mod_propale_marbre extends ModeleNumRefPropales * * @return string Example */ - function getExample() + public function getExample() { return $this->prefix."0501-0001"; } @@ -86,7 +86,7 @@ class mod_propale_marbre extends ModeleNumRefPropales * * @return boolean false si conflit, true si ok */ - function canBeActivated() + public function canBeActivated() { global $conf,$langs,$db; @@ -124,7 +124,7 @@ class mod_propale_marbre extends ModeleNumRefPropales * @param Propal $propal Object commercial proposal * @return string Next value */ - function getNextValue($objsoc, $propal) + public function getNextValue($objsoc, $propal) { global $db,$conf; @@ -165,7 +165,7 @@ class mod_propale_marbre extends ModeleNumRefPropales * @param Object $objforref Object for number to search * @return string Next free value */ - function getNumRef($objsoc, $objforref) + public function getNumRef($objsoc, $objforref) { return $this->getNextValue($objsoc, $objforref); } diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index 4391d14ea3c..66b395c6c8b 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -44,10 +44,10 @@ class SupplierInvoices extends DolibarrApi /** * Constructor */ - function __construct() + public function __construct() { - global $db, $conf; - $this->db = $db; + global $db, $conf; + $this->db = $db; $this->invoice = new FactureFournisseur($this->db); } @@ -61,23 +61,23 @@ class SupplierInvoices extends DolibarrApi * * @throws RestException */ - function get($id) + public function get($id) { - if(! DolibarrApiAccess::$user->rights->fournisseur->facture->lire) { - throw new RestException(401); - } + if(! DolibarrApiAccess::$user->rights->fournisseur->facture->lire) { + throw new RestException(401); + } $result = $this->invoice->fetch($id); if( ! $result ) { throw new RestException(404, 'Supplier invoice not found'); } - if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } + if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } - $this->invoice->fetchObjectLinked(); - return $this->_cleanObjectDatas($this->invoice); + $this->invoice->fetchObjectLinked(); + return $this->_cleanObjectDatas($this->invoice); } /** @@ -94,9 +94,9 @@ class SupplierInvoices extends DolibarrApi * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')" * @return array Array of invoice objects * - * @throws RestException + * @throws RestException */ - function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $status = '', $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $status = '', $sqlfilters = '') { global $db, $conf; @@ -120,7 +120,7 @@ class SupplierInvoices extends DolibarrApi if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")"; if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale - // Filter by status + // Filter by status if ($status == 'draft') $sql.= " AND t.fk_statut IN (0)"; if ($status == 'unpaid') $sql.= " AND t.fk_statut IN (1)"; if ($status == 'paid') $sql.= " AND t.fk_statut IN (2)"; @@ -137,7 +137,7 @@ class SupplierInvoices extends DolibarrApi { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } @@ -182,7 +182,7 @@ class SupplierInvoices extends DolibarrApi * @param array $request_data Request datas * @return int ID of supplier invoice */ - function post($request_data = null) + public function post($request_data = null) { if(! DolibarrApiAccess::$user->rights->fournisseur->facture->creer) { throw new RestException(401, "Insuffisant rights"); @@ -218,7 +218,7 @@ class SupplierInvoices extends DolibarrApi * @param array $request_data Datas * @return int */ - function put($id, $request_data = null) + public function put($id, $request_data = null) { if(! DolibarrApiAccess::$user->rights->fournisseur->facture->creer) { throw new RestException(401); @@ -229,9 +229,9 @@ class SupplierInvoices extends DolibarrApi throw new RestException(404, 'Supplier invoice not found'); } - if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } + if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } foreach($request_data as $field => $value) { if ($field == 'id') continue; @@ -250,7 +250,7 @@ class SupplierInvoices extends DolibarrApi * @param int $id Supplier invoice ID * @return type */ - function delete($id) + public function delete($id) { if(! DolibarrApiAccess::$user->rights->fournisseur->facture->supprimer) { throw new RestException(401); @@ -260,9 +260,9 @@ class SupplierInvoices extends DolibarrApi throw new RestException(404, 'Supplier invoice not found'); } - if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } + if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } if( $this->invoice->delete(DolibarrApiAccess::$user) < 0) { @@ -296,34 +296,34 @@ class SupplierInvoices extends DolibarrApi * "notrigger": 0 * } */ - function validate($id, $idwarehouse = 0, $notrigger = 0) + public function validate($id, $idwarehouse = 0, $notrigger = 0) { - if(! DolibarrApiAccess::$user->rights->fournisseur->facture->creer) { - throw new RestException(401); - } - $result = $this->invoice->fetch($id); - if( ! $result ) { - throw new RestException(404, 'Invoice not found'); - } + if(! DolibarrApiAccess::$user->rights->fournisseur->facture->creer) { + throw new RestException(401); + } + $result = $this->invoice->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Invoice not found'); + } if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - $result = $this->invoice->validate(DolibarrApiAccess::$user, '', $idwarehouse, $notrigger); - if ($result == 0) { - throw new RestException(304, 'Error nothing done. May be object is already validated'); - } - if ($result < 0) { - throw new RestException(500, 'Error when validating Invoice: '.$this->invoice->error); - } + $result = $this->invoice->validate(DolibarrApiAccess::$user, '', $idwarehouse, $notrigger); + if ($result == 0) { + throw new RestException(304, 'Error nothing done. May be object is already validated'); + } + if ($result < 0) { + throw new RestException(500, 'Error when validating Invoice: '.$this->invoice->error); + } - return array( - 'success' => array( - 'code' => 200, - 'message' => 'Invoice validated (Ref='.$this->invoice->ref.')' - ) - ); + return array( + 'success' => array( + 'code' => 200, + 'message' => 'Invoice validated (Ref='.$this->invoice->ref.')' + ) + ); } /** @@ -332,7 +332,7 @@ class SupplierInvoices extends DolibarrApi * @param Object $object Object to clean * @return array Array of cleaned object properties */ - function _cleanObjectDatas($object) + private function _cleanObjectDatas($object) { $object = parent::_cleanObjectDatas($object); @@ -354,7 +354,7 @@ class SupplierInvoices extends DolibarrApi * * @throws RestException */ - function _validate($data) + private function _validate($data) { $invoice = array(); foreach (SupplierInvoices::$FIELDS as $field) { diff --git a/htdocs/fourn/class/api_supplier_orders.class.php b/htdocs/fourn/class/api_supplier_orders.class.php index 38c9ab9e200..4da9a365e83 100644 --- a/htdocs/fourn/class/api_supplier_orders.class.php +++ b/htdocs/fourn/class/api_supplier_orders.class.php @@ -44,7 +44,7 @@ class SupplierOrders extends DolibarrApi /** * Constructor */ - function __construct() + public function __construct() { global $db, $conf; $this->db = $db; @@ -61,7 +61,7 @@ class SupplierOrders extends DolibarrApi * * @throws RestException */ - function get($id) + public function get($id) { if(! DolibarrApiAccess::$user->rights->fournisseur->commande->lire) { throw new RestException(401); @@ -96,7 +96,7 @@ class SupplierOrders extends DolibarrApi * * @throws RestException */ - function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $status = '', $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $status = '', $sqlfilters = '') { global $db, $conf; @@ -187,7 +187,7 @@ class SupplierOrders extends DolibarrApi * @param array $request_data Request datas * @return int ID of supplier order */ - function post($request_data = null) + public function post($request_data = null) { if(! DolibarrApiAccess::$user->rights->fournisseur->commande->creer) { throw new RestException(401, "Insuffisant rights"); @@ -223,7 +223,7 @@ class SupplierOrders extends DolibarrApi * @param array $request_data Datas * @return int */ - function put($id, $request_data = null) + public function put($id, $request_data = null) { if(! DolibarrApiAccess::$user->rights->fournisseur->commande->creer) { throw new RestException(401); @@ -255,7 +255,7 @@ class SupplierOrders extends DolibarrApi * @param int $id Supplier order ID * @return type */ - function delete($id) + public function delete($id) { if (! DolibarrApiAccess::$user->rights->fournisseur->commande->supprimer) { throw new RestException(401); @@ -300,7 +300,7 @@ class SupplierOrders extends DolibarrApi * "notrigger": 0 * } */ - function validate($id, $idwarehouse = 0, $notrigger = 0) + public function validate($id, $idwarehouse = 0, $notrigger = 0) { if(! DolibarrApiAccess::$user->rights->fournisseur->commande->creer) { throw new RestException(401); @@ -336,7 +336,7 @@ class SupplierOrders extends DolibarrApi * @param Object $object Object to clean * @return array Array of cleaned object properties */ - function _cleanObjectDatas($object) + private function _cleanObjectDatas($object) { $object = parent::_cleanObjectDatas($object); @@ -358,7 +358,7 @@ class SupplierOrders extends DolibarrApi * * @throws RestException */ - function _validate($data) + private function _validate($data) { $order = array(); foreach (SupplierOrders::$FIELDS as $field) { diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index 56d1e95a164..a5016822c66 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -48,7 +48,7 @@ class PaiementFourn extends Paiement public $picto = 'payment'; - var $statut; //Status of payment. 0 = unvalidated; 1 = validated + public $statut; //Status of payment. 0 = unvalidated; 1 = validated // fk_paiement dans llx_paiement est l'id du type de paiement (7 pour CHQ, ...) // fk_paiement dans llx_paiement_facture est le rowid du paiement @@ -69,7 +69,7 @@ class PaiementFourn extends Paiement * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db = $db; } @@ -82,7 +82,7 @@ class PaiementFourn extends Paiement * @param int $fk_bank Id of bank line associated to payment * @return int <0 if KO, -2 if not found, >0 if OK */ - function fetch($id, $ref = '', $fk_bank = '') + public function fetch($id, $ref = '', $fk_bank = '') { $error=0; @@ -146,7 +146,7 @@ class PaiementFourn extends Paiement * @param Societe $thirdparty Thirdparty * @return int id of created payment, < 0 if error */ - function create($user, $closepaidinvoices = 0, $thirdparty = null) + public function create($user, $closepaidinvoices = 0, $thirdparty = null) { global $langs,$conf; @@ -319,7 +319,7 @@ class PaiementFourn extends Paiement * @param int $notrigger No trigger * @return int <0 si ko, >0 si ok */ - function delete($notrigger = 0) + public function delete($notrigger = 0) { global $conf, $user, $langs; @@ -421,7 +421,7 @@ class PaiementFourn extends Paiement * @param int $id Id du paiement dont il faut afficher les infos * @return void */ - function info($id) + public function info($id) { $sql = 'SELECT c.rowid, datec, fk_user_author as fk_user_creat, tms'; $sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn as c'; @@ -465,7 +465,7 @@ class PaiementFourn extends Paiement * @param string $filter SQL filter * @return array Array of supplier invoice id */ - function getBillsArray($filter = '') + public function getBillsArray($filter = '') { $sql = 'SELECT fk_facturefourn'; $sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf, '.MAIN_DB_PREFIX.'facture_fourn as f'; @@ -503,12 +503,12 @@ class PaiementFourn extends Paiement * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle */ - function getLibStatut($mode = 0) + public function getLibStatut($mode = 0) { return $this->LibStatut($this->statut, $mode); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -516,7 +516,7 @@ class PaiementFourn extends Paiement * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ - function LibStatut($status, $mode = 0) + public function LibStatut($status, $mode = 0) { // phpcs:enable global $langs; @@ -570,7 +570,7 @@ class PaiementFourn extends Paiement * @param int $notooltip 1=Disable tooltip * @return string Chaine avec URL */ - function getNomUrl($withpicto = 0, $option = '', $mode = 'withlistofinvoices', $notooltip = 0) + public function getNomUrl($withpicto = 0, $option = '', $mode = 'withlistofinvoices', $notooltip = 0) { global $langs; @@ -606,7 +606,7 @@ class PaiementFourn extends Paiement * @param string $option ''=Create a specimen invoice with lines, 'nolines'=No lines * @return void */ - function initAsSpecimen($option = '') + public function initAsSpecimen($option = '') { global $user,$langs,$conf; @@ -631,7 +631,7 @@ class PaiementFourn extends Paiement * @param string $mode 'next' for next value or 'last' for last value * @return string free ref or last ref */ - function getNextNumRef($soc, $mode = 'next') + public function getNextNumRef($soc, $mode = 'next') { global $conf, $db, $langs; $langs->load("bills"); @@ -755,7 +755,7 @@ class PaiementFourn extends Paiement * * @return string 'dolibarr' if standard comportment or paid in dolibarr currency, 'customer' if payment received from multicurrency inputs */ - function getWay() + public function getWay() { global $conf; @@ -776,14 +776,14 @@ class PaiementFourn extends Paiement } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load the third party of object, from id into this->thirdparty * * @param int $force_thirdparty_id Force thirdparty id * @return int <0 if KO, >0 if OK */ - function fetch_thirdparty($force_thirdparty_id = 0) + public function fetch_thirdparty($force_thirdparty_id = 0) { // phpcs:enable require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';