From 62501b11e883c0323bc0ad696910146c19be6811 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 2 Mar 2019 00:14:22 +0100 Subject: [PATCH] add visibility --- htdocs/blockedlog/class/blockedlog.class.php | 37 ++- htdocs/cashdesk/class/Auth.class.php | 2 +- htdocs/compta/bank/class/account.class.php | 112 ++++----- .../bank/class/api_bankaccounts.class.php | 38 +-- .../bank/class/paymentvarious.class.php | 28 +-- .../facture/class/api_invoices.class.php | 2 +- .../facture/class/facture-rec.class.php | 2 +- htdocs/compta/facture/class/facture.class.php | 144 +++++------ .../facture/class/facturestats.class.php | 26 +- .../cheque/class/remisecheque.class.php | 126 +++++----- .../compta/paiement/class/paiement.class.php | 70 +++--- .../class/ligneprelevement.class.php | 26 +- .../class/rejetprelevement.class.php | 10 +- .../sociales/class/chargesociales.class.php | 67 +++--- .../class/paymentsocialcontribution.class.php | 57 +++-- .../class/expensereport.class.php | 133 +++++------ .../mailmanspip/class/mailmanspip.class.php | 28 +-- .../canvas/actions_card_common.class.php | 16 +- .../company/actions_card_company.class.php | 16 +- .../actions_card_individual.class.php | 34 +-- htdocs/societe/class/api_contacts.class.php | 80 +++---- .../societe/class/api_thirdparties.class.php | 80 +++---- htdocs/societe/class/client.class.php | 11 +- .../class/companybankaccount.class.php | 28 +-- .../class/companypaymentmode.class.php | 24 +- htdocs/societe/class/societe.class.php | 224 +++++++++--------- htdocs/societe/class/societeaccount.class.php | 20 +- 27 files changed, 717 insertions(+), 724 deletions(-) diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index 9c7baa0634a..ae64665bbfd 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -291,8 +291,7 @@ class BlockedLog } elseif ($this->action == 'MODULE_RESET') { - if ($this->signature == '0000000000') - { + if ($this->signature == '0000000000') { return 'System to track events into unalterable logs were disabled after some recording were done. We saved a special Fingerprint to track the chain as broken.'; } else @@ -387,14 +386,15 @@ class BlockedLog $arrayoffieldstoexclude = array( 'table_element','fields','ref_previous','ref_next','origin','origin_id','oldcopy','picto','error','errors','modelpdf','last_main_doc','civility_id','contact','contact_id', 'table_element_line','ismultientitymanaged','isextrafieldmanaged', - 'linkedObjectsIds','linkedObjects','fk_delivery_address', + 'linkedObjectsIds', + 'linkedObjects', + 'fk_delivery_address', 'context', 'projet' // There is already ->fk_project ); // Add more fields to exclude depending on object type - if ($this->element == 'cashcontrol') - { - $arrayoffieldstoexclude = array_merge($arrayoffieldstoexclude, array( + if ($this->element == 'cashcontrol') { + $arrayoffieldstoexclude = array_merge($arrayoffieldstoexclude, array( 'name','lastname','firstname','region','region_id','region_code','state','state_id','state_code','country','country_id','country_code', 'total_ht','total_tva','total_ttc','total_localtax1','total_localtax2', 'barcode_type','barcode_type_code','barcode_type_label','barcode_type_coder','mode_reglement_id','cond_reglement_id','mode_reglement','cond_reglement','shipping_method_id', @@ -727,15 +727,12 @@ class BlockedLog */ public function dolDecodeBlockedData($data, $mode = 0) { - try - { + try { //include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; //include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $aaa = unserialize($data); //$aaa = unserialize($data); - } - catch(Exception $e) - { + } catch(Exception $e) { //print $e->getErrs); } return $aaa; @@ -1064,14 +1061,14 @@ class BlockedLog } - /** - * Check if module was already used or not for at least one recording. - * - * @param int $ignoresystem Ignore system events for the test - * @return bool - */ - function alreadyUsed($ignoresystem = 0) - { + /** + * Check if module was already used or not for at least one recording. + * + * @param int $ignoresystem Ignore system events for the test + * @return bool + */ + public function alreadyUsed($ignoresystem = 0) + { global $conf; $result = false; @@ -1092,5 +1089,5 @@ class BlockedLog dol_syslog("Module Blockedlog alreadyUsed with ignoresystem=".$ignoresystem." is ".$result); return $result; - } + } } diff --git a/htdocs/cashdesk/class/Auth.class.php b/htdocs/cashdesk/class/Auth.class.php index 26c1bee3d3c..d33081f8e74 100644 --- a/htdocs/cashdesk/class/Auth.class.php +++ b/htdocs/cashdesk/class/Auth.class.php @@ -60,7 +60,7 @@ class Auth * @param string $aPasswd Password * @return void */ - function passwd($aPasswd) + public function passwd($aPasswd) { $this->passwd = $aPasswd; } diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 1c7a0c977a8..bd0e43b8461 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -235,7 +235,7 @@ class Account extends CommonObject * * @param DoliDB $db Database handler */ - function __construct(DoliDB $db) + public function __construct(DoliDB $db) { global $langs; @@ -290,7 +290,7 @@ class Account extends CommonObject * * @return int 1 if need to be concialiated, < 0 otherwise. */ - function canBeConciliated() + public function canBeConciliated() { global $conf; @@ -301,7 +301,7 @@ class Account extends CommonObject } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Add a link between bank line record and its source * @@ -312,7 +312,7 @@ class Account extends CommonObject * @param string $type Type of link ('payment', 'company', 'member', ...) * @return int <0 if KO, id line if OK */ - function add_url_line($line_id, $url_id, $url, $label, $type) + public function add_url_line($line_id, $url_id, $url, $label, $type) { // phpcs:enable $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_url ("; @@ -342,7 +342,7 @@ class Account extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * TODO Move this into AccountLine * Return array with links from llx_bank_url @@ -352,7 +352,7 @@ class Account extends CommonObject * @param string $type To search using type * @return array|int Array of links array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> ) or -1 on error */ - function get_url($fk_bank = '', $url_id = '', $type = '') + public function get_url($fk_bank = '', $url_id = '', $type = '') { // phpcs:enable $lines = array(); @@ -417,7 +417,7 @@ class Account extends CommonObject * @param int $datev Date value * @return int Rowid of added entry, <0 if KO */ - function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur = '', $banque = '', $accountancycode = '', $datev = null) + public function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur = '', $banque = '', $accountancycode = '', $datev = null) { // Deprecation warning if (is_numeric($oper)) { @@ -525,7 +525,7 @@ class Account extends CommonObject * @param int $notrigger 1=Disable triggers * @return int < 0 if KO, > 0 if OK */ - function create(User $user, $notrigger = 0) + public function create(User $user, $notrigger = 0) { global $langs,$conf, $hookmanager; @@ -690,7 +690,7 @@ class Account extends CommonObject * @param int $notrigger 1=Disable triggers * @return int <0 if KO, >0 if OK */ - function update(User $user, $notrigger = 0) + public function update(User $user, $notrigger = 0) { global $langs,$conf, $hookmanager; @@ -793,14 +793,14 @@ class Account extends CommonObject } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Update BBAN (RIB) account fields * * @param User $user Object user making update * @return int <0 if KO, >0 if OK */ - function update_bban(User $user = null) + public function update_bban(User $user = null) { // phpcs:enable global $conf,$langs; @@ -860,7 +860,7 @@ class Account extends CommonObject * @param string $ref Ref of bank account to get * @return int <0 if KO, >0 if OK */ - function fetch($id, $ref = '') + public function fetch($id, $ref = '') { global $conf; @@ -1008,7 +1008,7 @@ class Account extends CommonObject * @param User $user User deleting * @return int <0 if KO, >0 if OK */ - function delete(User $user = null) + public function delete(User $user = null) { global $conf; @@ -1076,12 +1076,12 @@ class Account extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto * @return string Label */ - function getLibStatut($mode = 0) + public function getLibStatut($mode = 0) { return $this->LibStatut($this->clos, $mode); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return label of given object status * @@ -1089,7 +1089,7 @@ class Account extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto * @return string Label */ - function LibStatut($statut, $mode = 0) + public function LibStatut($statut, $mode = 0) { // phpcs:enable global $langs; @@ -1120,13 +1120,13 @@ class Account extends CommonObject } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Renvoi si un compte peut etre supprimer ou non (sans mouvements) * * @return boolean vrai si peut etre supprime, faux sinon */ - function can_be_deleted() + public function can_be_deleted() { // phpcs:enable $can_be_deleted=false; @@ -1152,7 +1152,7 @@ class Account extends CommonObject * * @return string Error string */ - function error() + public function error() { return $this->error; } @@ -1163,7 +1163,7 @@ class Account extends CommonObject * @param int $option 1=Exclude future operation date (this is to exclude input made in advance and have real account sold) * @return int Current sold (value date <= today) */ - function solde($option = 0) + public function solde($option = 0) { $solde=0; @@ -1189,7 +1189,7 @@ class Account extends CommonObject return price2num($solde, 'MU'); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * @@ -1197,7 +1197,7 @@ class Account extends CommonObject * @param int $filteraccountid To get info for a particular account id * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ - function load_board(User $user, $filteraccountid = 0) + public function load_board(User $user, $filteraccountid = 0) { // phpcs:enable global $conf, $langs; @@ -1246,13 +1246,13 @@ class Account extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Charge indicateurs this->nb de tableau de bord * @param int $filteraccountid To get info for a particular account id * @return int <0 if ko, >0 if ok */ - function load_state_board($filteraccountid = 0) + public function load_state_board($filteraccountid = 0) { // phpcs:enable global $user; @@ -1329,7 +1329,7 @@ class Account extends CommonObject * @param int $notooltip 1=Disable tooltip * @return string Chaine avec URL */ - function getNomUrl($withpicto = 0, $mode = '', $option = '', $save_lastsearch_value = -1, $notooltip = 0) + public function getNomUrl($withpicto = 0, $mode = '', $option = '', $save_lastsearch_value = -1, $notooltip = 0) { global $conf, $langs, $user; @@ -1396,7 +1396,7 @@ class Account extends CommonObject * * @return int 1 if correct, <=0 if wrong */ - function verif() + public function verif() { require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.lib.php'; @@ -1430,7 +1430,7 @@ class Account extends CommonObject * * @return string country code */ - function getCountryCode() + public function getCountryCode() { global $mysoc; @@ -1467,7 +1467,7 @@ class Account extends CommonObject * 1=Need 2 fields for bank code: Bank, Desk (France, Spain, ...) + Account number and key * 2=Need 1 field for bank code: Bank only (Sort code for Great Britain, BSB for Australia) + Account number */ - function useDetailedBBAN() + public function useDetailedBBAN() { $country_code=$this->getCountryCode(); @@ -1481,7 +1481,7 @@ class Account extends CommonObject * * @return int 1 = mandatory / 0 = Not mandatory */ - function needIBAN() + public function needIBAN() { $country_code=$this->getCountryCode(); @@ -1531,7 +1531,7 @@ class Account extends CommonObject * @param int $id Id of object to load * @return void */ - function info($id) + public function info($id) { } @@ -1631,7 +1631,7 @@ class Account extends CommonObject * * @return void */ - function initAsSpecimen() + public function initAsSpecimen() { $this->specimen = 1; $this->ref = 'MBA'; @@ -1752,7 +1752,7 @@ class AccountLine extends CommonObject * * @param DoliDB $db Database handler */ - function __construct(DoliDB $db) + public function __construct(DoliDB $db) { $this->db = $db; } @@ -1765,7 +1765,7 @@ class AccountLine extends CommonObject * @param string $num External num to load (ex: num of transaction for paypal fee) * @return int <0 if KO, 0 if OK but not found, >0 if OK and found */ - function fetch($rowid, $ref = '', $num = '') + public function fetch($rowid, $ref = '', $num = '') { global $conf; @@ -1887,7 +1887,7 @@ class AccountLine extends CommonObject * @param User $user User object that delete * @return int <0 if KO, >0 if OK */ - function delete(User $user = null) + public function delete(User $user = null) { $nbko=0; @@ -1930,14 +1930,14 @@ class AccountLine extends CommonObject } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Delete bank line records * * @param User $user User object that delete * @return int <0 if KO, >0 if OK */ - function delete_urls(User $user = null) + public function delete_urls(User $user = null) { // phpcs:enable $nbko=0; @@ -1976,7 +1976,7 @@ class AccountLine extends CommonObject * @param int $notrigger 0=Disable all triggers * @return int <0 if KO, >0 if OK */ - function update(User $user, $notrigger = 0) + public function update(User $user, $notrigger = 0) { $this->db->begin(); @@ -2002,7 +2002,7 @@ class AccountLine extends CommonObject } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Update conciliation field * @@ -2011,7 +2011,7 @@ class AccountLine extends CommonObject * @param int $conciliated 1=Set transaction to conciliated, 0=Keep transaction non conciliated * @return int <0 if KO, >0 if OK */ - function update_conciliation(User $user, $cat, $conciliated = 1) + public function update_conciliation(User $user, $cat, $conciliated = 1) { // phpcs:enable global $conf,$langs; @@ -2067,7 +2067,7 @@ class AccountLine extends CommonObject } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Increase/decrease value date of a rowid * @@ -2075,7 +2075,7 @@ class AccountLine extends CommonObject * @param int $sign 1 or -1 * @return int >0 if OK, 0 if KO */ - function datev_change($rowid, $sign = 1) + public function datev_change($rowid, $sign = 1) { // phpcs:enable $sql = "SELECT datev FROM ".MAIN_DB_PREFIX."bank WHERE rowid = ".$rowid; @@ -2107,34 +2107,34 @@ class AccountLine extends CommonObject return 0; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Increase value date of a rowid * * @param int $id Id of line to change * @return int >0 if OK, 0 if KO */ - function datev_next($id) + public function datev_next($id) { // phpcs:enable return $this->datev_change($id, 1); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Decrease value date of a rowid * * @param int $id Id of line to change * @return int >0 if OK, 0 if KO */ - function datev_previous($id) + public function datev_previous($id) { // phpcs:enable return $this->datev_change($id, -1); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Increase/decrease operation date of a rowid * @@ -2142,7 +2142,7 @@ class AccountLine extends CommonObject * @param int $sign 1 or -1 * @return int >0 if OK, 0 if KO */ - function dateo_change($rowid, $sign = 1) + public function dateo_change($rowid, $sign = 1) { // phpcs:enable $sql = "SELECT dateo FROM ".MAIN_DB_PREFIX."bank WHERE rowid = ".$rowid; @@ -2174,27 +2174,27 @@ class AccountLine extends CommonObject return 0; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Increase operation date of a rowid * * @param int $id Id of line to change * @return int >0 if OK, 0 if KO */ - function dateo_next($id) + public function dateo_next($id) { // phpcs:enable return $this->dateo_change($id, 1); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Decrease operation date of a rowid * * @param int $id Id of line to change * @return int >0 if OK, 0 if KO */ - function dateo_previous($id) + public function dateo_previous($id) { // phpcs:enable return $this->dateo_change($id, -1); @@ -2207,7 +2207,7 @@ class AccountLine extends CommonObject * @param int $id Id of object to load * @return void */ - function info($id) + public function info($id) { $sql = 'SELECT b.rowid, b.datec, b.tms as datem,'; $sql.= ' b.fk_user_author, b.fk_user_rappro'; @@ -2257,7 +2257,7 @@ class AccountLine extends CommonObject * @param int $notooltip 1=Disable tooltip * @return string Chaine avec URL */ - function getNomUrl($withpicto = 0, $maxlen = 0, $option = '', $notooltip = 0) + public function getNomUrl($withpicto = 0, $maxlen = 0, $option = '', $notooltip = 0) { global $langs; @@ -2298,12 +2298,12 @@ class AccountLine extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long * @return string Libelle */ - function getLibStatut($mode = 0) + public function getLibStatut($mode = 0) { return $this->LibStatut($this->status, $mode); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -2311,7 +2311,7 @@ class AccountLine extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ - function LibStatut($statut, $mode = 0) + public function LibStatut($statut, $mode = 0) { // phpcs:enable global $langs; diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index feaaccaa50f..04692fb4e44 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -43,7 +43,7 @@ class BankAccounts extends DolibarrApi /** * Constructor */ - function __construct() + public function __construct() { global $db; $this->db = $db; @@ -61,11 +61,11 @@ class BankAccounts extends DolibarrApi * * @throws RestException */ - function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') { $list = array(); - if(! DolibarrApiAccess::$user->rights->banque->lire) { + if (! DolibarrApiAccess::$user->rights->banque->lire) { throw new RestException(401); } @@ -121,7 +121,7 @@ class BankAccounts extends DolibarrApi * * @throws RestException */ - function get($id) + public function get($id) { if (! DolibarrApiAccess::$user->rights->banque->lire) { throw new RestException(401); @@ -142,7 +142,7 @@ class BankAccounts extends DolibarrApi * @param array $request_data Request data * @return int ID of account */ - function post($request_data = null) + public function post($request_data = null) { if (! DolibarrApiAccess::$user->rights->banque->configurer) { throw new RestException(401); @@ -173,7 +173,7 @@ class BankAccounts extends DolibarrApi * @param array $request_data data * @return int */ - function put($id, $request_data = null) + public function put($id, $request_data = null) { if (! DolibarrApiAccess::$user->rights->banque->configurer) { throw new RestException(401); @@ -196,7 +196,7 @@ class BankAccounts extends DolibarrApi } else { - throw new RestException(500, $account->error); + throw new RestException(500, $account->error); } } @@ -206,7 +206,7 @@ class BankAccounts extends DolibarrApi * @param int $id ID of account * @return array */ - function delete($id) + public function delete($id) { if (! DolibarrApiAccess::$user->rights->banque->configurer) { throw new RestException(401); @@ -237,7 +237,7 @@ class BankAccounts extends DolibarrApi * * @throws RestException */ - function _validate($data) + private function _validate($data) { $account = array(); foreach (BankAccounts::$FIELDS as $field) { @@ -254,7 +254,7 @@ class BankAccounts extends DolibarrApi * @param object $object Object to clean * @return array Array of cleaned object properties */ - function _cleanObjectDatas($object) + private function _cleanObjectDatas($object) { $object = parent::_cleanObjectDatas($object); @@ -273,7 +273,7 @@ class BankAccounts extends DolibarrApi * * @url GET {id}/lines */ - function getLines($id) + public function getLines($id) { $list = array(); @@ -325,7 +325,7 @@ class BankAccounts extends DolibarrApi * * @url POST {id}/lines */ - function addLine($id, $date, $type, $label, $amount, $category = 0, $cheque_number = '', $cheque_writer = '', $cheque_bank = '') + public function addLine($id, $date, $type, $label, $amount, $category = 0, $cheque_number = '', $cheque_writer = '', $cheque_bank = '') { if (! DolibarrApiAccess::$user->rights->banque->modifier) { throw new RestException(401); @@ -337,8 +337,16 @@ class BankAccounts extends DolibarrApi throw new RestException(404, 'account not found'); } - $result = $account->addline($date, $type, $label, $amount, $cheque_number, $category, - DolibarrApiAccess::$user, $cheque_writer, $cheque_bank); + $result = $account->addline( + $date, + $type, + $label, + $amount, + $cheque_number, + $category, + DolibarrApiAccess::$user, + $cheque_writer, $cheque_bank + ); if ($result < 0) { throw new RestException(503, 'Error when adding line to account: ' . $account->error); } @@ -358,7 +366,7 @@ class BankAccounts extends DolibarrApi * * @url POST {id}/lines/{line_id}/links */ - function addLink($id, $line_id, $url_id, $url, $label, $type) + public function addLink($id, $line_id, $url_id, $url, $label, $type) { if (! DolibarrApiAccess::$user->rights->banque->modifier) { throw new RestException(401); diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index 06de0a00bc1..5a7ac205fe5 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -99,7 +99,7 @@ class PaymentVarious extends CommonObject * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db = $db; $this->element = 'payment_various'; @@ -113,7 +113,7 @@ class PaymentVarious extends CommonObject * @param int $notrigger 0=no, 1=yes (no update trigger) * @return int <0 if KO, >0 if OK */ - function update($user = null, $notrigger = 0) + public function update($user = null, $notrigger = 0) { global $conf, $langs; @@ -184,7 +184,7 @@ class PaymentVarious extends CommonObject * @param User $user User that load * @return int <0 if KO, >0 if OK */ - function fetch($id, $user = null) + public function fetch($id, $user = null) { global $langs; $sql = "SELECT"; @@ -258,7 +258,7 @@ class PaymentVarious extends CommonObject * @param User $user User that delete * @return int <0 if KO, >0 if OK */ - function delete($user) + public function delete($user) { global $conf, $langs; @@ -292,7 +292,7 @@ class PaymentVarious extends CommonObject * * @return void */ - function initAsSpecimen() + public function initAsSpecimen() { $this->id=0; @@ -316,7 +316,7 @@ class PaymentVarious extends CommonObject * @param User $user User that create * @return int <0 if KO, >0 if OK */ - function create($user) + public function create($user) { global $conf,$langs; @@ -482,14 +482,14 @@ class PaymentVarious extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Update link between payment various and line generate into llx_bank * * @param int $id_bank Id bank account * @return int <0 if KO, >0 if OK */ - function update_fk_bank($id_bank) + public function update_fk_bank($id_bank) { // phpcs:enable $sql = 'UPDATE '.MAIN_DB_PREFIX.'payment_various SET fk_bank = '.$id_bank; @@ -513,12 +513,12 @@ class PaymentVarious extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Libelle */ - function getLibStatut($mode = 0) + public function getLibStatut($mode = 0) { return $this->LibStatut($this->statut, $mode); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -526,7 +526,7 @@ class PaymentVarious extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Libelle */ - function LibStatut($statut, $mode = 0) + public function LibStatut($statut, $mode = 0) { // phpcs:enable global $langs; @@ -575,7 +575,7 @@ class PaymentVarious extends CommonObject * @param int $notooltip 1=Disable tooltip * @return string String with URL */ - function getNomUrl($withpicto = 0, $option = '', $save_lastsearch_value = -1, $notooltip = 0) + public function getNomUrl($withpicto = 0, $option = '', $save_lastsearch_value = -1, $notooltip = 0) { global $db, $conf, $langs, $hookmanager; global $langs; @@ -644,8 +644,8 @@ class PaymentVarious extends CommonObject * @param int $id Id of record * @return void */ - function info($id) - { + public function info($id) + { $sql = 'SELECT v.rowid, v.datec, v.fk_user_author'; $sql.= ' FROM '.MAIN_DB_PREFIX.'payment_various as v'; $sql.= ' WHERE v.rowid = '.$id; diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 52a499cadee..6c4c94fc2ce 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -1099,7 +1099,7 @@ class Invoices extends DolibarrApi * @throws 404 * @throws 405 */ - function useCreditNote($id, $discountid) + public function useCreditNote($id, $discountid) { require_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php'; diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index ce947369e79..3dffd5b396d 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -319,7 +319,7 @@ class FactureRec extends CommonInvoice * @param int $notrigger No trigger * @return int <0 if KO, Id of line if OK */ - function update(User $user, $notrigger = 0) + public function update(User $user, $notrigger = 0) { global $conf; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 08f75f1e28e..5e2db021f83 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -274,7 +274,7 @@ class Facture extends CommonInvoice * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db = $db; } @@ -289,7 +289,7 @@ class Facture extends CommonInvoice * @param int $forceduedate 1=Do not recalculate due date from payment condition but force it with value * @return int <0 if KO, >0 if OK */ - function create(User $user, $notrigger = 0, $forceduedate = 0) + public function create(User $user, $notrigger = 0, $forceduedate = 0) { global $langs,$conf,$mysoc,$hookmanager; $error=0; @@ -854,7 +854,7 @@ class Facture extends CommonInvoice * @param int $invertdetail Reverse sign of amounts for lines * @return int <0 if KO, >0 if OK */ - function createFromCurrent(User $user, $invertdetail = 0) + public function createFromCurrent(User $user, $invertdetail = 0) { global $conf; @@ -945,7 +945,7 @@ class Facture extends CommonInvoice * @param int $socid Id of thirdparty * @return int New id of clone */ - function createFromClone($socid = 0) + public function createFromClone($socid = 0) { global $user,$hookmanager, $conf; @@ -1054,7 +1054,7 @@ class Facture extends CommonInvoice * @param User $user Object user * @return int <0 if KO, 0 if nothing done, 1 if OK */ - function createFromOrder($object, User $user) + public function createFromOrder($object, User $user) { global $hookmanager; @@ -1172,7 +1172,7 @@ class Facture extends CommonInvoice * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @return string String with URL */ - function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = 0, $addlinktonotes = 0, $save_lastsearch_value = -1) + public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = 0, $addlinktonotes = 0, $save_lastsearch_value = -1) { global $langs, $conf, $user, $form; @@ -1280,7 +1280,7 @@ class Facture extends CommonInvoice * @param bool $fetch_situation Fetch the previous and next situation in $tab_previous_situation_invoice and $tab_next_situation_invoice * @return int >0 if OK, <0 if KO, 0 if not found */ - function fetch($rowid, $ref = '', $ref_ext = '', $ref_int = '', $fetch_situation = false) + public function fetch($rowid, $ref = '', $ref_ext = '', $ref_int = '', $fetch_situation = false) { global $conf; @@ -1431,13 +1431,13 @@ class Facture extends CommonInvoice } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load all detailed lines into this->lines * * @return int 1 if OK, < 0 if KO */ - function fetch_lines() + public function fetch_lines() { // phpcs:enable $this->lines=array(); @@ -1547,7 +1547,7 @@ class Facture extends CommonInvoice * * @return void */ - function fetchPreviousNextSituationInvoice() + public function fetchPreviousNextSituationInvoice() { global $conf; @@ -1587,7 +1587,7 @@ class Facture extends CommonInvoice * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update(User $user, $notrigger = 0) + public function update(User $user, $notrigger = 0) { global $conf; @@ -1692,14 +1692,14 @@ class Facture extends CommonInvoice } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Add a discount line into an invoice (as an invoice line) using an existing absolute discount (Consume the discount) * * @param int $idremise Id of absolute discount * @return int >0 if OK, <0 if KO */ - function insert_discount($idremise) + public function insert_discount($idremise) { // phpcs:enable global $langs; @@ -1794,7 +1794,7 @@ class Facture extends CommonInvoice } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set customer ref * @@ -1802,7 +1802,7 @@ class Facture extends CommonInvoice * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function set_ref_client($ref_client, $notrigger = 0) + public function set_ref_client($ref_client, $notrigger = 0) { // phpcs:enable global $user; @@ -1867,7 +1867,7 @@ class Facture extends CommonInvoice * @param int $idwarehouse Id warehouse to use for stock change. * @return int <0 if KO, 0=Refused, >0 if OK */ - function delete($user, $notrigger = 0, $idwarehouse = -1) + public function delete($user, $notrigger = 0, $idwarehouse = -1) { global $langs,$conf; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -2031,7 +2031,7 @@ class Facture extends CommonInvoice } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Tag la facture comme paye completement (si close_code non renseigne) => this->fk_statut=2, this->paye=1 * ou partiellement (si close_code renseigne) + appel trigger BILL_PAYED => this->fk_statut=2, this->paye stay 0 @@ -2041,7 +2041,7 @@ class Facture extends CommonInvoice * @param string $close_note Commentaire renseigne si on classe a payee alors que paiement incomplet (cas escompte par exemple) * @return int <0 if KO, >0 if OK */ - function set_paid($user, $close_code = '', $close_note = '') + public function set_paid($user, $close_code = '', $close_note = '') { // phpcs:enable $error=0; @@ -2091,7 +2091,7 @@ class Facture extends CommonInvoice } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Tag la facture comme non payee completement + appel trigger BILL_UNPAYED * Fonction utilisee quand un paiement prelevement est refuse, @@ -2100,7 +2100,7 @@ class Facture extends CommonInvoice * @param User $user Object user that change status * @return int <0 if KO, >0 if OK */ - function set_unpaid($user) + public function set_unpaid($user) { // phpcs:enable $error=0; @@ -2140,7 +2140,7 @@ class Facture extends CommonInvoice } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Tag invoice as canceled, with no payment on it (example for replacement invoice or payment never received) + call trigger BILL_CANCEL * Warning, if option to decrease stock on invoice was set, this function does not change stock (it might be a cancel because @@ -2151,7 +2151,7 @@ class Facture extends CommonInvoice * @param string $close_note Comment * @return int <0 if KO, >0 if OK */ - function set_canceled($user, $close_code = '', $close_note = '') + public function set_canceled($user, $close_code = '', $close_note = '') { // phpcs:enable @@ -2214,7 +2214,7 @@ class Facture extends CommonInvoice * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, 0=Nothing done because invoice is not a draft, >0 if OK */ - function validate($user, $force_number = '', $idwarehouse = 0, $notrigger = 0) + public function validate($user, $force_number = '', $idwarehouse = 0, $notrigger = 0) { global $conf,$langs; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -2471,7 +2471,7 @@ class Facture extends CommonInvoice * @param Translate $langs Translate object * @return bool false if KO, true if OK */ - function updatePriceNextInvoice(&$langs) + public function updatePriceNextInvoice(&$langs) { foreach ($this->tab_next_situation_invoice as $next_invoice) { @@ -2504,7 +2504,7 @@ class Facture extends CommonInvoice return true; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set draft status * @@ -2512,7 +2512,7 @@ class Facture extends CommonInvoice * @param int $idwarehouse Id warehouse to use for stock change. * @return int <0 if KO, >0 if OK */ - function set_draft($user, $idwarehouse = -1) + public function set_draft($user, $idwarehouse = -1) { // phpcs:enable global $conf,$langs; @@ -2632,7 +2632,7 @@ class Facture extends CommonInvoice * @param double $pu_ht_devise Unit price in currency * @return int <0 if KO, Id of line if OK */ - function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $date_start = '', $date_end = '', $ventil = 0, $info_bits = 0, $fk_remise_except = '', $price_base_type = 'HT', $pu_ttc = 0, $type = self::TYPE_STANDARD, $rang = -1, $special_code = 0, $origin = '', $origin_id = 0, $fk_parent_line = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $array_options = 0, $situation_percent = 100, $fk_prev_id = 0, $fk_unit = null, $pu_ht_devise = 0) + public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $date_start = '', $date_end = '', $ventil = 0, $info_bits = 0, $fk_remise_except = '', $price_base_type = 'HT', $pu_ttc = 0, $type = self::TYPE_STANDARD, $rang = -1, $special_code = 0, $origin = '', $origin_id = 0, $fk_parent_line = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $array_options = 0, $situation_percent = 100, $fk_prev_id = 0, $fk_unit = null, $pu_ht_devise = 0) { // Deprecation warning if ($label) { @@ -2862,7 +2862,7 @@ class Facture extends CommonInvoice * @param int $notrigger disable line update trigger * @return int < 0 if KO, > 0 if OK */ - function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $price_base_type = 'HT', $info_bits = 0, $type = self::TYPE_STANDARD, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $special_code = 0, $array_options = 0, $situation_percent = 100, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0) + public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $price_base_type = 'HT', $info_bits = 0, $type = self::TYPE_STANDARD, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $special_code = 0, $array_options = 0, $situation_percent = 100, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0) { global $conf,$user; // Deprecation warning @@ -3053,7 +3053,7 @@ class Facture extends CommonInvoice * @param float $situation_percent progress percentage need to be test * @return false if KO, true if OK */ - function checkProgressLine($idline, $situation_percent) + public function checkProgressLine($idline, $situation_percent) { $sql = 'SELECT fd.situation_percent FROM '.MAIN_DB_PREFIX.'facturedet fd INNER JOIN '.MAIN_DB_PREFIX.'facture f ON (fd.fk_facture = f.rowid) @@ -3073,7 +3073,7 @@ class Facture extends CommonInvoice else return $situation_percent < $obj->situation_percent; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Update invoice line with percentage * @@ -3081,7 +3081,7 @@ class Facture extends CommonInvoice * @param int $percent Percentage * @return void */ - function update_percent($line, $percent) + public function update_percent($line, $percent) { // phpcs:enable global $mysoc,$user; @@ -3111,7 +3111,7 @@ class Facture extends CommonInvoice * @param int $rowid Id of line to delete * @return int <0 if KO, >0 if OK */ - function deleteline($rowid) + public function deleteline($rowid) { global $user; @@ -3171,7 +3171,7 @@ class Facture extends CommonInvoice } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set percent discount * @@ -3180,7 +3180,7 @@ class Facture extends CommonInvoice * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok */ - function set_remise($user, $remise, $notrigger = 0) + public function set_remise($user, $remise, $notrigger = 0) { // phpcs:enable // Clean parameters @@ -3237,7 +3237,7 @@ class Facture extends CommonInvoice } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set absolute discount * @@ -3246,7 +3246,7 @@ class Facture extends CommonInvoice * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function set_remise_absolue($user, $remise, $notrigger = 0) + public function set_remise_absolue($user, $remise, $notrigger = 0) { // phpcs:enable if (empty($remise)) $remise=0; @@ -3313,7 +3313,7 @@ class Facture extends CommonInvoice * @param string $mode 'next' for next value or 'last' for last value * @return string free ref or last ref */ - function getNextNumRef($soc, $mode = 'next') + public function getNextNumRef($soc, $mode = 'next') { global $conf, $langs; $langs->load("bills"); @@ -3402,7 +3402,7 @@ class Facture extends CommonInvoice * @param int $id Id of object to load * @return void */ - function info($id) + public function info($id) { $sql = 'SELECT c.rowid, datec, date_valid as datev, tms as datem,'; $sql.= ' fk_user_author, fk_user_valid'; @@ -3441,7 +3441,7 @@ class Facture extends CommonInvoice } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of invoices (eventually filtered on a user) into an array * @@ -3455,7 +3455,7 @@ class Facture extends CommonInvoice * @param string $sortorder Sort order * @return int -1 if KO, array with result if OK */ - function liste_array($shortlist = 0, $draft = 0, $excluser = '', $socid = 0, $limit = 0, $offset = 0, $sortfield = 'f.datef,f.rowid', $sortorder = 'DESC') + public function liste_array($shortlist = 0, $draft = 0, $excluser = '', $socid = 0, $limit = 0, $offset = 0, $sortfield = 'f.datef,f.rowid', $sortorder = 'DESC') { // phpcs:enable global $conf,$user; @@ -3517,7 +3517,7 @@ class Facture extends CommonInvoice } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of invoices qualified to be replaced by another invoice. * Invoices matching the following rules are returned: @@ -3526,7 +3526,7 @@ class Facture extends CommonInvoice * @param int $socid Id thirdparty * @return array Array of invoices ('id'=>id, 'ref'=>ref, 'status'=>status, 'paymentornot'=>0/1) */ - function list_replacable_invoices($socid = 0) + public function list_replacable_invoices($socid = 0) { // phpcs:enable global $conf; @@ -3567,7 +3567,7 @@ class Facture extends CommonInvoice } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of invoices qualified to be corrected by a credit note. * Invoices matching the following rules are returned: @@ -3576,7 +3576,7 @@ class Facture extends CommonInvoice * @param int $socid Id thirdparty * @return array Array of invoices ($id => array('ref'=>,'paymentornot'=>,'status'=>,'paye'=>) */ - function list_qualified_avoir_invoices($socid = 0) + public function list_qualified_avoir_invoices($socid = 0) { // phpcs:enable global $conf; @@ -3642,7 +3642,7 @@ class Facture extends CommonInvoice } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Create a withdrawal request for a standing order. * Use the remain to pay excluding all existing open direct debit requests. @@ -3651,7 +3651,7 @@ class Facture extends CommonInvoice * @param float $amount Amount we request direct debit for * @return int <0 if KO, >0 if OK */ - function demande_prelevement($fuser, $amount = 0) + public function demande_prelevement($fuser, $amount = 0) { // phpcs:enable @@ -3754,7 +3754,7 @@ class Facture extends CommonInvoice } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Supprime une demande de prelevement * @@ -3762,7 +3762,7 @@ class Facture extends CommonInvoice * @param int $did id de la demande a supprimer * @return int <0 if OK, >0 if KO */ - function demande_prelevement_delete($fuser, $did) + public function demande_prelevement_delete($fuser, $did) { // phpcs:enable $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'prelevement_facture_demande'; @@ -3781,14 +3781,14 @@ class Facture extends CommonInvoice } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Object user * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ - function load_board($user) + public function load_board($user) { // phpcs:enable global $conf, $langs; @@ -3853,7 +3853,7 @@ class Facture extends CommonInvoice * * @return array Liste des id contacts facturation */ - function getIdBillingContact() + public function getIdBillingContact() { return $this->getIdContact('external', 'BILLING'); } @@ -3863,7 +3863,7 @@ class Facture extends CommonInvoice * * @return array Liste des id contacts livraison */ - function getIdShippingContact() + public function getIdShippingContact() { return $this->getIdContact('external', 'SHIPPING'); } @@ -3877,7 +3877,7 @@ class Facture extends CommonInvoice * @param string $option ''=Create a specimen invoice with lines, 'nolines'=No lines * @return void */ - function initAsSpecimen($option = '') + public function initAsSpecimen($option = '') { global $langs; @@ -4028,13 +4028,13 @@ class Facture extends CommonInvoice } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @return int <0 if KO, >0 if OK */ - function load_state_board() + public function load_state_board() { // phpcs:enable global $conf, $user; @@ -4077,7 +4077,7 @@ class Facture extends CommonInvoice * * @return int >0 if OK, <0 if KO */ - function getLinesArray() + public function getLinesArray() { return $this->fetch_lines(); } @@ -4123,7 +4123,7 @@ class Facture extends CommonInvoice * * @return int >= 1 if OK, -1 if error */ - function newCycle() + public function newCycle() { $sql = 'SELECT max(situation_cycle_ref) FROM ' . MAIN_DB_PREFIX . 'facture as f'; $sql.= " WHERE f.entity in (".getEntity('invoice', 0).")"; @@ -4146,25 +4146,25 @@ class Facture extends CommonInvoice } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Checks if the invoice is the first of a cycle * * @return boolean */ - function is_first() + public function is_first() { // phpcs:enable return ($this->situation_counter == 1); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Returns an array containing the previous situations as Facture objects * * @return mixed -1 if error, array of previous situations */ - function get_prev_sits() + public function get_prev_sits() { // phpcs:enable global $conf; @@ -4198,7 +4198,7 @@ class Facture extends CommonInvoice * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function setFinal(User $user, $notrigger = 0) + public function setFinal(User $user, $notrigger = 0) { $error=0; @@ -4239,14 +4239,14 @@ class Facture extends CommonInvoice } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Checks if the invoice is the last in its cycle * * @return bool Last of the cycle status * */ - function is_last_in_cycle() + public function is_last_in_cycle() { // phpcs:enable global $conf; @@ -4403,7 +4403,7 @@ class FactureLigne extends CommonInvoiceLine * @param int $rowid id of invoice line to get * @return int <0 if KO, >0 if OK */ - function fetch($rowid) + public function fetch($rowid) { $sql = 'SELECT fd.rowid, fd.fk_facture, fd.fk_parent_line, fd.fk_product, fd.product_type, fd.label as custom_label, fd.description, fd.price, fd.qty, fd.vat_src_code, fd.tva_tx,'; $sql.= ' fd.localtax1_tx, fd. localtax2_tx, fd.remise, fd.remise_percent, fd.fk_remise_except, fd.subprice,'; @@ -4495,7 +4495,7 @@ class FactureLigne extends CommonInvoiceLine * @param int $noerrorifdiscountalreadylinked 1=Do not make error if lines is linked to a discount and discount already linked to another * @return int <0 if KO, >0 if OK */ - function insert($notrigger = 0, $noerrorifdiscountalreadylinked = 0) + public function insert($notrigger = 0, $noerrorifdiscountalreadylinked = 0) { global $langs,$user,$conf; @@ -4712,7 +4712,7 @@ class FactureLigne extends CommonInvoiceLine * @param int $notrigger Disable triggers * @return int <0 if KO, >0 if OK */ - function update($user = '', $notrigger = 0) + public function update($user = '', $notrigger = 0) { global $user,$conf; @@ -4846,7 +4846,7 @@ class FactureLigne extends CommonInvoiceLine * * @return int <0 if KO, >0 if OK */ - function delete() + public function delete() { global $user; @@ -4877,14 +4877,14 @@ class FactureLigne extends CommonInvoiceLine } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Update DB line fields total_xxx * Used by migration * * @return int <0 if KO, >0 if OK */ - function update_total() + public function update_total() { // phpcs:enable $this->db->begin(); @@ -4919,7 +4919,7 @@ class FactureLigne extends CommonInvoiceLine } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Returns situation_percent of the previous line. * Warning: If invoice is a replacement invoice, this->fk_prev_id is id of the replaced line. @@ -4928,7 +4928,7 @@ class FactureLigne extends CommonInvoiceLine * @param bool $include_credit_note Include credit note or not * @return int >= 0 */ - function get_prev_progress($invoiceid, $include_credit_note = true) + public function get_prev_progress($invoiceid, $include_credit_note = true) { // phpcs:enable if (is_null($this->fk_prev_id) || empty($this->fk_prev_id) || $this->fk_prev_id == "") { diff --git a/htdocs/compta/facture/class/facturestats.class.php b/htdocs/compta/facture/class/facturestats.class.php index 65a8808bac7..91d3e4476ff 100644 --- a/htdocs/compta/facture/class/facturestats.class.php +++ b/htdocs/compta/facture/class/facturestats.class.php @@ -32,17 +32,17 @@ include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; */ class FactureStats extends Stats { - var $socid; - var $userid; + public $socid; + public $userid; /** * @var string Name of table without prefix where object is stored */ public $table_element; - - var $from; - var $field; - var $where; + + public $from; + public $field; + public $where; /** @@ -53,7 +53,7 @@ class FactureStats extends Stats * @param string $mode Option ('customer', 'supplier') * @param int $userid Id user for filter (creation user) */ - function __construct($db, $socid, $mode, $userid = 0) + public function __construct($db, $socid, $mode, $userid = 0) { global $user, $conf; @@ -100,7 +100,7 @@ class FactureStats extends Stats * @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month * @return array Array of values */ - function getNbByMonth($year, $format = 0) + public function getNbByMonth($year, $format = 0) { global $user; @@ -123,7 +123,7 @@ class FactureStats extends Stats * * @return array Array with number by year */ - function getNbByYear() + public function getNbByYear() { global $user; @@ -145,7 +145,7 @@ class FactureStats extends Stats * @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month * @return array Array with amount by month */ - function getAmountByMonth($year, $format = 0) + public function getAmountByMonth($year, $format = 0) { global $user; @@ -168,7 +168,7 @@ class FactureStats extends Stats * @param int $year Year to scan * @return array Array of values */ - function getAverageByMonth($year) + public function getAverageByMonth($year) { global $user; @@ -188,7 +188,7 @@ class FactureStats extends Stats * * @return array Array of values */ - function getAllByYear() + public function getAllByYear() { global $user; @@ -208,7 +208,7 @@ class FactureStats extends Stats * @param int $year Year to scan * @return array Array of values */ - function getAllByProduct($year) + public function getAllByProduct($year) { global $user; diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 2c4180c3858..15b006d2cc6 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -70,12 +70,12 @@ class RemiseCheque extends CommonObject * * @param DoliDB $db Database handler */ - function __construct($db) - { + public function __construct($db) + { $this->db = $db; $this->next_id = 0; $this->previous_id = 0; - } + } /** * Load record @@ -84,8 +84,8 @@ class RemiseCheque extends CommonObject * @param string $ref Ref record * @return int <0 if KO, > 0 if OK */ - function fetch($id, $ref = '') - { + public function fetch($id, $ref = '') + { global $conf; $sql = "SELECT bc.rowid, bc.datec, bc.fk_user_author, bc.fk_bank_account, bc.amount, bc.ref, bc.statut, bc.nbcheque, bc.ref_ext"; @@ -131,7 +131,7 @@ class RemiseCheque extends CommonObject $this->error=$this->db->lasterror(); return -1; } - } + } /** * Create a receipt to send cheques @@ -142,8 +142,8 @@ class RemiseCheque extends CommonObject * @param array $toRemise array with cheques to remise * @return int <0 if KO, >0 if OK */ - function create($user, $account_id, $limit, $toRemise) - { + public function create($user, $account_id, $limit, $toRemise) + { global $conf; $this->errno = 0; @@ -299,8 +299,8 @@ class RemiseCheque extends CommonObject * @param User $user Utilisateur qui effectue l'operation * @return int */ - function delete($user = '') - { + public function delete($user = '') + { global $conf; $this->errno = 0; @@ -353,8 +353,8 @@ class RemiseCheque extends CommonObject * @param User $user User * @return int <0 if KO, >0 if OK */ - function validate($user) - { + public function validate($user) + { global $langs,$conf; $this->errno = 0; @@ -416,8 +416,8 @@ class RemiseCheque extends CommonObject * @param string $mode 'next' for next value or 'last' for last value * @return string free ref or last ref */ - function getNextNumRef($mode = 'next') - { + public function getNextNumRef($mode = 'next') + { global $conf, $db, $langs, $mysoc; $langs->load("bills"); @@ -492,18 +492,18 @@ class RemiseCheque extends CommonObject print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete"); return ""; } - } + } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Objet user * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ - function load_board($user) - { + public function load_board($user) + { // phpcs:enable global $conf, $langs; @@ -547,17 +547,17 @@ class RemiseCheque extends CommonObject $this->error=$this->db->error(); return -1; } - } + } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Charge indicateurs this->nb de tableau de bord * * @return int <0 if ko, >0 if ok */ - function load_state_board() - { + public function load_state_board() + { // phpcs:enable global $user; @@ -588,7 +588,7 @@ class RemiseCheque extends CommonObject $this->error=$this->db->error(); return -1; } - } + } /** @@ -598,8 +598,8 @@ class RemiseCheque extends CommonObject * @param Translate $outputlangs Object langs * @return int <0 if KO, >0 if OK */ - function generatePdf($model, $outputlangs) - { + public function generatePdf($model, $outputlangs) + { global $langs,$conf; if (empty($model)) $model='blochet'; @@ -675,15 +675,15 @@ class RemiseCheque extends CommonObject $this->error=$langs->trans("ErrorFileDoesNotExists", $dir.$file); return -1; } - } + } /** * Mets a jour le montant total * * @return int 0 en cas de succes */ - function updateAmount() - { + public function updateAmount() + { global $conf; $this->errno = 0; @@ -735,7 +735,7 @@ class RemiseCheque extends CommonObject } return $this->errno; - } + } /** * Insere la remise en base @@ -743,8 +743,8 @@ class RemiseCheque extends CommonObject * @param int $account_id Compte bancaire concerne * @return int */ - function removeCheck($account_id) - { + public function removeCheck($account_id) + { $this->errno = 0; if ($this->id > 0) @@ -766,7 +766,7 @@ class RemiseCheque extends CommonObject } } return 0; - } + } /** * Check return management @@ -776,8 +776,8 @@ class RemiseCheque extends CommonObject * @param date $rejection_date Date to use on the negative payment * @return int Id of negative payment line created */ - function rejectCheck($bank_id, $rejection_date) - { + public function rejectCheck($bank_id, $rejection_date) + { global $db, $user; $payment = new Paiement($db); @@ -866,14 +866,14 @@ class RemiseCheque extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Charge les proprietes ref_previous et ref_next * * @return int <0 if KO, 0 if OK */ - function load_previous_next_id() - { + public function load_previous_next_id() + { // phpcs:enable global $conf; @@ -909,7 +909,7 @@ class RemiseCheque extends CommonObject } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set the creation date * @@ -917,7 +917,7 @@ class RemiseCheque extends CommonObject * @param int $date Date creation * @return int <0 if KO, >0 if OK */ - function set_date($user, $date) + public function set_date($user, $date) { // phpcs:enable if ($user->rights->banque->cheque) @@ -945,7 +945,7 @@ class RemiseCheque extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set the ref of bordereau * @@ -953,8 +953,8 @@ class RemiseCheque extends CommonObject * @param int $ref ref of bordereau * @return int <0 if KO, >0 if OK */ - function set_number($user, $ref) - { + public function set_number($user, $ref) + { // phpcs:enable if ($user->rights->banque->cheque) { @@ -988,8 +988,8 @@ class RemiseCheque extends CommonObject * @param string $option ''=Create a specimen invoice with lines, 'nolines'=No lines * @return void */ - function initAsSpecimen($option = '') - { + public function initAsSpecimen($option = '') + { global $user,$langs,$conf; $now=dol_now(); @@ -1001,7 +1001,7 @@ class RemiseCheque extends CommonObject $this->ref = 'SPECIMEN'; $this->specimen=1; $this->date_bordereau = $nownotime; - } + } /** * Return clicable name (with picto eventually) @@ -1013,8 +1013,8 @@ class RemiseCheque extends CommonObject * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @return string Chaine avec URL */ - function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) - { + public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) + { global $conf, $langs; $result=''; @@ -1056,7 +1056,7 @@ class RemiseCheque extends CommonObject $result .= $linkend; return $result; - } + } /** * Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee) @@ -1064,12 +1064,12 @@ class RemiseCheque extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle */ - function getLibStatut($mode = 0) - { - return $this->LibStatut($this->statut, $mode); - } + public function getLibStatut($mode = 0) + { + return $this->LibStatut($this->statut, $mode); + } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return label of a status * @@ -1077,46 +1077,46 @@ class RemiseCheque extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto * @return string Libelle du statut */ - function LibStatut($status, $mode = 0) - { + public function LibStatut($status, $mode = 0) + { // phpcs:enable global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage $langs->load('compta'); if ($mode == 0) { if ($status == 0) return $langs->trans('ToValidate'); - if ($status == 1) return $langs->trans('Validated'); + elseif ($status == 1) return $langs->trans('Validated'); } elseif ($mode == 1) { if ($status == 0) return $langs->trans('ToValidate'); - if ($status == 1) return $langs->trans('Validated'); + elseif ($status == 1) return $langs->trans('Validated'); } elseif ($mode == 2) { if ($status == 0) return img_picto($langs->trans('ToValidate'), 'statut0').' '.$langs->trans('ToValidate'); - if ($status == 1) return img_picto($langs->trans('Validated'), 'statut4').' '.$langs->trans('Validated'); + elseif ($status == 1) return img_picto($langs->trans('Validated'), 'statut4').' '.$langs->trans('Validated'); } elseif ($mode == 3) { if ($status == 0) return img_picto($langs->trans('ToValidate'), 'statut0'); - if ($status == 1) return img_picto($langs->trans('Validated'), 'statut4'); + elseif ($status == 1) return img_picto($langs->trans('Validated'), 'statut4'); } elseif ($mode == 4) { if ($status == 0) return img_picto($langs->trans('ToValidate'), 'statut0').' '.$langs->trans('ToValidate'); - if ($status == 1) return img_picto($langs->trans('Validated'), 'statut4').' '.$langs->trans('Validated'); + elseif ($status == 1) return img_picto($langs->trans('Validated'), 'statut4').' '.$langs->trans('Validated'); } elseif ($mode == 5) { if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'), 'statut0'); - if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'), 'statut4'); + elseif ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'), 'statut4'); } elseif ($mode == 6) { if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'), 'statut0'); - if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'), 'statut4'); + elseif ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'), 'statut4'); } return $langs->trans('Unknown'); - } + } } diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 7307b3e1601..13b04854b9c 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -225,7 +225,7 @@ class Paiement extends CommonObject * @param Societe $thirdparty Thirdparty * @return int id of created payment, < 0 if error */ - function create($user, $closepaidinvoices = 0, $thirdparty = null) + public function create($user, $closepaidinvoices = 0, $thirdparty = null) { global $conf, $langs; @@ -497,7 +497,7 @@ class Paiement extends CommonObject * @param int $notrigger No trigger * @return int <0 si ko, >0 si ok */ - function delete($notrigger = 0) + public function delete($notrigger = 0) { global $conf, $user, $langs; @@ -607,7 +607,7 @@ class Paiement extends CommonObject * @param int $notrigger No trigger * @return int <0 if KO, bank_line_id if OK */ - function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque, $notrigger = 0) + public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque, $notrigger = 0) { global $conf,$langs,$user; @@ -730,9 +730,8 @@ class Paiement extends CommonObject } // Add link 'WithdrawalPayment' in bank_url - if (! $error && $label == '(WithdrawalPayment)') - { - $result=$acc->add_url_line( + if (! $error && $label == '(WithdrawalPayment)') { + $result=$acc->add_url_line( $bank_line_id, $this->id_prelevement, DOL_URL_ROOT.'/compta/prelevement/card.php?id=', @@ -776,14 +775,14 @@ class Paiement extends CommonObject } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Mise a jour du lien entre le paiement et la ligne generee dans llx_bank * * @param int $id_bank Id compte bancaire * @return int <0 if KO, >0 if OK */ - function update_fk_bank($id_bank) + public function update_fk_bank($id_bank) { // phpcs:enable $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' set fk_bank = '.$id_bank; @@ -801,16 +800,16 @@ class Paiement extends CommonObject dol_syslog(get_class($this).'::update_fk_bank '.$this->error); return -1; } - } + } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Updates the payment date * * @param int $date New date * @return int <0 if KO, 0 if OK */ - function update_date($date) + public function update_date($date) { // phpcs:enable $error=0; @@ -868,18 +867,17 @@ class Paiement extends CommonObject return -1; //no date given or already validated } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Updates the payment number * * @param string $num New num * @return int <0 if KO, 0 if OK */ - function update_num($num) + public function update_num($num) { // phpcs:enable - if(!empty($num) && $this->statut!=1) - { + if(!empty($num) && $this->statut!=1) { $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; $sql.= " SET num_paiement = '".$this->db->escape($num)."'"; $sql.= " WHERE rowid = ".$this->id; @@ -906,8 +904,8 @@ class Paiement extends CommonObject * @param User $user User making validation * @return int <0 if KO, >0 if OK */ - function valide(User $user = null) - { + public function valide(User $user = null) + { $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET statut = 1 WHERE rowid = '.$this->id; dol_syslog(get_class($this).'::valide', LOG_DEBUG); @@ -922,7 +920,7 @@ class Paiement extends CommonObject dol_syslog(get_class($this).'::valide '.$this->error); return -1; } - } + } /** * Reject payment @@ -930,8 +928,8 @@ class Paiement extends CommonObject * @param User $user User making reject * @return int <0 if KO, >0 if OK */ - function reject(User $user = null) - { + public function reject(User $user = null) + { $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET statut = 2 WHERE rowid = '.$this->id; dol_syslog(get_class($this).'::reject', LOG_DEBUG); @@ -946,7 +944,7 @@ class Paiement extends CommonObject dol_syslog(get_class($this).'::reject '.$this->error); return -1; } - } + } /** * Information sur l'objet @@ -954,8 +952,8 @@ class Paiement extends CommonObject * @param int $id id du paiement dont il faut afficher les infos * @return void */ - function info($id) - { + public function info($id) + { $sql = 'SELECT p.rowid, p.datec, p.fk_user_creat, p.fk_user_modif, p.tms'; $sql.= ' FROM '.MAIN_DB_PREFIX.'paiement as p'; $sql.= ' WHERE p.rowid = '.$id; @@ -990,7 +988,7 @@ class Paiement extends CommonObject { dol_print_error($this->db); } - } + } /** * Retourne la liste des factures sur lesquels porte le paiement @@ -998,8 +996,8 @@ class Paiement extends CommonObject * @param string $filter Critere de filtre * @return array Tableau des id de factures */ - function getBillsArray($filter = '') - { + public function getBillsArray($filter = '') + { $sql = 'SELECT fk_facture'; $sql.= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf, '.MAIN_DB_PREFIX.'facture as f'; $sql.= ' WHERE pf.fk_facture = f.rowid AND fk_paiement = '.$this->id; @@ -1026,7 +1024,7 @@ class Paiement extends CommonObject dol_syslog(get_class($this).'::getBillsArray Error '.$this->error.' -', LOG_DEBUG); return -1; } - } + } /** * Return next reference of customer invoice not already used (or last reference) @@ -1036,7 +1034,7 @@ class Paiement extends CommonObject * @param string $mode 'next' for next value or 'last' for last value * @return string free ref or last ref */ - function getNextNumRef($soc, $mode = 'next') + public function getNextNumRef($soc, $mode = 'next') { global $conf, $db, $langs; $langs->load("bills"); @@ -1119,7 +1117,7 @@ class Paiement extends CommonObject * * @return string 'dolibarr' if standard comportment or paid in main currency, 'customer' if payment received from multicurrency inputs */ - function getWay() + public function getWay() { global $conf; @@ -1147,7 +1145,7 @@ class Paiement extends CommonObject * @param string $option ''=Create a specimen invoice with lines, 'nolines'=No lines * @return void */ - function initAsSpecimen($option = '') + public function initAsSpecimen($option = '') { global $user,$langs,$conf; @@ -1173,7 +1171,7 @@ class Paiement extends CommonObject * @param int $notooltip 1=Disable tooltip * @return string Chaine avec URL */ - function getNomUrl($withpicto = 0, $option = '', $mode = 'withlistofinvoices', $notooltip = 0) + public function getNomUrl($withpicto = 0, $option = '', $mode = 'withlistofinvoices', $notooltip = 0) { global $conf, $langs; @@ -1231,12 +1229,12 @@ class Paiement extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle */ - function getLibStatut($mode = 0) + public function getLibStatut($mode = 0) { return $this->LibStatut($this->statut, $mode); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -1244,7 +1242,7 @@ class Paiement extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ - function LibStatut($status, $mode = 0) + public function LibStatut($status, $mode = 0) { // phpcs:enable global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage @@ -1288,14 +1286,14 @@ class Paiement extends CommonObject return ''; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load the third party of object, from id into this->thirdparty * * @param int $force_thirdparty_id Force thirdparty id * @return int <0 if KO, >0 if OK */ - function fetch_thirdparty($force_thirdparty_id = 0) + public function fetch_thirdparty($force_thirdparty_id = 0) { // phpcs:enable include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; diff --git a/htdocs/compta/prelevement/class/ligneprelevement.class.php b/htdocs/compta/prelevement/class/ligneprelevement.class.php index 6f9d50ceb07..e76cc9d184d 100644 --- a/htdocs/compta/prelevement/class/ligneprelevement.class.php +++ b/htdocs/compta/prelevement/class/ligneprelevement.class.php @@ -41,7 +41,7 @@ class LignePrelevement */ public $db; - var $statuts = array(); + public $statuts = array(); /** @@ -50,7 +50,7 @@ class LignePrelevement * @param DoliDb $db Database handler * @param User $user Objet user */ - function __construct($db, $user) + public function __construct($db, $user) { global $conf,$langs; @@ -71,7 +71,7 @@ class LignePrelevement * @param int $rowid id de la facture a recuperer * @return integer */ - function fetch($rowid) + public function fetch($rowid) { global $conf; @@ -117,18 +117,18 @@ class LignePrelevement return $result; } -/** + /** * Return status label of object * * @param int $mode 0=Label, 1=Picto + label, 2=Picto, 3=Label + Picto * @return string Label */ - function getLibStatut($mode = 0) + public function getLibStatut($mode = 0) { return $this->LibStatut($this->statut, $mode); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return status label for a status * @@ -136,7 +136,7 @@ class LignePrelevement * @param int $mode 0=Label, 1=Picto + label, 2=Picto, 3=Label + Picto * @return string Label */ - function LibStatut($statut, $mode = 0) + public function LibStatut($statut, $mode = 0) { // phpcs:enable global $langs; @@ -148,20 +148,20 @@ class LignePrelevement elseif ($mode == 1) { if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]), 'statut1').' '.$langs->trans($this->statuts[$statut]); // Waiting - if ($statut==2) return img_picto($langs->trans($this->statuts[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]); // Credited - if ($statut==3) return img_picto($langs->trans($this->statuts[$statut]), 'statut8').' '.$langs->trans($this->statuts[$statut]); // Refused + elseif ($statut==2) return img_picto($langs->trans($this->statuts[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]); // Credited + elseif ($statut==3) return img_picto($langs->trans($this->statuts[$statut]), 'statut8').' '.$langs->trans($this->statuts[$statut]); // Refused } elseif ($mode == 2) { if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]), 'statut1'); - if ($statut==2) return img_picto($langs->trans($this->statuts[$statut]), 'statut6'); - if ($statut==3) return img_picto($langs->trans($this->statuts[$statut]), 'statut8'); + elseif ($statut==2) return img_picto($langs->trans($this->statuts[$statut]), 'statut6'); + elseif ($statut==3) return img_picto($langs->trans($this->statuts[$statut]), 'statut8'); } elseif ($mode == 3) { if ($statut==0) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut1'); - if ($statut==2) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut6'); - if ($statut==3) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut8'); + elseif ($statut==2) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut6'); + elseif ($statut==3) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut8'); } } diff --git a/htdocs/compta/prelevement/class/rejetprelevement.class.php b/htdocs/compta/prelevement/class/rejetprelevement.class.php index f0df56fbec1..27dfe40a74f 100644 --- a/htdocs/compta/prelevement/class/rejetprelevement.class.php +++ b/htdocs/compta/prelevement/class/rejetprelevement.class.php @@ -47,7 +47,7 @@ class RejetPrelevement * @param DoliDb $db Database handler * @param User $user Objet user */ - function __construct($db, $user) + public function __construct($db, $user) { global $langs; @@ -82,7 +82,7 @@ class RejetPrelevement * @param int $facturation Facturation * @return void */ - function create($user, $id, $motif, $date_rejet, $bonid, $facturation = 0) + public function create($user, $id, $motif, $date_rejet, $bonid, $facturation = 0) { global $langs,$conf; @@ -198,14 +198,14 @@ class RejetPrelevement } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Send email to all users that has asked the withdraw request * * @param Facture $fac Invoice object * @return void */ - function _send_email($fac) + private function _send_email($fac) { // phpcs:enable global $langs; @@ -334,7 +334,7 @@ class RejetPrelevement * @param int $rowid id of invoice to retrieve * @return int */ - function fetch($rowid) + public function fetch($rowid) { $sql = "SELECT pr.date_rejet as dr, motif, afacturer"; diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 8600e21b2ea..41c9555ccfc 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -81,7 +81,7 @@ class ChargeSociales extends CommonObject * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db = $db; } @@ -93,7 +93,7 @@ class ChargeSociales extends CommonObject * @param string $ref Ref * @return int <0 KO >0 OK */ - function fetch($id, $ref = '') + public function fetch($id, $ref = '') { $sql = "SELECT cs.rowid, cs.date_ech"; $sql.= ", cs.libelle as lib, cs.fk_type, cs.amount, cs.fk_projet as fk_project, cs.paye, cs.periode, cs.import_key"; @@ -152,7 +152,7 @@ class ChargeSociales extends CommonObject * * @return boolean True or false */ - function check() + public function check() { $newamount=price2num($this->amount, 'MT'); @@ -172,7 +172,7 @@ class ChargeSociales extends CommonObject * @param User $user User making creation * @return int <0 if KO, id if OK */ - function create($user) + public function create($user) { global $conf; $error=0; @@ -182,8 +182,7 @@ class ChargeSociales extends CommonObject // Nettoyage parametres $newamount=price2num($this->amount, 'MT'); - if (!$this->check()) - { + if (!$this->check()) { $this->error="ErrorBadParameter"; return -2; } @@ -206,8 +205,7 @@ class ChargeSociales extends CommonObject dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); - if ($resql) - { + if ($resql) { $this->id=$this->db->last_insert_id(MAIN_DB_PREFIX."chargesociales"); //dol_syslog("ChargesSociales::create this->id=".$this->id); @@ -238,7 +236,7 @@ class ChargeSociales extends CommonObject * @param User $user Object user making delete * @return int <0 if KO, >0 if OK */ - function delete($user) + public function delete($user) { $error=0; @@ -309,7 +307,7 @@ class ChargeSociales extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user, $notrigger = 0) + public function update($user, $notrigger = 0) { $error=0; $this->db->begin(); @@ -365,7 +363,7 @@ class ChargeSociales extends CommonObject * @param int $year Year * @return number */ - function solde($year = 0) + public function solde($year = 0) { global $conf; @@ -399,14 +397,14 @@ class ChargeSociales extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Tag social contribution as payed completely * * @param User $user Object user making change * @return int <0 if KO, >0 if OK */ - function set_paid($user) + public function set_paid($user) { // phpcs:enable $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET"; @@ -417,14 +415,14 @@ class ChargeSociales extends CommonObject else return -1; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Remove tag payed on social contribution * * @param User $user Object user making change * @return int <0 if KO, >0 if OK */ - function set_unpaid($user) + public function set_unpaid($user) { // phpcs:enable $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET"; @@ -442,12 +440,12 @@ class ChargeSociales extends CommonObject * @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise) * @return string Label */ - function getLibStatut($mode = 0, $alreadypaid = -1) + public function getLibStatut($mode = 0, $alreadypaid = -1) { return $this->LibStatut($this->paye, $mode, $alreadypaid); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -456,7 +454,7 @@ class ChargeSociales extends CommonObject * @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise) * @return string Label */ - function LibStatut($statut, $mode = 0, $alreadypaid = -1) + public function LibStatut($statut, $mode = 0, $alreadypaid = -1) { // phpcs:enable global $langs; @@ -467,37 +465,37 @@ class ChargeSociales extends CommonObject if ($mode == 0 || $mode == 1) { if ($statut == 0) return $langs->trans("Unpaid"); - if ($statut == 1) return $langs->trans("Paid"); + elseif ($statut == 1) return $langs->trans("Paid"); } elseif ($mode == 2) { if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid"); - if ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted"); - if ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid"); + elseif ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted"); + elseif ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid"); } elseif ($mode == 3) { if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1'); - if ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3'); - if ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6'); + elseif ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3'); + elseif ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6'); } elseif ($mode == 4) { if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid"); - if ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted"); - if ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid"); + elseif ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted"); + elseif ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid"); } elseif ($mode == 5) { if ($statut == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1'); - if ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3'); - if ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6'); + elseif ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3'); + elseif ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6'); } elseif ($mode == 6) { if ($statut == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1'); - if ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3'); - if ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6'); + elseif ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3'); + elseif ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6'); } else return "Error, mode/status not found"; @@ -514,7 +512,7 @@ class ChargeSociales extends CommonObject * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @return string String with link */ - function getNomUrl($withpicto = 0, $maxlen = 0, $notooltip = 0, $short = 0, $save_lastsearch_value = -1) + public function getNomUrl($withpicto = 0, $maxlen = 0, $notooltip = 0, $short = 0, $save_lastsearch_value = -1) { global $langs, $conf, $user, $form; @@ -574,7 +572,7 @@ class ChargeSociales extends CommonObject * * @return int Amount of payment already done, <0 if KO */ - function getSommePaiement() + public function getSommePaiement() { $table='paiementcharge'; $field='fk_charge'; @@ -585,8 +583,7 @@ class ChargeSociales extends CommonObject dol_syslog(get_class($this)."::getSommePaiement", LOG_DEBUG); $resql=$this->db->query($sql); - if ($resql) - { + if ($resql) { $amount=0; $obj = $this->db->fetch_object($resql); @@ -607,7 +604,7 @@ class ChargeSociales extends CommonObject * @param int $id Id of social contribution * @return int <0 if KO, >0 if OK */ - function info($id) + public function info($id) { $sql = "SELECT e.rowid, e.tms as datem, e.date_creation as datec, e.date_valid as datev, e.import_key,"; $sql.= " e.fk_user_author, e.fk_user_modif, e.fk_user_valid"; @@ -663,7 +660,7 @@ class ChargeSociales extends CommonObject * * @return void */ - function initAsSpecimen() + public function initAsSpecimen() { // Initialize parameters $this->id=0; diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 4969b8f9b79..0fe747d0a86 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -91,7 +91,7 @@ class PaymentSocialContribution extends CommonObject * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db = $db; } @@ -104,7 +104,7 @@ class PaymentSocialContribution extends CommonObject * @param int $closepaidcontrib 1=Also close payed contributions to paid, 0=Do nothing more * @return int <0 if KO, id of payment if OK */ - function create($user, $closepaidcontrib = 0) + public function create($user, $closepaidcontrib = 0) { global $conf, $langs; @@ -221,7 +221,7 @@ class PaymentSocialContribution extends CommonObject * @param int $id Id object * @return int <0 if KO, >0 if OK */ - function fetch($id) + public function fetch($id) { global $langs; $sql = "SELECT"; @@ -292,7 +292,7 @@ class PaymentSocialContribution extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user = null, $notrigger = 0) + public function update($user = null, $notrigger = 0) { global $conf, $langs; $error=0; @@ -379,7 +379,7 @@ class PaymentSocialContribution extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function delete($user, $notrigger = 0) + public function delete($user, $notrigger = 0) { global $conf, $langs; $error=0; @@ -409,10 +409,10 @@ class PaymentSocialContribution extends CommonObject if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } } - if (! $error) - { - if (! $notrigger) - { + //if (! $error) + //{ + // if (! $notrigger) + // { // Uncomment this and change MYOBJECT to your own tag if you // want this action call a trigger. @@ -422,8 +422,8 @@ class PaymentSocialContribution extends CommonObject //$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf); //if ($result < 0) { $error++; $this->errors=$interface->errors; } //// End call triggers - } - } + // } + //} // Commit or rollback if ($error) @@ -451,7 +451,7 @@ class PaymentSocialContribution extends CommonObject * @param int $fromid Id of object to clone * @return int New id of clone */ - function createFromClone($fromid) + public function createFromClone($fromid) { global $user,$langs; @@ -510,7 +510,7 @@ class PaymentSocialContribution extends CommonObject * * @return void */ - function initAsSpecimen() + public function initAsSpecimen() { $this->id=0; @@ -540,7 +540,7 @@ class PaymentSocialContribution extends CommonObject * @param string $emetteur_banque Name of bank * @return int <0 if KO, >0 if OK */ - function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque) + public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque) { global $conf; @@ -624,14 +624,14 @@ class PaymentSocialContribution extends CommonObject } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Mise a jour du lien entre le paiement de charge et la ligne dans llx_bank generee * * @param int $id_bank Id if bank * @return int >0 if OK, <=0 if KO */ - function update_fk_bank($id_bank) + public function update_fk_bank($id_bank) { // phpcs:enable $sql = "UPDATE ".MAIN_DB_PREFIX."paiementcharge SET fk_bank = ".$id_bank." WHERE rowid = ".$this->id; @@ -656,12 +656,12 @@ class PaymentSocialContribution extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle */ - function getLibStatut($mode = 0) + public function getLibStatut($mode = 0) { return $this->LibStatut($this->statut, $mode); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -669,7 +669,7 @@ class PaymentSocialContribution extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ - function LibStatut($status, $mode = 0) + public function LibStatut($status, $mode = 0) { // phpcs:enable global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage @@ -720,7 +720,7 @@ class PaymentSocialContribution extends CommonObject * @param int $maxlen Longueur max libelle * @return string Chaine avec URL */ - function getNomUrl($withpicto = 0, $maxlen = 0) + public function getNomUrl($withpicto = 0, $maxlen = 0) { global $langs; @@ -729,16 +729,15 @@ class PaymentSocialContribution extends CommonObject if (empty($this->ref)) $this->ref=$this->lib; $label = $langs->trans("ShowPayment").': '.$this->ref; - if (!empty($this->id)) - { - $link = ''; - $linkend=''; + if (!empty($this->id)) { + $link = ''; + $linkend=''; if ($withpicto) $result.=($link.img_object($label, 'payment', 'class="classfortooltip"').$linkend.' '); - if ($withpicto && $withpicto != 2) $result.=' '; - if ($withpicto != 2) $result.=$link.($maxlen?dol_trunc($this->ref, $maxlen):$this->ref).$linkend; - } + if ($withpicto && $withpicto != 2) $result.=' '; + if ($withpicto != 2) $result.=$link.($maxlen?dol_trunc($this->ref, $maxlen):$this->ref).$linkend; + } - return $result; - } + return $result; + } } diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 9df4596a8d6..bbada0e22f7 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -137,7 +137,7 @@ class ExpenseReport extends CommonObject * * @param DoliDB $db Handler acces base de donnees */ - function __construct($db) + public function __construct($db) { $this->db = $db; $this->total_ht = 0; @@ -155,10 +155,10 @@ class ExpenseReport extends CommonObject * Create object in database * * @param User $user User that create - * @param int $notrigger Disable triggers + * @param int $notrigger Disable triggers * @return int <0 if KO, >0 if OK */ - function create($user, $notrigger = 0) + public function create($user, $notrigger = 0) { global $conf; @@ -307,7 +307,7 @@ class ExpenseReport extends CommonObject * @param int $fk_user_author Id of new user * @return int New id of clone */ - function createFromClone($fk_user_author) + public function createFromClone($fk_user_author) { global $user,$hookmanager; @@ -377,7 +377,7 @@ class ExpenseReport extends CommonObject * @param User $userofexpensereport New user we want to have the expense report on. * @return int <0 if KO, >0 if OK */ - function update($user, $notrigger = 0, $userofexpensereport = null) + public function update($user, $notrigger = 0, $userofexpensereport = null) { global $langs; @@ -447,7 +447,7 @@ class ExpenseReport extends CommonObject * @param string $ref Ref {@name ref} * @return int <0 if KO, >0 if OK */ - function fetch($id, $ref = '') + public function fetch($id, $ref = '') { global $conf; @@ -545,7 +545,7 @@ class ExpenseReport extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Classify the expense report as paid * @@ -554,7 +554,7 @@ class ExpenseReport extends CommonObject * @param int $notrigger Disable triggers * @return int <0 if KO, >0 if OK */ - function set_paid($id, $fuser, $notrigger = 0) + public function set_paid($id, $fuser, $notrigger = 0) { // phpcs:enable $error = 0; @@ -613,12 +613,12 @@ class ExpenseReport extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Label */ - function getLibStatut($mode = 0) + public function getLibStatut($mode = 0) { return $this->LibStatut($this->status, $mode); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Returns the label of a statut * @@ -626,7 +626,7 @@ class ExpenseReport extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label */ - function LibStatut($status, $mode = 0) + public function LibStatut($status, $mode = 0) { // phpcs:enable global $langs; @@ -660,7 +660,7 @@ class ExpenseReport extends CommonObject * @param int $id Id of object * @return void */ - function info($id) + public function info($id) { global $conf; @@ -684,16 +684,16 @@ class ExpenseReport extends CommonObject { $obj = $this->db->fetch_object($resql); - $this->id = $obj->rowid; + $this->id = $obj->rowid; - $this->date_creation = $this->db->jdate($obj->datec); + $this->date_creation = $this->db->jdate($obj->datec); $this->date_modification = $this->db->jdate($obj->date_modification); - $this->date_validation = $this->db->jdate($obj->datev); - $this->date_approbation = $this->db->jdate($obj->datea); + $this->date_validation = $this->db->jdate($obj->datev); + $this->date_approbation = $this->db->jdate($obj->datea); $cuser = new User($this->db); $cuser->fetch($obj->fk_user_author); - $this->user_creation = $cuser; + $this->user_creation = $cuser; if ($obj->fk_user_creation) { @@ -737,7 +737,7 @@ class ExpenseReport extends CommonObject * * @return void */ - function initAsSpecimen() + public function initAsSpecimen() { global $user,$langs,$conf; @@ -767,8 +767,7 @@ class ExpenseReport extends CommonObject $this->note_public='SPECIMEN'; $nbp = 5; $xnbp = 0; - while ($xnbp < $nbp) - { + while ($xnbp < $nbp) { $line=new ExpenseReportLine($this->db); $line->comments=$langs->trans("Comment")." ".$xnbp; $line->date=($now-3600*(1+$xnbp)); @@ -793,7 +792,7 @@ class ExpenseReport extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * fetch_line_by_project * @@ -801,7 +800,7 @@ class ExpenseReport extends CommonObject * @param User $user User * @return int <0 if KO, >0 if OK */ - function fetch_line_by_project($projectid, $user = '') + public function fetch_line_by_project($projectid, $user = '') { // phpcs:enable global $conf,$db,$langs; @@ -906,7 +905,7 @@ class ExpenseReport extends CommonObject * @param int $id Id of expense report * @return int <0 if KO, >0 if OK */ - function recalculer($id) + public function recalculer($id) { $sql = 'SELECT tt.total_ht, tt.total_ttc, tt.total_tva'; $sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line.' as tt'; @@ -950,13 +949,13 @@ class ExpenseReport extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * fetch_lines * * @return int <0 if OK, >0 if KO */ - function fetch_lines() + public function fetch_lines() { // phpcs:enable $this->lines=array(); @@ -1038,7 +1037,7 @@ class ExpenseReport extends CommonObject * @param User $fuser User that delete * @return int <0 if KO, >0 if OK */ - function delete(User $fuser = null) + public function delete(User $fuser = null) { global $user,$langs,$conf; @@ -1078,7 +1077,7 @@ class ExpenseReport extends CommonObject * @param int $notrigger Disable triggers * @return int <0 if KO, 0 if nothing done, >0 if OK */ - function setValidate($fuser, $notrigger = 0) + public function setValidate($fuser, $notrigger = 0) { global $conf,$langs,$user; @@ -1195,14 +1194,14 @@ class ExpenseReport extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * set_save_from_refuse * * @param User $fuser User * @return int <0 if KO, >0 if OK */ - function set_save_from_refuse($fuser) + public function set_save_from_refuse($fuser) { // phpcs:enable global $conf,$langs; @@ -1249,16 +1248,15 @@ class ExpenseReport extends CommonObject * @param int $notrigger Disable triggers * @return int <0 if KO, 0 if nothing done, >0 if OK */ - function setApproved($fuser, $notrigger = 0) + public function setApproved($fuser, $notrigger = 0) { $now=dol_now(); - $error = 0; + $error = 0; // date approval $this->date_approve = $now; - if ($this->fk_statut != 5) - { - $this->db->begin(); + if ($this->fk_statut != 5) { + $this->db->begin(); $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; $sql.= " SET ref = '".$this->db->escape($this->ref)."', fk_statut = 5, fk_user_approve = ".$fuser->id.","; @@ -1309,10 +1307,10 @@ class ExpenseReport extends CommonObject * * @param User $fuser User * @param Details $details Details - * @param int $notrigger Disable triggers + * @param int $notrigger Disable triggers * @return int */ - function setDeny($fuser, $details, $notrigger = 0) + public function setDeny($fuser, $details, $notrigger = 0) { $now = dol_now(); $error = 0; @@ -1369,7 +1367,7 @@ class ExpenseReport extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * set_unpaid * @@ -1377,7 +1375,7 @@ class ExpenseReport extends CommonObject * @param int $notrigger Disable triggers * @return int <0 if KO, >0 if OK */ - function set_unpaid($fuser, $notrigger = 0) + public function set_unpaid($fuser, $notrigger = 0) { // phpcs:enable $error = 0; @@ -1430,7 +1428,7 @@ class ExpenseReport extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * set_cancel * @@ -1439,7 +1437,7 @@ class ExpenseReport extends CommonObject * @param int $notrigger Disable triggers * @return int <0 if KO, >0 if OK */ - function set_cancel($fuser, $detail, $notrigger = 0) + public function set_cancel($fuser, $detail, $notrigger = 0) { // phpcs:enable $error = 0; @@ -1499,7 +1497,7 @@ class ExpenseReport extends CommonObject * * @return string free ref */ - function getNextNumRef() + public function getNextNumRef() { global $langs, $conf; $langs->load("trips"); @@ -1559,7 +1557,7 @@ class ExpenseReport extends CommonObject * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @return string String with URL */ - function getNomUrl($withpicto = 0, $max = 0, $short = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1) + public function getNomUrl($withpicto = 0, $max = 0, $short = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1) { global $langs, $conf; @@ -1615,7 +1613,7 @@ class ExpenseReport extends CommonObject return $result; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Update total of an expense report when you add a line. * @@ -1623,7 +1621,7 @@ class ExpenseReport extends CommonObject * @param string $ligne_total_tva Amount of all taxes * @return void */ - function update_totaux_add($ligne_total_ht, $ligne_total_tva) + public function update_totaux_add($ligne_total_ht, $ligne_total_tva) { // phpcs:enable $this->total_ht = $this->total_ht + $ligne_total_ht; @@ -1645,7 +1643,7 @@ class ExpenseReport extends CommonObject endif; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Update total of an expense report when you delete a line. * @@ -1653,7 +1651,7 @@ class ExpenseReport extends CommonObject * @param string $ligne_total_tva Amount of all taxes * @return void */ - function update_totaux_del($ligne_total_ht, $ligne_total_tva) + public function update_totaux_del($ligne_total_ht, $ligne_total_tva) { // phpcs:enable $this->total_ht = $this->total_ht - $ligne_total_ht; @@ -1689,7 +1687,7 @@ class ExpenseReport extends CommonObject * @param int $type Type line * @return int <0 if KO, >0 if OK */ - function addline($qty = 0, $up = 0, $fk_c_type_fees = 0, $vatrate = 0, $date = '', $comments = '', $fk_project = 0, $fk_c_exp_tax_cat = 0, $type = 0) + public function addline($qty = 0, $up = 0, $fk_c_type_fees = 0, $vatrate = 0, $date = '', $comments = '', $fk_project = 0, $fk_c_exp_tax_cat = 0, $type = 0) { global $conf,$langs,$mysoc; @@ -1783,7 +1781,7 @@ class ExpenseReport extends CommonObject * @param string $seller seller, but actually he is unknown * @return true or false */ - function checkRules($type = 0, $seller = '') + public function checkRules($type = 0, $seller = '') { global $user,$conf,$db,$langs; @@ -1852,7 +1850,7 @@ class ExpenseReport extends CommonObject * * @return boolean true=applied, false=not applied */ - function applyOffset() + public function applyOffset() { global $conf; @@ -1900,7 +1898,7 @@ class ExpenseReport extends CommonObject * * @return bool */ - function offsetAlreadyGiven() + public function offsetAlreadyGiven() { $sql = 'SELECT e.rowid FROM '.MAIN_DB_PREFIX.'expensereport e'; $sql.= ' INNER JOIN '.MAIN_DB_PREFIX.'expensereport_det d ON (e.rowid = d.fk_expensereport)'; @@ -1939,7 +1937,7 @@ class ExpenseReport extends CommonObject * @param int $fk_c_exp_tax_cat id of category of car * @return int <0 if KO, >0 if OK */ - function updateline($rowid, $type_fees_id, $projet_id, $vatrate, $comments, $qty, $value_unit, $date, $expensereport_id, $fk_c_exp_tax_cat = 0) + public function updateline($rowid, $type_fees_id, $projet_id, $vatrate, $comments, $qty, $value_unit, $date, $expensereport_id, $fk_c_exp_tax_cat = 0) { global $user, $mysoc; @@ -2046,7 +2044,7 @@ class ExpenseReport extends CommonObject * @param User $fuser User * @return int <0 if KO, >0 if OK */ - function deleteline($rowid, $fuser = '') + public function deleteline($rowid, $fuser = '') { $this->db->begin(); @@ -2068,7 +2066,7 @@ class ExpenseReport extends CommonObject return 1; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * periode_existe * @@ -2077,7 +2075,7 @@ class ExpenseReport extends CommonObject * @param Date $date_fin End date * @return int <0 if KO, >0 if OK */ - function periode_existe($fuser, $date_debut, $date_fin) + public function periode_existe($fuser, $date_debut, $date_fin) { // phpcs:enable $sql = "SELECT rowid, date_debut, date_fin"; @@ -2086,8 +2084,7 @@ class ExpenseReport extends CommonObject dol_syslog(get_class($this)."::periode_existe sql=".$sql); $result = $this->db->query($sql); - if($result) - { + if ($result) { $num_lignes = $this->db->num_rows($result); $i = 0; if ($num_lignes>0) @@ -2126,14 +2123,14 @@ class ExpenseReport extends CommonObject } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of people with permission to validate expense reports. * Search for permission "approve expense report" * * @return array Array of user ids */ - function fetch_users_approver_expensereport() + public function fetch_users_approver_expensereport() { // phpcs:enable $users_validator=array(); @@ -2207,7 +2204,7 @@ class ExpenseReport extends CommonObject * @param int $active Active or not * @return array */ - function listOfTypes($active = 1) + public function listOfTypes($active = 1) { global $langs; $ret=array(); @@ -2234,13 +2231,13 @@ class ExpenseReport extends CommonObject return $ret; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Charge indicateurs this->nb pour le tableau de bord * * @return int <0 if KO, >0 if OK */ - function load_state_board() + public function load_state_board() { // phpcs:enable global $conf; @@ -2253,10 +2250,8 @@ class ExpenseReport extends CommonObject $sql.= " AND ex.entity IN (".getEntity('expensereport').")"; $resql=$this->db->query($sql); - if ($resql) - { - while ($obj=$this->db->fetch_object($resql)) - { + if ($resql) { + while ($obj=$this->db->fetch_object($resql)) { $this->nb["expensereports"]=$obj->nb; } $this->db->free($resql); @@ -2270,7 +2265,7 @@ class ExpenseReport extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * @@ -2278,16 +2273,16 @@ class ExpenseReport extends CommonObject * @param string $option 'topay' or 'toapprove' * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ - function load_board($user, $option = 'topay') + public function load_board($user, $option = 'topay') { // phpcs:enable global $conf, $langs; if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe - $now=dol_now(); + $now=dol_now(); - $userchildids = $user->getAllChildIds(1); + $userchildids = $user->getAllChildIds(1); $sql = "SELECT ex.rowid, ex.date_valid"; $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as ex"; diff --git a/htdocs/mailmanspip/class/mailmanspip.class.php b/htdocs/mailmanspip/class/mailmanspip.class.php index 64f162a7de8..d80edaf725f 100644 --- a/htdocs/mailmanspip/class/mailmanspip.class.php +++ b/htdocs/mailmanspip/class/mailmanspip.class.php @@ -65,7 +65,7 @@ class MailmanSpip * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db = $db; } @@ -75,7 +75,7 @@ class MailmanSpip * * @return boolean */ - function isSpipEnabled() + public function isSpipEnabled() { if (defined("ADHERENT_USE_SPIP") && (ADHERENT_USE_SPIP == 1)) { @@ -90,7 +90,7 @@ class MailmanSpip * * @return boolean */ - function checkSpipConfig() + public function checkSpipConfig() { if (defined('ADHERENT_SPIP_SERVEUR') && defined('ADHERENT_SPIP_USER') && defined('ADHERENT_SPIP_PASS') && defined('ADHERENT_SPIP_DB')) { @@ -108,7 +108,7 @@ class MailmanSpip * * @return boolean|DoliDB Boolean of DoliDB */ - function connectSpip() + public function connectSpip() { $resource = getDoliDBInstance('mysql', ADHERENT_SPIP_SERVEUR, ADHERENT_SPIP_USER, ADHERENT_SPIP_PASS, ADHERENT_SPIP_DB, ADHERENT_SPIP_PORT); @@ -176,14 +176,14 @@ class MailmanSpip return $result; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Fonction qui donne les droits redacteurs dans spip * * @param Adherent $object Object with data (->firstname, ->lastname, ->email and ->login) * @return int =0 if KO, >0 if OK */ - function add_to_spip($object) + public function add_to_spip($object) { // phpcs:enable dol_syslog(get_class($this)."::add_to_spip"); @@ -220,14 +220,14 @@ class MailmanSpip return 0; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Fonction qui enleve les droits redacteurs dans spip * * @param Adherent $object Object with data (->login) * @return int =0 if KO, >0 if OK */ - function del_to_spip($object) + public function del_to_spip($object) { // phpcs:enable dol_syslog(get_class($this)."::del_to_spip"); @@ -261,14 +261,14 @@ class MailmanSpip return 0; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Fonction qui dit si cet utilisateur est un redacteur existant dans spip * * @param object $object Object with data (->login) * @return int 1=exists, 0=does not exists, -1=error */ - function is_in_spip($object) + public function is_in_spip($object) { // phpcs:enable if ($this->isSpipEnabled()) @@ -313,7 +313,7 @@ class MailmanSpip return -1; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Subscribe an email to all mailing-lists * @@ -321,7 +321,7 @@ class MailmanSpip * @param array $listes To force mailing-list (string separated with ,) * @return int <0 if KO, >=0 if OK */ - function add_to_mailman($object, $listes = '') + public function add_to_mailman($object, $listes = '') { // phpcs:enable global $conf,$langs,$user; @@ -386,7 +386,7 @@ class MailmanSpip } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Unsubscribe an email from all mailing-lists * Used when a user is resiliated @@ -395,7 +395,7 @@ class MailmanSpip * @param array $listes To force mailing-list (string separated with ,) * @return int <0 if KO, >=0 if OK */ - function del_to_mailman($object, $listes = '') + public function del_to_mailman($object, $listes = '') { // phpcs:enable global $conf,$langs,$user; diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php index d9d5f75ce14..ca8d67d1125 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -32,15 +32,15 @@ abstract class ActionsCardCommon */ public $db; - var $dirmodule; - var $targetmodule; - var $canvas; - var $card; + public $dirmodule; + public $targetmodule; + public $canvas; + public $card; //! Template container - var $tpl = array(); + public $tpl = array(); //! Object container - var $object; + public $object; /** * @var string Error code (or message) @@ -70,7 +70,7 @@ abstract class ActionsCardCommon $this->object = $object; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Assign custom values for canvas (for example into this->tpl to be used by templates) * @@ -79,7 +79,7 @@ abstract class ActionsCardCommon * @param string $ref Ref of object * @return void */ - function assign_values(&$action, $id = 0, $ref = '') + public function assign_values(&$action, $id = 0, $ref = '') { // phpcs:enable global $conf, $langs, $user, $mysoc, $canvas; diff --git a/htdocs/societe/canvas/company/actions_card_company.class.php b/htdocs/societe/canvas/company/actions_card_company.class.php index ebbf7d22810..a4a3d71a4a9 100644 --- a/htdocs/societe/canvas/company/actions_card_company.class.php +++ b/htdocs/societe/canvas/company/actions_card_company.class.php @@ -38,7 +38,7 @@ class ActionsCardCompany extends ActionsCardCommon * @param string $canvas Name of canvas * @param string $card Name of tab (sub-canvas) */ - function __construct($db, $dirmodule, $targetmodule, $canvas, $card) + public function __construct($db, $dirmodule, $targetmodule, $canvas, $card) { $this->db = $db; $this->dirmodule = $dirmodule; @@ -67,7 +67,7 @@ class ActionsCardCompany extends ActionsCardCommon } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Assign custom values for canvas (for example into this->tpl to be used by templates) * @@ -76,7 +76,7 @@ class ActionsCardCompany extends ActionsCardCommon * @param string $ref Ref of object * @return void */ - function assign_values(&$action, $id = 0, $ref = '') + public function assign_values(&$action, $id = 0, $ref = '') { // phpcs:enable global $conf, $langs, $user, $mysoc; @@ -200,7 +200,7 @@ class ActionsCardCompany extends ActionsCardCommon $this->tpl['parent_company'] = $langs->trans("NoParentCompany"); } } - } + } /** * Check permissions of a user to show a page and an object. Check read permission @@ -215,8 +215,8 @@ class ActionsCardCompany extends ActionsCardCommon * @param string $dbt_select Field name for select if not rowid. (optional) * @return int 1 */ - function restrictedArea($user, $features = 'societe', $objectid = 0, $dbtablename = '', $feature2 = '', $dbt_keyfield = 'fk_soc', $dbt_select = 'rowid') - { - return restrictedArea($user, $features, $objectid, $dbtablename, $feature2, $dbt_keyfield, $dbt_select); - } + public function restrictedArea($user, $features = 'societe', $objectid = 0, $dbtablename = '', $feature2 = '', $dbt_keyfield = 'fk_soc', $dbt_select = 'rowid') + { + return restrictedArea($user, $features, $objectid, $dbtablename, $feature2, $dbt_keyfield, $dbt_select); + } } diff --git a/htdocs/societe/canvas/individual/actions_card_individual.class.php b/htdocs/societe/canvas/individual/actions_card_individual.class.php index 01f6c4539b1..391fd85c836 100644 --- a/htdocs/societe/canvas/individual/actions_card_individual.class.php +++ b/htdocs/societe/canvas/individual/actions_card_individual.class.php @@ -37,14 +37,14 @@ class ActionsCardIndividual extends ActionsCardCommon * @param string $canvas Name of canvas * @param string $card Name of tab (sub-canvas) */ - function __construct($db, $dirmodule, $targetmodule, $canvas, $card) - { - $this->db = $db; - $this->dirmodule = $dirmodule; - $this->targetmodule = $targetmodule; + public function __construct($db, $dirmodule, $targetmodule, $canvas, $card) + { + $this->db = $db; + $this->dirmodule = $dirmodule; + $this->targetmodule = $targetmodule; $this->canvas = $canvas; $this->card = $card; - } + } /** @@ -75,16 +75,16 @@ class ActionsCardIndividual extends ActionsCardCommon * @param int $id Id of object (may be empty for creation) * @return int <0 if KO, >0 if OK */ - function doActions(&$action, $id) - { + public function doActions(&$action, $id) + { $ret = $this->getObject($id); $return = parent::doActions($action); return $return; - } + } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Assign custom values for canvas (for example into this->tpl to be used by templates) * @@ -93,8 +93,8 @@ class ActionsCardIndividual extends ActionsCardCommon * @param string $ref Ref of object * @return void */ - function assign_values(&$action, $id = 0, $ref = '') - { + public function assign_values(&$action, $id = 0, $ref = '') + { // phpcs:enable global $conf, $langs; global $form, $formcompany; @@ -117,7 +117,7 @@ class ActionsCardIndividual extends ActionsCardCommon $this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$this->object->id, $langs->trans("DeleteAnIndividual"), $langs->trans("ConfirmDeleteIndividual"), "confirm_delete", '', 0, "1,action-delete"); } } - } + } /** * Check permissions of a user to show a page and an object. Check read permission @@ -132,8 +132,8 @@ class ActionsCardIndividual extends ActionsCardCommon * @param string $dbt_select Field name for select if not rowid. (optional) * @return int 1 */ - function restrictedArea($user, $features = 'societe', $objectid = 0, $dbtablename = '', $feature2 = '', $dbt_keyfield = 'fk_soc', $dbt_select = 'rowid') - { - return restrictedArea($user, $features, $objectid, $dbtablename, $feature2, $dbt_keyfield, $dbt_select); - } + public function restrictedArea($user, $features = 'societe', $objectid = 0, $dbtablename = '', $feature2 = '', $dbt_keyfield = 'fk_soc', $dbt_select = 'rowid') + { + return restrictedArea($user, $features, $objectid, $dbtablename, $feature2, $dbt_keyfield, $dbt_select); + } } diff --git a/htdocs/societe/class/api_contacts.class.php b/htdocs/societe/class/api_contacts.class.php index e6ba5c8beac..97fc83a3545 100644 --- a/htdocs/societe/class/api_contacts.class.php +++ b/htdocs/societe/class/api_contacts.class.php @@ -46,7 +46,7 @@ class Contacts extends DolibarrApi /** * Constructor */ - function __construct() + public function __construct() { global $db, $conf; $this->db = $db; @@ -68,7 +68,7 @@ class Contacts extends DolibarrApi * * @throws RestException */ - function get($id, $includecount = 0) + public function get($id, $includecount = 0) { if (!DolibarrApiAccess::$user->rights->societe->contact->lire) { @@ -111,7 +111,7 @@ class Contacts extends DolibarrApi * * @throws RestException */ - function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '', $includecount = 0) + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '', $includecount = 0) { global $db, $conf; @@ -191,7 +191,7 @@ class Contacts extends DolibarrApi } $obj_ret[] = $this->_cleanObjectDatas($contact_static); } - + $i++; } } @@ -211,7 +211,7 @@ class Contacts extends DolibarrApi * @param array $request_data Request datas * @return int ID of contact */ - function post($request_data = null) + public function post($request_data = null) { if (!DolibarrApiAccess::$user->rights->societe->contact->creer) { @@ -237,7 +237,7 @@ class Contacts extends DolibarrApi * @param array $request_data Datas * @return int */ - function put($id, $request_data = null) + public function put($id, $request_data = null) { if (!DolibarrApiAccess::$user->rights->societe->contact->creer) { @@ -273,7 +273,7 @@ class Contacts extends DolibarrApi * @param int $id Contact ID * @return integer */ - function delete($id) + public function delete($id) { if (!DolibarrApiAccess::$user->rights->societe->contact->supprimer) { @@ -302,16 +302,16 @@ class Contacts extends DolibarrApi * * @url POST {id}/createUser */ - function createUser($id, $request_data = null) + public function createUser($id, $request_data = null) { //if (!DolibarrApiAccess::$user->rights->user->user->creer) { //throw new RestException(401); //} if (!isset($request_data["login"])) - throw new RestException(400, "login field missing"); + throw new RestException(400, "login field missing"); if (!isset($request_data["password"])) - throw new RestException(400, "password field missing"); + throw new RestException(400, "password field missing"); if (!DolibarrApiAccess::$user->rights->societe->contact->lire) { throw new RestException(401, 'No permission to read contacts'); @@ -357,7 +357,7 @@ class Contacts extends DolibarrApi * * @url GET {id}/categories */ - function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) + public function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) { if (! DolibarrApiAccess::$user->rights->categorie->lire) { throw new RestException(401); @@ -382,44 +382,44 @@ class Contacts extends DolibarrApi /** * Clean sensible object datas * - * @param object $object Object to clean - * @return array Array of cleaned object properties + * @param Object $object Object to clean + * @return array Array of cleaned object properties */ - function _cleanObjectDatas($object) + private function _cleanObjectDatas($object) { - $object = parent::_cleanObjectDatas($object); + $object = parent::_cleanObjectDatas($object); - unset($object->total_ht); - unset($object->total_tva); - unset($object->total_localtax1); - unset($object->total_localtax2); - unset($object->total_ttc); + unset($object->total_ht); + unset($object->total_tva); + unset($object->total_localtax1); + unset($object->total_localtax2); + unset($object->total_ttc); - unset($object->note); - unset($object->lines); - unset($object->thirdparty); + unset($object->note); + unset($object->lines); + unset($object->thirdparty); - return $object; + return $object; } - /** - * Validate fields before create or update object + /** + * Validate fields before create or update object * - * @param array|null $data Data to validate - * @return array - * @throws RestException - */ - function _validate($data) + * @param array|null $data Data to validate + * @return array + * @throws RestException + */ + private function _validate($data) { - $contact = array(); - foreach (Contacts::$FIELDS as $field) - { - if (!isset($data[$field])) - throw new RestException(400, "$field field missing"); - $contact[$field] = $data[$field]; - } + $contact = array(); + foreach (Contacts::$FIELDS as $field) { + if (!isset($data[$field])) { + throw new RestException(400, "$field field missing"); + } + $contact[$field] = $data[$field]; + } - return $contact; - } + return $contact; + } } diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 12391eedac1..3cc1dd51b1a 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -44,7 +44,7 @@ class Thirdparties extends DolibarrApi /** * Constructor */ - function __construct() + public function __construct() { global $db, $conf; $this->db = $db; @@ -71,7 +71,7 @@ class Thirdparties extends DolibarrApi * * @throws RestException */ - function get($id) + public function get($id) { if(! DolibarrApiAccess::$user->rights->societe->lire) { throw new RestException(401); @@ -117,7 +117,7 @@ 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 = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $mode = 0, $sqlfilters = '') { global $db, $conf; @@ -203,7 +203,7 @@ class Thirdparties extends DolibarrApi * @param array $request_data Request datas * @return int ID of thirdparty */ - function post($request_data = null) + public function post($request_data = null) { if(! DolibarrApiAccess::$user->rights->societe->creer) { throw new RestException(401); @@ -227,7 +227,7 @@ class Thirdparties extends DolibarrApi * @param array $request_data Datas * @return int */ - function put($id, $request_data = null) + public function put($id, $request_data = null) { if(! DolibarrApiAccess::$user->rights->societe->creer) { throw new RestException(401); @@ -267,7 +267,7 @@ class Thirdparties extends DolibarrApi * * @url PUT {id}/merge/{idtodelete} */ - function merge($id, $idtodelete) + public function merge($id, $idtodelete) { global $db, $hookmanager; @@ -473,7 +473,7 @@ $reshook = $hookmanager->executeHooks('replaceThirdparty', array( * @param int $id Thirparty ID * @return integer */ - function delete($id) + public function delete($id) { if(! DolibarrApiAccess::$user->rights->societe->supprimer) { throw new RestException(401); @@ -501,7 +501,7 @@ $reshook = $hookmanager->executeHooks('replaceThirdparty', array( * * @url GET {id}/categories */ - function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) + public function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) { if (! DolibarrApiAccess::$user->rights->categorie->lire) { throw new RestException(401); @@ -540,7 +540,7 @@ $reshook = $hookmanager->executeHooks('replaceThirdparty', array( * * @url POST {id}/categories/{category_id} */ - function addCategory($id, $category_id) + public function addCategory($id, $category_id) { if(! DolibarrApiAccess::$user->rights->societe->creer) { throw new RestException(401); @@ -578,7 +578,7 @@ $reshook = $hookmanager->executeHooks('replaceThirdparty', array( * * @url DELETE {id}/categories/{category_id} */ - function deleteCategory($id, $category_id) + public function deleteCategory($id, $category_id) { if(! DolibarrApiAccess::$user->rights->societe->creer) { throw new RestException(401); @@ -619,7 +619,7 @@ $reshook = $hookmanager->executeHooks('replaceThirdparty', array( * * @url GET {id}/supplier_categories */ - function getSupplierCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) + public function getSupplierCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) { if (! DolibarrApiAccess::$user->rights->categorie->lire) { throw new RestException(401); @@ -658,7 +658,7 @@ $reshook = $hookmanager->executeHooks('replaceThirdparty', array( * * @url POST {id}/supplier_categories/{category_id} */ - function addSupplierCategory($id, $category_id) + public function addSupplierCategory($id, $category_id) { if(! DolibarrApiAccess::$user->rights->societe->creer) { throw new RestException(401); @@ -696,7 +696,7 @@ $reshook = $hookmanager->executeHooks('replaceThirdparty', array( * * @url DELETE {id}/supplier_categories/{category_id} */ - function deleteSupplierCategory($id, $category_id) + public function deleteSupplierCategory($id, $category_id) { if(! DolibarrApiAccess::$user->rights->societe->creer) { throw new RestException(401); @@ -739,7 +739,7 @@ $reshook = $hookmanager->executeHooks('replaceThirdparty', array( * @throws 401 * @throws 404 */ - function getOutStandingProposals($id, $mode = 'customer') + public function getOutStandingProposals($id, $mode = 'customer') { $obj_ret = array(); @@ -783,7 +783,7 @@ $reshook = $hookmanager->executeHooks('replaceThirdparty', array( * @throws 401 * @throws 404 */ - function getOutStandingOrder($id, $mode = 'customer') + public function getOutStandingOrder($id, $mode = 'customer') { $obj_ret = array(); @@ -826,7 +826,7 @@ $reshook = $hookmanager->executeHooks('replaceThirdparty', array( * @throws 401 * @throws 404 */ - function getOutStandingInvoices($id, $mode = 'customer') + public function getOutStandingInvoices($id, $mode = 'customer') { $obj_ret = array(); @@ -872,7 +872,7 @@ $reshook = $hookmanager->executeHooks('replaceThirdparty', array( * @throws 404 * @throws 503 */ - function getFixedAmountDiscounts($id, $filter = "none", $sortfield = "f.type", $sortorder = 'ASC') + public function getFixedAmountDiscounts($id, $filter = "none", $sortfield = "f.type", $sortorder = 'ASC') { $obj_ret = array(); @@ -930,7 +930,7 @@ $reshook = $hookmanager->executeHooks('replaceThirdparty', array( * @throws 404 * @throws 405 */ - function getInvoicesQualifiedForReplacement($id) + public function getInvoicesQualifiedForReplacement($id) { if(! DolibarrApiAccess::$user->rights->facture->lire) { throw new RestException(401); @@ -972,7 +972,7 @@ $reshook = $hookmanager->executeHooks('replaceThirdparty', array( * @throws 404 * @throws 405 */ - function getInvoicesQualifiedForCreditNote($id) + public function getInvoicesQualifiedForCreditNote($id) { if(! DolibarrApiAccess::$user->rights->facture->lire) { throw new RestException(401); @@ -1008,7 +1008,7 @@ $reshook = $hookmanager->executeHooks('replaceThirdparty', array( * * @url GET {id}/bankaccounts */ - function getCompanyBankAccount($id) + public function getCompanyBankAccount($id) { global $db, $conf; @@ -1086,7 +1086,7 @@ $reshook = $hookmanager->executeHooks('replaceThirdparty', array( * * @url POST {id}/bankaccounts */ - function createCompanyBankAccount($id, $request_data = null) + public function createCompanyBankAccount($id, $request_data = null) { if(! DolibarrApiAccess::$user->rights->societe->creer) { throw new RestException(401); @@ -1121,7 +1121,7 @@ $reshook = $hookmanager->executeHooks('replaceThirdparty', array( * * @url PUT {id}/bankaccounts/{bankaccount_id} */ - function updateCompanyBankAccount($id, $bankaccount_id, $request_data = null) + public function updateCompanyBankAccount($id, $bankaccount_id, $request_data = null) { if(! DolibarrApiAccess::$user->rights->societe->creer) { throw new RestException(401); @@ -1156,7 +1156,7 @@ $reshook = $hookmanager->executeHooks('replaceThirdparty', array( * * @url DELETE {id}/bankaccounts/{bankaccount_id} */ - function deleteCompanyBankAccount($id, $bankaccount_id) + public function deleteCompanyBankAccount($id, $bankaccount_id) { if(! DolibarrApiAccess::$user->rights->societe->creer) { throw new RestException(401); @@ -1281,7 +1281,7 @@ $reshook = $hookmanager->executeHooks('replaceThirdparty', array( * * @url GET {id}/gateways/ */ - function getSocieteAccounts($id, $site = null) + public function getSocieteAccounts($id, $site = null) { global $db, $conf; @@ -1357,7 +1357,7 @@ $reshook = $hookmanager->executeHooks('replaceThirdparty', array( * * @url POST {id}/gateways */ - function createSocieteAccount($id, $request_data = null) + public function createSocieteAccount($id, $request_data = null) { global $db; @@ -1416,7 +1416,7 @@ $reshook = $hookmanager->executeHooks('replaceThirdparty', array( * @throws RestException * @url PUT {id}/gateways/{site} */ - function putSocieteAccount($id, $site, $request_data = null) + public function putSocieteAccount($id, $site, $request_data = null) { global $db; @@ -1497,7 +1497,7 @@ $reshook = $hookmanager->executeHooks('replaceThirdparty', array( * * @url PATCH {id}/gateways/{site} */ - function patchSocieteAccount($id, $site, $request_data = null) + public function patchSocieteAccount($id, $site, $request_data = null) { global $db; @@ -1551,7 +1551,7 @@ $reshook = $hookmanager->executeHooks('replaceThirdparty', array( * * @url DELETE {id}/gateways/{site} */ - function deleteSocieteAccount($id, $site) + public function deleteSocieteAccount($id, $site) { global /** @var Database $db */ $db; @@ -1588,7 +1588,7 @@ $reshook = $hookmanager->executeHooks('replaceThirdparty', array( * * @url DELETE {id}/gateways */ - function deleteSocieteAccounts($id) + public function deleteSocieteAccounts($id) { global /** @var Database $db */ $db; @@ -1632,7 +1632,7 @@ $reshook = $hookmanager->executeHooks('replaceThirdparty', array( * @param object $object Object to clean * @return array Array of cleaned object properties */ - function _cleanObjectDatas($object) + private function _cleanObjectDatas($object) { $object = parent::_cleanObjectDatas($object); @@ -1658,14 +1658,14 @@ $reshook = $hookmanager->executeHooks('replaceThirdparty', array( * * @throws RestException */ - function _validate($data) - { - $thirdparty = array(); - foreach (Thirdparties::$FIELDS as $field) { - if (!isset($data[$field])) - throw new RestException(400, "$field field missing"); - $thirdparty[$field] = $data[$field]; - } - return $thirdparty; - } + private function _validate($data) + { + $thirdparty = array(); + foreach (Thirdparties::$FIELDS as $field) { + if (!isset($data[$field])) + throw new RestException(400, "$field field missing"); + $thirdparty[$field] = $data[$field]; + } + return $thirdparty; + } } diff --git a/htdocs/societe/class/client.class.php b/htdocs/societe/class/client.class.php index fb1110e52ac..7419486ce95 100644 --- a/htdocs/societe/class/client.class.php +++ b/htdocs/societe/class/client.class.php @@ -39,7 +39,7 @@ class Client extends Societe * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db = $db; @@ -47,13 +47,13 @@ class Client extends Societe $this->fournisseur = 0; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load indicators into this->nb for board * * @return int <0 if KO, >0 if OK */ - function load_state_board() + public function load_state_board() { // phpcs:enable global $user; @@ -98,7 +98,7 @@ class Client extends Societe * @param int $active 1=Active only, 0=Not active only, -1=All * @return int <0 if KO, >0 if OK */ - function loadCacheOfProspStatus($active = 1) + public function loadCacheOfProspStatus($active = 1) { global $langs; @@ -107,8 +107,7 @@ class Client extends Societe $resql=$this->db->query($sql); $num=$this->db->num_rows($resql); $i=0; - while ($i < $num) - { + while ($i < $num) { $obj=$this->db->fetch_object($resql); $this->cacheprospectstatus[$obj->id]=array('id'=>$obj->id, 'code'=>$obj->code, 'label'=> ($langs->trans("ST_".strtoupper($obj->code))=="ST_".strtoupper($obj->code))?$obj->label:$langs->trans("ST_".strtoupper($obj->code))); $i++; diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index c81ed2f325a..60fb6a2a4c7 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -33,15 +33,15 @@ require_once DOL_DOCUMENT_ROOT .'/compta/bank/class/account.class.php'; */ class CompanyBankAccount extends Account { - var $socid; + public $socid; - var $default_rib; - var $frstrecur; - var $rum; - var $date_rum; + public $default_rib; + public $frstrecur; + public $rum; + public $date_rum; - var $datec; - var $datem; + public $datec; + public $datem; /** @@ -67,7 +67,7 @@ class CompanyBankAccount extends Account * @param int $notrigger 1=Disable triggers * @return int <0 if KO, >= 0 if OK */ - function create(User $user = null, $notrigger = 0) + public function create(User $user = null, $notrigger = 0) { $now = dol_now(); $error = 0; @@ -126,7 +126,7 @@ class CompanyBankAccount extends Account * @param int $notrigger 1=Disable triggers * @return int <=0 if KO, >0 if OK */ - function update(User $user = null, $notrigger = 0) + public function update(User $user = null, $notrigger = 0) { global $conf; $error = 0; @@ -201,7 +201,7 @@ class CompanyBankAccount extends Account * @param int $type If id of company filled, we say if we want record of this type only * @return int <0 if KO, >0 if OK */ - function fetch($id, $socid = 0, $default = 1, $type = 'ban') + public function fetch($id, $socid = 0, $default = 1, $type = 'ban') { if (empty($id) && empty($socid)) return -1; @@ -263,7 +263,7 @@ class CompanyBankAccount extends Account * @param int $notrigger 1=Disable triggers * @return int <0 if KO, >0 if OK */ - function delete(User $user = null, $notrigger = 0) + public function delete(User $user = null, $notrigger = 0) { global $conf; @@ -333,7 +333,7 @@ class CompanyBankAccount extends Account * @param int $rib RIB id * @return int 0 if KO, 1 if OK */ - function setAsDefault($rib = 0) + public function setAsDefault($rib = 0) { $sql1 = "SELECT rowid as id, fk_soc FROM ".MAIN_DB_PREFIX."societe_rib"; $sql1.= " WHERE rowid = ".($rib?$rib:$this->id); @@ -389,7 +389,7 @@ class CompanyBankAccount extends Account * * @return void */ - function initAsSpecimen() + public function initAsSpecimen() { $this->specimen = 1; $this->ref = 'CBA'; @@ -409,7 +409,7 @@ class CompanyBankAccount extends Account $this->country_id = 1; $this->rum = 'UMR-CU1212-0007-5-1475405262'; - $this->date_rum =dol_now() - 10000; + $this->date_rum = dol_now() - 10000; $this->frstrecur = 'FRST'; $this->socid = 0; diff --git a/htdocs/societe/class/companypaymentmode.class.php b/htdocs/societe/class/companypaymentmode.class.php index 1278b627029..5194046e40c 100644 --- a/htdocs/societe/class/companypaymentmode.class.php +++ b/htdocs/societe/class/companypaymentmode.class.php @@ -349,7 +349,7 @@ class CompanyPaymentMode extends CommonObject * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @return string String with URL */ - function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) + public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) { global $db, $conf, $langs; global $dolibarr_main_authentication, $dolibarr_main_demo; @@ -407,7 +407,7 @@ class CompanyPaymentMode extends CommonObject * @param string $alltypes 1=The default is for all payment types instead of per type * @return int 0 if KO, 1 if OK */ - function setAsDefault($id = 0, $alltypes = 0) + public function setAsDefault($id = 0, $alltypes = 0) { $sql1 = "SELECT rowid as id, fk_soc, type FROM ".MAIN_DB_PREFIX."societe_rib"; $sql1.= " WHERE rowid = ".($id?$id:$this->id); @@ -467,12 +467,12 @@ class CompanyPaymentMode extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ - function getLibStatut($mode = 0) + public function getLibStatut($mode = 0) { return $this->LibStatut($this->status, $mode); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return the status * @@ -480,7 +480,7 @@ class CompanyPaymentMode extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label of status */ - static function LibStatut($status, $mode = 0) + public static function LibStatut($status, $mode = 0) { // phpcs:enable global $langs; @@ -488,32 +488,32 @@ class CompanyPaymentMode extends CommonObject if ($mode == 0 || $mode == 1) { if ($status == 1) return $langs->trans('Enabled'); - if ($status == 0) return $langs->trans('Disabled'); + elseif ($status == 0) return $langs->trans('Disabled'); } elseif ($mode == 2) { if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled'); - if ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled'); + elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled'); } elseif ($mode == 3) { if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4'); - if ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5'); + elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5'); } elseif ($mode == 4) { if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled'); - if ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled'); + elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled'); } elseif ($mode == 5) { if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4'); - if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5'); + elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5'); } elseif ($mode == 6) { if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4'); - if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5'); + elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5'); } } @@ -523,7 +523,7 @@ class CompanyPaymentMode extends CommonObject * @param int $id Id of order * @return void */ - function info($id) + public function info($id) { $sql = 'SELECT rowid, date_creation as datec, tms as datem,'; $sql.= ' fk_user_creat, fk_user_modif'; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 1aacca2c895..466cda8e05f 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -507,7 +507,7 @@ class Societe extends CommonObject * @param User $user Object of user that ask creation * @return int >= 0 if OK, < 0 if KO */ - function create(User $user) + public function create(User $user) { global $langs,$conf,$mysoc; @@ -627,14 +627,14 @@ class Societe extends CommonObject } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Create a contact/address from thirdparty * * @param User $user Object user * @return int <0 if KO, >0 if OK */ - function create_individual(User $user) + public function create_individual(User $user) { // phpcs:enable require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; @@ -671,7 +671,7 @@ class Societe extends CommonObject * * @return int 0 if OK, <0 if KO */ - function verify() + public function verify() { global $conf, $langs, $mysoc; @@ -817,7 +817,7 @@ class Societe extends CommonObject * @param int $nosyncmember Do not synchronize info of linked member * @return int <0 if KO, >=0 if OK */ - function update($id, $user = '', $call_trigger = 1, $allowmodcodeclient = 0, $allowmodcodefournisseur = 0, $action = 'update', $nosyncmember = 1) + public function update($id, $user = '', $call_trigger = 1, $allowmodcodeclient = 0, $allowmodcodefournisseur = 0, $action = 'update', $nosyncmember = 1) { global $langs,$conf,$hookmanager; @@ -1232,7 +1232,7 @@ class Societe extends CommonObject * @param string $ref_alias Name_alias of third party (Warning, this can return several records) * @return int >0 if OK, <0 if KO or if two records found for same ref or idprof, 0 if not found. */ - function fetch($rowid, $ref = '', $ref_ext = '', $ref_int = '', $idprof1 = '', $idprof2 = '', $idprof3 = '', $idprof4 = '', $idprof5 = '', $idprof6 = '', $email = '', $ref_alias = '') + public function fetch($rowid, $ref = '', $ref_ext = '', $ref_int = '', $idprof1 = '', $idprof2 = '', $idprof3 = '', $idprof4 = '', $idprof5 = '', $idprof6 = '', $email = '', $ref_alias = '') { global $langs; global $conf; @@ -1460,7 +1460,7 @@ class Societe extends CommonObject * @param int $call_trigger 0=No, 1=yes * @return int <0 if KO, 0 if nothing done, >0 if OK */ - function delete($id, User $fuser = null, $call_trigger = 1) + public function delete($id, User $fuser = null, $call_trigger = 1) { global $langs, $conf, $user; @@ -1591,13 +1591,13 @@ class Societe extends CommonObject return 0; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Define third party as a customer * * @return int <0 if KO, >0 if OK */ - function set_as_client() + public function set_as_client() { // phpcs:enable if ($this->id) @@ -1619,7 +1619,7 @@ class Societe extends CommonObject return 0; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Definit la societe comme un client * @@ -1628,7 +1628,7 @@ class Societe extends CommonObject * @param User $user Utilisateur qui definie la remise * @return int <0 if KO, >0 if OK */ - function set_remise_client($remise, $note, User $user) + public function set_remise_client($remise, $note, User $user) { // phpcs:enable global $conf, $langs; @@ -1682,7 +1682,7 @@ class Societe extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Definit la societe comme un client * @@ -1691,7 +1691,7 @@ class Societe extends CommonObject * @param User $user Utilisateur qui definie la remise * @return int <0 if KO, >0 if OK */ - function set_remise_supplier($remise, $note, User $user) + public function set_remise_supplier($remise, $note, User $user) { // phpcs:enable global $conf, $langs; @@ -1745,7 +1745,7 @@ class Societe extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Add a discount for third party * @@ -1756,7 +1756,7 @@ class Societe extends CommonObject * @param int $discount_type 0 => customer discount, 1 => supplier discount * @return int <0 if KO, id of discount record if OK */ - function set_remise_except($remise, User $user, $desc, $tva_tx = 0, $discount_type = 0) + public function set_remise_except($remise, User $user, $desc, $tva_tx = 0, $discount_type = 0) { // phpcs:enable global $langs; @@ -1816,7 +1816,7 @@ class Societe extends CommonObject * @param int $discount_type 0 => customer discount, 1 => supplier discount * @return int <0 if KO, Credit note amount otherwise */ - function getAvailableDiscounts($user = '', $filter = '', $maxvalue = 0, $discount_type = 0) + public function getAvailableDiscounts($user = '', $filter = '', $maxvalue = 0, $discount_type = 0) { require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; @@ -1840,7 +1840,7 @@ class Societe extends CommonObject * @param int $mode 0=Array with properties, 1=Array of id. * @return array Array of sales representatives of third party */ - function getSalesRepresentatives(User $user, $mode = 0) + public function getSalesRepresentatives(User $user, $mode = 0) { global $conf; @@ -1894,7 +1894,7 @@ class Societe extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set the price level * @@ -1902,7 +1902,7 @@ class Societe extends CommonObject * @param User $user Use making change * @return int <0 if KO, >0 if OK */ - function set_price_level($price_level, User $user) + public function set_price_level($price_level, User $user) { // phpcs:enable if ($this->id) @@ -1933,7 +1933,7 @@ class Societe extends CommonObject return -1; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Add link to sales representative * @@ -1941,7 +1941,7 @@ class Societe extends CommonObject * @param int $commid Id of user * @return void */ - function add_commercial(User $user, $commid) + public function add_commercial(User $user, $commid) { // phpcs:enable $error=0; @@ -1971,7 +1971,7 @@ class Societe extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Add link to sales representative * @@ -1979,7 +1979,7 @@ class Societe extends CommonObject * @param int $commid Id of user * @return void */ - function del_commercial(User $user, $commid) + public function del_commercial(User $user, $commid) { // phpcs:enable $error=0; @@ -2011,7 +2011,7 @@ class Societe extends CommonObject * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @return string String with URL */ - function getNomUrl($withpicto = 0, $option = '', $maxlen = 0, $notooltip = 0, $save_lastsearch_value = -1) + public function getNomUrl($withpicto = 0, $option = '', $maxlen = 0, $notooltip = 0, $save_lastsearch_value = -1) { global $conf, $langs, $hookmanager; @@ -2205,12 +2205,12 @@ class Societe extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle */ - function getLibStatut($mode = 0) + public function getLibStatut($mode = 0) { return $this->LibStatut($this->status, $mode); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -2218,7 +2218,7 @@ class Societe extends CommonObject * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto * @return string Libelle du statut */ - function LibStatut($statut, $mode = 0) + public function LibStatut($statut, $mode = 0) { // phpcs:enable global $langs; @@ -2261,14 +2261,14 @@ class Societe extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of contacts emails existing for third party * * @param int $addthirdparty 1=Add also a record for thirdparty email * @return array Array of contacts emails */ - function thirdparty_and_contact_email_array($addthirdparty = 0) + public function thirdparty_and_contact_email_array($addthirdparty = 0) { // phpcs:enable global $langs; @@ -2283,13 +2283,13 @@ class Societe extends CommonObject return $contact_emails; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of contacts mobile phone existing for third party * * @return array Array of contacts emails */ - function thirdparty_and_contact_phone_array() + public function thirdparty_and_contact_phone_array() { // phpcs:enable global $langs; @@ -2305,7 +2305,7 @@ class Societe extends CommonObject return $contact_phone; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of contacts emails or mobile existing for third party * @@ -2313,7 +2313,7 @@ class Societe extends CommonObject * @param int $hidedisabled 1=Hide contact if disabled * @return array Array of contacts emails or mobile. Example: array(id=>'Name ') */ - function contact_property_array($mode = 'email', $hidedisabled = 0) + public function contact_property_array($mode = 'email', $hidedisabled = 0) { // phpcs:enable global $langs; @@ -2375,13 +2375,13 @@ class Societe extends CommonObject } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Renvoie la liste des contacts de cette societe * * @return array tableau des contacts */ - function contact_array() + public function contact_array() { // phpcs:enable $contacts = array(); @@ -2409,13 +2409,13 @@ class Societe extends CommonObject return $contacts; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Renvoie la liste des contacts de cette societe * * @return array $contacts tableau des contacts */ - function contact_array_objects() + public function contact_array_objects() { // phpcs:enable require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; @@ -2446,7 +2446,7 @@ class Societe extends CommonObject return $contacts; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return property of contact from its id * @@ -2454,7 +2454,7 @@ class Societe extends CommonObject * @param string $mode 'email' or 'mobile' * @return string Email of contact with format: "Full name " */ - function contact_get_property($rowid, $mode) + public function contact_get_property($rowid, $mode) { // phpcs:enable $contact_property=''; @@ -2486,14 +2486,14 @@ class Societe extends CommonObject } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return bank number property of thirdparty (label or rum) * * @param string $mode 'label' or 'rum' or 'format' * @return string Bank number */ - function display_rib($mode = 'label') + public function display_rib($mode = 'label') { // phpcs:enable require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php'; @@ -2524,13 +2524,13 @@ class Societe extends CommonObject return 'BadParameterToFunctionDisplayRib'; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return Array of RIB * * @return array|int 0 if KO, Array of CompanyBanckAccount if OK */ - function get_all_rib() + public function get_all_rib() { // phpcs:enable require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php'; @@ -2554,7 +2554,7 @@ class Societe extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Attribut un code client a partir du module de controle des codes. * Return value is stored into this->code_client @@ -2563,7 +2563,7 @@ class Societe extends CommonObject * @param int $type Should be 0 to say customer * @return void */ - function get_codeclient($objsoc = 0, $type = 0) + public function get_codeclient($objsoc = 0, $type = 0) { // phpcs:enable global $conf; @@ -2586,7 +2586,7 @@ class Societe extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Attribut un code fournisseur a partir du module de controle des codes. * Return value is stored into this->code_fournisseur @@ -2595,7 +2595,7 @@ class Societe extends CommonObject * @param int $type Should be 1 to say supplier * @return void */ - function get_codefournisseur($objsoc = 0, $type = 1) + public function get_codefournisseur($objsoc = 0, $type = 1) { // phpcs:enable global $conf; @@ -2617,14 +2617,14 @@ class Societe extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Verifie si un code client est modifiable en fonction des parametres * du module de controle des codes. * * @return int 0=No, 1=Yes */ - function codeclient_modifiable() + public function codeclient_modifiable() { // phpcs:enable global $conf; @@ -2654,13 +2654,13 @@ class Societe extends CommonObject } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Verifie si un code fournisseur est modifiable dans configuration du module de controle des codes * * @return int 0=No, 1=Yes */ - function codefournisseur_modifiable() + public function codefournisseur_modifiable() { // phpcs:enable global $conf; @@ -2690,7 +2690,7 @@ class Societe extends CommonObject } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Check customer code * @@ -2700,7 +2700,7 @@ class Societe extends CommonObject * -3 ErrorCustomerCodeAlreadyUsed * -4 ErrorPrefixRequired */ - function check_codeclient() + public function check_codeclient() { // phpcs:enable global $conf; @@ -2727,7 +2727,7 @@ class Societe extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Check supplier code * @@ -2737,7 +2737,7 @@ class Societe extends CommonObject * -3 ErrorCustomerCodeAlreadyUsed * -4 ErrorPrefixRequired */ - function check_codefournisseur() + public function check_codefournisseur() { // phpcs:enable global $conf; @@ -2764,7 +2764,7 @@ class Societe extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Renvoie un code compta, suivant le module de code compta. * Peut etre identique a celui saisit ou genere automatiquement. @@ -2773,7 +2773,7 @@ class Societe extends CommonObject * @param string $type Type of thirdparty ('customer' or 'supplier') * @return string Code compta si ok, 0 si aucun, <0 si ko */ - function get_codecompta($type) + public function get_codecompta($type) { // phpcs:enable global $conf; @@ -2816,14 +2816,14 @@ class Societe extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Define parent commany of current company * * @param int $id Id of thirdparty to set or '' to remove * @return int <0 if KO, >0 if OK */ - function set_parent($id) + public function set_parent($id) { // phpcs:enable if ($this->id) @@ -2846,14 +2846,14 @@ class Societe extends CommonObject else return -1; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Returns if a profid sould be verified * * @param int $idprof 1,2,3,4,5,6 (Exemple: 1=siren,2=siret,3=naf,4=rcs/rm,5=idprof5,6=idprof6) * @return boolean true , false */ - function id_prof_verifiable($idprof) + public function id_prof_verifiable($idprof) { // phpcs:enable global $conf; @@ -2885,7 +2885,7 @@ class Societe extends CommonObject return $ret; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Verify if a profid exists into database for others thirds * @@ -2894,7 +2894,7 @@ class Societe extends CommonObject * @param int $socid Id of thirdparty to exclude (if update) * @return boolean True if exists, False if not */ - function id_prof_exists($idprof, $value, $socid = 0) + public function id_prof_exists($idprof, $value, $socid = 0) { // phpcs:enable $field = $idprof; @@ -2945,7 +2945,7 @@ class Societe extends CommonObject else return false; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Verifie la validite d'un identifiant professionnel en fonction du pays de la societe (siren, siret, ...) * @@ -2954,7 +2954,7 @@ class Societe extends CommonObject * @return int <=0 if KO, >0 if OK * TODO better to have this in a lib than into a business class */ - function id_prof_check($idprof, $soc) + public function id_prof_check($idprof, $soc) { // phpcs:enable global $conf; @@ -3096,7 +3096,7 @@ class Societe extends CommonObject return $ok; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return an url to check online a professional id or empty string * @@ -3105,7 +3105,7 @@ class Societe extends CommonObject * @return string Url or empty string if no URL known * TODO better in a lib than into business class */ - function id_prof_url($idprof, $thirdparty) + public function id_prof_url($idprof, $thirdparty) { // phpcs:enable global $conf,$langs,$hookmanager; @@ -3150,13 +3150,13 @@ class Societe extends CommonObject return ''; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Indique si la societe a des projets * * @return bool true si la societe a des projets, false sinon */ - function has_projects() + public function has_projects() { // phpcs:enable $sql = 'SELECT COUNT(*) as numproj FROM '.MAIN_DB_PREFIX.'projet WHERE fk_soc = ' . $this->id; @@ -3182,7 +3182,7 @@ class Societe extends CommonObject * @param int $id Id of thirdparty to load * @return void */ - function info($id) + public function info($id) { $sql = "SELECT s.rowid, s.nom as name, s.datec as date_creation, tms as date_modification,"; $sql.= " fk_user_creat, fk_user_modif"; @@ -3228,7 +3228,7 @@ class Societe extends CommonObject * * @return boolean true=is a company, false=a and user */ - function isACompany() + public function isACompany() { global $conf; @@ -3250,19 +3250,19 @@ class Societe extends CommonObject * * @return boolean true = country inside EEC, false = country outside EEC */ - function isInEEC() + public function isInEEC() { require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; return isInEEC($this); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Charge la liste des categories fournisseurs * * @return int 0 if success, <> 0 if error */ - function LoadSupplierCateg() + public function LoadSupplierCateg() { // phpcs:enable $this->SupplierCategories = array(); @@ -3285,14 +3285,14 @@ class Societe extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Insert link supplier - category * * @param int $categorie_id Id of category * @return int 0 if success, <> 0 if error */ - function AddFournisseurInCategory($categorie_id) + public function AddFournisseurInCategory($categorie_id) { // phpcs:enable if ($categorie_id > 0 && $this->id > 0) @@ -3310,7 +3310,7 @@ class Societe extends CommonObject } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Create a third party into database from a member object * @@ -3320,7 +3320,7 @@ class Societe extends CommonObject * @param string $customercode Customer code * @return int <0 if KO, id of created account if OK */ - function create_from_member(Adherent $member, $socname = '', $socalias = '', $customercode = '') + public function create_from_member(Adherent $member, $socname = '', $socalias = '', $customercode = '') { // phpcs:enable global $user,$langs; @@ -3392,7 +3392,7 @@ class Societe extends CommonObject * @param Conf $conf Conf object (possibility to use another entity) * @return void */ - function setMysoc(Conf $conf) + public function setMysoc(Conf $conf) { global $langs; @@ -3468,7 +3468,7 @@ class Societe extends CommonObject * * @return void */ - function initAsSpecimen() + public function initAsSpecimen() { $now=dol_now(); @@ -3521,7 +3521,7 @@ class Societe extends CommonObject * @param int $localTaxNum To get info for only localtax1 or localtax2 * @return boolean true or false */ - function useLocalTax($localTaxNum = 0) + public function useLocalTax($localTaxNum = 0) { $sql = "SELECT t.localtax1, t.localtax2"; $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c"; @@ -3545,7 +3545,7 @@ class Societe extends CommonObject * * @return boolean true or false */ - function useNPR() + public function useNPR() { $sql = "SELECT t.rowid"; $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c"; @@ -3566,7 +3566,7 @@ class Societe extends CommonObject * * @return boolean true or false */ - function useRevenueStamp() + public function useRevenueStamp() { $sql = "SELECT COUNT(*) as nb"; $sql .= " FROM ".MAIN_DB_PREFIX."c_revenuestamp as r, ".MAIN_DB_PREFIX."c_country as c"; @@ -3592,19 +3592,19 @@ class Societe extends CommonObject * * @return string Libelle */ - function getLibProspLevel() + public function getLibProspLevel() { return $this->LibProspLevel($this->fk_prospectlevel); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return label of prospect level * * @param int $fk_prospectlevel Prospect level * @return string label of level */ - function LibProspLevel($fk_prospectlevel) + public function LibProspLevel($fk_prospectlevel) { // phpcs:enable global $langs; @@ -3619,7 +3619,7 @@ class Societe extends CommonObject } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set prospect level * @@ -3627,7 +3627,7 @@ class Societe extends CommonObject * @return int <0 if KO, >0 if OK * @deprecated Use update function instead */ - function set_prospect_level(User $user) + public function set_prospect_level(User $user) { // phpcs:enable return $this->update($this->id, $user); @@ -3640,12 +3640,12 @@ class Societe extends CommonObject * @param string $label Label to use for status for added status * @return string Libelle */ - function getLibProspCommStatut($mode = 0, $label = '') + public function getLibProspCommStatut($mode = 0, $label = '') { return $this->LibProspCommStatut($this->stcomm_id, $mode, $label); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return label of a given status * @@ -3654,7 +3654,7 @@ class Societe extends CommonObject * @param string $label Label to use for status for added status * @return string Libelle du statut */ - function LibProspCommStatut($statut, $mode = 0, $label = '') + public function LibProspCommStatut($statut, $mode = 0, $label = '') { // phpcs:enable global $langs; @@ -3700,7 +3700,7 @@ class Societe extends CommonObject return "Error, mode/status not found"; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set outstanding value * @@ -3708,7 +3708,7 @@ class Societe extends CommonObject * @return int <0 if KO, >0 if OK * @deprecated Use update function instead */ - function set_OutstandingBill(User $user) + public function set_OutstandingBill(User $user) { // phpcs:enable return $this->update($this->id, $user); @@ -3720,7 +3720,7 @@ class Societe extends CommonObject * @param string $mode 'customer' or 'supplier' * @return array array('opened'=>Amount, 'total'=>Total amount) */ - function getOutstandingProposals($mode = 'customer') + public function getOutstandingProposals($mode = 'customer') { $table='propal'; if ($mode == 'supplier') $table = 'supplier_proposal'; @@ -3760,7 +3760,7 @@ class Societe extends CommonObject * @param string $mode 'customer' or 'supplier' * @return array array('opened'=>Amount, 'total'=>Total amount) */ - function getOutstandingOrders($mode = 'customer') + public function getOutstandingOrders($mode = 'customer') { $table='commande'; if ($mode == 'supplier') $table = 'commande_fournisseur'; @@ -3800,7 +3800,7 @@ class Societe extends CommonObject * @param string $mode 'customer' or 'supplier' * @return array array('opened'=>Amount, 'total'=>Total amount) */ - function getOutstandingBills($mode = 'customer') + public function getOutstandingBills($mode = 'customer') { $table='facture'; if ($mode == 'supplier') $table = 'facture_fourn'; @@ -3867,16 +3867,16 @@ class Societe extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - /** - * Return amount of bill not paid - * - * @return int Amount in debt for thirdparty - * @deprecated - * @see getOutstandingBills() - */ - function get_OutstandingBill() - { + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Return amount of bill not paid + * + * @return int Amount in debt for thirdparty + * @deprecated + * @see getOutstandingBills() + */ + public function get_OutstandingBill() + { // phpcs:enable /* Accurate value of remain to pay is to sum remaintopay for each invoice $paiement = $invoice->getSommePaiement(); @@ -3920,28 +3920,28 @@ class Societe extends CommonObject * * @return string Label */ - function getLibCustProspStatut() + public function getLibCustProspStatut() { return $this->LibCustProspStatut($this->client); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Renvoi le libelle d'un statut donne * * @param int $statut Id statut * @return string Libelle du statut */ - function LibCustProspStatut($statut) + public function LibCustProspStatut($statut) { // phpcs:enable global $langs; $langs->load('companies'); if ($statut==0) return $langs->trans("NorProspectNorCustomer"); - if ($statut==1) return $langs->trans("Customer"); - if ($statut==2) return $langs->trans("Prospect"); - if ($statut==3) return $langs->trans("ProspectCustomer"); + elseif ($statut==1) return $langs->trans("Customer"); + elseif ($statut==2) return $langs->trans("Prospect"); + elseif ($statut==3) return $langs->trans("ProspectCustomer"); } diff --git a/htdocs/societe/class/societeaccount.class.php b/htdocs/societe/class/societeaccount.class.php index 80d98875e39..14b567a62e6 100644 --- a/htdocs/societe/class/societeaccount.class.php +++ b/htdocs/societe/class/societeaccount.class.php @@ -342,14 +342,14 @@ class SocieteAccount extends CommonObject * Return a link to the object card (with optionaly the picto) * * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) - * @param string $option On what the link point to ('nolink', ...) + * @param string $option On what the link point to ('nolink', ...) * @param int $notooltip 1=Disable tooltip * @param string $morecss Add more css on link * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking - * @return string String with URL - */ - function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) - { + * @return string String with URL + */ + public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) + { global $db, $conf, $langs; global $dolibarr_main_authentication, $dolibarr_main_demo; global $menumanager; @@ -399,7 +399,7 @@ class SocieteAccount extends CommonObject $result .= $linkend; return $result; - } + } /** * Retourne le libelle du status d'un user (actif, inactif) @@ -407,12 +407,12 @@ class SocieteAccount extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ - function getLibStatut($mode = 0) + public function getLibStatut($mode = 0) { return $this->LibStatut($this->status, $mode); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return the status * @@ -420,7 +420,7 @@ class SocieteAccount extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label of status */ - static function LibStatut($status, $mode = 0) + public static function LibStatut($status, $mode = 0) { // phpcs:enable global $langs; @@ -469,7 +469,7 @@ class SocieteAccount extends CommonObject * @param int $id Id of order * @return void */ - function info($id) + public function info($id) { $sql = 'SELECT rowid, date_creation as datec, tms as datem,'; $sql.= ' fk_user_creat, fk_user_modif';