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/api/class/api.class.php b/htdocs/api/class/api.class.php index 5918b1a5414..954fa0d7ec9 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); @@ -219,7 +220,8 @@ class DolibarrApi * @param string $dbt_select Field name for select if not rowid. Not used if objectid is null (optional) * @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 ea61731b51a..a9e50af0941 100644 --- a/htdocs/api/class/api_status.class.php +++ b/htdocs/api/class/api_status.class.php @@ -26,18 +26,19 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php'; */ class Status { - /** + /** * Get status (Dolibarr version) - */ - 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 b1084b01a54..6bee1e65d71 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() ); @@ -107,7 +111,8 @@ class BlockedLogAuthority * * @param string $block new block to chain */ - public function addBlock($block) { + public function addBlock($block) + { $this->blockchain.=$block; @@ -119,7 +124,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; @@ -141,7 +147,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; @@ -198,7 +205,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; @@ -252,7 +260,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; @@ -289,7 +298,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 @@ -330,4 +340,4 @@ class BlockedLogAuthority return 1; } -} \ No newline at end of file +} 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/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/filemanagerdol/connectors/php/io.php b/htdocs/core/filemanagerdol/connectors/php/io.php index 66d024edce8..3ac325ed5d4 100644 --- a/htdocs/core/filemanagerdol/connectors/php/io.php +++ b/htdocs/core/filemanagerdol/connectors/php/io.php @@ -24,7 +24,7 @@ /** * CombinePaths - * + * * @param string $sBasePath sBasePath * @param string $sFolder sFolder * @return string Combined path @@ -393,13 +393,13 @@ EOF; // This is the function that sends the results of the uploading process to CKE. /** * SendCKEditorResults - * + * * @param string $callback callback * @param string $sFileUrl sFileUrl * @param string $customMsg customMsg * @return void */ -function SendCKEditorResults ($callback, $sFileUrl, $customMsg = '') +function SendCKEditorResults($callback, $sFileUrl, $customMsg = '') { echo ''; } - - diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php index 28584b60e32..3116d85287a 100644 --- a/htdocs/core/lib/bank.lib.php +++ b/htdocs/core/lib/bank.lib.php @@ -161,7 +161,8 @@ function bank_admin_prepare_head($object) * @param Object $object Object related to tabs * @return array Array of tabs to shoc */ -function various_payment_prepare_head($object) { +function various_payment_prepare_head($object) +{ global $db, $langs, $conf; @@ -358,7 +359,7 @@ function checkES($IentOfi, $InumCta) for ($i = 0; $i < 11; $i++) { $sum += $values[$i] * (int) substr($InumCta, $i, 1);//int to cast result of substr to a number } - + $key = 11 - $sum % 11; if ($key == 10) @@ -369,4 +370,3 @@ function checkES($IentOfi, $InumCta) $keycontrol .= $key; return $keycontrol; } - diff --git a/htdocs/core/lib/fichinter.lib.php b/htdocs/core/lib/fichinter.lib.php index fcb14be9c67..8d5cd9c8495 100644 --- a/htdocs/core/lib/fichinter.lib.php +++ b/htdocs/core/lib/fichinter.lib.php @@ -76,11 +76,11 @@ function fichinter_prepare_head($object) foreach($resources as $resource_obj) { $linked_resources = $object->getElementResources('fichinter',$object->id,$resource_obj); - + } } } - + $head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=fichinter&element_id='.$object->id; $head[$h][1] = $langs->trans("Resources"); if ($nbResource > 0) $head[$h][1].= ' '.$nbResource.''; @@ -163,13 +163,13 @@ function fichinter_admin_prepare_head() return $head; } -function fichinter_rec_prepare_head ($object) +function fichinter_rec_prepare_head($object) { global $langs, $conf; //, $user; - + $h = 0; $head = array(); - + $head[$h][0] = DOL_URL_ROOT.'/fichinter/card-rec.php?id='.$object->id; $head[$h][1] = $langs->trans("CardFichinter"); $head[$h][2] = 'card'; @@ -182,4 +182,3 @@ function fichinter_rec_prepare_head ($object) return $head; } - diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 219719b3232..ea596294bf7 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1167,7 +1167,8 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m return $numFinal; } -function get_string_between($string, $start, $end){ +function get_string_between($string, $start, $end) +{ $string = " ".$string; $ini = strpos($string,$start); if ($ini == 0) return ""; @@ -2197,7 +2198,8 @@ function colorStringToArray($stringcolor,$colorifnotfound=array(88,88,88)) * @param array $input Array of products * @return array Array of combinations */ -function cartesianArray(array $input) { +function cartesianArray(array $input) +{ // filter out empty values $input = array_filter($input); @@ -2305,8 +2307,9 @@ function getModuleDirForApiClass($module) * @param $max int Between 0 and 255 * @return String */ -function random_color_part($min=0,$max=255) { - return str_pad( dechex( mt_rand( $min, $max) ), 2, '0', STR_PAD_LEFT); +function random_color_part($min=0,$max=255) +{ + return str_pad( dechex( mt_rand( $min, $max) ), 2, '0', STR_PAD_LEFT); } /* @@ -2316,6 +2319,7 @@ function random_color_part($min=0,$max=255) { * @param $max int Between 0 and 255 * @return String */ -function random_color($min=0, $max=255) { - return random_color_part($min, $max) . random_color_part($min, $max) . random_color_part($min, $max); +function random_color($min=0, $max=255) +{ + return random_color_part($min, $max) . random_color_part($min, $max) . random_color_part($min, $max); } diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php index 1819d8e80c5..855c70ef05e 100644 --- a/htdocs/core/lib/payments.lib.php +++ b/htdocs/core/lib/payments.lib.php @@ -24,7 +24,8 @@ * @param Paiement $object Current payment object * @return array Tabs for the payment section */ -function payment_prepare_head(Paiement $object) { +function payment_prepare_head(Paiement $object) +{ global $langs, $conf; @@ -59,7 +60,8 @@ function payment_prepare_head(Paiement $object) { * @param Paiement $object Current payment object * @return array Tabs for the payment section */ -function payment_supplier_prepare_head(Paiement $object) { +function payment_supplier_prepare_head(Paiement $object) +{ global $langs, $conf; diff --git a/htdocs/core/lib/resource.lib.php b/htdocs/core/lib/resource.lib.php index 6ab25c5b57f..bf586b83f88 100644 --- a/htdocs/core/lib/resource.lib.php +++ b/htdocs/core/lib/resource.lib.php @@ -87,7 +87,8 @@ function resource_prepare_head($object) return $head; } -function resource_admin_prepare_head() { +function resource_admin_prepare_head() +{ global $langs, $conf, $user; diff --git a/htdocs/core/lib/salaries.lib.php b/htdocs/core/lib/salaries.lib.php index eaaa90a710e..0c121c308d3 100644 --- a/htdocs/core/lib/salaries.lib.php +++ b/htdocs/core/lib/salaries.lib.php @@ -20,14 +20,15 @@ /** * Returns an array with the tabs for the "salaries" section * It loads tabs from modules looking for the entity salaries - * + * * @param Paiement $object Current salaries object * @return array Tabs for the salaries section */ -function salaries_prepare_head($object) { - +function salaries_prepare_head($object) +{ + global $db, $langs, $conf; - + $h = 0; $head = array(); @@ -57,7 +58,7 @@ function salaries_prepare_head($object) { $head[$h][1] = $langs->trans("Info"); $head[$h][2] = 'info'; $h++; - + complete_head_from_modules($conf,$langs,$object,$head,$h,'salaries', 'remove'); return $head; diff --git a/htdocs/core/modules/modBlockedLog.class.php b/htdocs/core/modules/modBlockedLog.class.php index 07331bcbc3c..0cfa4b8d95a 100644 --- a/htdocs/core/modules/modBlockedLog.class.php +++ b/htdocs/core/modules/modBlockedLog.class.php @@ -51,7 +51,7 @@ class modBlockedLog extends DolibarrModules // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Enable a log on some business events into a non reversible log. This module may be mandatory for some countries."; - // Possible values for version are: 'development', 'experimental', 'dolibarr' or version + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version $this->version = 'dolibarr'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); @@ -145,7 +145,8 @@ class modBlockedLog extends DolibarrModules * * @return boolean True if already used, otherwise False */ - function alreadyUsed() { + function alreadyUsed() + { require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php'; $b=new BlockedLog($this->db); @@ -204,7 +205,8 @@ class modBlockedLog extends DolibarrModules * @param string $options Options when enabling module ('', 'noboxes') * @return int 1 if OK, 0 if KO */ - function remove($options = '') { + function remove($options = '') + { global $conf, $user; diff --git a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php index d76b397ace8..550f401f90b 100644 --- a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php +++ b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php @@ -41,10 +41,11 @@ class pdf_standardlabel extends CommonStickerGenerator * @param array $param Associative array containing label content and optional parameters * @return void */ - function addSticker(&$pdf,$outputlangs,$param) { + function addSticker(&$pdf,$outputlangs,$param) + { // use this method in future refactoring } - + /** * Output a sticker on page at position _COUNTX, _COUNTY (_COUNTX and _COUNTY start from 0) * - %LOGO% is replace with company logo @@ -254,7 +255,7 @@ class pdf_standardlabel extends CommonStickerGenerator if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; - + // Load traductions files requiredby by page $outputlangs->loadLangs(array("main", "dict", "companies", "admin")); diff --git a/htdocs/core/triggers/dolibarrtriggers.class.php b/htdocs/core/triggers/dolibarrtriggers.class.php index 61a89b083f8..f47daa0d419 100644 --- a/htdocs/core/triggers/dolibarrtriggers.class.php +++ b/htdocs/core/triggers/dolibarrtriggers.class.php @@ -80,11 +80,12 @@ abstract class DolibarrTriggers * * @param DoliDB $db Database handler */ - public function __construct(DoliDB $db) { + public function __construct(DoliDB $db) + { $this->db = $db; - if (empty($this->name)) + if (empty($this->name)) { $this->name = preg_replace('/^Interface/i', '', get_class($this)); } diff --git a/htdocs/dav/fileserver.php b/htdocs/dav/fileserver.php index 2fc4485dc76..bfdc81887ff 100644 --- a/htdocs/dav/fileserver.php +++ b/htdocs/dav/fileserver.php @@ -58,8 +58,7 @@ $tmpDir = $conf->dav->dir_temp; //var_dump($tmpDir);exit; // Authentication callback function -$authBackend = new \Sabre\DAV\Auth\Backend\BasicCallBack(function ($username, $password) -{ +$authBackend = new \Sabre\DAV\Auth\Backend\BasicCallBack(function ($username, $password) { global $user; global $conf; global $dolibarr_main_authentication; diff --git a/htdocs/expedition/class/api_shipments.class.php b/htdocs/expedition/class/api_shipments.class.php index 87596e59613..0e07c3706a4 100644 --- a/htdocs/expedition/class/api_shipments.class.php +++ b/htdocs/expedition/class/api_shipments.class.php @@ -35,7 +35,7 @@ class Shipments extends DolibarrApi static $FIELDS = array( 'socid', 'origin_id', - 'origin_type' + 'origin_type', ); /** @@ -99,7 +99,8 @@ class Shipments 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(); @@ -217,7 +218,8 @@ class Shipments extends DolibarrApi * @return int */ /* - function getLines($id) { + function getLines($id) + { if(! DolibarrApiAccess::$user->rights->expedition->lire) { throw new RestException(401); } @@ -250,7 +252,8 @@ class Shipments extends DolibarrApi * @return int */ /* - function postLine($id, $request_data = null) { + function postLine($id, $request_data = null) + { if(! DolibarrApiAccess::$user->rights->expedition->creer) { throw new RestException(401); } @@ -312,7 +315,8 @@ class Shipments extends DolibarrApi * @return object */ /* - function putLine($id, $lineid, $request_data = null) { + function putLine($id, $lineid, $request_data = null) + { if(! DolibarrApiAccess::$user->rights->expedition->creer) { throw new RestException(401); } @@ -372,7 +376,8 @@ class Shipments extends DolibarrApi * @throws 401 * @throws 404 */ - function deleteLine($id, $lineid) { + function deleteLine($id, $lineid) + { if(! DolibarrApiAccess::$user->rights->expedition->creer) { throw new RestException(401); } @@ -407,7 +412,8 @@ class Shipments extends DolibarrApi * * @return int */ - function put($id, $request_data = null) { + function put($id, $request_data = null) + { if (! DolibarrApiAccess::$user->rights->expedition->creer) { throw new RestException(401); } @@ -537,7 +543,8 @@ class Shipments extends DolibarrApi * @throws 404 * @throws 405 */ -/* function setinvoiced($id) { +/* function setinvoiced($id) + { if(! DolibarrApiAccess::$user->rights->expedition->creer) { throw new RestException(401); @@ -573,7 +580,8 @@ class Shipments extends DolibarrApi * @throws 405 */ /* - function createShipmentFromOrder($orderid) { + function createShipmentFromOrder($orderid) + { require_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php'; @@ -608,7 +616,8 @@ class Shipments 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/expensereport/class/api_expensereports.class.php b/htdocs/expensereport/class/api_expensereports.class.php index 726aa158413..d83714356a2 100644 --- a/htdocs/expensereport/class/api_expensereports.class.php +++ b/htdocs/expensereport/class/api_expensereports.class.php @@ -94,7 +94,8 @@ class ExpenseReports 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 Expense Report objects */ - function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = 0, $sqlfilters = '') { + function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = 0, $sqlfilters = '') + { global $db, $conf; $obj_ret = array(); @@ -195,7 +196,8 @@ class ExpenseReports extends DolibarrApi * @return int */ /* - function getLines($id) { + function getLines($id) + { if(! DolibarrApiAccess::$user->rights->expensereport->lire) { throw new RestException(401); } @@ -228,7 +230,8 @@ class ExpenseReports extends DolibarrApi * @return int */ /* - function postLine($id, $request_data = null) { + function postLine($id, $request_data = null) + { if(! DolibarrApiAccess::$user->rights->expensereport->creer) { throw new RestException(401); } @@ -290,7 +293,8 @@ class ExpenseReports extends DolibarrApi * @return object */ /* - function putLine($id, $lineid, $request_data = null) { + function putLine($id, $lineid, $request_data = null) + { if(! DolibarrApiAccess::$user->rights->expensereport->creer) { throw new RestException(401); } @@ -348,7 +352,8 @@ class ExpenseReports extends DolibarrApi * @return int */ /* - function deleteLine($id, $lineid) { + function deleteLine($id, $lineid) + { if(! DolibarrApiAccess::$user->rights->expensereport->creer) { throw new RestException(401); } @@ -380,7 +385,8 @@ class ExpenseReports extends DolibarrApi * * @return int */ - function put($id, $request_data = null) { + function put($id, $request_data = null) + { if(! DolibarrApiAccess::$user->rights->expensereport->creer) { throw new RestException(401); } @@ -490,7 +496,8 @@ class ExpenseReports 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/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index c8b64790061..e5c4faf4d12 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -418,7 +418,7 @@ class Holiday extends CommonObject } else { - // SQL Error + // SQL Error $this->error="Error ".$this->db->lasterror(); return -1; } @@ -542,7 +542,7 @@ class Holiday extends CommonObject } else { - // SQL Error + // SQL Error $this->error="Error ".$this->db->lasterror(); return -1; } @@ -985,7 +985,8 @@ class Holiday extends CommonObject * @param string $htmlname Name of HTML select field * @return string Show select of status */ - function selectStatutCP($selected='', $htmlname='select_statut') { + function selectStatutCP($selected='', $htmlname='select_statut') + { global $langs; @@ -1019,7 +1020,8 @@ class Holiday extends CommonObject * @param string $value vrai si mise à jour OK sinon faux * @return boolean ok or ko */ - function updateConfCP($name,$value) { + function updateConfCP($name,$value) + { $sql = "UPDATE ".MAIN_DB_PREFIX."holiday_config SET"; $sql.= " value = '".$value."'"; @@ -1247,7 +1249,8 @@ class Holiday extends CommonObject * @param string $name name du paramètre de configuration * @return string retourne checked si > 0 */ - function getCheckOption($name) { + function getCheckOption($name) + { $sql = "SELECT value"; $sql.= " FROM ".MAIN_DB_PREFIX."holiday_config"; @@ -1308,7 +1311,8 @@ class Holiday extends CommonObject * @param int $user_id ID de l'utilisateur à supprimer * @return boolean Vrai si pas d'erreur, faut si Erreur */ - function deleteCPuser($user_id) { + function deleteCPuser($user_id) + { $sql = "DELETE FROM ".MAIN_DB_PREFIX."holiday_users"; $sql.= " WHERE fk_user = '".$user_id."'"; @@ -1632,7 +1636,8 @@ class Holiday extends CommonObject * * @return int retourne le nombre d'utilisateur */ - function countActiveUsersWithoutCP() { + function countActiveUsersWithoutCP() + { $sql = "SELECT count(u.rowid) as compteur"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u LEFT OUTER JOIN ".MAIN_DB_PREFIX."holiday_users hu ON (hu.fk_user=u.rowid)"; diff --git a/htdocs/imports/emptyexample.php b/htdocs/imports/emptyexample.php index ffb270a6306..f11ad902de6 100644 --- a/htdocs/imports/emptyexample.php +++ b/htdocs/imports/emptyexample.php @@ -22,9 +22,15 @@ */ // This file is a wrapper, so empty header -function llxHeader() { print 'Build an import example file'; } +function llxHeader() +{ + print 'Build an import example file'; +} // This file is a wrapper, so empty footer -function llxFooter() { print ''; } +function llxFooter() +{ + print ''; +} require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -86,4 +92,3 @@ foreach($fieldstarget as $code=>$label) //var_dump($contentlinevalues); print $objimport->build_example_file($format,$headerlinefields,$contentlinevalues,$datatoimport); - diff --git a/htdocs/modulebuilder/template/class/api_mymodule.class.php b/htdocs/modulebuilder/template/class/api_mymodule.class.php index b4abf60861e..1aa164bd33c 100644 --- a/htdocs/modulebuilder/template/class/api_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/api_mymodule.class.php @@ -41,7 +41,7 @@ class MyModuleApi extends DolibarrApi * @var array $FIELDS Mandatory fields, checked when create and update object */ static $FIELDS = array( - 'name' + 'name', ); @@ -109,7 +109,8 @@ class MyModuleApi extends DolibarrApi * * @url GET /myobjects/ */ - 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(); @@ -127,7 +128,7 @@ class MyModuleApi extends DolibarrApi $sql.= ", ".MAIN_DB_PREFIX."c_stcomm as st"; $sql.= " WHERE s.fk_stcomm = st.id"; - // Example of use $mode + // Example of use $mode //if ($mode == 1) $sql.= " AND s.client IN (1, 3)"; //if ($mode == 2) $sql.= " AND s.client IN (2, 3)"; @@ -195,8 +196,8 @@ class MyModuleApi extends DolibarrApi function post($request_data = null) { if(! DolibarrApiAccess::$user->rights->myobject->create) { - throw new RestException(401); - } + throw new RestException(401); + } // Check mandatory fields $result = $this->_validate($request_data); @@ -221,8 +222,8 @@ class MyModuleApi extends DolibarrApi function put($id, $request_data = null) { if(! DolibarrApiAccess::$user->rights->myobject->create) { - throw new RestException(401); - } + throw new RestException(401); + } $result = $this->myobject->fetch($id); if( ! $result ) { @@ -261,9 +262,9 @@ class MyModuleApi extends DolibarrApi throw new RestException(404, 'MyObject not found'); } - if( ! DolibarrApi::_checkAccessToResource('myobject',$this->myobject->id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } + if( ! DolibarrApi::_checkAccessToResource('myobject',$this->myobject->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } if( !$this->myobject->delete($id)) { diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index 2881e23a21b..58dc00d530c 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -93,7 +93,7 @@ class MultiCurrency extends CommonObject public function __construct(DoliDB $db) { $this->db = &$db; - + return 1; } @@ -108,21 +108,21 @@ class MultiCurrency extends CommonObject public function create(User $user, $trigger = true) { global $conf,$langs; - + dol_syslog('Currency::create', LOG_DEBUG); $error = 0; - + if (self::checkCodeAlreadyExists($this->code)) { $error++; $this->errors[] = $langs->trans('multicurrency_code_already_added'); return -1; } - + if (empty($this->entity) || $this->entity <= 0) $this->entity = $conf->entity; $now=date('Y-m-d H:i:s'); - + // Insert request $sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '('; $sql .= ' code,'; @@ -152,7 +152,7 @@ class MultiCurrency extends CommonObject $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element); $this->date_create = $now; $this->fk_user = $user->id; - + if ($trigger) { $result=$this->call_trigger('CURRENCY_CREATE', $user); if ($result < 0) $error++; @@ -181,7 +181,7 @@ class MultiCurrency extends CommonObject public function fetch($id, $code = null) { dol_syslog('Currency::fetch', LOG_DEBUG); - + global $conf; $sql = 'SELECT'; @@ -192,7 +192,7 @@ class MultiCurrency extends CommonObject dol_syslog(__METHOD__,LOG_DEBUG); $resql = $this->db->query($sql); - + if ($resql) { $numrows = $this->db->num_rows($resql); if ($numrows) { @@ -204,7 +204,7 @@ class MultiCurrency extends CommonObject $this->entity = $obj->entity; $this->date_create = $obj->date_create; $this->fk_user = $obj->fk_user; - + $this->fetchAllCurrencyRate(); $this->getRate(); } @@ -234,7 +234,7 @@ class MultiCurrency extends CommonObject $sql.= ' FROM ' . MAIN_DB_PREFIX . $this->table_element_line. ' as cr'; $sql.= ' WHERE cr.fk_multicurrency = '.$this->id; $sql.= ' ORDER BY cr.date_sync DESC'; - + $this->rates = array(); dol_syslog(__METHOD__,LOG_DEBUG); @@ -245,7 +245,7 @@ class MultiCurrency extends CommonObject while ($obj = $this->db->fetch_object($resql)) { $rate = new CurrencyRate($this->db); $rate->fetch($obj->rowid); - + $this->rates[] = $rate; } $this->db->free($resql); @@ -272,19 +272,19 @@ class MultiCurrency extends CommonObject $error = 0; dol_syslog('Currency::update', LOG_DEBUG); - + // Clean parameters $this->name = trim($this->name); $this->code = trim($this->code); - + // Check parameters if (empty($this->code)) { $error++; dol_syslog('Currency::update $this->code can not be empty', LOG_ERR); - + return -1; } - + // Update request $sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET'; $sql .= ' name=\''.$this->db->escape($this->name).'\''; @@ -328,7 +328,7 @@ class MultiCurrency extends CommonObject public function delete($trigger = true) { global $user; - + dol_syslog('Currency::delete', LOG_DEBUG); $error = 0; @@ -347,7 +347,7 @@ class MultiCurrency extends CommonObject $this->errors[] = 'Error ' . $this->db->lasterror(); dol_syslog('Currency::delete ' . join(',', $this->errors), LOG_ERR); } - + $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element; $sql .= ' WHERE rowid=' . $this->id; @@ -371,7 +371,7 @@ class MultiCurrency extends CommonObject return 1; } } - + /** * Delete rates in database * @@ -386,85 +386,85 @@ class MultiCurrency extends CommonObject return false; } } - + return true; } - + /** - * Delete rate in database - * + * Delete rate in database + * * @param double $rate rate value - * + * * @return int -1 if KO, 1 if OK */ public function addRate($rate) { $currencyRate = new CurrencyRate($this->db); $currencyRate->rate = $rate; - - if ($currencyRate->create($this->id) > 0) + + if ($currencyRate->create($this->id) > 0) { $this->rate = $currencyRate; return 1; } - else + else { $this->rate = null; return -1; } } - + /** * Try get label of code in llx_currency then add rate - * + * * @param string $code currency code * @param double $rate new rate - * + * * @return int -1 if KO, 1 if OK, 2 if label found and OK */ function addRateFromDolibarr($code, $rate) { global $db, $user; - + $currency = new MultiCurrency($db); $currency->code = $code; $currency->name = $code; - + $sql = 'SELECT label FROM '.MAIN_DB_PREFIX.'c_currencies WHERE code_iso = \''.$db->escape($code).'\''; - + dol_syslog(__METHOD__,LOG_DEBUG); $resql = $db->query($sql); if ($resql && ($line = $db->fetch_object($resql))) { $currency->name = $line->label; } - + if ($currency->create($user) > 0) { $currency->addRate($rate); - + if (!empty($line)) return 2; else return 1; } - - return -1; + + return -1; } - + /** * Add new entry into llx_multicurrency_rate to historise - * + * * @param double $rate rate value - * + * * @return int <0 if KO, >0 if OK */ public function updateRate($rate) { return $this->addRate($rate); } - + /** - * Fetch CurrencyRate object in $this->rate - * + * Fetch CurrencyRate object in $this->rate + * * @return int <0 if KO, 0 if not found, >0 if OK */ public function getRate() @@ -473,50 +473,50 @@ class MultiCurrency extends CommonObject $sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line.' as cr'; $sql.= ' WHERE cr.fk_multicurrency = '.$this->id; $sql.= ' AND cr.date_sync = (SELECT MAX(cr2.date_sync) FROM '.MAIN_DB_PREFIX.$this->table_element_line.' AS cr2 WHERE cr2.fk_multicurrency = '.$this->id.')'; - + dol_syslog(__METHOD__,LOG_DEBUG); $resql = $this->db->query($sql); if ($resql && ($obj = $this->db->fetch_object($resql))) { $this->rate = new CurrencyRate($this->db); return $this->rate->fetch($obj->rowid); } - + } - + /** - * Get id of currency from code + * Get id of currency from code * * @param DoliDB $db object db * @param string $code code value search - * + * * @return 0 if not found, >0 if OK */ public static function getIdFromCode(&$db, $code) { global $conf; - + $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'multicurrency WHERE code = \''.$db->escape($code).'\' AND entity = '.$conf->entity; - + dol_syslog(__METHOD__,LOG_DEBUG); $resql = $db->query($sql); if ($resql && $obj = $db->fetch_object($resql)) return $obj->rowid; else return 0; } - + /** - * Get id and rate of currency from code - * + * Get id and rate of currency from code + * * @param DoliDB $db object db * @param string $code code value search * @param date $date_document date from document (propal, order, invoice, ...) - * + * * @return array [0] => id currency * [1] => rate */ public static function getIdAndTxFromCode(&$db, $code, $date_document='') { global $conf; - + $sql1 = 'SELECT m.rowid, mc.rate FROM '.MAIN_DB_PREFIX.'multicurrency m'; $sql1.= ' LEFT JOIN '.MAIN_DB_PREFIX.'multicurrency_rate mc ON (m.rowid = mc.fk_multicurrency)'; $sql1.= ' WHERE m.code = \''.$db->escape($code).'\''; @@ -524,10 +524,10 @@ class MultiCurrency extends CommonObject $sql2= ''; if (!empty($conf->global->MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE) && !empty($date_document)) $sql2.= ' AND DATE_FORMAT(mc.date_sync, "%Y-%m-%d") = "'.date('Y-m-d', $date_document).'"'; $sql3.= ' ORDER BY mc.date_sync DESC LIMIT 1'; - + dol_syslog(__METHOD__,LOG_DEBUG); $resql = $db->query($sql1.$sql2.$sql3); - + if ($resql && $obj = $db->fetch_object($resql)) return array($obj->rowid, $obj->rate); else { @@ -536,67 +536,67 @@ class MultiCurrency extends CommonObject $resql = $db->query($sql1.$sql3); if ($resql && $obj = $db->fetch_object($resql)) return array($obj->rowid, $obj->rate); } - + return array(0, 1); } - } - + } + /** * Get the conversion of amount with invoice rate - * + * * @param int $fk_facture id of facture * @param double $amount amount to convert * @param string $way dolibarr mean the amount is in dolibarr currency * @param string $table facture or facture_fourn - * + * * @return double amount converted */ public static function getAmountConversionFromInvoiceRate($fk_facture, $amount, $way='dolibarr', $table='facture') { global $db; - + $multicurrency_tx = self::getInvoiceRate($fk_facture, $table); - - if ($multicurrency_tx) + + if ($multicurrency_tx) { if ($way == 'dolibarr') return $amount * $multicurrency_tx; else return $amount / $multicurrency_tx; } else return $amount; } - + /** * Get current invoite rate - * + * * @param int $fk_facture id of facture * @param string $table facture or facture_fourn */ public static function getInvoiceRate($fk_facture, $table='facture') { global $db; - + $sql = 'SELECT multicurrency_tx FROM '.MAIN_DB_PREFIX.$table.' WHERE rowid = '.$fk_facture; - + dol_syslog(__METHOD__,LOG_DEBUG); $resql = $db->query($sql); if ($resql && ($line = $db->fetch_object($resql))) { return $line->multicurrency_tx; } - + return false; } /** * With free account we can't set source then recalcul all rates to force another source - * - * @param stdClass $TRate Object containing all currencies rates + * + * @param stdClass $TRate Object containing all currencies rates * @return -1 if KO, 0 if nothing, 1 if OK */ - public static function recalculRates(&$TRate) + public static function recalculRates(&$TRate) { global $conf; - + if (!empty($conf->global->MULTICURRENCY_ALTERNATE_SOURCE)) { $alternate_source = 'USD'.$conf->global->MULTICURRENCY_ALTERNATE_SOURCE; @@ -607,25 +607,25 @@ class MultiCurrency extends CommonObject { $rate *= $coef; } - + return 1; } - + return -1; // Alternate souce not found } - + return 0; // Nothing to do } - + /** * Sync rates from api - * + * * @param array $response array of reponse from api to sync dolibarr rates */ public static function syncRates($response) { global $db,$conf; - + $ch = curl_init('http://apilayer.net/api/live?access_key='.$key.''); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); @@ -634,11 +634,11 @@ class MultiCurrency extends CommonObject if ($response->success) { - + $TRate = $response->quotes; $timestamp = $response->timestamp; - if (self::recalculRates($TRate) >= 0) + if (self::recalculRates($TRate) >= 0) { foreach ($TRate as $currency_code => $rate) { @@ -648,11 +648,11 @@ class MultiCurrency extends CommonObject { $obj->updateRate($rate); } - else + else { self::addRateFromDolibarr($code, $rate); } - } + } } } else @@ -660,17 +660,17 @@ class MultiCurrency extends CommonObject setEventMessages($langs->trans('multicurrency_syncronize_error', $response->error->info), null, 'errors'); } } - + /** * Check in database if the current code already exists - * + * * @param string $code current code to search * @return boolean True if exists, false if not exists */ public static function checkCodeAlreadyExists($code) { global $db; - + $currency = new MultiCurrency($db); if ($currency->fetch('', $code) > 0) return true; else return false; @@ -710,7 +710,7 @@ class CurrencyRate extends CommonObjectLine * @var int Id of entity */ public $entity; - + /** * Constructor * @@ -719,10 +719,10 @@ class CurrencyRate extends CommonObjectLine public function __construct(DoliDB $db) { $this->db = &$db; - + return 1; } - + /** * Create object into database * @@ -734,14 +734,14 @@ class CurrencyRate extends CommonObjectLine public function create($fk_multicurrency, $trigger = true) { global $conf, $user; - + dol_syslog('CurrencyRate::create', LOG_DEBUG); $error = 0; $this->rate = price2num($this->rate); if (empty($this->entity) || $this->entity <= 0) $this->entity = $conf->entity; $now=date('Y-m-d H:i:s'); - + // Insert request $sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '('; $sql .= ' rate,'; @@ -769,7 +769,7 @@ class CurrencyRate extends CommonObjectLine $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element); $this->fk_multicurrency = $fk_multicurrency; $this->date_sync = $now; - + if ($trigger) { $result=$this->call_trigger('CURRENCYRATE_CREATE', $user); if ($result < 0) $error++; @@ -829,7 +829,7 @@ class CurrencyRate extends CommonObjectLine return - 1; } } - + /** * Update object into database * @@ -840,13 +840,13 @@ class CurrencyRate extends CommonObjectLine public function update($trigger = true) { global $user; - + $error = 0; dol_syslog('CurrencyRate::update', LOG_DEBUG); - + $this->rate = price2num($this->rate); - + // Update request $sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET'; $sql .= ' rate='.$this->rate; @@ -878,7 +878,7 @@ class CurrencyRate extends CommonObjectLine return 1; } } - + /** * Delete object in database * @@ -889,7 +889,7 @@ class CurrencyRate extends CommonObjectLine public function delete($trigger = true) { global $user; - + dol_syslog('CurrencyRate::delete', LOG_DEBUG); $error = 0; @@ -925,5 +925,5 @@ class CurrencyRate extends CommonObjectLine return 1; } } - + } diff --git a/htdocs/public/agenda/agendaexport.php b/htdocs/public/agenda/agendaexport.php index 72f1a6b9242..6e08f06d630 100644 --- a/htdocs/public/agenda/agendaexport.php +++ b/htdocs/public/agenda/agendaexport.php @@ -42,13 +42,19 @@ if (! defined('NOCSRFCHECK')) define("NOCSRFCHECK",1); // We accept to go on * * @return void */ -function llxHeaderVierge() { print 'Export agenda cal'; } +function llxHeaderVierge() +{ + print 'Export agenda cal'; +} /** * Footer function * * @return void */ -function llxFooterVierge() { print ''; } +function llxFooterVierge() +{ + print ''; +} require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; diff --git a/htdocs/public/donations/donateurs_code.php b/htdocs/public/donations/donateurs_code.php index 3d8057cbe85..3705c9945bc 100644 --- a/htdocs/public/donations/donateurs_code.php +++ b/htdocs/public/donations/donateurs_code.php @@ -30,13 +30,19 @@ define("NOCSRFCHECK",1); // We accept to go on this page from external web site. * * @return void */ -function llxHeaderVierge() { print 'Export agenda cal'; } +function llxHeaderVierge() +{ + print 'Export agenda cal'; +} /** * Header function * * @return void */ -function llxFooterVierge() { print ''; } +function llxFooterVierge() +{ + print ''; +} require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT .'/don/class/don.class.php'; diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php index 515f08f6053..229faccff9a 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -26,7 +26,7 @@ require_once DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php"; require_once DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php"; /** - * DAO Resource object + * DAO Resource object */ class Dolresource extends CommonObject { @@ -60,14 +60,14 @@ class Dolresource extends CommonObject /** * Create object into database * - * @param User $user User that creates + * @param User $user User that creates * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, Id of created object if OK */ function create($user, $notrigger=0) { - global $conf, $langs, $hookmanager; - $error=0; + global $conf, $langs, $hookmanager; + $error=0; // Clean parameters @@ -730,7 +730,8 @@ class Dolresource extends CommonObject * @deprecated, remplaced by hook getElementResources * @see getElementResources() */ - function fetch_all_available() { + function fetch_all_available() + { global $conf; if (! empty($conf->modules_parts['resources'])) diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 42ff31af66a..aefdf5f4389 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -32,7 +32,7 @@ class Thirdparties extends DolibarrApi * @var array $FIELDS Mandatory fields, checked when create and update object */ static $FIELDS = array( - 'name' + 'name', ); /** @@ -114,7 +114,8 @@ class Thirdparties extends DolibarrApi * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.nom:like:'TheCompany%') and (t.date_creation:<:'20160101')" * @return array Array of thirdparty objects */ - function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $mode=0, $sqlfilters = '') { + function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $mode=0, $sqlfilters = '') + { global $db, $conf; $obj_ret = array(); @@ -929,7 +930,8 @@ class Thirdparties extends DolibarrApi * @throws 404 * @throws 405 */ - function getInvoicesQualifiedForReplacement($id) { + function getInvoicesQualifiedForReplacement($id) + { if(! DolibarrApiAccess::$user->rights->facture->lire) { throw new RestException(401); @@ -971,7 +973,8 @@ class Thirdparties extends DolibarrApi * @throws 404 * @throws 405 */ - function getInvoicesQualifiedForCreditNote($id) { + function getInvoicesQualifiedForCreditNote($id) + { if(! DolibarrApiAccess::$user->rights->facture->lire) { throw new RestException(401); @@ -1004,7 +1007,8 @@ class Thirdparties extends DolibarrApi * * @return array */ - function getCompanyBankAccount($socid){ + function getCompanyBankAccount($socid) + { global $db, $conf; @@ -1154,7 +1158,8 @@ class Thirdparties extends DolibarrApi * * @url DELETE {socid}/CompanyBankAccount/{id} */ - function deleteCompanyBankAccount($id, $socid){ + function deleteCompanyBankAccount($id, $socid) + { if(! DolibarrApiAccess::$user->rights->societe->creer) { throw new RestException(401); @@ -1177,7 +1182,8 @@ class Thirdparties 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/webservices/server_user.php b/htdocs/webservices/server_user.php index 60bf95bd20c..ab2d18427ff 100644 --- a/htdocs/webservices/server_user.php +++ b/htdocs/webservices/server_user.php @@ -681,7 +681,8 @@ function createUserFromThirdparty($authentication,$thirdpartywithuser) * @param array $shortuser Array of login/password info * @return mixed */ -function setUserPassword($authentication,$shortuser) { +function setUserPassword($authentication,$shortuser) +{ global $db,$conf,$langs; diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index c72daec989e..e32b17ec09d 100644 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -1118,7 +1118,8 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase * * @return void */ - public function testDolNl2Br() { + public function testDolNl2Br() + { //String to encode $string = "a\na";