diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index 9fda4e37901..bbe101112d0 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -12,6 +12,7 @@ */nltechno* */htdocs/includes *.min.css + *.js @@ -172,6 +173,9 @@ 0 + + + diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index 27254ef31d1..7420ae8a982 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -359,7 +359,8 @@ class AccountancyCategory // extends CommonObject * @param int $id Id * @return int <0 if KO, 0 if not found, >0 if OK */ - public function display($id) { + public function display($id) + { global $conf; $sql = "SELECT t.rowid, t.account_number, t.label"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t"; @@ -394,7 +395,8 @@ class AccountancyCategory // extends CommonObject * * @return int <0 if KO, 0 if not found, >0 if OK */ - public function getCptBK($id) { + public function getCptBK($id) + { global $conf; $sql = "SELECT t.numero_compte, t.label_operation, t.doc_ref"; @@ -442,8 +444,9 @@ class AccountancyCategory // extends CommonObject * * @return int <0 if KO, 0 if not found, >0 if OK */ - public function getAccountsWithNoCategory($id) { - global $conf; + public function getAccountsWithNoCategory($id) + { + global $conf; $sql = "SELECT aa.account_number as numero_compte, aa.label as label_compte"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa"; @@ -485,7 +488,8 @@ class AccountancyCategory // extends CommonObject * * @return int <0 if KO, >0 if OK */ - public function updateAccAcc($id_cat, $cpts = array()) { + public function updateAccAcc($id_cat, $cpts = array()) + { global $conf; $error = 0; @@ -548,7 +552,8 @@ class AccountancyCategory // extends CommonObject * * @return int <0 if KO, >0 if OK */ - public function deleteCptCat($cpt_id) { + public function deleteCptCat($cpt_id) + { $error = 0; $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account as aa"; diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 376dd9df487..b55eccef0ef 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -78,7 +78,8 @@ class AccountancyExport * * @param DoliDb $db Database handler */ - public function __construct(DoliDB &$db) { + public function __construct(DoliDB &$db) + { global $conf; $this->db = &$db; @@ -91,7 +92,8 @@ class AccountancyExport * * @return array of type */ - public static function getType() { + public static function getType() + { global $langs; return array ( @@ -113,7 +115,8 @@ class AccountancyExport * * @return array of type */ - public static function getTypeConfig() { + public static function getTypeConfig() + { global $conf, $langs; return array ( @@ -175,7 +178,8 @@ class AccountancyExport * * @return void */ - public static function downloadFile() { + public static function downloadFile() + { global $conf; $filename = 'general_ledger'; include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php'; @@ -187,7 +191,8 @@ class AccountancyExport * @param unknown $TData data * @return void */ - public function export(&$TData) { + public function export(&$TData) + { global $conf, $langs; self::downloadFile(); @@ -236,7 +241,8 @@ class AccountancyExport * * @return void */ - public function exportNormal($objectLines) { + public function exportNormal($objectLines) + { global $conf; foreach ( $objectLines as $line ) { @@ -260,7 +266,8 @@ class AccountancyExport * * @return void */ - public function exportCegid($objectLines) { + public function exportCegid($objectLines) + { foreach ( $objectLines as $line ) { $date = dol_print_date($line->doc_date, '%d%m%Y'); $separator = ";"; @@ -285,7 +292,8 @@ class AccountancyExport * * @return void */ - public function exportCogilog($objectLines) { + public function exportCogilog($objectLines) + { foreach ( $objectLines as $line ) { $date = dol_print_date($line->doc_date, '%d%m%Y'); $separator = ";"; @@ -318,7 +326,8 @@ class AccountancyExport * * @return void */ - public function exportCoala($objectLines) { + public function exportCoala($objectLines) + { // Coala export $separator = ";"; $end_line = "\n"; @@ -345,7 +354,8 @@ class AccountancyExport * * @return void */ - public function exportBob50($objectLines) { + public function exportBob50($objectLines) + { // Bob50 $separator = ";"; @@ -383,7 +393,8 @@ class AccountancyExport * * @return void */ - public function exportCiel(&$TData) { + public function exportCiel(&$TData) + { global $conf; $end_line ="\r\n"; @@ -423,7 +434,8 @@ class AccountancyExport * * @return void */ - public function exportQuadratus(&$TData) { + public function exportQuadratus(&$TData) + { global $conf; $end_line ="\r\n"; @@ -506,7 +518,8 @@ class AccountancyExport * * @return void */ - public function exportEbp($objectLines) { + public function exportEbp($objectLines) + { $separator = ','; $end_line = "\n"; @@ -538,7 +551,8 @@ class AccountancyExport * * @return void */ - public function exportAgiris($objectLines) { + public function exportAgiris($objectLines) + { $separator = ';'; $end_line = "\n"; @@ -575,7 +589,8 @@ class AccountancyExport * * @return void */ - public function exportConfigurable($objectLines) { + public function exportConfigurable($objectLines) + { global $conf; foreach ($objectLines as $line) { @@ -605,7 +620,8 @@ class AccountancyExport * @param integer $size data * @return string */ - public static function trunc($str, $size) { + public static function trunc($str, $size) + { return dol_trunc($str, $size, 'right', 'UTF-8', 1); } } diff --git a/htdocs/accountancy/class/accountancysystem.class.php b/htdocs/accountancy/class/accountancysystem.class.php index 53717968320..ef13b84b4bb 100644 --- a/htdocs/accountancy/class/accountancysystem.class.php +++ b/htdocs/accountancy/class/accountancysystem.class.php @@ -47,7 +47,8 @@ class AccountancySystem * * @param DoliDB $db handler */ - function __construct($db) { + function __construct($db) + { $this->db = $db; } @@ -106,7 +107,8 @@ class AccountancySystem * @param User $user making insert * @return int if KO, Id of line if OK */ - function create($user) { + function create($user) + { $now = dol_now(); $sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_system"; @@ -134,4 +136,4 @@ class AccountancySystem return $result; } -} \ No newline at end of file +} diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index d8ad61dc7f1..0acd6c06973 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -79,7 +79,8 @@ class AccountingAccount extends CommonObject * * @param DoliDB $db Database handle */ - function __construct($db) { + function __construct($db) + { global $conf; $this->db = $db; @@ -156,7 +157,8 @@ class AccountingAccount extends CommonObject * @param int $notrigger Disable triggers * @return int <0 if KO, >0 if OK */ - function create($user, $notrigger = 0) { + function create($user, $notrigger = 0) + { global $conf; $error = 0; $now = dol_now(); @@ -307,7 +309,8 @@ class AccountingAccount extends CommonObject * * @return int <0 if KO, >0 if OK */ - function checkUsage() { + function checkUsage() + { global $langs; $sql = "(SELECT fk_code_ventilation FROM " . MAIN_DB_PREFIX . "facturedet"; @@ -340,7 +343,8 @@ class AccountingAccount extends CommonObject * @param int $notrigger 0=triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function delete($user, $notrigger = 0) { + function delete($user, $notrigger = 0) + { $error = 0; $result = $this->checkUsage(); @@ -467,7 +471,8 @@ class AccountingAccount extends CommonObject * @param int $id of record * @return void */ - function info($id) { + function info($id) + { $sql = 'SELECT a.rowid, a.datec, a.fk_user_author, a.fk_user_modif, a.tms'; $sql .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as a'; $sql .= ' WHERE a.rowid = ' . $id; @@ -504,7 +509,8 @@ class AccountingAccount extends CommonObject * @param int $id Id * @return int <0 if KO, >0 if OK */ - function account_desactivate($id) { + function account_desactivate($id) + { $result = $this->checkUsage(); if ($result > 0) { @@ -536,7 +542,8 @@ class AccountingAccount extends CommonObject * @param int $id Id * @return int <0 if KO, >0 if OK */ - function account_activate($id) { + function account_activate($id) + { $this->db->begin(); $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account "; diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php index 454de6d7b84..2291028ddf3 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -46,7 +46,8 @@ class AccountingJournal extends CommonObject * * @param DoliDB $db Database handle */ - function __construct($db) { + function __construct($db) + { $this->db = $db; } @@ -117,7 +118,8 @@ class AccountingJournal extends CommonObject * * @return int <0 if KO, >0 if OK */ - function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') { + function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') + { $sql = "SELECT rowid, code, label, nature, active"; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; // Manage filter diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index f7fed2e2b5b..2d9e2fa4fdb 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -88,7 +88,8 @@ class BookKeeping extends CommonObject * * @param DoliDb $db Database handler */ - public function __construct(DoliDB $db) { + public function __construct(DoliDB $db) + { $this->db = $db; } @@ -99,7 +100,8 @@ class BookKeeping extends CommonObject * @param bool $notrigger false=launch triggers after, true=disable triggers * @return int <0 if KO, Id of created object if OK */ - public function create(User $user, $notrigger = false) { + public function create(User $user, $notrigger = false) + { global $conf, $langs; dol_syslog(__METHOD__, LOG_DEBUG); @@ -420,7 +422,8 @@ class BookKeeping extends CommonObject * @param string $mode Mode * @return int <0 if KO, Id of created object if OK */ - public function createStd(User $user, $notrigger = false, $mode='') { + public function createStd(User $user, $notrigger = false, $mode='') + { global $conf; dol_syslog(__METHOD__, LOG_DEBUG); @@ -590,7 +593,8 @@ class BookKeeping extends CommonObject * * @return int <0 if KO, 0 if not found, >0 if OK */ - public function fetch($id, $ref = null, $mode='') { + public function fetch($id, $ref = null, $mode='') + { global $conf; dol_syslog(__METHOD__, LOG_DEBUG); @@ -687,7 +691,8 @@ class BookKeeping extends CommonObject * * @return int <0 if KO, >=0 if OK */ - public function fetchAllByAccount($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') { + public function fetchAllByAccount($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') + { global $conf; dol_syslog(__METHOD__, LOG_DEBUG); @@ -811,7 +816,8 @@ class BookKeeping extends CommonObject * * @return int <0 if KO, >0 if OK */ - public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') { + public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') + { global $conf; dol_syslog(__METHOD__, LOG_DEBUG); @@ -1016,7 +1022,8 @@ class BookKeeping extends CommonObject * @param string $mode Mode * @return int <0 if KO, >0 if OK */ - public function update(User $user, $notrigger = false, $mode='') { + public function update(User $user, $notrigger = false, $mode='') + { $error = 0; dol_syslog(__METHOD__, LOG_DEBUG); @@ -1185,7 +1192,8 @@ class BookKeeping extends CommonObject * @param string $mode Mode * @return int <0 if KO, >0 if OK */ - public function delete(User $user, $notrigger = false, $mode='') { + public function delete(User $user, $notrigger = false, $mode='') + { dol_syslog(__METHOD__, LOG_DEBUG); $error = 0; @@ -1234,7 +1242,8 @@ class BookKeeping extends CommonObject * @param string $importkey Import key * @return int Result */ - function deleteByImportkey($importkey) { + function deleteByImportkey($importkey) + { $this->db->begin(); // first check if line not yet in bookkeeping @@ -1263,7 +1272,8 @@ class BookKeeping extends CommonObject * @param string $mode Mode * @return int <0 if KO, >0 if OK */ - function deleteByYearAndJournal($delyear='', $journal='', $mode='') { + function deleteByYearAndJournal($delyear='', $journal='', $mode='') + { global $conf; if (empty($delyear) && empty($journal)) @@ -1302,7 +1312,8 @@ class BookKeeping extends CommonObject * @param int $piecenum Piecenum to delete * @return int Result */ - function deleteMvtNum($piecenum) { + function deleteMvtNum($piecenum) + { global $conf; $this->db->begin(); @@ -1336,7 +1347,8 @@ class BookKeeping extends CommonObject * * @return int New id of clone */ - public function createFromClone($fromid) { + public function createFromClone($fromid) + { dol_syslog(__METHOD__, LOG_DEBUG); global $user; @@ -1381,7 +1393,8 @@ class BookKeeping extends CommonObject * * @return void */ - public function initAsSpecimen() { + public function initAsSpecimen() + { global $user; $now=dol_now(); @@ -1417,7 +1430,8 @@ class BookKeeping extends CommonObject * @param string $mode Mode * @return int <0 if KO, >0 if OK */ - public function fetchPerMvt($piecenum, $mode='') { + public function fetchPerMvt($piecenum, $mode='') + { global $conf; $sql = "SELECT piece_num,doc_date,code_journal,journal_label,doc_ref,doc_type,date_creation"; @@ -1481,7 +1495,8 @@ class BookKeeping extends CommonObject * @param string $mode Mode * @return int <0 if KO, >0 if OK */ - function fetchAllPerMvt($piecenum, $mode='') { + function fetchAllPerMvt($piecenum, $mode='') + { global $conf; $sql = "SELECT rowid, doc_date, doc_type,"; @@ -1539,7 +1554,8 @@ class BookKeeping extends CommonObject * @param string $model Model * @return int Result */ - function export_bookkeping($model = 'ebp') { + function export_bookkeping($model = 'ebp') + { global $conf; $sql = "SELECT rowid, doc_date, doc_type,"; @@ -1696,7 +1712,8 @@ class BookKeeping extends CommonObject * @param int $aabase Set accounting_account base class to display empty=all or from 1 to 8 will display only account beginning by this number * @return string String with HTML select */ - function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '') { + function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '') + { global $conf; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php index 217ab47c0ab..1758da55b1b 100644 --- a/htdocs/adherents/class/api_members.class.php +++ b/htdocs/adherents/class/api_members.class.php @@ -91,7 +91,8 @@ class Members extends DolibarrApi * * @throws RestException */ - function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $typeid = '', $sqlfilters = '') { + function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $typeid = '', $sqlfilters = '') + { global $db, $conf; $obj_ret = array(); @@ -293,7 +294,8 @@ class Members extends DolibarrApi * @param object $object Object to clean * @return array Array of cleaned object properties */ - function _cleanObjectDatas($object) { + function _cleanObjectDatas($object) + { $object = parent::_cleanObjectDatas($object); diff --git a/htdocs/adherents/class/api_memberstypes.class.php b/htdocs/adherents/class/api_memberstypes.class.php index 1a8e93e0609..bcba76056f1 100644 --- a/htdocs/adherents/class/api_memberstypes.class.php +++ b/htdocs/adherents/class/api_memberstypes.class.php @@ -31,7 +31,7 @@ class MembersTypes extends DolibarrApi * @var array $FIELDS Mandatory fields, checked when create and update object */ static $FIELDS = array( - 'label' + 'label', ); /** @@ -86,7 +86,8 @@ class MembersTypes extends DolibarrApi * * @throws RestException */ - function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') { + function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') + { global $db, $conf; $obj_ret = array(); @@ -271,7 +272,8 @@ class MembersTypes extends DolibarrApi * @param object $object Object to clean * @return array Array of cleaned object properties */ - function _cleanObjectDatas($object) { + function _cleanObjectDatas($object) + { $object = parent::_cleanObjectDatas($object); diff --git a/htdocs/adherents/class/api_subscriptions.class.php b/htdocs/adherents/class/api_subscriptions.class.php index 3ae4f6f39d5..ed403167dd4 100644 --- a/htdocs/adherents/class/api_subscriptions.class.php +++ b/htdocs/adherents/class/api_subscriptions.class.php @@ -34,7 +34,7 @@ class Subscriptions extends DolibarrApi 'fk_adherent', 'dateh', 'datef', - 'amount' + 'amount', ); /** @@ -85,7 +85,8 @@ class Subscriptions extends DolibarrApi * * @throws RestException */ - function index($sortfield = "dateadh", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') { + function index($sortfield = "dateadh", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') + { global $db, $conf; $obj_ret = array(); diff --git a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php index 92061ca6cec..4617481d04d 100644 --- a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php +++ b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php @@ -69,10 +69,10 @@ class PrestaShopWebservice * @param string $key Authentification key * @param mixed $debug Debug mode Activated (true) or deactivated (false) */ - function __construct($url, $key, $debug = true) { - if (!extension_loaded('curl')) { - throw new PrestaShopWebserviceException('Please activate the PHP extension \'curl\' to allow use of PrestaShop webservice library'); - } + function __construct($url, $key, $debug = true) + { + if (!extension_loaded('curl')) + throw new PrestaShopWebserviceException('Please activate the PHP extension \'curl\' to allow use of PrestaShop webservice library'); $this->url = $url; $this->key = $key; $this->debug = $debug; diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index c1de096fc7a..e003106e736 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -94,7 +94,8 @@ class DolibarrApi * @param object $object Object to clean * @return array Array of cleaned object properties */ - function _cleanObjectDatas($object) { + function _cleanObjectDatas($object) + { // Remove $db object property for object unset($object->db); @@ -220,7 +221,8 @@ class DolibarrApi * @return bool * @throws RestException */ - static function _checkAccessToResource($resource, $resource_id=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid') { + static function _checkAccessToResource($resource, $resource_id=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid') + { // Features/modules to check $featuresarray = array($resource); diff --git a/htdocs/api/class/api_login.class.php b/htdocs/api/class/api_login.class.php index 56808819b3f..797cd2429d5 100644 --- a/htdocs/api/class/api_login.class.php +++ b/htdocs/api/class/api_login.class.php @@ -26,7 +26,8 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; class Login { - function __construct() { + function __construct() + { global $db; $this->db = $db; } @@ -51,7 +52,8 @@ class Login * @url GET / * @url POST / */ - public function index($login, $password, $entity='', $reset=0) { + public function index($login, $password, $entity='', $reset=0) + { global $conf, $dolibarr_main_authentication, $dolibarr_auto_user; diff --git a/htdocs/api/class/api_status.class.php b/htdocs/api/class/api_status.class.php index 22f20c0aa34..3ade4ea51b8 100644 --- a/htdocs/api/class/api_status.class.php +++ b/htdocs/api/class/api_status.class.php @@ -26,19 +26,21 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php'; */ class Status { - /** + /** * Get status (Dolibarr version) + * * @return array - */ - function index() { - global $conf; + */ + function index() + { + global $conf; - return array( - 'success' => array( - 'code' => 200, - 'dolibarr_version' => DOL_VERSION, - 'access_locked' => (empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)?'0':$conf->global->MAIN_ONLY_LOGIN_ALLOWED) - ) - ); + return array( + 'success' => array( + 'code' => 200, + 'dolibarr_version' => DOL_VERSION, + 'access_locked' => (empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)?'0':$conf->global->MAIN_ONLY_LOGIN_ALLOWED), + ), + ); } } diff --git a/htdocs/blockedlog/class/authority.class.php b/htdocs/blockedlog/class/authority.class.php index a1539923117..11bb3aa2d0f 100644 --- a/htdocs/blockedlog/class/authority.class.php +++ b/htdocs/blockedlog/class/authority.class.php @@ -50,7 +50,8 @@ class BlockedLogAuthority * * @param DoliDB $db Database handler */ - public function __construct($db) { + public function __construct($db) + { $this->db = $db; @@ -61,7 +62,8 @@ class BlockedLogAuthority * * @return string blockchain */ - public function getLocalBlockChain() { + public function getLocalBlockChain() + { $block_static = new BlockedLog($this->db); @@ -84,7 +86,8 @@ class BlockedLogAuthority * * @return string hash md5 of blockchain */ - public function getBlockchainHash() { + public function getBlockchainHash() + { return md5($this->signature.$this->blockchain); @@ -96,7 +99,8 @@ class BlockedLogAuthority * @param string $hash hash md5 of blockchain to test * @return boolean */ - public function checkBlockchain($hash) { + public function checkBlockchain($hash) + { return ($hash === $this->getBlockchainHash() ); @@ -108,7 +112,8 @@ class BlockedLogAuthority * @param string $block new block to chain * @return void */ - public function addBlock($block) { + public function addBlock($block) + { $this->blockchain.=$block; @@ -120,7 +125,8 @@ class BlockedLogAuthority * @param string $block new block to chain * @return boolean */ - public function checkBlock($block) { + public function checkBlock($block) + { if(strlen($block)!=64) return false; @@ -142,7 +148,8 @@ class BlockedLogAuthority * @param string $signature Signature of object to load * @return int >0 if OK, <0 if KO, 0 if not found */ - public function fetch($id, $signature='') { + public function fetch($id, $signature='') + { global $langs; @@ -199,7 +206,8 @@ class BlockedLogAuthority * @param User $user Object user that create * @return int <0 if KO, >0 if OK */ - public function create($user) { + public function create($user) + { global $conf,$langs,$hookmanager; @@ -253,7 +261,8 @@ class BlockedLogAuthority * @param User $user Object user that create * @return int <0 if KO, >0 if OK */ - public function update($user) { + public function update($user) + { global $conf,$langs,$hookmanager; @@ -290,7 +299,8 @@ class BlockedLogAuthority * * @return int <0 if KO, >0 if OK */ - public function syncSignatureWithAuthority() { + public function syncSignatureWithAuthority() + { global $conf, $langs; //TODO create cron task on activation @@ -331,4 +341,4 @@ class BlockedLogAuthority return 1; } -} \ No newline at end of file +} diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index bada3f2951d..4d7c5e5c3c4 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -608,7 +608,8 @@ class BlockedLog * @param int $id Id of object to load * @return int >0 if OK, <0 if KO, 0 if not found */ - public function fetch($id) { + public function fetch($id) + { global $langs; @@ -704,7 +705,8 @@ class BlockedLog * * @return boolean */ - public function setCertified() { + public function setCertified() + { $res = $this->db->query("UPDATE ".MAIN_DB_PREFIX."blockedlog SET certified=1 WHERE rowid=".$this->id); if($res===false) return false; @@ -721,7 +723,8 @@ class BlockedLog * @param int $forcesignature Force signature (for example '0000000000' when we disabled the module) * @return int <0 if KO, >0 if OK */ - public function create($user, $forcesignature='') { + public function create($user, $forcesignature='') + { global $conf,$langs,$hookmanager; diff --git a/htdocs/cashdesk/class/Facturation.class.php b/htdocs/cashdesk/class/Facturation.class.php index a0e992e9da9..ac26a326962 100644 --- a/htdocs/cashdesk/class/Facturation.class.php +++ b/htdocs/cashdesk/class/Facturation.class.php @@ -310,7 +310,7 @@ class Facturation * @return string Ref */ public function ref($aRef=null) - { + { if (is_null($aRef)) { @@ -652,7 +652,7 @@ class Facturation { return $this->prix_total_ttc; } - else if ( $aTotalTtc == 'RESET' ) + elseif ( $aTotalTtc == 'RESET' ) { $this->prix_total_ttc = null; } @@ -663,4 +663,3 @@ class Facturation } } - diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index c559d760f0f..843e2fc0ee6 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -103,7 +103,8 @@ class Categories extends DolibarrApi * * @throws RestException */ - function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $sqlfilters = '') { + function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $sqlfilters = '') + { global $db, $conf; $obj_ret = array(); @@ -266,7 +267,8 @@ class Categories extends DolibarrApi * @param Categorie $object Object to clean * @return array Array of cleaned object properties */ - function _cleanObjectDatas($object) { + function _cleanObjectDatas($object) + { $object = parent::_cleanObjectDatas($object); diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index f5d9c7db762..e5818a9f462 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -46,8 +46,8 @@ class AgendaEvents extends DolibarrApi */ function __construct() { - global $db, $conf; - $this->db = $db; + global $db, $conf; + $this->db = $db; $this->actioncomm = new ActionComm($this->db); } @@ -99,13 +99,14 @@ class AgendaEvents extends DolibarrApi * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.label:like:'%dol%') and (t.datec:<:'20160101')" * @return array Array of Agenda Events objects */ - function index($sortfield = "t.id", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = 0, $sqlfilters = '') { + function index($sortfield = "t.id", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = 0, $sqlfilters = '') + { global $db, $conf; $obj_ret = array(); if (! DolibarrApiAccess::$user->rights->agenda->myactions->read) { - throw new RestException(401, "Insuffisant rights to read events"); + throw new RestException(401, "Insuffisant rights to read events"); } // case of external user @@ -226,7 +227,8 @@ class AgendaEvents extends DolibarrApi * @return int */ /* - function put($id, $request_data = null) { + function put($id, $request_data = null) + { if (! DolibarrApiAccess::$user->rights->agenda->myactions->create) { throw new RestException(401, "Insuffisant rights to create your Agenda Event"); } @@ -319,7 +321,8 @@ class AgendaEvents extends DolibarrApi * @param object $object Object to clean * @return array Array of cleaned object properties */ - function _cleanObjectDatas($object) { + function _cleanObjectDatas($object) + { $object = parent::_cleanObjectDatas($object); diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index 2b0e31930c2..1fe8d4efd96 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -925,7 +925,8 @@ class AdvanceTargetingMailing extends CommonObject * For exemple jean;joe;jim%%;!jimo;!jima%> will target all jean, joe, start with jim but not jimo and not everythnig taht start by jima * @return string Sql to use for the where condition */ - public function transformToSQL($column_to_test,$criteria) { + public function transformToSQL($column_to_test,$criteria) + { $return_sql_criteria = '('; //This is a multiple value test diff --git a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php index 9fb00e8dc73..76054a95879 100644 --- a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php +++ b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php @@ -37,7 +37,8 @@ class FormAdvTargetEmailing extends Form * * @param DoliDB $db handler */ - function __construct($db) { + function __construct($db) + { global $langs; $this->db = $db; @@ -50,7 +51,8 @@ class FormAdvTargetEmailing extends Form * @param string $htmlname select field * @return string select field */ - function multiselectProspectionStatus($selected_array = array(), $htmlname = 'cust_prospect_status') { + function multiselectProspectionStatus($selected_array = array(), $htmlname = 'cust_prospect_status') + { global $conf, $langs; $options_array = array(); @@ -86,7 +88,8 @@ class FormAdvTargetEmailing extends Form * @param array $selected_array or Code or Label of preselected country * @return string HTML string with select */ - function multiselectCountry($htmlname = 'country_id', $selected_array=array()) { + function multiselectCountry($htmlname = 'country_id', $selected_array=array()) + { global $conf, $langs; $langs->load("dict"); @@ -146,7 +149,8 @@ class FormAdvTargetEmailing extends Form * @param User $user User action * @return string combo list code */ - function multiselectselectSalesRepresentatives($htmlname, $selected_array, $user) { + function multiselectselectSalesRepresentatives($htmlname, $selected_array, $user) + { global $conf; @@ -187,7 +191,8 @@ class FormAdvTargetEmailing extends Form * @param array $selected_array selected array * @return string combo list code */ - function multiselectselectLanguage($htmlname='', $selected_array=array()) { + function multiselectselectLanguage($htmlname='', $selected_array=array()) + { global $conf,$langs; @@ -333,7 +338,8 @@ class FormAdvTargetEmailing extends Form * @param int $showempty show empty * @return string HTML combo */ - function advMultiselectarray($htmlname, $options_array = array(), $selected_array = array(), $showempty = 0) { + function advMultiselectarray($htmlname, $options_array = array(), $selected_array = array(), $showempty = 0) + { global $conf, $langs; $form=new Form($this->db); @@ -420,7 +426,8 @@ class FormAdvTargetEmailing extends Form * @param string $type_element Type element. Example: 'mailing' * @return string HTML combo */ - public function selectAdvtargetemailingTemplate($htmlname='template_id', $selected=0, $showempty=0, $type_element='mailing') { + public function selectAdvtargetemailingTemplate($htmlname='template_id', $selected=0, $showempty=0, $type_element='mailing') + { global $conf, $user, $langs; $out = ''; @@ -463,4 +470,4 @@ class FormAdvTargetEmailing extends Form $this->db->free ( $resql ); return $out; } -} \ No newline at end of file +} diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index 39857d88365..0313add9cae 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -97,7 +97,8 @@ class Proposals 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 order objects */ - function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') { + function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') + { global $db, $conf; $obj_ret = array(); @@ -215,7 +216,8 @@ class Proposals extends DolibarrApi * * @return int */ - function getLines($id) { + function getLines($id) + { if(! DolibarrApiAccess::$user->rights->propal->lire) { throw new RestException(401); } @@ -381,7 +383,8 @@ class Proposals extends DolibarrApi * @throws 401 * @throws 404 */ - function deleteLine($id, $lineid) { + function deleteLine($id, $lineid) + { if(! DolibarrApiAccess::$user->rights->propal->creer) { throw new RestException(401); } @@ -415,7 +418,8 @@ class Proposals extends DolibarrApi * * @return int */ - function put($id, $request_data = null) { + function put($id, $request_data = null) + { if(! DolibarrApiAccess::$user->rights->propal->creer) { throw new RestException(401); } @@ -703,23 +707,24 @@ class Proposals extends DolibarrApi } - /** - * Clean sensible object datas - * - * @param object $object Object to clean - * @return array Array of cleaned object properties - */ - function _cleanObjectDatas($object) { + /** + * Clean sensible object datas + * + * @param object $object Object to clean + * @return array Array of cleaned object properties + */ + function _cleanObjectDatas($object) + { - $object = parent::_cleanObjectDatas($object); + $object = parent::_cleanObjectDatas($object); - unset($object->note); - unset($object->name); - unset($object->lastname); - unset($object->firstname); - unset($object->civility_id); - unset($object->address); + unset($object->note); + unset($object->name); + unset($object->lastname); + unset($object->firstname); + unset($object->civility_id); + unset($object->address); - return $object; - } + return $object; + } } diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index d43325f9c58..c0266d76d70 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -97,9 +97,10 @@ class Orders extends DolibarrApi * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" * @return array Array of order objects * - * @throws RestException + * @throws RestException */ - function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') { + function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') + { global $db, $conf; $obj_ret = array(); @@ -218,7 +219,8 @@ class Orders extends DolibarrApi * * @return int */ - function getLines($id) { + function getLines($id) + { if(! DolibarrApiAccess::$user->rights->commande->lire) { throw new RestException(401); } @@ -249,7 +251,8 @@ class Orders extends DolibarrApi * * @return int */ - function postLine($id, $request_data = null) { + function postLine($id, $request_data = null) + { if(! DolibarrApiAccess::$user->rights->commande->creer) { throw new RestException(401); } @@ -311,7 +314,8 @@ class Orders extends DolibarrApi * * @return object */ - function putLine($id, $lineid, $request_data = null) { + function putLine($id, $lineid, $request_data = null) + { if(! DolibarrApiAccess::$user->rights->commande->creer) { throw new RestException(401); } @@ -371,7 +375,8 @@ class Orders extends DolibarrApi * @throws 401 * @throws 404 */ - function deleteLine($id, $lineid) { + function deleteLine($id, $lineid) + { if(! DolibarrApiAccess::$user->rights->commande->creer) { throw new RestException(401); } @@ -403,7 +408,8 @@ class Orders extends DolibarrApi * * @return int */ - function put($id, $request_data = null) { + function put($id, $request_data = null) + { if (! DolibarrApiAccess::$user->rights->commande->creer) { throw new RestException(401); } @@ -544,7 +550,8 @@ class Orders extends DolibarrApi * @throws 404 * @throws 405 */ - function reopen($id) { + function reopen($id) + { if(! DolibarrApiAccess::$user->rights->commande->creer) { throw new RestException(401); @@ -581,7 +588,8 @@ class Orders extends DolibarrApi * @throws 404 * @throws 405 */ - function setinvoiced($id) { + function setinvoiced($id) + { if(! DolibarrApiAccess::$user->rights->commande->creer) { throw new RestException(401); @@ -706,21 +714,22 @@ class Orders extends DolibarrApi } - /** - * Create an order using an existing proposal. - * - * - * @param int $proposalid Id of the proposal - * - * @url POST /createfromproposal/{proposalid} - * - * @return int - * @throws 400 - * @throws 401 - * @throws 404 - * @throws 405 - */ - function createOrderFromProposal($proposalid) { + /** + * Create an order using an existing proposal. + * + * + * @param int $proposalid Id of the proposal + * + * @url POST /createfromproposal/{proposalid} + * + * @return int + * @throws 400 + * @throws 401 + * @throws 404 + * @throws 405 + */ + function createOrderFromProposal($proposalid) + { require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php'; @@ -756,7 +765,8 @@ class Orders extends DolibarrApi * @param object $object Object to clean * @return array Array of cleaned object properties */ - function _cleanObjectDatas($object) { + function _cleanObjectDatas($object) + { $object = parent::_cleanObjectDatas($object); diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index f51fa829912..247cecb2eea 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -945,7 +945,8 @@ class Account extends CommonObject * @param int[]|int $categories Category or categories IDs * @return void */ - public function setCategories($categories) { + public function setCategories($categories) + { // Handle single category if (! is_array($categories)) { $categories = array($categories); diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 2b8ebd57d06..ab2903c95b4 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -32,7 +32,7 @@ class Invoices extends DolibarrApi * @var array $FIELDS Mandatory fields, checked when create and update object */ static $FIELDS = array( - 'socid' + 'socid', ); /** @@ -104,7 +104,8 @@ class Invoices extends DolibarrApi * * @throws RestException */ - function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids='', $status='', $sqlfilters = '') { + function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids='', $status='', $sqlfilters = '') + { global $db, $conf; $obj_ret = array(); @@ -245,7 +246,8 @@ class Invoices extends DolibarrApi * @throws 404 * @throws 405 */ - function createInvoiceFromOrder($orderid) { + function createInvoiceFromOrder($orderid) + { require_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php'; @@ -282,7 +284,8 @@ class Invoices extends DolibarrApi * * @return int */ - function getLines($id) { + function getLines($id) + { if(! DolibarrApiAccess::$user->rights->facture->lire) { throw new RestException(401); } @@ -319,7 +322,8 @@ class Invoices extends DolibarrApi * @throws 401 * @throws 404 */ - function putLine($id, $lineid, $request_data = null) { + function putLine($id, $lineid, $request_data = null) + { if(! DolibarrApiAccess::$user->rights->facture->creer) { throw new RestException(401); } @@ -383,7 +387,8 @@ class Invoices extends DolibarrApi * @throws 404 * @throws 405 */ - function deleteLine($id, $lineid) { + function deleteLine($id, $lineid) + { if(! DolibarrApiAccess::$user->rights->facture->creer) { throw new RestException(401); @@ -511,7 +516,8 @@ class Invoices extends DolibarrApi * @throws 404 * @throws 400 */ - function postLine($id, $request_data = null) { + function postLine($id, $request_data = null) + { if(! DolibarrApiAccess::$user->rights->facture->creer) { throw new RestException(401); } @@ -849,7 +855,8 @@ class Invoices extends DolibarrApi * @throws 404 * @throws 405 */ - function useDiscount($id, $discountid) { + function useDiscount($id, $discountid) + { if(! DolibarrApiAccess::$user->rights->facture->creer) { throw new RestException(401); @@ -894,7 +901,8 @@ class Invoices extends DolibarrApi * @throws 404 * @throws 405 */ - function useCreditNote($id, $discountid) { + function useCreditNote($id, $discountid) + { require_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php'; @@ -938,7 +946,8 @@ class Invoices extends DolibarrApi * @throws 404 * @throws 405 */ - function getPayments($id) { + function getPayments($id) + { if(! DolibarrApiAccess::$user->rights->facture->lire) { throw new RestException(401); @@ -985,8 +994,9 @@ class Invoices extends DolibarrApi * @throws 401 * @throws 404 */ - function addPayment($id, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_paiement='', $comment='', $chqemetteur='', $chqbank='') { - global $conf; + function addPayment($id, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_paiement='', $comment='', $chqemetteur='', $chqbank='') + { + global $conf; require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php'; @@ -1215,18 +1225,19 @@ class Invoices extends DolibarrApi * @param object $object Object to clean * @return array Array of cleaned object properties */ - function _cleanObjectDatas($object) { + function _cleanObjectDatas($object) + { - $object = parent::_cleanObjectDatas($object); + $object = parent::_cleanObjectDatas($object); unset($object->note); - unset($object->address); - unset($object->barcode_type); - unset($object->barcode_type_code); - unset($object->barcode_type_label); - unset($object->barcode_type_coder); + unset($object->address); + unset($object->barcode_type); + unset($object->barcode_type_code); + unset($object->barcode_type_label); + unset($object->barcode_type_coder); - return $object; + return $object; } /** @@ -1241,8 +1252,9 @@ class Invoices extends DolibarrApi { $invoice = array(); foreach (Invoices::$FIELDS as $field) { - if (!isset($data[$field])) + if (!isset($data[$field])) { throw new RestException(400, "$field field missing"); + } $invoice[$field] = $data[$field]; } return $invoice; diff --git a/htdocs/contrat/class/api_contracts.class.php b/htdocs/contrat/class/api_contracts.class.php index f5303074e63..8c206554ee1 100644 --- a/htdocs/contrat/class/api_contracts.class.php +++ b/htdocs/contrat/class/api_contracts.class.php @@ -100,7 +100,8 @@ class Contracts extends DolibarrApi * * @throws RestException */ - function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') { + function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') + { global $db, $conf; $obj_ret = array(); @@ -216,7 +217,8 @@ class Contracts extends DolibarrApi * * @return int */ - function getLines($id) { + function getLines($id) + { if(! DolibarrApiAccess::$user->rights->contrat->lire) { throw new RestException(401); } @@ -247,7 +249,8 @@ class Contracts extends DolibarrApi * * @return int */ - function postLine($id, $request_data = null) { + function postLine($id, $request_data = null) + { if(! DolibarrApiAccess::$user->rights->contrat->creer) { throw new RestException(401); } @@ -300,7 +303,8 @@ class Contracts extends DolibarrApi * * @return object */ - function putLine($id, $lineid, $request_data = null) { + function putLine($id, $lineid, $request_data = null) + { if(! DolibarrApiAccess::$user->rights->contrat->creer) { throw new RestException(401); } @@ -359,7 +363,8 @@ class Contracts extends DolibarrApi * * @return object */ - function activateLine($id, $lineid, $datestart, $dateend = null, $comment = null) { + function activateLine($id, $lineid, $datestart, $dateend = null, $comment = null) + { if(! DolibarrApiAccess::$user->rights->contrat->creer) { throw new RestException(401); } @@ -396,7 +401,8 @@ class Contracts extends DolibarrApi * * @return object */ - function unactivateLine($id, $lineid, $datestart, $comment = null) { + function unactivateLine($id, $lineid, $datestart, $comment = null) + { if(! DolibarrApiAccess::$user->rights->contrat->creer) { throw new RestException(401); } @@ -436,7 +442,8 @@ class Contracts extends DolibarrApi * @throws 401 * @throws 404 */ - function deleteLine($id, $lineid) { + function deleteLine($id, $lineid) + { if(! DolibarrApiAccess::$user->rights->contrat->creer) { throw new RestException(401); } @@ -470,7 +477,8 @@ class Contracts extends DolibarrApi * * @return int */ - function put($id, $request_data = null) { + function put($id, $request_data = null) + { if(! DolibarrApiAccess::$user->rights->contrat->creer) { throw new RestException(401); } @@ -632,7 +640,8 @@ class Contracts extends DolibarrApi * @param object $object Object to clean * @return array Array of cleaned object properties */ - function _cleanObjectDatas($object) { + function _cleanObjectDatas($object) + { $object = parent::_cleanObjectDatas($object); diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index a867d8937c9..1fb2bb3afa6 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2350,7 +2350,8 @@ class Contrat extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int New id of clone */ - function createFromClone($socid = 0, $notrigger=0) { + function createFromClone($socid = 0, $notrigger=0) + { global $db, $user, $langs, $conf, $hookmanager; dol_include_once('/projet/class/project.class.php'); diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 70058ae4a7c..629bc19e390 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -42,9 +42,10 @@ abstract class CommonDocGenerator * * @param DoliDB $db Database handler */ - public function __construct($db) { - $this->db = $db; - } + public function __construct($db) + { + $this->db = $db; + } /** @@ -228,7 +229,8 @@ abstract class CommonDocGenerator * @param array_key $array_key Name of the key for return array * @return array of substitution key->code */ - function get_substitutionarray_contact($object, $outputlangs, $array_key = 'object') { + function get_substitutionarray_contact($object, $outputlangs, $array_key = 'object') + { global $conf; if(empty($object->country) && ! empty($object->country_code)) @@ -652,7 +654,8 @@ abstract class CommonDocGenerator * @param boolean $recursive Want to fetch child array or child object * @return array Array of substitution key->code */ - function get_substitutionarray_each_var_object(&$object,$outputlangs,$recursive=true) { + function get_substitutionarray_each_var_object(&$object,$outputlangs,$recursive=true) + { $array_other = array(); if(!empty($object)) { foreach($object as $key => $value) { @@ -769,10 +772,9 @@ abstract class CommonDocGenerator */ function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0) { - if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y); - $pdf->line($x+$l, $y, $x+$l, $y+$h); - if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h); - $pdf->line($x, $y+$h, $x, $y); + if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y); + $pdf->line($x+$l, $y, $x+$l, $y+$h); + if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h); + $pdf->line($x, $y+$h, $x, $y); } } - diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 51f57dc7eab..18578edbb8d 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6874,7 +6874,8 @@ abstract class CommonObject * @param array $fieldsentry Properties of field * @return string */ - protected function quote($value, $fieldsentry) { + protected function quote($value, $fieldsentry) + { if (is_null($value)) return 'NULL'; else if (preg_match('/^(int|double|real)/i', $fieldsentry['type'])) return $this->db->escape("$value"); else return "'".$this->db->escape($value)."'"; diff --git a/htdocs/core/class/commonstickergenerator.class.php b/htdocs/core/class/commonstickergenerator.class.php index c6ef9351b69..efd0f491162 100644 --- a/htdocs/core/class/commonstickergenerator.class.php +++ b/htdocs/core/class/commonstickergenerator.class.php @@ -216,7 +216,7 @@ abstract class CommonStickerGenerator * @param string $dest to * @return float value value after conversion */ - function _Convert_Metric ($value, $src, $dest) + function _Convert_Metric($value, $src, $dest) { if ($src != $dest) { $tab['in'] = 39.37008; diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php index 17e437f5223..b6030809d6f 100644 --- a/htdocs/core/class/html.formaccounting.class.php +++ b/htdocs/core/class/html.formaccounting.class.php @@ -216,7 +216,8 @@ class FormAccounting extends Form * @param string $selectedkey Value * @return string HTML edit field */ - function select_bookkeeping_importkey($htmlname = 'importkey', $selectedkey = '') { + function select_bookkeeping_importkey($htmlname = 'importkey', $selectedkey = '') + { $options = array(); $sql = 'SELECT DISTINCT import_key from ' . MAIN_DB_PREFIX . 'accounting_bookkeeping'; @@ -339,7 +340,8 @@ class FormAccounting extends Form * @param string $morecss More css * @return string String with HTML select */ - function select_auxaccount($selectid, $htmlname='account_num_aux', $showempty=0, $morecss='maxwidth200') { + function select_auxaccount($selectid, $htmlname='account_num_aux', $showempty=0, $morecss='maxwidth200') + { $aux_account = array(); @@ -428,4 +430,3 @@ class FormAccounting extends Form } } } - diff --git a/htdocs/core/class/html.formmailing.class.php b/htdocs/core/class/html.formmailing.class.php index e3e6ce4cbf9..c0cadfba460 100644 --- a/htdocs/core/class/html.formmailing.class.php +++ b/htdocs/core/class/html.formmailing.class.php @@ -23,7 +23,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/html.form.class.php'; /** - * Class to offer components to list and upload files + * Class to offer components to list and upload files */ class FormMailing extends Form { @@ -37,7 +37,8 @@ class FormMailing extends Form * @param integer $show_empty Show empty option * @return string HTML select */ - public function selectDestinariesStatus($selectedid='',$htmlname='dest_status', $show_empty=0) { + public function selectDestinariesStatus($selectedid='', $htmlname='dest_status', $show_empty=0) + { global $langs; $langs->load("mails"); @@ -54,5 +55,5 @@ class FormMailing extends Form $options = $options + $mailing->statut_dest; return Form::selectarray($htmlname, $options, $selectedid, 0, 0, 0, '', 1); - } + } } diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index f54caacff8b..cd1f4a64c17 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -370,7 +370,8 @@ class Ldap * * @return boolean version */ - function setVersion() { + function setVersion() + { // LDAP_OPT_PROTOCOL_VERSION est une constante qui vaut 17 $ldapsetversion = ldap_set_option($this->connection, LDAP_OPT_PROTOCOL_VERSION, $this->ldapProtocolVersion); return $ldapsetversion; @@ -381,7 +382,8 @@ class Ldap * * @return boolean referrals */ - function setReferrals() { + function setReferrals() + { // LDAP_OPT_REFERRALS est une constante qui vaut ? $ldapreferrals = ldap_set_option($this->connection, LDAP_OPT_REFERRALS, 0); return $ldapreferrals; diff --git a/htdocs/core/class/openid.class.php b/htdocs/core/class/openid.class.php index d46481a0c60..7d36df58b81 100644 --- a/htdocs/core/class/openid.class.php +++ b/htdocs/core/class/openid.class.php @@ -30,8 +30,8 @@ class SimpleOpenID var $URLs = array(); var $error = array(); var $fields = array( - 'required' => array(), - 'optional' => array(), + 'required' => array(), + 'optional' => array(), ); /** @@ -126,7 +126,8 @@ class SimpleOpenID * @return void */ function SetIdentity($a) - { // Set Identity URL + { + // Set Identity URL if ((stripos($a, 'http://') === false) && (stripos($a, 'https://') === false)){ $a = 'http://'.$a; @@ -153,7 +154,8 @@ class SimpleOpenID * @return string */ function GetIdentity() - { // Get Identity + { + // Get Identity return $this->openid_url_identity; } @@ -254,7 +256,8 @@ class SimpleOpenID * @return false|string false if KO, string of url if OK */ function array2url($arr) - { // converts associated array to URL Query String + { + // converts associated array to URL Query String if (!is_array($arr)){ return false; } @@ -306,7 +309,8 @@ class SimpleOpenID * @return string */ function CURL_Request($url, $method="GET", $params = "") - { // Remember, SSL MUST BE SUPPORTED + { + // Remember, SSL MUST BE SUPPORTED if (is_array($params)) $params = $this->array2url($params); $curl = curl_init($url . ($method == "GET" && $params != "" ? "?" . $params : "")); @@ -361,7 +365,7 @@ class SimpleOpenID */ function GetOpenIDServer($url='') { - global $conf; + global $conf; include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; if (empty($url)) $url=$conf->global->MAIN_AUTHENTICATION_OPENID_URL; @@ -522,4 +526,3 @@ class SimpleOpenID } } - diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index 7f0f8143cbd..c18e2232c01 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -1650,7 +1650,7 @@ class SMTPs * @param integer $_value Message Priority * @return void */ - function setPriority ( $_value = 3 ) + function setPriority( $_value = 3 ) { if ( ( is_numeric($_value) ) && ( ( $_value >= 0 ) && ( $_value <= 5 ) ) ) @@ -1814,12 +1814,14 @@ class SMTPs * @param int $_errNum Error Code Number * @param string $_errMsg Error Message * @return void - */ - function _setErr ( $_errNum, $_errMsg ) - { - $this->_smtpsErrors[] = array( 'num' => $_errNum, - 'msg' => $_errMsg ); - } + */ + function _setErr( $_errNum, $_errMsg ) + { + $this->_smtpsErrors[] = array( + 'num' => $_errNum, + 'msg' => $_errMsg, + ); + } /** * Returns errors codes and messages for Class @@ -2049,4 +2051,3 @@ class SMTPs * - basic shell with some commets * */ - diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index 3a7a79122c9..b9a9ad6f4bf 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -677,7 +677,8 @@ class Utils * * @return int 0 if OK, < 0 if KO */ - function compressSyslogs() { + function compressSyslogs() + { global $conf; if(empty($conf->loghandlers['mod_syslog_file'])) { // File Syslog disabled diff --git a/htdocs/core/class/vcard.class.php b/htdocs/core/class/vcard.class.php index abd63fa5ef4..81fcb25e2b4 100644 --- a/htdocs/core/class/vcard.class.php +++ b/htdocs/core/class/vcard.class.php @@ -111,12 +111,13 @@ class vCard * mise en forme de la photo * warning NON TESTE ! * - * @param string $type Type - * @param string $photo Photo - * @return void - */ + * @param string $type Type + * @param string $photo Photo + * @return void + */ function setPhoto($type, $photo) - { // $type = "GIF" | "JPEG" + { + // $type = "GIF" | "JPEG" $this->properties["PHOTO;TYPE=$type;ENCODING=BASE64"] = base64_encode($photo); } @@ -200,7 +201,8 @@ class vCard * @param string $type Type * @return void */ - function setLabel($postoffice="", $extended="", $street="", $city="", $region="", $zip="", $country="", $type="HOME;POSTAL") { + function setLabel($postoffice="", $extended="", $street="", $city="", $region="", $zip="", $country="", $type="HOME;POSTAL") + { $label = ""; if ($postoffice!="") $label.= "$postoffice\r\n"; if ($extended!="") $label.= "$extended\r\n"; diff --git a/htdocs/core/db/mssql.class.php b/htdocs/core/db/mssql.class.php index 4734c3364b5..be980c306ec 100644 --- a/htdocs/core/db/mssql.class.php +++ b/htdocs/core/db/mssql.class.php @@ -1138,7 +1138,8 @@ class DoliDBMssql extends DoliDB * @param string $fieldname Field's name to escape * @return string field's name escaped */ - function EscapeFieldName($fieldname) { + function EscapeFieldName($fieldname) + { return "[".$fieldname."]"; } @@ -1150,7 +1151,8 @@ class DoliDBMssql extends DoliDB * @param mixed $fields String for one field or array of string for multiple field * @return false|object */ - function GetFieldInformation($table,$fields) { + function GetFieldInformation($table,$fields) + { $sql="SELECT * from INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='".$this->escape($table)."' AND COLUMN_NAME"; if (is_array($fields)) { @@ -1176,4 +1178,3 @@ class DoliDBMssql extends DoliDB } } - diff --git a/htdocs/core/db/sqlite3.class.php b/htdocs/core/db/sqlite3.class.php index 78762f282b4..a08756f786a 100644 --- a/htdocs/core/db/sqlite3.class.php +++ b/htdocs/core/db/sqlite3.class.php @@ -1302,7 +1302,8 @@ class DoliDBSqlite3 extends DoliDB * @param int $day Day * @return int Formatted date */ - private static function calc_daynr($year, $month, $day) { + private static function calc_daynr($year, $month, $day) + { $y = $year; if ($y == 0 && $month == 0) return 0; $num = (365* $y + 31 * ($month - 1) + $day); @@ -1322,7 +1323,8 @@ class DoliDBSqlite3 extends DoliDB * @param bool $sunday_first_day_of_week ??? * @return int */ - private static function calc_weekday($daynr, $sunday_first_day_of_week) { + private static function calc_weekday($daynr, $sunday_first_day_of_week) + { $ret = floor(($daynr + 5 + ($sunday_first_day_of_week ? 1 : 0)) % 7); return $ret; } @@ -1348,7 +1350,8 @@ class DoliDBSqlite3 extends DoliDB * @param string $calc_year ??? * @return string ??? */ - private static function calc_week($year, $month, $day, $week_behaviour, &$calc_year) { + private static function calc_week($year, $month, $day, $week_behaviour, &$calc_year) + { $daynr=self::calc_daynr($year,$month,$day); $first_daynr=self::calc_daynr($year,1,1); $monday_first= ($week_behaviour & self::WEEK_MONDAY_FIRST) ? 1 : 0; @@ -1388,4 +1391,3 @@ class DoliDBSqlite3 extends DoliDB } } - diff --git a/htdocs/core/filemanagerdol/connectors/php/io.php b/htdocs/core/filemanagerdol/connectors/php/io.php index 8fee80af4bd..3ac325ed5d4 100644 --- a/htdocs/core/filemanagerdol/connectors/php/io.php +++ b/htdocs/core/filemanagerdol/connectors/php/io.php @@ -399,7 +399,7 @@ EOF; * @param string $customMsg customMsg * @return void */ -function SendCKEditorResults ($callback, $sFileUrl, $customMsg = '') +function SendCKEditorResults($callback, $sFileUrl, $customMsg = '') { echo '