diff --git a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php index 9c691c88e88..f4ed611ac03 100644 --- a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php +++ b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php @@ -69,7 +69,7 @@ class PrestaShopWebservice * @param string $key Authentification key * @param mixed $debug Debug mode Activated (true) or deactivated (false) */ - function __construct($url, $key, $debug = true) + public function __construct($url, $key, $debug = true) { if (!extension_loaded('curl')) throw new PrestaShopWebserviceException('Please activate the PHP extension \'curl\' to allow use of PrestaShop webservice library'); @@ -77,7 +77,7 @@ class PrestaShopWebservice $this->key = $key; $this->debug = $debug; $this->version = 'unknown'; - } + } /** * Take the status code and throw an exception if the server didn't return 200 or 201 code diff --git a/htdocs/admin/dolistore/class/dolistore.class.php b/htdocs/admin/dolistore/class/dolistore.class.php index b3a9f037e95..8a27072fad1 100644 --- a/htdocs/admin/dolistore/class/dolistore.class.php +++ b/htdocs/admin/dolistore/class/dolistore.class.php @@ -54,7 +54,7 @@ class Dolistore * * @param boolean $debug Enable debug of request on screen */ - function __construct($debug = false) + public function __construct($debug = false) { global $conf, $langs; @@ -77,7 +77,7 @@ class Dolistore * @param array $options Options * @return void */ - function getRemoteData($options = array('start' => 0, 'end' => 10, 'per_page' => 50, 'categorie' => 0)) + public function getRemoteData($options = array('start' => 0, 'end' => 10, 'per_page' => 50, 'categorie' => 0)) { global $conf, $langs; @@ -163,14 +163,14 @@ class Dolistore } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return tree of Dolistore categories. $this->categories must have been loaded before. * * @param int $parent Id of parent category * @return string */ - function get_categories($parent = 0) + public function get_categories($parent = 0) { // phpcs:enable if (!isset($this->categories)) die('not possible'); @@ -212,13 +212,13 @@ class Dolistore } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of product formated for output * * @return string HTML output */ - function get_products() + public function get_products() { // phpcs:enable global $langs, $conf; @@ -291,44 +291,44 @@ class Dolistore '.$download_link.' '; - } - return $html; - } + } + return $html; + } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * get previous link * * @param string $text symbol previous * @return string html previous link */ - function get_previous_link($text = '<<') + public function get_previous_link($text = '<<') { // phpcs:enable return ''.$text.''; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * get next link * * @param string $text symbol next * @return string html next link */ - function get_next_link($text = '>>') + public function get_next_link($text = '>>') { // phpcs:enable return ''.$text.''; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - /** + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** * get previous url * * @return string previous url */ - function get_previous_url() - { + public function get_previous_url() + { // phpcs:enable $param_array = array(); if ($this->start < $this->per_page) { @@ -343,15 +343,15 @@ class Dolistore } $param = http_build_query($param_array); return $this->url."&".$param; - } + } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * get next url * * @return string next url */ - function get_next_url() + public function get_next_url() { // phpcs:enable $param_array = array(); @@ -369,7 +369,7 @@ class Dolistore return $this->url."&".$param; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * version compare * @@ -377,7 +377,7 @@ class Dolistore * @param string $v2 version 2 * @return int result of compare */ - function version_compare($v1, $v2) + public function version_compare($v1, $v2) { // phpcs:enable $v1 = explode('.', $v1); diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index 4951f365ec2..33122986187 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -182,7 +182,7 @@ class Proposals extends DolibarrApi * @return int ID of proposal */ public function post($request_data = null) - { + { if(! DolibarrApiAccess::$user->rights->propal->creer) { throw new RestException(401, "Insuffisant rights"); } @@ -204,7 +204,7 @@ class Proposals extends DolibarrApi } return $this->propal->id; - } + } /** * Get lines of a commercial proposal diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 37f6b2bd3f5..304eccf9bb7 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -239,7 +239,7 @@ class Propal extends CommonObject * @param int $socid Id third party * @param int $propalid Id proposal */ - function __construct($db, $socid = "", $propalid = 0) + public function __construct($db, $socid = "", $propalid = 0) { global $conf,$langs; @@ -254,7 +254,7 @@ class Propal extends CommonObject } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Add line into array products * $this->thirdparty should be loaded @@ -267,7 +267,7 @@ class Propal extends CommonObject * TODO Replace calls to this function by generation objet Ligne * inserted into table $this->products */ - function add_product($idproduct, $qty, $remise_percent = 0) + public function add_product($idproduct, $qty, $remise_percent = 0) { // phpcs:enable global $conf, $mysoc; @@ -316,14 +316,14 @@ class Propal extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Adding line of fixed discount in the proposal in DB * * @param int $idremise Id of fixed discount * @return int >0 if OK, <0 if KO */ - function insert_discount($idremise) + public function insert_discount($idremise) { // phpcs:enable global $langs; @@ -434,7 +434,7 @@ class Propal extends CommonObject * @return int >0 if OK, <0 if KO * @see add_product */ - function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $fk_product = 0, $remise_percent = 0.0, $price_base_type = 'HT', $pu_ttc = 0.0, $info_bits = 0, $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $origin = '', $origin_id = 0, $pu_ht_devise = 0, $fk_remise_except = 0) + public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $fk_product = 0, $remise_percent = 0.0, $price_base_type = 'HT', $pu_ttc = 0.0, $info_bits = 0, $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $origin = '', $origin_id = 0, $pu_ht_devise = 0, $fk_remise_except = 0) { global $mysoc, $conf, $langs; @@ -663,11 +663,11 @@ class Propal extends CommonObject * @param int $notrigger disable line update trigger * @return int 0 if OK, <0 if KO */ - function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $desc = '', $price_base_type = 'HT', $info_bits = 0, $special_code = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $type = 0, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0) + public function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $desc = '', $price_base_type = 'HT', $info_bits = 0, $special_code = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $type = 0, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0) { global $mysoc; -dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise_percent=$remise_percent, + dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise_percent=$remise_percent, txtva=$txtva, desc=$desc, price_base_type=$price_base_type, info_bits=$info_bits, special_code=$special_code, fk_parent_line=$fk_parent_line, pa_ht=$pa_ht, type=$type, date_start=$date_start, date_end=$date_end"); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; @@ -827,7 +827,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise * @param int $lineid Id of line to delete * @return int >0 if OK, <0 if KO */ - function deleteline($lineid) + public function deleteline($lineid) { global $user; @@ -869,7 +869,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >=0 if OK */ - function create($user, $notrigger = 0) + public function create($user, $notrigger = 0) { global $conf,$hookmanager; $error=0; @@ -1193,7 +1193,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Insert into DB a proposal object completely defined by its data members (ex, results from copy). * @@ -1201,7 +1201,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise * @return int Id of the new object if ok, <0 if ko * @see create */ - function create_from($user) + public function create_from($user) { // phpcs:enable // i love this function because $this->products is not used in create function... @@ -1216,7 +1216,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise * @param int $socid Id of thirdparty * @return int New id of clone */ - function createFromClone($socid = 0) + public function createFromClone($socid = 0) { global $user,$conf,$hookmanager; @@ -1345,7 +1345,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise * @param string $ref Ref of proposal * @return int >0 if OK, <0 if KO */ - function fetch($rowid, $ref = '') + public function fetch($rowid, $ref = '') { $sql = "SELECT p.rowid, p.ref, p.entity, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc"; @@ -1509,7 +1509,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise * @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; @@ -1597,14 +1597,14 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load array lines * * @param int $only_product Return only physical products * @return int <0 if KO, >0 if OK */ - function fetch_lines($only_product = 0) + public function fetch_lines($only_product = 0) { // phpcs:enable $this->lines=array(); @@ -1723,7 +1723,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise * @param int $notrigger 1=Does not execute triggers, 0=execute triggers * @return int <0 if KO, 0=Nothing done, >=0 if OK */ - function valid($user, $notrigger = 0) + public function valid($user, $notrigger = 0) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -1838,7 +1838,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Define proposal date * @@ -1847,7 +1847,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function set_date($user, $date, $notrigger = 0) + public function set_date($user, $date, $notrigger = 0) { // phpcs:enable if (empty($date)) @@ -1907,7 +1907,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Define end validity date * @@ -1916,7 +1916,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function set_echeance($user, $date_fin_validite, $notrigger = 0) + public function set_echeance($user, $date_fin_validite, $notrigger = 0) { // phpcs:enable if (! empty($user->rights->propal->creer)) @@ -1969,7 +1969,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set delivery date * @@ -1978,7 +1978,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok */ - function set_date_livraison($user, $date_livraison, $notrigger = 0) + public function set_date_livraison($user, $date_livraison, $notrigger = 0) { // phpcs:enable if (! empty($user->rights->propal->creer)) @@ -2031,7 +2031,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set delivery * @@ -2040,7 +2040,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function set_availability($user, $id, $notrigger = 0) + public function set_availability($user, $id, $notrigger = 0) { // phpcs:enable if (! empty($user->rights->propal->creer) && $this->statut >= self::STATUS_DRAFT) @@ -2102,7 +2102,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set source of demand * @@ -2111,7 +2111,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function set_demand_reason($user, $id, $notrigger = 0) + public function set_demand_reason($user, $id, $notrigger = 0) { // phpcs:enable if (! empty($user->rights->propal->creer) && $this->statut >= self::STATUS_DRAFT) @@ -2175,7 +2175,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set customer reference number * @@ -2184,7 +2184,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok */ - function set_ref_client($user, $ref_client, $notrigger = 0) + public function set_ref_client($user, $ref_client, $notrigger = 0) { // phpcs:enable if (! empty($user->rights->propal->creer)) @@ -2240,7 +2240,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set an overall discount on the proposal * @@ -2249,7 +2249,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok */ - function set_remise_percent($user, $remise, $notrigger = 0) + public function set_remise_percent($user, $remise, $notrigger = 0) { // phpcs:enable $remise=trim($remise)?trim($remise):0; @@ -2307,7 +2307,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set an absolute overall discount on the proposal * @@ -2316,7 +2316,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise * @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 $remise=trim($remise)?trim($remise):0; @@ -2385,7 +2385,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function reopen($user, $statut, $note = '', $notrigger = 0) + public function reopen($user, $statut, $note = '', $notrigger = 0) { $this->statut = $statut; @@ -2446,7 +2446,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers * @return int <0 if KO, >0 if OK */ - function cloture($user, $statut, $note = "", $notrigger = 0) + public function cloture($user, $statut, $note = "", $notrigger = 0) { global $langs,$conf; @@ -2549,7 +2549,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 si ko, >0 si ok */ - function classifyBilled(User $user, $notrigger = 0) + public function classifyBilled(User $user, $notrigger = 0) { $error=0; @@ -2597,7 +2597,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set draft status * @@ -2605,7 +2605,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function set_draft($user, $notrigger = 0) + public function set_draft($user, $notrigger = 0) { // phpcs:enable $error=0; @@ -2656,7 +2656,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of proposal (eventually filtered on user) into an array * @@ -2670,7 +2670,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise * @param string $sortorder Sort order * @return int -1 if KO, array with result if OK */ - function liste_array($shortlist = 0, $draft = 0, $notcurrentuser = 0, $socid = 0, $limit = 0, $offset = 0, $sortfield = 'p.datep', $sortorder = 'DESC') + public function liste_array($shortlist = 0, $draft = 0, $notcurrentuser = 0, $socid = 0, $limit = 0, $offset = 0, $sortfield = 'p.datep', $sortorder = 'DESC') { // phpcs:enable global $user; @@ -2739,19 +2739,19 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise * * @return array Array of invoices */ - function getInvoiceArrayList() + public function getInvoiceArrayList() { return $this->InvoiceArrayList($this->id); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Returns an array with id and ref of related invoices * * @param int $id Id propal * @return array Array of invoices id */ - function InvoiceArrayList($id) + public function InvoiceArrayList($id) { // phpcs:enable $ga = array(); @@ -2838,7 +2838,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int 1 if ok, otherwise if error */ - function delete($user, $notrigger = 0) + public function delete($user, $notrigger = 0) { global $conf; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -2962,7 +2962,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise * @return int >0 if OK, <0 if KO * @deprecated use set_availability */ - function availability($availability_id, $notrigger = 0) + public function availability($availability_id, $notrigger = 0) { global $user; @@ -3024,7 +3024,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Change source demand * @@ -3033,7 +3033,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise * @return int >0 si ok, <0 si ko * @deprecated use set_demand_reason */ - function demand_reason($demand_reason_id, $notrigger = 0) + public function demand_reason($demand_reason_id, $notrigger = 0) { // phpcs:enable global $user; @@ -3103,7 +3103,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise * @param int $id Proposal id * @return void */ - function info($id) + public function info($id) { $sql = "SELECT c.rowid, "; $sql.= " c.datec, c.date_valid as datev, c.date_cloture as dateo,"; @@ -3158,12 +3158,12 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise * @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->statut, $mode); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return label of a status (draft, validated, ...) * @@ -3171,7 +3171,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise * @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 = 1) + public function LibStatut($statut, $mode = 1) { // phpcs:enable global $conf; @@ -3210,7 +3210,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * @@ -3218,7 +3218,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise * @param int $mode "opened" for proposal to close, "signed" for proposal to invoice * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ - function load_board($user, $mode) + public function load_board($user, $mode) { // phpcs:enable global $conf, $langs; @@ -3300,7 +3300,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise * * @return void */ - function initAsSpecimen() + public function initAsSpecimen() { global $langs; @@ -3386,13 +3386,13 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise } } - // 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; @@ -3438,7 +3438,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise * @param Societe $soc Object thirdparty * @return string Reference libre pour la propale */ - function getNextNumRef($soc) + public function getNextNumRef($soc) { global $conf,$langs; $langs->load("propal"); @@ -3500,7 +3500,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise * @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 = '', $get_params = '', $notooltip = 0, $save_lastsearch_value = -1) + public function getNomUrl($withpicto = 0, $option = '', $get_params = '', $notooltip = 0, $save_lastsearch_value = -1) { global $langs, $conf, $user; @@ -3574,7 +3574,7 @@ dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise * * @return int >0 if OK, <0 if KO */ - function getLinesArray() + public function getLinesArray() { return $this->fetch_lines(); } @@ -3754,7 +3754,7 @@ class PropaleLigne extends CommonObjectLine * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db= $db; } @@ -3765,7 +3765,7 @@ class PropaleLigne extends CommonObjectLine * @param int $rowid Propal line id * @return int <0 if KO, >0 if OK */ - function fetch($rowid) + public function fetch($rowid) { $sql = 'SELECT pd.rowid, pd.fk_propal, pd.fk_parent_line, pd.fk_product, pd.label as custom_label, pd.description, pd.price, pd.qty, pd.vat_src_code, pd.tva_tx,'; $sql.= ' pd.remise, pd.remise_percent, pd.fk_remise_except, pd.subprice,'; @@ -3859,7 +3859,7 @@ class PropaleLigne extends CommonObjectLine * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function insert($notrigger = 0) + public function insert($notrigger = 0) { global $conf,$user; @@ -4002,7 +4002,7 @@ class PropaleLigne extends CommonObjectLine * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok */ - function delete(User $user, $notrigger = 0) + public function delete(User $user, $notrigger = 0) { global $conf; @@ -4056,7 +4056,7 @@ class PropaleLigne extends CommonObjectLine * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok */ - function update($notrigger = 0) + public function update($notrigger = 0) { global $conf,$user; @@ -4178,14 +4178,14 @@ class PropaleLigne extends CommonObjectLine } } - // 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(); diff --git a/htdocs/comm/propal/class/propalestats.class.php b/htdocs/comm/propal/class/propalestats.class.php index 6fd9d36f54b..808411100f9 100644 --- a/htdocs/comm/propal/class/propalestats.class.php +++ b/htdocs/comm/propal/class/propalestats.class.php @@ -40,12 +40,12 @@ class PropaleStats extends Stats */ public $table_element; - var $socid; - var $userid; + public $socid; + public $userid; - var $from; - var $field; - var $where; + public $from; + public $field; + public $where; /** @@ -56,7 +56,7 @@ class PropaleStats extends Stats * @param int $userid Id user for filter (creation user) * @param string $mode Option ('customer', 'supplier') */ - function __construct($db, $socid = 0, $userid = 0, $mode = 'customer') + public function __construct($db, $socid = 0, $userid = 0, $mode = 'customer') { global $user, $conf; @@ -106,7 +106,7 @@ class PropaleStats 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 number by month */ - function getNbByMonth($year, $format = 0) + public function getNbByMonth($year, $format = 0) { global $user; @@ -128,7 +128,7 @@ class PropaleStats extends Stats * @return array Array with number by year * */ - function getNbByYear() + public function getNbByYear() { global $user; @@ -149,7 +149,7 @@ class PropaleStats 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) + public function getAmountByMonth($year, $format) { global $user; @@ -171,7 +171,7 @@ class PropaleStats extends Stats * @param int $year year for stats * @return array array with number by month */ - function getAverageByMonth($year) + public function getAverageByMonth($year) { global $user; @@ -191,7 +191,7 @@ class PropaleStats extends Stats * * @return array Array of values */ - function getAllByYear() + public function getAllByYear() { global $user; @@ -213,7 +213,7 @@ class PropaleStats 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/localtax/class/localtax.class.php b/htdocs/compta/localtax/class/localtax.class.php index 686e72c46a7..b0178bd09e1 100644 --- a/htdocs/compta/localtax/class/localtax.class.php +++ b/htdocs/compta/localtax/class/localtax.class.php @@ -75,7 +75,7 @@ class Localtax extends CommonObject * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db = $db; } @@ -87,7 +87,7 @@ class Localtax 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; @@ -163,7 +163,7 @@ class Localtax extends CommonObject * @param int $notrigger 0=no, 1=yes (no update trigger) * @return int <0 if KO, >0 if OK */ - function update(User $user, $notrigger = 0) + public function update(User $user, $notrigger = 0) { global $conf, $langs; @@ -228,7 +228,7 @@ class Localtax extends CommonObject * @param int $id Object id * @return int <0 if KO, >0 if OK */ - function fetch($id) + public function fetch($id) { global $langs; $sql = "SELECT"; @@ -292,7 +292,7 @@ class Localtax extends CommonObject * @param User $user User that delete * @return int <0 if KO, >0 if OK */ - function delete($user) + public function delete($user) { // Call trigger $result=$this->call_trigger('LOCALTAX_DELETE', $user); @@ -322,7 +322,7 @@ class Localtax extends CommonObject * * @return void */ - function initAsSpecimen() + public function initAsSpecimen() { $this->id=0; @@ -345,7 +345,7 @@ class Localtax extends CommonObject * @param int $year Year * @return int ??? */ - function solde($year = 0) + public function solde($year = 0) { $reglee = $this->localtax_sum_reglee($year); @@ -358,14 +358,14 @@ class Localtax extends CommonObject return $solde; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Total de la localtax des factures emises par la societe. * * @param int $year Year * @return int ??? */ - function localtax_sum_collectee($year = 0) + public function localtax_sum_collectee($year = 0) { // phpcs:enable $sql = "SELECT sum(f.localtax) as amount"; @@ -398,14 +398,14 @@ class Localtax extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * localtax payed * * @param int $year Year * @return int ??? */ - function localtax_sum_payee($year = 0) + public function localtax_sum_payee($year = 0) { // phpcs:enable @@ -440,7 +440,7 @@ class Localtax extends CommonObject } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * localtax payed * Total de la localtax payed @@ -448,7 +448,7 @@ class Localtax extends CommonObject * @param int $year Year * @return int ??? */ - function localtax_sum_reglee($year = 0) + public function localtax_sum_reglee($year = 0) { // phpcs:enable @@ -489,7 +489,7 @@ class Localtax extends CommonObject * @param User $user Object user that insert * @return int <0 if KO, rowid in localtax table if OK */ - function addPayment($user) + public function addPayment($user) { global $conf,$langs; @@ -596,21 +596,20 @@ class Localtax extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Update the link betwen localtax payment and the line into llx_bank * * @param int $id Id bank account * @return int <0 if KO, >0 if OK */ - function update_fk_bank($id) + public function update_fk_bank($id) { // phpcs:enable $sql = 'UPDATE '.MAIN_DB_PREFIX.'localtax SET fk_bank = '.$id; $sql.= ' WHERE rowid = '.$this->id; $result = $this->db->query($sql); - if ($result) - { + if ($result) { return 1; } else @@ -628,7 +627,7 @@ class Localtax extends CommonObject * @param string $option Sur quoi pointe le lien * @return string Chaine avec URL */ - function getNomUrl($withpicto = 0, $option = '') + public function getNomUrl($withpicto = 0, $option = '') { global $langs; @@ -652,12 +651,12 @@ class Localtax 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 * @@ -665,7 +664,7 @@ class Localtax 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 diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 16c7c2f3f52..142dd1b0e1e 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -81,7 +81,7 @@ class BonPrelevement extends CommonObject * @param DoliDB $db Database handler * @param string $filename Filename of withdraw receipt */ - function __construct($db, $filename = '') + public function __construct($db, $filename = '') { global $conf,$langs; @@ -112,7 +112,7 @@ class BonPrelevement extends CommonObject $this->fetched = 0; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Add invoice to withdrawal * @@ -126,7 +126,7 @@ class BonPrelevement extends CommonObject * @param string $number_key number key of account number * @return int >0 if OK, <0 if KO */ - function AddFacture($facture_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key) + public function AddFacture($facture_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key) { // phpcs:enable $result = 0; @@ -184,7 +184,7 @@ class BonPrelevement extends CommonObject * @param string $number_key number key of account number * @return int >0 if OK, <0 if KO */ - function addline(&$line_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key) + public function addline(&$line_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key) { $result = -1; $concat = 0; @@ -258,7 +258,7 @@ class BonPrelevement extends CommonObject * @param int $error Id of error * @return string Error string */ - function getErrorString($error) + public function getErrorString($error) { global $langs; @@ -276,7 +276,7 @@ class BonPrelevement extends CommonObject * @param string $ref Ref of direct debit * @return int >0 if OK, <0 if KO */ - function fetch($rowid, $ref = '') + public function fetch($rowid, $ref = '') { global $conf; @@ -300,20 +300,20 @@ class BonPrelevement extends CommonObject { $obj = $this->db->fetch_object($result); - $this->id = $obj->rowid; - $this->ref = $obj->ref; - $this->amount = $obj->amount; - $this->note = $obj->note; - $this->datec = $this->db->jdate($obj->dc); + $this->id = $obj->rowid; + $this->ref = $obj->ref; + $this->amount = $obj->amount; + $this->note = $obj->note; + $this->datec = $this->db->jdate($obj->dc); - $this->date_trans = $this->db->jdate($obj->date_trans); - $this->method_trans = $obj->method_trans; - $this->user_trans = $obj->fk_user_trans; + $this->date_trans = $this->db->jdate($obj->date_trans); + $this->method_trans = $obj->method_trans; + $this->user_trans = $obj->fk_user_trans; - $this->date_credit = $this->db->jdate($obj->date_credit); - $this->user_credit = $obj->fk_user_credit; + $this->date_credit = $this->db->jdate($obj->date_credit); + $this->user_credit = $obj->fk_user_credit; - $this->statut = $obj->statut; + $this->statut = $obj->statut; $this->fetched = 1; @@ -331,13 +331,13 @@ class BonPrelevement extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set credite and set status of linked invoices. Still used ?? * * @return int <0 if KO, >=0 if OK */ - function set_credite() + public function set_credite() { // phpcs:enable global $user,$conf; @@ -410,7 +410,7 @@ class BonPrelevement extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set direct debit order to "credited" status. * @@ -418,7 +418,7 @@ class BonPrelevement extends CommonObject * @param int $date date of action * @return int >0 if OK, <0 if KO */ - function set_infocredit($user, $date) + public function set_infocredit($user, $date) { // phpcs:enable global $conf,$langs; @@ -557,7 +557,7 @@ class BonPrelevement extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set withdrawal to transmited status * @@ -566,7 +566,7 @@ class BonPrelevement extends CommonObject * @param string $method method of transmision to bank * @return int >0 if OK, <0 if KO */ - function set_infotrans($user, $date, $method) + public function set_infotrans($user, $date, $method) { // phpcs:enable global $conf,$langs; @@ -683,13 +683,13 @@ class BonPrelevement extends CommonObject return $arr; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Returns amount of withdrawal * * @return double Total amount */ - function SommeAPrelever() + public function SommeAPrelever() { // phpcs:enable global $conf; @@ -722,7 +722,7 @@ class BonPrelevement extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Get number of invoices to withdrawal * TODO delete params banque and agence when not necesary @@ -731,7 +731,7 @@ class BonPrelevement extends CommonObject * @param int $agence dolibarr mysoc agence * @return int 0 if OK, <0 if KO */ - function delete($user = null) + public function delete($user = null) { $this->db->begin(); @@ -1178,7 +1178,7 @@ class BonPrelevement extends CommonObject * @param string $option link target * @return string URL of target */ - function getNomUrl($withpicto = 0, $option = '') + public function getNomUrl($withpicto = 0, $option = '') { global $langs; @@ -1200,14 +1200,14 @@ class BonPrelevement extends CommonObject } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Delete a notification def by id * * @param int $rowid id of notification * @return int 0 if OK, <0 if KO */ - function DeleteNotificationById($rowid) + public function DeleteNotificationById($rowid) { // phpcs:enable $result = 0; @@ -1225,7 +1225,7 @@ class BonPrelevement extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Delete a notification * @@ -1233,7 +1233,7 @@ class BonPrelevement extends CommonObject * @param string $action notification action * @return int >0 if OK, <0 if KO */ - function DeleteNotification($user, $action) + public function DeleteNotification($user, $action) { // phpcs:enable $result = 0; @@ -1251,7 +1251,7 @@ class BonPrelevement extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Add a notification * @@ -1260,7 +1260,7 @@ class BonPrelevement extends CommonObject * @param string $action notification action * @return int 0 if OK, <0 if KO */ - function AddNotification($db, $user, $action) + public function AddNotification($db, $user, $action) { // phpcs:enable $result = 0; @@ -1299,7 +1299,7 @@ class BonPrelevement extends CommonObject * @param string $executiondate Date to execute transfer * @return int 0 if OK, <0 if KO */ - function generate($format = 'ALL', $executiondate = '') + public function generate($format = 'ALL', $executiondate = '') { global $conf,$langs,$mysoc; @@ -1478,7 +1478,7 @@ class BonPrelevement extends CommonObject } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Write recipient of request (customer) * @@ -1493,7 +1493,7 @@ class BonPrelevement extends CommonObject * @param string $rib_dom rib domiciliation * @return void */ - function EnregDestinataire($rowid, $client_nom, $rib_banque, $rib_guichet, $rib_number, $amount, $ref, $facid, $rib_dom = '') + public function EnregDestinataire($rowid, $client_nom, $rib_banque, $rib_guichet, $rib_number, $amount, $ref, $facid, $rib_dom = '') { // phpcs:enable fputs($this->file, "06"); @@ -1559,14 +1559,14 @@ class BonPrelevement extends CommonObject * @param string $row_drum Id of customer bank account (rib.rowid) * @return string RUM number */ - static function buildRumNumber($row_code_client, $row_datec, $row_drum) + public static function buildRumNumber($row_code_client, $row_datec, $row_drum) { global $langs; $pre = $langs->trans('RUM').'-'; return $pre.$row_code_client.'-'.$row_drum.'-'.date('U', $row_datec); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Write recipient of request (customer) * @@ -1588,7 +1588,7 @@ class BonPrelevement extends CommonObject * @param string $row_drum rib.rowid used to generate rum * @return string Return string with SEPA part DrctDbtTxInf */ - function EnregDestinataireSEPA($row_code_client, $row_nom, $row_address, $row_zip, $row_town, $row_country_code, $row_cb, $row_cg, $row_cc, $row_somme, $row_ref, $row_idfac, $row_iban, $row_bic, $row_datec, $row_drum) + public function EnregDestinataireSEPA($row_code_client, $row_nom, $row_address, $row_zip, $row_town, $row_country_code, $row_cb, $row_cg, $row_cc, $row_somme, $row_ref, $row_idfac, $row_iban, $row_bic, $row_datec, $row_drum) { // phpcs:enable global $conf; @@ -1646,13 +1646,13 @@ class BonPrelevement extends CommonObject } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Write sender of request (me) * * @return void */ - function EnregEmetteur() + public function EnregEmetteur() { // phpcs:enable fputs($this->file, "03"); @@ -1713,7 +1713,7 @@ class BonPrelevement extends CommonObject fputs($this->file, "\n"); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Write sender of request (me). * Note: The tag PmtInf is opened here but closed into caller @@ -1726,7 +1726,7 @@ class BonPrelevement extends CommonObject * @param string $format FRST or RCUR or ALL * @return string String with SEPA Sender */ - function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrLf = '\n', $format = 'FRST') + public function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrLf = '\n', $format = 'FRST') { // phpcs:enable // SEPA INITIALISATION @@ -1836,14 +1836,14 @@ class BonPrelevement extends CommonObject return $XML_SEPA_INFO; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Write end * * @param int $total total amount * @return void */ - function EnregTotal($total) + public function EnregTotal($total) { // phpcs:enable fputs($this->file, "08"); @@ -1905,12 +1905,12 @@ class BonPrelevement extends CommonObject * @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 * @@ -1918,7 +1918,7 @@ class BonPrelevement 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 if (empty($this->labelstatut)) @@ -1937,32 +1937,32 @@ class BonPrelevement extends CommonObject elseif ($mode == 2) { if ($statut==0) return img_picto($this->labelstatut[$statut], 'statut1').' '.$this->labelstatut[$statut]; - if ($statut==1) return img_picto($this->labelstatut[$statut], 'statut3').' '.$this->labelstatut[$statut]; - if ($statut==2) return img_picto($this->labelstatut[$statut], 'statut6').' '.$this->labelstatut[$statut]; + elseif ($statut==1) return img_picto($this->labelstatut[$statut], 'statut3').' '.$this->labelstatut[$statut]; + elseif ($statut==2) return img_picto($this->labelstatut[$statut], 'statut6').' '.$this->labelstatut[$statut]; } elseif ($mode == 3) { if ($statut==0) return img_picto($this->labelstatut[$statut], 'statut1'); - if ($statut==1) return img_picto($this->labelstatut[$statut], 'statut3'); - if ($statut==2) return img_picto($this->labelstatut[$statut], 'statut6'); + elseif ($statut==1) return img_picto($this->labelstatut[$statut], 'statut3'); + elseif ($statut==2) return img_picto($this->labelstatut[$statut], 'statut6'); } elseif ($mode == 4) { if ($statut==0) return img_picto($this->labelstatut[$statut], 'statut1').' '.$this->labelstatut[$statut]; - if ($statut==1) return img_picto($this->labelstatut[$statut], 'statut3').' '.$this->labelstatut[$statut]; - if ($statut==2) return img_picto($this->labelstatut[$statut], 'statut6').' '.$this->labelstatut[$statut]; + elseif ($statut==1) return img_picto($this->labelstatut[$statut], 'statut3').' '.$this->labelstatut[$statut]; + elseif ($statut==2) return img_picto($this->labelstatut[$statut], 'statut6').' '.$this->labelstatut[$statut]; } elseif ($mode == 5) { if ($statut==0) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut1'); - if ($statut==1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut3'); - if ($statut==2) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut6'); + elseif ($statut==1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut3'); + elseif ($statut==2) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut6'); } elseif ($mode == 6) { if ($statut==0) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut1'); - if ($statut==1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut3'); - if ($statut==2) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut6'); + elseif ($statut==1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut3'); + elseif ($statut==2) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut], 'statut6'); } } } diff --git a/htdocs/compta/salaries/class/paymentsalary.class.php b/htdocs/compta/salaries/class/paymentsalary.class.php index aad1d9d6e91..40cec40ecad 100644 --- a/htdocs/compta/salaries/class/paymentsalary.class.php +++ b/htdocs/compta/salaries/class/paymentsalary.class.php @@ -31,681 +31,681 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php'; */ class PaymentSalary extends CommonObject { - /** - * @var string ID to identify managed object - */ - public $element='payment_salary'; + /** + * @var string ID to identify managed object + */ + public $element='payment_salary'; - /** - * @var string Name of table without prefix where object is stored - */ - public $table_element='payment_salary'; + /** + * @var string Name of table without prefix where object is stored + */ + public $table_element='payment_salary'; - /** - * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png - */ - public $picto='payment'; + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ + public $picto='payment'; - public $tms; + public $tms; - /** - * @var int User ID - */ - public $fk_user; + /** + * @var int User ID + */ + public $fk_user; - public $datep; - public $datev; - public $amount; + public $datep; + public $datev; + public $amount; - /** + /** * @var int ID */ - public $fk_project; + public $fk_project; - public $type_payment; - public $num_payment; + public $type_payment; + public $num_payment; - /** + /** * @var string salary payments label */ public $label; - public $datesp; - public $dateep; + public $datesp; + public $dateep; - /** + /** * @var int ID */ - public $fk_bank; + public $fk_bank; - /** + /** * @var int ID */ - public $fk_user_author; + public $fk_user_author; - /** + /** * @var int ID */ - public $fk_user_modif; + public $fk_user_modif; - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - function __construct($db) - { - $this->db = $db; - $this->element = 'payment_salary'; - $this->table_element = 'payment_salary'; - } + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + $this->db = $db; + $this->element = 'payment_salary'; + $this->table_element = 'payment_salary'; + } - /** - * Update database - * - * @param User $user User that modify - * @param int $notrigger 0=no, 1=yes (no update trigger) - * @return int <0 if KO, >0 if OK - */ - function update($user = null, $notrigger = 0) - { - global $conf, $langs; + /** + * Update database + * + * @param User $user User that modify + * @param int $notrigger 0=no, 1=yes (no update trigger) + * @return int <0 if KO, >0 if OK + */ + public function update($user = null, $notrigger = 0) + { + global $conf, $langs; - $error=0; + $error=0; - // Clean parameters - $this->fk_user=trim($this->fk_user); - $this->amount=trim($this->amount); - $this->label=trim($this->label); - $this->note=trim($this->note); - $this->fk_bank=trim($this->fk_bank); - $this->fk_user_author=trim($this->fk_user_author); - $this->fk_user_modif=trim($this->fk_user_modif); + // Clean parameters + $this->fk_user=trim($this->fk_user); + $this->amount=trim($this->amount); + $this->label=trim($this->label); + $this->note=trim($this->note); + $this->fk_bank=trim($this->fk_bank); + $this->fk_user_author=trim($this->fk_user_author); + $this->fk_user_modif=trim($this->fk_user_modif); - // Check parameters - if (empty($this->fk_user) || $this->fk_user < 0) - { - $this->error='ErrorBadParameter'; - return -1; - } + // Check parameters + if (empty($this->fk_user) || $this->fk_user < 0) + { + $this->error='ErrorBadParameter'; + return -1; + } - $this->db->begin(); + $this->db->begin(); - // Update request - $sql = "UPDATE ".MAIN_DB_PREFIX."payment_salary SET"; + // Update request + $sql = "UPDATE ".MAIN_DB_PREFIX."payment_salary SET"; - $sql.= " tms='".$this->db->idate($this->tms)."',"; - $sql.= " fk_user=".$this->fk_user.","; - $sql.= " datep='".$this->db->idate($this->datep)."',"; - $sql.= " datev='".$this->db->idate($this->datev)."',"; - $sql.= " amount=".price2num($this->amount).","; - $sql.= " fk_projet='".$this->db->escape($this->fk_project)."',"; - $sql.= " fk_typepayment=".$this->fk_typepayment."',"; - $sql.= " num_payment='".$this->db->escape($this->num_payment)."',"; - $sql.= " label='".$this->db->escape($this->label)."',"; - $sql.= " datesp='".$this->db->idate($this->datesp)."',"; - $sql.= " dateep='".$this->db->idate($this->dateep)."',"; - $sql.= " note='".$this->db->escape($this->note)."',"; - $sql.= " fk_bank=".($this->fk_bank > 0 ? "'".$this->db->escape($this->fk_bank)."'":"null").","; - $sql.= " fk_user_author=".$this->fk_user_author.","; - $sql.= " fk_user_modif=".$this->fk_user_modif; + $sql.= " tms='".$this->db->idate($this->tms)."',"; + $sql.= " fk_user=".$this->fk_user.","; + $sql.= " datep='".$this->db->idate($this->datep)."',"; + $sql.= " datev='".$this->db->idate($this->datev)."',"; + $sql.= " amount=".price2num($this->amount).","; + $sql.= " fk_projet='".$this->db->escape($this->fk_project)."',"; + $sql.= " fk_typepayment=".$this->fk_typepayment."',"; + $sql.= " num_payment='".$this->db->escape($this->num_payment)."',"; + $sql.= " label='".$this->db->escape($this->label)."',"; + $sql.= " datesp='".$this->db->idate($this->datesp)."',"; + $sql.= " dateep='".$this->db->idate($this->dateep)."',"; + $sql.= " note='".$this->db->escape($this->note)."',"; + $sql.= " fk_bank=".($this->fk_bank > 0 ? "'".$this->db->escape($this->fk_bank)."'":"null").","; + $sql.= " fk_user_author=".$this->fk_user_author.","; + $sql.= " fk_user_modif=".$this->fk_user_modif; - $sql.= " WHERE rowid=".$this->id; + $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::update", LOG_DEBUG); - $resql = $this->db->query($sql); - if (! $resql) - { - $this->error="Error ".$this->db->lasterror(); - return -1; - } + dol_syslog(get_class($this)."::update", LOG_DEBUG); + $resql = $this->db->query($sql); + if (! $resql) + { + $this->error="Error ".$this->db->lasterror(); + return -1; + } - if (! $notrigger) - { + if (! $notrigger) + { // Call trigger $result=$this->call_trigger('PAYMENT_SALARY_MODIFY', $user); if ($result < 0) $error++; // End call triggers - } + } - if (! $error) - { - $this->db->commit(); - return 1; - } - else - { - $this->db->rollback(); - return -1; - } - } + if (! $error) + { + $this->db->commit(); + return 1; + } + else + { + $this->db->rollback(); + return -1; + } + } - /** - * Load object in memory from database - * - * @param int $id id object - * @param User $user User that load - * @return int <0 if KO, >0 if OK - */ - function fetch($id, $user = null) - { - global $langs; - $sql = "SELECT"; - $sql.= " s.rowid,"; + /** + * Load object in memory from database + * + * @param int $id id object + * @param User $user User that load + * @return int <0 if KO, >0 if OK + */ + public function fetch($id, $user = null) + { + global $langs; + $sql = "SELECT"; + $sql.= " s.rowid,"; - $sql.= " s.tms,"; - $sql.= " s.fk_user,"; - $sql.= " s.datep,"; - $sql.= " s.datev,"; - $sql.= " s.amount,"; - $sql.= " s.fk_projet as fk_project,"; - $sql.= " s.fk_typepayment,"; - $sql.= " s.num_payment,"; - $sql.= " s.label,"; - $sql.= " s.datesp,"; - $sql.= " s.dateep,"; - $sql.= " s.note,"; - $sql.= " s.fk_bank,"; - $sql.= " s.fk_user_author,"; - $sql.= " s.fk_user_modif,"; - $sql.= " b.fk_account,"; - $sql.= " b.fk_type,"; - $sql.= " b.rappro"; + $sql.= " s.tms,"; + $sql.= " s.fk_user,"; + $sql.= " s.datep,"; + $sql.= " s.datev,"; + $sql.= " s.amount,"; + $sql.= " s.fk_projet as fk_project,"; + $sql.= " s.fk_typepayment,"; + $sql.= " s.num_payment,"; + $sql.= " s.label,"; + $sql.= " s.datesp,"; + $sql.= " s.dateep,"; + $sql.= " s.note,"; + $sql.= " s.fk_bank,"; + $sql.= " s.fk_user_author,"; + $sql.= " s.fk_user_modif,"; + $sql.= " b.fk_account,"; + $sql.= " b.fk_type,"; + $sql.= " b.rappro"; - $sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid"; - $sql.= " WHERE s.rowid = ".$id; + $sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid"; + $sql.= " WHERE s.rowid = ".$id; - dol_syslog(get_class($this)."::fetch", LOG_DEBUG); - $resql=$this->db->query($sql); - if ($resql) - { - if ($this->db->num_rows($resql)) - { - $obj = $this->db->fetch_object($resql); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); + $resql=$this->db->query($sql); + if ($resql) + { + if ($this->db->num_rows($resql)) + { + $obj = $this->db->fetch_object($resql); - $this->id = $obj->rowid; - $this->ref = $obj->rowid; - $this->tms = $this->db->jdate($obj->tms); - $this->fk_user = $obj->fk_user; - $this->datep = $this->db->jdate($obj->datep); - $this->datev = $this->db->jdate($obj->datev); - $this->amount = $obj->amount; - $this->fk_project = $obj->fk_project; - $this->type_payement = $obj->fk_typepayment; - $this->num_payment = $obj->num_payment; - $this->label = $obj->label; - $this->datesp = $this->db->jdate($obj->datesp); - $this->dateep = $this->db->jdate($obj->dateep); - $this->note = $obj->note; - $this->fk_bank = $obj->fk_bank; - $this->fk_user_author = $obj->fk_user_author; - $this->fk_user_modif = $obj->fk_user_modif; - $this->fk_account = $obj->fk_account; - $this->fk_type = $obj->fk_type; - $this->rappro = $obj->rappro; - } - $this->db->free($resql); + $this->id = $obj->rowid; + $this->ref = $obj->rowid; + $this->tms = $this->db->jdate($obj->tms); + $this->fk_user = $obj->fk_user; + $this->datep = $this->db->jdate($obj->datep); + $this->datev = $this->db->jdate($obj->datev); + $this->amount = $obj->amount; + $this->fk_project = $obj->fk_project; + $this->type_payement = $obj->fk_typepayment; + $this->num_payment = $obj->num_payment; + $this->label = $obj->label; + $this->datesp = $this->db->jdate($obj->datesp); + $this->dateep = $this->db->jdate($obj->dateep); + $this->note = $obj->note; + $this->fk_bank = $obj->fk_bank; + $this->fk_user_author = $obj->fk_user_author; + $this->fk_user_modif = $obj->fk_user_modif; + $this->fk_account = $obj->fk_account; + $this->fk_type = $obj->fk_type; + $this->rappro = $obj->rappro; + } + $this->db->free($resql); - return 1; - } - else - { - $this->error="Error ".$this->db->lasterror(); - return -1; - } - } + return 1; + } + else + { + $this->error="Error ".$this->db->lasterror(); + return -1; + } + } - /** - * Delete object in database - * - * @param User $user User that delete - * @return int <0 if KO, >0 if OK - */ - function delete($user) - { - global $conf, $langs; + /** + * Delete object in database + * + * @param User $user User that delete + * @return int <0 if KO, >0 if OK + */ + public function delete($user) + { + global $conf, $langs; - $error=0; + $error=0; - // Call trigger - $result=$this->call_trigger('PAYMENT_SALARY_DELETE', $user); - if ($result < 0) return -1; - // End call triggers + // Call trigger + $result=$this->call_trigger('PAYMENT_SALARY_DELETE', $user); + if ($result < 0) return -1; + // End call triggers - $sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_salary"; - $sql.= " WHERE rowid=".$this->id; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_salary"; + $sql.= " WHERE rowid=".$this->id; - dol_syslog(get_class($this)."::delete", LOG_DEBUG); - $resql = $this->db->query($sql); - if (! $resql) - { - $this->error="Error ".$this->db->lasterror(); - return -1; - } + dol_syslog(get_class($this)."::delete", LOG_DEBUG); + $resql = $this->db->query($sql); + if (! $resql) + { + $this->error="Error ".$this->db->lasterror(); + return -1; + } - return 1; - } + return 1; + } - /** - * Initialise an instance with random values. - * Used to build previews or test instances. - * id must be 0 if object instance is a specimen. - * - * @return void - */ - function initAsSpecimen() - { - $this->id=0; + /** + * Initialise an instance with random values. + * Used to build previews or test instances. + * id must be 0 if object instance is a specimen. + * + * @return void + */ + public function initAsSpecimen() + { + $this->id=0; - $this->tms=''; - $this->fk_user=''; - $this->datep=''; - $this->datev=''; - $this->amount=''; - $this->label=''; - $this->datesp=''; - $this->dateep=''; - $this->note=''; - $this->fk_bank=''; - $this->fk_user_author=''; - $this->fk_user_modif=''; - } + $this->tms=''; + $this->fk_user=''; + $this->datep=''; + $this->datev=''; + $this->amount=''; + $this->label=''; + $this->datesp=''; + $this->dateep=''; + $this->note=''; + $this->fk_bank=''; + $this->fk_user_author=''; + $this->fk_user_modif=''; + } - /** - * Create in database - * - * @param User $user User that create - * @return int <0 if KO, >0 if OK - */ - function create($user) - { - global $conf,$langs; + /** + * Create in database + * + * @param User $user User that create + * @return int <0 if KO, >0 if OK + */ + public function create($user) + { + global $conf,$langs; - $error=0; - $now=dol_now(); + $error=0; + $now=dol_now(); - // Clean parameters - $this->amount=price2num(trim($this->amount)); - $this->label=trim($this->label); - $this->note=trim($this->note); - $this->fk_bank=trim($this->fk_bank); - $this->fk_user_author=trim($this->fk_user_author); - $this->fk_user_modif=trim($this->fk_user_modif); + // Clean parameters + $this->amount=price2num(trim($this->amount)); + $this->label=trim($this->label); + $this->note=trim($this->note); + $this->fk_bank=trim($this->fk_bank); + $this->fk_user_author=trim($this->fk_user_author); + $this->fk_user_modif=trim($this->fk_user_modif); - // Check parameters - if (! $this->label) - { - $this->error=$langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")); - return -3; - } - if ($this->fk_user < 0 || $this->fk_user == '') - { - $this->error=$langs->trans("ErrorFieldRequired", $langs->transnoentities("Employee")); - return -4; - } - if ($this->amount < 0 || $this->amount == '') - { - $this->error=$langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")); - return -5; - } - if (! empty($conf->banque->enabled) && (empty($this->accountid) || $this->accountid <= 0)) - { - $this->error=$langs->trans("ErrorFieldRequired", $langs->transnoentities("Account")); - return -6; - } - if (! empty($conf->banque->enabled) && (empty($this->type_payment) || $this->type_payment <= 0)) - { - $this->error=$langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode")); - return -7; - } + // Check parameters + if (! $this->label) + { + $this->error=$langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")); + return -3; + } + if ($this->fk_user < 0 || $this->fk_user == '') + { + $this->error=$langs->trans("ErrorFieldRequired", $langs->transnoentities("Employee")); + return -4; + } + if ($this->amount < 0 || $this->amount == '') + { + $this->error=$langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")); + return -5; + } + if (! empty($conf->banque->enabled) && (empty($this->accountid) || $this->accountid <= 0)) + { + $this->error=$langs->trans("ErrorFieldRequired", $langs->transnoentities("Account")); + return -6; + } + if (! empty($conf->banque->enabled) && (empty($this->type_payment) || $this->type_payment <= 0)) + { + $this->error=$langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode")); + return -7; + } - $this->db->begin(); + $this->db->begin(); - // Insert into llx_payment_salary - $sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_salary (fk_user"; - $sql.= ", datep"; - $sql.= ", datev"; - $sql.= ", amount"; - $sql.= ", fk_projet"; - $sql.= ", salary"; - $sql.= ", fk_typepayment"; - $sql.= ", num_payment"; - if ($this->note) $sql.= ", note"; - $sql.= ", label"; - $sql.= ", datesp"; - $sql.= ", dateep"; - $sql.= ", fk_user_author"; - $sql.= ", datec"; - $sql.= ", fk_bank"; - $sql.= ", entity"; - $sql.= ") "; - $sql.= " VALUES ("; - $sql.= "'".$this->db->escape($this->fk_user)."'"; - $sql.= ", '".$this->db->idate($this->datep)."'"; - $sql.= ", '".$this->db->idate($this->datev)."'"; - $sql.= ", ".$this->amount; - $sql.= ", ".($this->fk_project > 0? $this->fk_project : 0); - $sql.= ", ".($this->salary > 0 ? $this->salary : "null"); - $sql.= ", ".$this->db->escape($this->type_payment); - $sql.= ", '".$this->db->escape($this->num_payment)."'"; - if ($this->note) $sql.= ", '".$this->db->escape($this->note)."'"; - $sql.= ", '".$this->db->escape($this->label)."'"; - $sql.= ", '".$this->db->idate($this->datesp)."'"; - $sql.= ", '".$this->db->idate($this->dateep)."'"; - $sql.= ", '".$this->db->escape($user->id)."'"; - $sql.= ", '".$this->db->idate($now)."'"; - $sql.= ", NULL"; - $sql.= ", ".$conf->entity; - $sql.= ")"; + // Insert into llx_payment_salary + $sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_salary (fk_user"; + $sql.= ", datep"; + $sql.= ", datev"; + $sql.= ", amount"; + $sql.= ", fk_projet"; + $sql.= ", salary"; + $sql.= ", fk_typepayment"; + $sql.= ", num_payment"; + if ($this->note) $sql.= ", note"; + $sql.= ", label"; + $sql.= ", datesp"; + $sql.= ", dateep"; + $sql.= ", fk_user_author"; + $sql.= ", datec"; + $sql.= ", fk_bank"; + $sql.= ", entity"; + $sql.= ") "; + $sql.= " VALUES ("; + $sql.= "'".$this->db->escape($this->fk_user)."'"; + $sql.= ", '".$this->db->idate($this->datep)."'"; + $sql.= ", '".$this->db->idate($this->datev)."'"; + $sql.= ", ".$this->amount; + $sql.= ", ".($this->fk_project > 0? $this->fk_project : 0); + $sql.= ", ".($this->salary > 0 ? $this->salary : "null"); + $sql.= ", ".$this->db->escape($this->type_payment); + $sql.= ", '".$this->db->escape($this->num_payment)."'"; + if ($this->note) $sql.= ", '".$this->db->escape($this->note)."'"; + $sql.= ", '".$this->db->escape($this->label)."'"; + $sql.= ", '".$this->db->idate($this->datesp)."'"; + $sql.= ", '".$this->db->idate($this->dateep)."'"; + $sql.= ", '".$this->db->escape($user->id)."'"; + $sql.= ", '".$this->db->idate($now)."'"; + $sql.= ", NULL"; + $sql.= ", ".$conf->entity; + $sql.= ")"; - dol_syslog(get_class($this)."::create", LOG_DEBUG); - $result = $this->db->query($sql); - if ($result) - { + dol_syslog(get_class($this)."::create", LOG_DEBUG); + $result = $this->db->query($sql); + if ($result) + { - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_salary"); + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_salary"); - if ($this->id > 0) - { - if (! empty($conf->banque->enabled) && ! empty($this->amount)) - { - // Insert into llx_bank - require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + if ($this->id > 0) + { + if (! empty($conf->banque->enabled) && ! empty($this->amount)) + { + // Insert into llx_bank + require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - $acc = new Account($this->db); - $result=$acc->fetch($this->accountid); - if ($result <= 0) dol_print_error($this->db); + $acc = new Account($this->db); + $result=$acc->fetch($this->accountid); + if ($result <= 0) dol_print_error($this->db); - // Insert payment into llx_bank - // Add link 'payment_salary' in bank_url between payment and bank transaction - $bank_line_id = $acc->addline( - $this->datep, - $this->type_payment, - $this->label, - -abs($this->amount), - $this->num_payment, - '', - $user, - '', - '', - '', - $this->datev - ); + // Insert payment into llx_bank + // Add link 'payment_salary' in bank_url between payment and bank transaction + $bank_line_id = $acc->addline( + $this->datep, + $this->type_payment, + $this->label, + -abs($this->amount), + $this->num_payment, + '', + $user, + '', + '', + '', + $this->datev + ); - // Update fk_bank into llx_paiement. - // So we know the payment which has generate the banking ecriture - if ($bank_line_id > 0) - { - $this->update_fk_bank($bank_line_id); - } - else - { - $this->error=$acc->error; - $error++; - } + // Update fk_bank into llx_paiement. + // So we know the payment which has generate the banking ecriture + if ($bank_line_id > 0) + { + $this->update_fk_bank($bank_line_id); + } + else + { + $this->error=$acc->error; + $error++; + } - if (! $error) - { - // Add link 'payment_salary' in bank_url between payment and bank transaction - $url=DOL_URL_ROOT.'/compta/salaries/card.php?id='; + if (! $error) + { + // Add link 'payment_salary' in bank_url between payment and bank transaction + $url=DOL_URL_ROOT.'/compta/salaries/card.php?id='; - $result=$acc->add_url_line($bank_line_id, $this->id, $url, "(SalaryPayment)", "payment_salary"); - if ($result <= 0) - { - $this->error=$acc->error; - $error++; - } - } + $result=$acc->add_url_line($bank_line_id, $this->id, $url, "(SalaryPayment)", "payment_salary"); + if ($result <= 0) + { + $this->error=$acc->error; + $error++; + } + } - $fuser=new User($this->db); - $fuser->fetch($this->fk_user); + $fuser=new User($this->db); + $fuser->fetch($this->fk_user); - // Add link 'user' in bank_url between operation and bank transaction - $result=$acc->add_url_line( - $bank_line_id, - $this->fk_user, - DOL_URL_ROOT.'/user/card.php?id=', - $fuser->getFullName($langs), - // $langs->trans("SalaryPayment").' '.$fuser->getFullName($langs).' '.dol_print_date($this->datesp,'dayrfc').' '.dol_print_date($this->dateep,'dayrfc'), - 'user' - ); + // Add link 'user' in bank_url between operation and bank transaction + $result=$acc->add_url_line( + $bank_line_id, + $this->fk_user, + DOL_URL_ROOT.'/user/card.php?id=', + $fuser->getFullName($langs), + // $langs->trans("SalaryPayment").' '.$fuser->getFullName($langs).' '.dol_print_date($this->datesp,'dayrfc').' '.dol_print_date($this->dateep,'dayrfc'), + 'user' + ); - if ($result <= 0) - { - $this->error=$acc->error; - $error++; - } - } + if ($result <= 0) + { + $this->error=$acc->error; + $error++; + } + } - // Call trigger - $result=$this->call_trigger('PAYMENT_SALARY_CREATE', $user); - if ($result < 0) $error++; - // End call triggers - } - else $error++; + // Call trigger + $result=$this->call_trigger('PAYMENT_SALARY_CREATE', $user); + if ($result < 0) $error++; + // End call triggers + } + else $error++; - if (! $error) - { - $this->db->commit(); - return $this->id; - } - else - { - $this->db->rollback(); - return -2; - } - } - else - { - $this->error=$this->db->error(); - $this->db->rollback(); - return -1; - } - } + if (! $error) + { + $this->db->commit(); + return $this->id; + } + else + { + $this->db->rollback(); + return -2; + } + } + else + { + $this->error=$this->db->error(); + $this->db->rollback(); + return -1; + } + } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - /** - * Update link between payment salary 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) - { + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Update link between payment salary and line generate into llx_bank + * + * @param int $id_bank Id bank account + * @return int <0 if KO, >0 if OK + */ + public function update_fk_bank($id_bank) + { // phpcs:enable - $sql = 'UPDATE '.MAIN_DB_PREFIX.'payment_salary SET fk_bank = '.$id_bank; - $sql.= ' WHERE rowid = '.$this->id; - $result = $this->db->query($sql); - if ($result) - { - return 1; - } - else - { - dol_print_error($this->db); - return -1; - } - } + $sql = 'UPDATE '.MAIN_DB_PREFIX.'payment_salary SET fk_bank = '.$id_bank; + $sql.= ' WHERE rowid = '.$this->id; + $result = $this->db->query($sql); + if ($result) + { + return 1; + } + else + { + dol_print_error($this->db); + return -1; + } + } - /** - * Send name clicable (with possibly the picto) - * - * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto - * @param string $option link option + /** + * Send name clicable (with possibly the picto) + * + * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto + * @param string $option link option * @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 Chaine with URL - */ - function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) - { - global $db, $conf, $langs, $hookmanager; - global $dolibarr_main_authentication, $dolibarr_main_demo; - global $menumanager; + * @return string Chaine with URL + */ + public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) + { + global $db, $conf, $langs, $hookmanager; + global $dolibarr_main_authentication, $dolibarr_main_demo; + global $menumanager; - if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips + if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips - $result = ''; + $result = ''; - $label = '' . $langs->trans("ShowSalaryPayment") . ''; - $label.= '
'; - $label.= '' . $langs->trans('Ref') . ': ' . $this->ref; + $label = '' . $langs->trans("ShowSalaryPayment") . ''; + $label.= '
'; + $label.= '' . $langs->trans('Ref') . ': ' . $this->ref; - $url = DOL_URL_ROOT.'/compta/salaries/card.php?id='.$this->id; + $url = DOL_URL_ROOT.'/compta/salaries/card.php?id='.$this->id; - if ($option != 'nolink') - { - // Add param to save lastsearch_values or not - $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); - if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; - if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; - } + if ($option != 'nolink') + { + // Add param to save lastsearch_values or not + $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; + if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; + } - $linkclose=''; - if (empty($notooltip)) - { - if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) - { - $label=$langs->trans("ShowMyObject"); - $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; - } - $linkclose.=' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"'; + $linkclose=''; + if (empty($notooltip)) + { + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label=$langs->trans("ShowMyObject"); + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose.=' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"'; - /* - $hookmanager->initHooks(array('myobjectdao')); - $parameters=array('id'=>$this->id); - $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks - if ($reshook > 0) $linkclose = $hookmanager->resPrint; - */ - } - else $linkclose = ($morecss?' class="'.$morecss.'"':''); + /* + $hookmanager->initHooks(array('myobjectdao')); + $parameters=array('id'=>$this->id); + $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) $linkclose = $hookmanager->resPrint; + */ + } + else $linkclose = ($morecss?' class="'.$morecss.'"':''); - $linkstart = ''; - $linkend=''; + $linkstart = ''; + $linkend=''; - $result .= $linkstart; - if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); - if ($withpicto != 2) $result.= $this->ref; - $result .= $linkend; - //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); + $result .= $linkstart; + if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); + if ($withpicto != 2) $result.= $this->ref; + $result .= $linkend; + //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); - global $action,$hookmanager; - $hookmanager->initHooks(array('salarypayment')); - $parameters=array('id'=>$this->id, 'getnomurl'=>$result); - $reshook=$hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks - if ($reshook > 0) $result = $hookmanager->resPrint; - else $result .= $hookmanager->resPrint; + global $action,$hookmanager; + $hookmanager->initHooks(array('salarypayment')); + $parameters=array('id'=>$this->id, 'getnomurl'=>$result); + $reshook=$hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) $result = $hookmanager->resPrint; + else $result .= $hookmanager->resPrint; - return $result; - } + return $result; + } - /** - * Information on record - * - * @param int $id Id of record - * @return void - */ - function info($id) - { - $sql = 'SELECT ps.rowid, ps.datec, ps.fk_user_author'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'payment_salary as ps'; - $sql.= ' WHERE ps.rowid = '.$id; + /** + * Information on record + * + * @param int $id Id of record + * @return void + */ + public function info($id) + { + $sql = 'SELECT ps.rowid, ps.datec, ps.fk_user_author'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'payment_salary as ps'; + $sql.= ' WHERE ps.rowid = '.$id; - dol_syslog(get_class($this).'::info', LOG_DEBUG); - $result = $this->db->query($sql); + dol_syslog(get_class($this).'::info', LOG_DEBUG); + $result = $this->db->query($sql); - if ($result) - { - if ($this->db->num_rows($result)) - { - $obj = $this->db->fetch_object($result); - $this->id = $obj->rowid; - if ($obj->fk_user_author) - { - $cuser = new User($this->db); - $cuser->fetch($obj->fk_user_author); - $this->user_creation = $cuser; - } - $this->date_creation = $this->db->jdate($obj->datec); - } - $this->db->free($result); - } - else - { - dol_print_error($this->db); - } - } + if ($result) + { + if ($this->db->num_rows($result)) + { + $obj = $this->db->fetch_object($result); + $this->id = $obj->rowid; + if ($obj->fk_user_author) + { + $cuser = new User($this->db); + $cuser->fetch($obj->fk_user_author); + $this->user_creation = $cuser; + } + $this->date_creation = $this->db->jdate($obj->datec); + } + $this->db->free($result); + } + else + { + dol_print_error($this->db); + } + } - /** - * Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee) - * - * @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); - } + /** + * Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee) + * + * @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 + */ + public function getLibStatut($mode = 0) + { + return $this->LibStatut($this->statut, $mode); + } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - /** - * Renvoi le libelle d'un statut donne - * - * @param int $status Statut - * @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) - { + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Renvoi le libelle d'un statut donne + * + * @param int $status Statut + * @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 + */ + public function LibStatut($status, $mode = 0) + { // phpcs:enable - global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage + 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'); - } - if ($mode == 1) - { - if ($status == 0) return $langs->trans('ToValidate'); - if ($status == 1) return $langs->trans('Validated'); - } - if ($mode == 2) - { - if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate'); - if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated'); - } - if ($mode == 3) - { - if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1'); - if ($status == 1) return img_picto($langs->trans('Validated'),'statut4'); - } - if ($mode == 4) - { - if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate'); - if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated'); - } - if ($mode == 5) - { - if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1'); - if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4'); - } - if ($mode == 6) - { - if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1'); - if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4'); - }*/ - return ''; - } + $langs->load('compta'); + /*if ($mode == 0) + { + if ($status == 0) return $langs->trans('ToValidate'); + if ($status == 1) return $langs->trans('Validated'); + } + if ($mode == 1) + { + if ($status == 0) return $langs->trans('ToValidate'); + if ($status == 1) return $langs->trans('Validated'); + } + if ($mode == 2) + { + if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate'); + if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated'); + } + if ($mode == 3) + { + if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1'); + if ($status == 1) return img_picto($langs->trans('Validated'),'statut4'); + } + if ($mode == 4) + { + if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate'); + if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated'); + } + if ($mode == 5) + { + if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1'); + if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4'); + } + if ($mode == 6) + { + if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1'); + if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4'); + }*/ + return ''; + } } diff --git a/htdocs/compta/salaries/class/salariesstats.class.php b/htdocs/compta/salaries/class/salariesstats.class.php index c1249abedac..0287f4978df 100644 --- a/htdocs/compta/salaries/class/salariesstats.class.php +++ b/htdocs/compta/salaries/class/salariesstats.class.php @@ -29,138 +29,137 @@ include_once DOL_DOCUMENT_ROOT . '/compta/salaries/class/paymentsalary.class.php */ class SalariesStats extends Stats { - /** - * @var string Name of table without prefix where object is stored - */ - public $table_element; + /** + * @var string Name of table without prefix where object is stored + */ + public $table_element; - var $socid; - var $userid; + public $socid; + public $userid; - var $from; - var $field; - var $where; + public $from; + public $field; + public $where; - /** - * Constructor - * - * @param DoliDB $db Database handler - * @param int $socid Id third party - * @param mixed $userid Id user for filter or array of user ids - * @return void - */ - function __construct($db, $socid = 0, $userid = 0) - { - global $conf; + /** + * Constructor + * + * @param DoliDB $db Database handler + * @param int $socid Id third party + * @param mixed $userid Id user for filter or array of user ids + * @return void + */ + public function __construct($db, $socid = 0, $userid = 0) + { + global $conf; - $this->db = $db; - $this->socid = $socid; - $this->userid = $userid; + $this->db = $db; + $this->socid = $socid; + $this->userid = $userid; - $object=new PaymentSalary($this->db); - $this->from = MAIN_DB_PREFIX.$object->table_element; - $this->field='amount'; + $object=new PaymentSalary($this->db); + $this->from = MAIN_DB_PREFIX.$object->table_element; + $this->field='amount'; - $this->where.= " entity = ".$conf->entity; - if ($this->socid) - { - $this->where.=" AND fk_soc = ".$this->socid; - } - if (is_array($this->userid) && count($this->userid) > 0) $this->where.=' AND fk_user IN ('.join(',', $this->userid).')'; - elseif ($this->userid > 0) $this->where.=' AND fk_user = '.$this->userid; - } + $this->where.= " entity = ".$conf->entity; + if ($this->socid) { + $this->where.=" AND fk_soc = ".$this->socid; + } + if (is_array($this->userid) && count($this->userid) > 0) $this->where.=' AND fk_user IN ('.join(',', $this->userid).')'; + elseif ($this->userid > 0) $this->where.=' AND fk_user = '.$this->userid; + } - /** - * Return the number of salary by year - * - * @return array Array of values - */ - function getNbByYear() - { - $sql = "SELECT YEAR(datep) as dm, count(*)"; - $sql.= " FROM ".$this->from; - $sql.= " GROUP BY dm DESC"; - $sql.= " WHERE ".$this->where; + /** + * Return the number of salary by year + * + * @return array Array of values + */ + public function getNbByYear() + { + $sql = "SELECT YEAR(datep) as dm, count(*)"; + $sql.= " FROM ".$this->from; + $sql.= " GROUP BY dm DESC"; + $sql.= " WHERE ".$this->where; - return $this->_getNbByYear($sql); - } + return $this->_getNbByYear($sql); + } - /** - * Return the number of salary by month, for a given year - * - * @param string $year Year to scan - * @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) - { - $sql = "SELECT MONTH(datep) as dm, count(*)"; - $sql.= " FROM ".$this->from; - $sql.= " WHERE YEAR(datep) = ".$year; - $sql.= " AND ".$this->where; - $sql.= " GROUP BY dm"; - $sql.= $this->db->order('dm', 'DESC'); + /** + * Return the number of salary by month, for a given year + * + * @param string $year Year to scan + * @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 + */ + public function getNbByMonth($year, $format = 0) + { + $sql = "SELECT MONTH(datep) as dm, count(*)"; + $sql.= " FROM ".$this->from; + $sql.= " WHERE YEAR(datep) = ".$year; + $sql.= " AND ".$this->where; + $sql.= " GROUP BY dm"; + $sql.= $this->db->order('dm', 'DESC'); - $res=$this->_getNbByMonth($year, $sql, $format); - //var_dump($res);print '
'; - return $res; - } + $res=$this->_getNbByMonth($year, $sql, $format); + //var_dump($res);print '
'; + return $res; + } - /** - * Return amount of salaries by month for a given year - * - * @param int $year Year to scan - * @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 getAmountByMonth($year, $format = 0) - { - $sql = "SELECT date_format(datep,'%m') as dm, sum(".$this->field.")"; - $sql.= " FROM ".$this->from; - $sql.= " WHERE date_format(datep,'%Y') = '".$year."'"; - $sql.= " AND ".$this->where; - $sql.= " GROUP BY dm"; - $sql.= $this->db->order('dm', 'DESC'); + /** + * Return amount of salaries by month for a given year + * + * @param int $year Year to scan + * @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 + */ + public function getAmountByMonth($year, $format = 0) + { + $sql = "SELECT date_format(datep,'%m') as dm, sum(".$this->field.")"; + $sql.= " FROM ".$this->from; + $sql.= " WHERE date_format(datep,'%Y') = '".$year."'"; + $sql.= " AND ".$this->where; + $sql.= " GROUP BY dm"; + $sql.= $this->db->order('dm', 'DESC'); - $res=$this->_getAmountByMonth($year, $sql, $format); - //var_dump($res);print '
'; - return $res; - } + $res=$this->_getAmountByMonth($year, $sql, $format); + //var_dump($res);print '
'; + return $res; + } - /** - * Return average amount - * - * @param int $year Year to scan - * @return array Array of values - */ - function getAverageByMonth($year) - { - $sql = "SELECT date_format(datep,'%m') as dm, avg(".$this->field.")"; - $sql.= " FROM ".$this->from; - $sql.= " WHERE date_format(datep,'%Y') = '".$year."'"; - $sql.= " AND ".$this->where; - $sql.= " GROUP BY dm"; - $sql.= $this->db->order('dm', 'DESC'); + /** + * Return average amount + * + * @param int $year Year to scan + * @return array Array of values + */ + public function getAverageByMonth($year) + { + $sql = "SELECT date_format(datep,'%m') as dm, avg(".$this->field.")"; + $sql.= " FROM ".$this->from; + $sql.= " WHERE date_format(datep,'%Y') = '".$year."'"; + $sql.= " AND ".$this->where; + $sql.= " GROUP BY dm"; + $sql.= $this->db->order('dm', 'DESC'); - return $this->_getAverageByMonth($year, $sql); - } + return $this->_getAverageByMonth($year, $sql); + } - /** - * Return nb, total and average - * - * @return array Array of values - */ - function getAllByYear() - { - $sql = "SELECT date_format(datep,'%Y') as year, count(*) as nb, sum(".$this->field.") as total, avg(".$this->field.") as avg"; - $sql.= " FROM ".$this->from; - $sql.= " WHERE ".$this->where; - $sql.= " GROUP BY year"; - $sql.= $this->db->order('year', 'DESC'); + /** + * Return nb, total and average + * + * @return array Array of values + */ + public function getAllByYear() + { + $sql = "SELECT date_format(datep,'%Y') as year, count(*) as nb, sum(".$this->field.") as total, avg(".$this->field.") as avg"; + $sql.= " FROM ".$this->from; + $sql.= " WHERE ".$this->where; + $sql.= " GROUP BY year"; + $sql.= $this->db->order('year', 'DESC'); - return $this->_getAllByYear($sql); - } + return $this->_getAllByYear($sql); + } } diff --git a/htdocs/core/modules/bank/doc/pdf_ban.modules.php b/htdocs/core/modules/bank/doc/pdf_ban.modules.php index 98f86e9a596..53a38eb70ed 100644 --- a/htdocs/core/modules/bank/doc/pdf_ban.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_ban.modules.php @@ -50,7 +50,7 @@ class pdf_ban extends ModeleBankAccountDoc * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { global $conf,$langs,$mysoc; @@ -90,7 +90,7 @@ class pdf_ban extends ModeleBankAccountDoc } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Fonction generant le projet sur le disque * @@ -98,7 +98,7 @@ class pdf_ban extends ModeleBankAccountDoc * @param Translate $outputlangs Lang output object * @return int 1 if OK, <=0 if KO */ - function write_file($object, $outputlangs) + public function write_file($object, $outputlangs) { // phpcs:enable global $conf, $hookmanager, $langs, $user; @@ -288,7 +288,7 @@ class pdf_ban extends ModeleBankAccountDoc * @param int $hidebottom Hide bottom bar of array * @return void */ - function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0) + private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0) { global $conf,$mysoc; @@ -304,7 +304,7 @@ class pdf_ban extends ModeleBankAccountDoc * @param Translate $outputlangs Object lang for output * @return void */ - function _pagehead(&$pdf, $object, $showaddress, $outputlangs) + private function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { global $langs,$conf,$mysoc; @@ -390,7 +390,7 @@ class pdf_ban extends ModeleBankAccountDoc * @param int $hidefreetext 1=Hide free text * @return integer */ - function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) + private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; diff --git a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php index f61758abf92..bbd5858192c 100644 --- a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php @@ -52,7 +52,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { global $conf, $langs, $mysoc; @@ -92,7 +92,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Fonction generant le projet sur le disque * @@ -105,7 +105,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc * @param null|array $moreparams More parameters * @return int 1 if OK, <=0 if KO */ - function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) + public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) { // phpcs:enable global $conf, $hookmanager, $langs, $user, $mysoc; @@ -435,7 +435,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc * @param int $hidebottom Hide bottom bar of array * @return void */ - function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0) + private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0) { global $conf,$mysoc; @@ -443,7 +443,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Show miscellaneous information (payment mode, payment term, ...) * @@ -453,7 +453,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc * @param Translate $outputlangs Langs object * @return void */ - function _tableau_info(&$pdf, $object, $posy, $outputlangs) + private function _tableau_info(&$pdf, $object, $posy, $outputlangs) { // phpcs:enable global $conf, $mysoc; @@ -480,7 +480,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Show area for the customer to sign * @@ -490,7 +490,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc * @param Translate $outputlangs Objet langs * @return int Position pour suite */ - function _signature_area(&$pdf, $object, $posy, $outputlangs) + private function _signature_area(&$pdf, $object, $posy, $outputlangs) { // phpcs:enable $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -531,7 +531,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc * @param Translate $outputlangs Object lang for output * @return void */ - function _pagehead(&$pdf, $object, $showaddress, $outputlangs) + private function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { global $langs,$conf,$mysoc; @@ -623,7 +623,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc * @param int $hidefreetext 1=Hide free text * @return integer */ - function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) + private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; diff --git a/htdocs/core/modules/bank/modules_bank.php b/htdocs/core/modules/bank/modules_bank.php index 8cdf2ba7ebe..f965e29ccce 100644 --- a/htdocs/core/modules/bank/modules_bank.php +++ b/htdocs/core/modules/bank/modules_bank.php @@ -37,7 +37,7 @@ abstract class ModeleBankAccountDoc extends CommonDocGenerator public $error=''; - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of active generation modules * @@ -45,7 +45,7 @@ abstract class ModeleBankAccountDoc extends CommonDocGenerator * @param integer $maxfilenamelength Max length of value to show * @return array List of templates */ - static function liste_modeles($db, $maxfilenamelength = 0) + public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable global $conf; diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index 14f3c1fc862..d2f2ba9af07 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -63,7 +63,7 @@ class doc_generic_order_odt extends ModelePDFCommandes * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { global $conf, $langs, $mysoc; @@ -108,7 +108,7 @@ class doc_generic_order_odt extends ModelePDFCommandes * @param Translate $langs Lang object to use for output * @return string Description */ - function info($langs) + public function info($langs) { global $conf,$langs; @@ -191,9 +191,9 @@ class doc_generic_order_odt extends ModelePDFCommandes return $texte; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Function to build a document on disk using the generic odt module. + * Function to build a document on disk using the generic odt module. * * @param Commande $object Object source to build document * @param Translate $outputlangs Lang output object @@ -203,7 +203,7 @@ class doc_generic_order_odt extends ModelePDFCommandes * @param int $hideref Do not show ref * @return int 1 if OK, <=0 if KO */ - function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0) + public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable global $user,$langs,$conf,$mysoc,$hookmanager; @@ -338,7 +338,7 @@ class doc_generic_order_odt extends ModelePDFCommandes // Open and load template require_once ODTPHP_PATH.'odf.php'; try { - $odfHandler = new odf( + $odfHandler = new odf( $srctemplatepath, array( 'PATH_TO_TMP' => $conf->commande->dir_temp, diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php index 558ffe44e0a..53891a1c340 100644 --- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php +++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php @@ -64,7 +64,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { global $conf, $langs, $mysoc; @@ -109,7 +109,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition * @param Translate $langs Lang object to use for output * @return string Description */ - function info($langs) + public function info($langs) { global $conf,$langs; @@ -191,7 +191,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition return $texte; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Function to build a document on disk using the generic odt module. * @@ -203,7 +203,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition * @param int $hideref Do not show ref * @return int 1 if OK, <=0 if KO */ - function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0) + public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable global $user,$langs,$conf,$mysoc,$hookmanager; @@ -337,7 +337,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition // Open and load template require_once ODTPHP_PATH.'odf.php'; try { - $odfHandler = new odf( + $odfHandler = new odf( $srctemplatepath, array( 'PATH_TO_TMP' => $conf->expedition->dir_temp, diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 665c756d2e5..e0de76bb7b7 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -867,7 +867,7 @@ class pdf_rouget extends ModelePdfExpedition * @param Translate $outputlangs Object lang for output * @return void */ - function _pagehead(&$pdf, $object, $showaddress, $outputlangs) + private function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { global $conf,$langs,$mysoc; @@ -1107,15 +1107,15 @@ class pdf_rouget extends ModelePdfExpedition } /** - * Show footer of page. Need this->emetteur object + * Show footer of page. Need this->emetteur object * - * @param PDF $pdf PDF - * @param Object $object Object to show - * @param Translate $outputlangs Object lang for output - * @param int $hidefreetext 1=Hide free text - * @return int Return height of bottom margin including footer text + * @param PDF $pdf PDF + * @param Object $object Object to show + * @param Translate $outputlangs Object lang for output + * @param int $hidefreetext 1=Hide free text + * @return int Return height of bottom margin including footer text */ - function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) + private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; diff --git a/htdocs/core/modules/expedition/mod_expedition_ribera.php b/htdocs/core/modules/expedition/mod_expedition_ribera.php index ac0c286d389..7b20d1df4d8 100644 --- a/htdocs/core/modules/expedition/mod_expedition_ribera.php +++ b/htdocs/core/modules/expedition/mod_expedition_ribera.php @@ -57,7 +57,7 @@ class mod_expedition_ribera extends ModelNumRefExpedition * * @return string text description */ - function info() + public function info() { global $conf, $langs; @@ -93,7 +93,7 @@ class mod_expedition_ribera extends ModelNumRefExpedition * * @return string Example */ - function getExample() + public function getExample() { global $conf,$langs,$mysoc; @@ -119,7 +119,7 @@ class mod_expedition_ribera extends ModelNumRefExpedition * @param Object $shipment Shipment object * @return string Value if OK, 0 if KO */ - function getNextValue($objsoc, $shipment) + public function getNextValue($objsoc, $shipment) { global $db,$conf; @@ -140,7 +140,7 @@ class mod_expedition_ribera extends ModelNumRefExpedition return $numFinal; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return next free value * @@ -148,7 +148,7 @@ class mod_expedition_ribera extends ModelNumRefExpedition * @param Object $objforref Shipment object * @return string Next free value */ - function expedition_get_num($objsoc, $objforref) + public function expedition_get_num($objsoc, $objforref) { // phpcs:enable return $this->getNextValue($objsoc, $objforref); diff --git a/htdocs/core/modules/expedition/mod_expedition_safor.php b/htdocs/core/modules/expedition/mod_expedition_safor.php index 3bf655c6f23..40033df65f7 100644 --- a/htdocs/core/modules/expedition/mod_expedition_safor.php +++ b/htdocs/core/modules/expedition/mod_expedition_safor.php @@ -59,7 +59,7 @@ class mod_expedition_safor extends ModelNumRefExpedition * * @return string text description */ - function info() + public function info() { global $langs; return $langs->trans("SimpleNumRefModelDesc", $this->prefix); @@ -71,7 +71,7 @@ class mod_expedition_safor extends ModelNumRefExpedition * * @return string Example */ - function getExample() + public function getExample() { return $this->prefix."0501-0001"; } @@ -82,7 +82,7 @@ class mod_expedition_safor extends ModelNumRefExpedition * * @return boolean false if conflit, true if ok */ - function canBeActivated() + public function canBeActivated() { global $conf,$langs,$db; @@ -117,7 +117,7 @@ class mod_expedition_safor extends ModelNumRefExpedition * @param Object $shipment Shipment object * @return string Value if OK, 0 if KO */ - function getNextValue($objsoc, $shipment) + public function getNextValue($objsoc, $shipment) { global $db,$conf; @@ -150,7 +150,7 @@ class mod_expedition_safor extends ModelNumRefExpedition return $this->prefix.$yymm."-".$num; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return next free value * @@ -158,7 +158,7 @@ class mod_expedition_safor extends ModelNumRefExpedition * @param Object $objforref Shipment object * @return string Next free value */ - function expedition_get_num($objsoc, $objforref) + public function expedition_get_num($objsoc, $objforref) { // phpcs:enable return $this->getNextValue($objsoc, $objforref); diff --git a/htdocs/core/modules/expedition/modules_expedition.php b/htdocs/core/modules/expedition/modules_expedition.php index 7b88a83392e..3a2d7774e33 100644 --- a/htdocs/core/modules/expedition/modules_expedition.php +++ b/htdocs/core/modules/expedition/modules_expedition.php @@ -42,7 +42,7 @@ abstract class ModelePdfExpedition extends CommonDocGenerator public $error=''; - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of active generation models * @@ -50,7 +50,7 @@ abstract class ModelePdfExpedition extends CommonDocGenerator * @param integer $maxfilenamelength Max length of value to show * @return array List of templates */ - static function liste_modeles($db, $maxfilenamelength = 0) + public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable global $conf; @@ -80,7 +80,7 @@ abstract class ModelNumRefExpedition * * @return boolean true if model can be used */ - function isEnabled() + public function isEnabled() { return true; } @@ -90,7 +90,7 @@ abstract class ModelNumRefExpedition * * @return string text description */ - function info() + public function info() { global $langs; $langs->load("sendings"); @@ -102,7 +102,7 @@ abstract class ModelNumRefExpedition * * @return string Example */ - function getExample() + public function getExample() { global $langs; $langs->load("sendings"); @@ -114,7 +114,7 @@ abstract class ModelNumRefExpedition * * @return boolean false if conflict, true if ok */ - function canBeActivated() + public function canBeActivated() { return true; } @@ -126,7 +126,7 @@ abstract class ModelNumRefExpedition * @param Object $shipment Shipment object * @return string Value */ - function getNextValue($objsoc, $shipment) + public function getNextValue($objsoc, $shipment) { global $langs; return $langs->trans("NotAvailable"); @@ -137,7 +137,7 @@ abstract class ModelNumRefExpedition * * @return string Value */ - function getVersion() + public function getVersion() { global $langs; $langs->load("admin"); diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index 03ebe71e88d..2563028ee93 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -114,13 +114,13 @@ class pdf_standard extends ModeleExpenseReport public $emetteur; - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - function __construct($db) - { + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { global $conf, $langs, $mysoc; // Translations @@ -192,7 +192,7 @@ class pdf_standard extends ModeleExpenseReport } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Function to build pdf onto disk * @@ -204,7 +204,7 @@ class pdf_standard extends ModeleExpenseReport * @param int $hideref Do not show ref * @return int 1=OK, 0=KO */ - function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) + public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable global $user, $langs, $conf, $mysoc, $db, $hookmanager; @@ -450,8 +450,7 @@ class pdf_standard extends ModeleExpenseReport } // Show square - if ($pagenb == 1) - { + if ($pagenb == 1) { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } @@ -625,7 +624,7 @@ class pdf_standard extends ModeleExpenseReport * @param Translate $outputlangs Object lang for output * @return void */ - function _pagehead(&$pdf, $object, $showaddress, $outputlangs) + private function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { global $conf, $langs, $hookmanager; @@ -770,8 +769,7 @@ class pdf_standard extends ModeleExpenseReport $pdf->MultiCell(96, 4, $outputlangs->transnoentities("DateCreation")." : ".dol_print_date($object->date_create, "day", false, $outputlangs), 0, 'L'); } - if ($object->fk_statut==99) - { + if ($object->fk_statut==99) { if ($object->fk_user_refuse > 0) { $userfee=new User($this->db); $userfee->fetch($object->fk_user_refuse); $posy+=6; @@ -840,7 +838,7 @@ class pdf_standard extends ModeleExpenseReport * @param string $currency Currency code * @return void */ - function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '') + private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '') { global $conf; @@ -1054,15 +1052,15 @@ class pdf_standard extends ModeleExpenseReport } /** - * Show footer of page. Need this->emetteur object + * Show footer of page. Need this->emetteur object * - * @param PDF $pdf PDF - * @param Object $object Object to show - * @param Translate $outputlangs Object lang for output - * @param int $hidefreetext 1=Hide free text - * @return int Return height of bottom margin including footer text + * @param PDF $pdf PDF + * @param Object $object Object to show + * @param Translate $outputlangs Object lang for output + * @param int $hidefreetext 1=Hide free text + * @return int Return height of bottom margin including footer text */ - function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) + private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; diff --git a/htdocs/core/modules/expensereport/mod_expensereport_jade.php b/htdocs/core/modules/expensereport/mod_expensereport_jade.php index b4d1b7b2b6e..a878fb1325c 100644 --- a/htdocs/core/modules/expensereport/mod_expensereport_jade.php +++ b/htdocs/core/modules/expensereport/mod_expensereport_jade.php @@ -59,10 +59,10 @@ class mod_expensereport_jade extends ModeleNumRefExpenseReport * * @return string Text with description */ - function info() + public function info() { - global $langs; - return $langs->trans("SimpleNumRefModelDesc", $this->prefix); + global $langs; + return $langs->trans("SimpleNumRefModelDesc", $this->prefix); } @@ -71,7 +71,7 @@ class mod_expensereport_jade extends ModeleNumRefExpenseReport * * @return string Example */ - function getExample() + public function getExample() { return $this->prefix."0501-0001"; } @@ -83,7 +83,7 @@ class mod_expensereport_jade extends ModeleNumRefExpenseReport * * @return boolean false si conflit, true si ok */ - function canBeActivated() + public function canBeActivated() { global $conf,$langs,$db; @@ -117,7 +117,7 @@ class mod_expensereport_jade extends ModeleNumRefExpenseReport * @param Object $object Object we need next value for * @return string Value if KO, <0 if KO */ - function getNextValue($object) + public function getNextValue($object) { global $db,$conf; diff --git a/htdocs/core/modules/expensereport/mod_expensereport_sand.php b/htdocs/core/modules/expensereport/mod_expensereport_sand.php index e9c5eb06dd5..2311de4841a 100644 --- a/htdocs/core/modules/expensereport/mod_expensereport_sand.php +++ b/htdocs/core/modules/expensereport/mod_expensereport_sand.php @@ -59,7 +59,7 @@ class mod_expensereport_sand extends ModeleNumRefExpenseReport * * @return string Texte descripif */ - function info() + public function info() { global $db, $conf, $langs; @@ -99,7 +99,7 @@ class mod_expensereport_sand extends ModeleNumRefExpenseReport * * @return string Example */ - function getExample() + public function getExample() { global $db, $conf,$langs,$user; @@ -116,15 +116,15 @@ class mod_expensereport_sand extends ModeleNumRefExpenseReport return $numExample; } - /** - * Return next free value - * - * @param Object $object Object we need next value for - * @return string Value if KO, <0 if KO - */ - function getNextValue($object) + /** + * Return next free value + * + * @param Object $object Object we need next value for + * @return string Value if KO, <0 if KO + */ + public function getNextValue($object) { - global $db,$conf; + global $db,$conf; require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php'; @@ -154,5 +154,5 @@ class mod_expensereport_sand extends ModeleNumRefExpenseReport $numFinal=get_next_value($db, $mask, 'expensereport', 'ref', '', null, $date, 'next', true, $fuser); return $numFinal; - } + } } diff --git a/htdocs/core/modules/expensereport/modules_expensereport.php b/htdocs/core/modules/expensereport/modules_expensereport.php index 09759b808cf..fde96e56af5 100644 --- a/htdocs/core/modules/expensereport/modules_expensereport.php +++ b/htdocs/core/modules/expensereport/modules_expensereport.php @@ -29,7 +29,7 @@ abstract class ModeleExpenseReport extends CommonDocGenerator public $error=''; - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of active models generation * @@ -37,7 +37,7 @@ abstract class ModeleExpenseReport extends CommonDocGenerator * @param integer $maxfilenamelength Max length of value to show * @return array List of templates */ - static function liste_modeles($db, $maxfilenamelength = 0) + public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable global $conf; @@ -52,7 +52,6 @@ abstract class ModeleExpenseReport extends CommonDocGenerator } } -// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * expensereport_pdf_create * @@ -68,8 +67,7 @@ abstract class ModeleExpenseReport extends CommonDocGenerator */ function expensereport_pdf_create(DoliDB $db, ExpenseReport $object, $message, $modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0) { - // phpcs:enable - return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); } /** @@ -89,7 +87,7 @@ abstract class ModeleNumRefExpenseReport * * @return boolean true if model can be used */ - function isEnabled() + public function isEnabled() { return true; } @@ -99,7 +97,7 @@ abstract class ModeleNumRefExpenseReport * * @return string Descriptive text */ - function info() + public function info() { global $langs; $langs->load("orders"); @@ -140,20 +138,20 @@ abstract class ModeleNumRefExpenseReport return $langs->trans("NotAvailable"); } - /** - * Returns the version of the numbering module - * - * @return string Value - */ + /** + * Returns the version of the numbering module + * + * @return string Value + */ public function getVersion() - { - global $langs; - $langs->load("admin"); + { + global $langs; + $langs->load("admin"); - if ($this->version == 'development') return $langs->trans("VersionDevelopment"); - if ($this->version == 'experimental') return $langs->trans("VersionExperimental"); - if ($this->version == 'dolibarr') return DOL_VERSION; - if ($this->version) return $this->version; - return $langs->trans("NotAvailable"); - } + if ($this->version == 'development') return $langs->trans("VersionDevelopment"); + elseif ($this->version == 'experimental') return $langs->trans("VersionExperimental"); + elseif ($this->version == 'dolibarr') return DOL_VERSION; + elseif ($this->version) return $this->version; + else return $langs->trans("NotAvailable"); + } } diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 17b6e556908..dbb8fadfe12 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -93,7 +93,7 @@ class ImportCsv extends ModeleImports * @param DoliDB $db Database handler * @param string $datatoimport String code describing import set (ex: 'societe_1') */ - function __construct($db, $datatoimport) + public function __construct($db, $datatoimport) { global $conf, $langs; $this->db = $db; @@ -118,20 +118,20 @@ class ImportCsv extends ModeleImports } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Output header of an example file for this format * * @param Translate $outputlangs Output language * @return string */ - function write_header_example($outputlangs) + public function write_header_example($outputlangs) { // phpcs:enable return ''; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Output title line of an example file for this format * @@ -139,14 +139,14 @@ class ImportCsv extends ModeleImports * @param array $headerlinefields Array of fields name * @return string */ - function write_title_example($outputlangs, $headerlinefields) + public function write_title_example($outputlangs, $headerlinefields) { // phpcs:enable $s=join($this->separator, array_map('cleansep', $headerlinefields)); return $s."\n"; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Output record of an example file for this format * @@ -154,21 +154,21 @@ class ImportCsv extends ModeleImports * @param array $contentlinevalues Array of lines * @return string */ - function write_record_example($outputlangs, $contentlinevalues) + public function write_record_example($outputlangs, $contentlinevalues) { // phpcs:enable $s=join($this->separator, array_map('cleansep', $contentlinevalues)); return $s."\n"; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Output footer of an example file for this format * * @param Translate $outputlangs Output language * @return string */ - function write_footer_example($outputlangs) + public function write_footer_example($outputlangs) { // phpcs:enable return ''; @@ -176,14 +176,14 @@ class ImportCsv extends ModeleImports - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Open input file * * @param string $file Path of filename * @return int <0 if KO, >=0 if OK */ - function import_open_file($file) + public function import_open_file($file) { // phpcs:enable global $langs; @@ -209,40 +209,40 @@ class ImportCsv extends ModeleImports } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return nb of records. File must be closed. * * @param string $file Path of filename * @return int <0 if KO, >=0 if OK */ - function import_get_nb_of_lines($file) + public function import_get_nb_of_lines($file) { // phpcs:enable return dol_count_nb_of_line($file); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Input header line from file * * @return int <0 if KO, >=0 if OK */ - function import_read_header() + public function import_read_header() { // phpcs:enable return 0; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return array of next record in input file. * * @return Array Array of field values. Data are UTF8 encoded. [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=not empty string) */ - function import_read_record() + public function import_read_record() { // phpcs:enable global $conf; @@ -293,13 +293,13 @@ class ImportCsv extends ModeleImports return $newarrayres; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Close file handle * * @return integer */ - function import_close_file() + public function import_close_file() { // phpcs:enable fclose($this->handle); @@ -307,7 +307,7 @@ class ImportCsv extends ModeleImports } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Insert a record into database * @@ -319,7 +319,7 @@ class ImportCsv extends ModeleImports * @param array $updatekeys Array of keys to use to try to do an update first before insert. This field are defined into the module descriptor. * @return int <0 if KO, >0 if OK */ - function import_insert($arrayrecord, $array_match_file_to_database, $objimport, $maxfields, $importid, $updatekeys) + public function import_insert($arrayrecord, $array_match_file_to_database, $objimport, $maxfields, $importid, $updatekeys) { // phpcs:enable global $langs,$conf,$user; diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index 3cdd100068e..44134281fb4 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -95,7 +95,7 @@ class ImportXlsx extends ModeleImports * @param DoliDB $db Database handler * @param string $datatoimport String code describing import set (ex: 'societe_1') */ - function __construct($db, $datatoimport) + public function __construct($db, $datatoimport) { global $conf,$langs; $this->db = $db; @@ -125,14 +125,14 @@ class ImportXlsx extends ModeleImports } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Output header of an example file for this format * * @param Translate $outputlangs Output language * @return string */ - function write_header_example($outputlangs) + public function write_header_example($outputlangs) { // phpcs:enable global $user,$conf,$langs; @@ -158,7 +158,7 @@ class ImportXlsx extends ModeleImports return ''; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Output title line of an example file for this format * @@ -166,7 +166,7 @@ class ImportXlsx extends ModeleImports * @param array $headerlinefields Array of fields name * @return string */ - function write_title_example($outputlangs, $headerlinefields) + public function write_title_example($outputlangs, $headerlinefields) { // phpcs:enable global $conf; @@ -184,7 +184,7 @@ class ImportXlsx extends ModeleImports return ''; // final output will be generated in footer } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Output record of an example file for this format * @@ -192,7 +192,7 @@ class ImportXlsx extends ModeleImports * @param array $contentlinevalues Array of lines * @return string */ - function write_record_example($outputlangs, $contentlinevalues) + public function write_record_example($outputlangs, $contentlinevalues) { // phpcs:enable $col = 0; @@ -205,14 +205,14 @@ class ImportXlsx extends ModeleImports return ''; // final output will be generated in footer } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Output footer of an example file for this format * * @param Translate $outputlangs Output language * @return string */ - function write_footer_example($outputlangs) + public function write_footer_example($outputlangs) { // phpcs:enable // return the file content as a string @@ -229,14 +229,14 @@ class ImportXlsx extends ModeleImports - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Open input file * * @param string $file Path of filename * @return int <0 if KO, >=0 if OK */ - function import_open_file($file) + public function import_open_file($file) { // phpcs:enable global $langs; @@ -253,14 +253,14 @@ class ImportXlsx extends ModeleImports } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return nb of records. File must be closed. * * @param string $file Path of filename * @return int <0 if KO, >=0 if OK */ - function import_get_nb_of_lines($file) + public function import_get_nb_of_lines($file) { // phpcs:enable $reader = new PHPExcel_Reader_Excel2007(); @@ -275,13 +275,13 @@ class ImportXlsx extends ModeleImports } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Input header line from file * * @return int <0 if KO, >=0 if OK */ - function import_read_header() + public function import_read_header() { // phpcs:enable // This is not called by the import code !!! @@ -294,13 +294,13 @@ class ImportXlsx extends ModeleImports } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return array of next record in input file. * * @return Array Array of field values. Data are UTF8 encoded. [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=not empty string) */ - function import_read_record() + public function import_read_record() { // phpcs:enable global $conf; @@ -319,13 +319,13 @@ class ImportXlsx extends ModeleImports return $array; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Close file handle * * @return integer */ - function import_close_file() + public function import_close_file() { // phpcs:enable $this->workbook->disconnectWorksheets(); @@ -334,7 +334,7 @@ class ImportXlsx extends ModeleImports // What is this doing here ? it is common to all imports, is should be in the parent class - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Insert a record into database * @@ -346,7 +346,7 @@ class ImportXlsx extends ModeleImports * @param array $updatekeys Array of keys to use to try to do an update first before insert. This field are defined into the module descriptor. * @return int <0 if KO, >0 if OK */ - function import_insert($arrayrecord, $array_match_file_to_database, $objimport, $maxfields, $importid, $updatekeys) + public function import_insert($arrayrecord, $array_match_file_to_database, $objimport, $maxfields, $importid, $updatekeys) { // phpcs:enable global $langs,$conf,$user; diff --git a/htdocs/core/modules/import/modules_import.php b/htdocs/core/modules/import/modules_import.php index 1c885bda1b4..7595c3c6c52 100644 --- a/htdocs/core/modules/import/modules_import.php +++ b/htdocs/core/modules/import/modules_import.php @@ -79,7 +79,7 @@ class ModeleImports /** * Constructor */ - function __construct() + public function __construct() { } @@ -89,7 +89,7 @@ class ModeleImports * * @return string Id */ - function getDriverId() + public function getDriverId() { return $this->id; } @@ -99,7 +99,7 @@ class ModeleImports * * @return string Label */ - function getDriverLabel() + public function getDriverLabel() { return $this->label; } @@ -109,7 +109,7 @@ class ModeleImports * * @return string Description */ - function getDriverDesc() + public function getDriverDesc() { return $this->desc; } @@ -119,7 +119,7 @@ class ModeleImports * * @return string Driver suffix */ - function getDriverExtension() + public function getDriverExtension() { return $this->extension; } @@ -129,7 +129,7 @@ class ModeleImports * * @return string Driver version */ - function getDriverVersion() + public function getDriverVersion() { return $this->version; } @@ -139,7 +139,7 @@ class ModeleImports * * @return string Label of external lib */ - function getLibLabel() + public function getLibLabel() { return $this->label_lib; } @@ -149,13 +149,13 @@ class ModeleImports * * @return string Version of external lib */ - function getLibVersion() + public function getLibVersion() { return $this->version_lib; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Charge en memoire et renvoie la liste des modeles actifs * @@ -163,7 +163,7 @@ class ModeleImports * @param integer $maxfilenamelength Max length of value to show * @return array List of templates */ - function liste_modeles($db, $maxfilenamelength = 0) + public function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable dol_syslog(get_class($this)."::liste_modeles"); @@ -213,7 +213,7 @@ class ModeleImports * @param string $key Key * @return string */ - function getPictoForKey($key) + public function getPictoForKey($key) { return $this->picto[$key]; } @@ -224,7 +224,7 @@ class ModeleImports * @param string $key Key * @return string */ - function getDriverLabelForKey($key) + public function getDriverLabelForKey($key) { return $this->driverlabel[$key]; } @@ -235,7 +235,7 @@ class ModeleImports * @param string $key Key * @return string */ - function getDriverDescForKey($key) + public function getDriverDescForKey($key) { return $this->driverdesc[$key]; } @@ -246,7 +246,7 @@ class ModeleImports * @param string $key Key * @return string */ - function getDriverVersionForKey($key) + public function getDriverVersionForKey($key) { return $this->driverversion[$key]; } @@ -257,7 +257,7 @@ class ModeleImports * @param string $key Key * @return string */ - function getLibLabelForKey($key) + public function getLibLabelForKey($key) { return $this->liblabel[$key]; } @@ -268,7 +268,7 @@ class ModeleImports * @param string $key Key * @return string */ - function getLibVersionForKey($key) + public function getLibVersionForKey($key) { return $this->libversion[$key]; } diff --git a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php index e8e5a6f9205..e84a05dd227 100644 --- a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php @@ -117,7 +117,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { global $conf,$langs,$mysoc; @@ -174,20 +174,20 @@ class pdf_typhon extends ModelePDFDeliveryOrder } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Function to build pdf onto disk * - * @param Object $object Object to generate - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref + * @param Object $object Object to generate + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int $hidedetails Do not show line details + * @param int $hidedesc Do not show desc + * @param int $hideref Do not show ref * @return int 1=OK, 0=KO */ - function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) - { + public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) + { // phpcs:enable global $user,$langs,$conf,$mysoc,$hookmanager; @@ -637,7 +637,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder return 0; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Show miscellaneous information (payment mode, payment term, ...) * @@ -647,7 +647,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder * @param Translate $outputlangs Langs object * @return void */ - function _tableau_info(&$pdf, $object, $posy, $outputlangs) + private function _tableau_info(&$pdf, $object, $posy, $outputlangs) { // phpcs:enable global $conf,$mysoc; @@ -678,7 +678,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder * @param int $hidebottom Hide bottom bar of array * @return void */ - function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0) + private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0) { global $conf,$mysoc; @@ -740,7 +740,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder * @param Translate $outputlangs Object lang for output * @return void */ - function _pagehead(&$pdf, $object, $showaddress, $outputlangs) + private function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { global $conf,$langs,$hookmanager; @@ -910,18 +910,18 @@ class pdf_typhon extends ModelePDFDeliveryOrder } /** - * Show footer of page. Need this->emetteur object + * Show footer of page. Need this->emetteur object * - * @param PDF $pdf PDF - * @param Object $object Object to show - * @param Translate $outputlangs Object lang for output - * @param int $hidefreetext 1=Hide free text - * @return int Return height of bottom margin including footer text + * @param PDF $pdf PDF + * @param Object $object Object to show + * @param Translate $outputlangs Object lang for output + * @param int $hidefreetext 1=Hide free text + * @return int Return height of bottom margin including footer text */ - function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) - { - global $conf; - $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; - return pdf_pagefoot($pdf, $outputlangs, 'DELIVERY_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); - } + private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) + { + global $conf; + $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + return pdf_pagefoot($pdf, $outputlangs, 'DELIVERY_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); + } } diff --git a/htdocs/core/modules/livraison/mod_livraison_jade.php b/htdocs/core/modules/livraison/mod_livraison_jade.php index 89cb2794be3..fe94bf839c1 100644 --- a/htdocs/core/modules/livraison/mod_livraison_jade.php +++ b/htdocs/core/modules/livraison/mod_livraison_jade.php @@ -65,7 +65,7 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder * * @return string Texte descripif */ - function info() + public function info() { global $langs; return $langs->trans("SimpleNumRefModelDesc", $this->prefix); @@ -76,7 +76,7 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder * * @return string Example */ - function getExample() + public function getExample() { return $this->prefix."0501-0001"; } @@ -87,7 +87,7 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder * * @return boolean false si conflit, true si ok */ - function canBeActivated() + public function canBeActivated() { global $langs,$conf,$db; @@ -125,7 +125,7 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder * @param Object $object Object we need next value for * @return string Value if KO, <0 if KO */ - function getNextValue($objsoc, $object) + public function getNextValue($objsoc, $object) { global $db,$conf; @@ -138,8 +138,7 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder $resql=$db->query($sql); dol_syslog("mod_livraison_jade::getNextValue", LOG_DEBUG); - if ($resql) - { + if ($resql) { $obj = $db->fetch_object($resql); if ($obj) $max = intval($obj->max); else $max=0; @@ -161,15 +160,15 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - /** - * Return next free ref - * - * @param Societe $objsoc Object thirdparty - * @param Object $object Object livraison - * @return string Texte descriptif + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Return next free ref + * + * @param Societe $objsoc Object thirdparty + * @param Object $object Object livraison + * @return string Texte descriptif */ - function livraison_get_num($objsoc = 0, $object = '') + public function livraison_get_num($objsoc = 0, $object = '') { // phpcs:enable return $this->getNextValue($objsoc, $object); diff --git a/htdocs/core/modules/livraison/mod_livraison_saphir.php b/htdocs/core/modules/livraison/mod_livraison_saphir.php index 4f8a0640816..2fc2e16d7fd 100644 --- a/htdocs/core/modules/livraison/mod_livraison_saphir.php +++ b/htdocs/core/modules/livraison/mod_livraison_saphir.php @@ -60,8 +60,8 @@ class mod_livraison_saphir extends ModeleNumRefDeliveryOrder * * @return string Texte descripif */ - function info() - { + public function info() + { global $conf, $langs; $langs->load("bills"); @@ -100,7 +100,7 @@ class mod_livraison_saphir extends ModeleNumRefDeliveryOrder * * @return string Example */ - function getExample() + public function getExample() { global $conf,$langs,$mysoc; @@ -124,7 +124,7 @@ class mod_livraison_saphir extends ModeleNumRefDeliveryOrder * @param Object $object Object delivery * @return string Value if OK, 0 if KO */ - function getNextValue($objsoc, $object) + public function getNextValue($objsoc, $object) { global $db,$conf; @@ -152,13 +152,13 @@ class mod_livraison_saphir extends ModeleNumRefDeliveryOrder * @param string $objforref Object for number to search * @return string Next free value */ - function getNumRef($objsoc, $objforref) + public function getNumRef($objsoc, $objforref) { return $this->getNextValue($objsoc, $objforref); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return next free ref * @@ -166,7 +166,7 @@ class mod_livraison_saphir extends ModeleNumRefDeliveryOrder * @param Object $object Objet livraison * @return string Texte descripif */ - function livraison_get_num($objsoc = 0, $object = '') + public function livraison_get_num($objsoc = 0, $object = '') { // phpcs:enable return $this->getNextValue($objsoc, $object); diff --git a/htdocs/core/modules/livraison/modules_livraison.php b/htdocs/core/modules/livraison/modules_livraison.php index 8ed70b102fd..ce9d9b77f77 100644 --- a/htdocs/core/modules/livraison/modules_livraison.php +++ b/htdocs/core/modules/livraison/modules_livraison.php @@ -36,119 +36,119 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; */ abstract class ModelePDFDeliveryOrder extends CommonDocGenerator { - /** - * @var string Error code (or message) - */ - public $error=''; + /** + * @var string Error code (or message) + */ + public $error=''; - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - /** - * Return list of active generation modules - * - * @param DoliDB $db Database handler + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Return list of active generation modules + * + * @param DoliDB $db Database handler * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates - */ - static function liste_modeles($db, $maxfilenamelength = 0) - { + * @return array List of templates + */ + public static function liste_modeles($db, $maxfilenamelength = 0) + { // phpcs:enable - global $conf; + global $conf; - $type='delivery'; - $liste=array(); + $type='delivery'; + $liste=array(); - include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - $liste=getListOfModels($db, $type, $maxfilenamelength); + include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + $liste=getListOfModels($db, $type, $maxfilenamelength); - return $liste; - } + return $liste; + } } /** - * \class ModeleNumRefDeliveryOrder - * \brief Classe mere des modeles de numerotation des references de bon de livraison + * \class ModeleNumRefDeliveryOrder + * \brief Classe mere des modeles de numerotation des references de bon de livraison */ abstract class ModeleNumRefDeliveryOrder { - /** - * @var string Error code (or message) - */ - public $error=''; + /** + * @var string Error code (or message) + */ + public $error=''; - /** - * Return if a module can be used or not - * - * @return boolean true if module can be used - */ - function isEnabled() - { - return true; - } + /** + * Return if a module can be used or not + * + * @return boolean true if module can be used + */ + public function isEnabled() + { + return true; + } - /** - * Renvoi la description par defaut du modele de numerotation - * - * @return string Texte descripif - */ - function info() - { - global $langs; - $langs->load("deliveries"); - return $langs->trans("NoDescription"); - } + /** + * Renvoi la description par defaut du modele de numerotation + * + * @return string Texte descripif + */ + public function info() + { + global $langs; + $langs->load("deliveries"); + return $langs->trans("NoDescription"); + } - /** - * Renvoi un exemple de numerotation - * - * @return string Example - */ - function getExample() - { - global $langs; - $langs->load("deliveries"); - return $langs->trans("NoExample"); - } + /** + * Renvoi un exemple de numerotation + * + * @return string Example + */ + public function getExample() + { + global $langs; + $langs->load("deliveries"); + return $langs->trans("NoExample"); + } - /** - * Test si les numeros deja en vigueur dans la base ne provoquent pas d - * de conflits qui empechera cette numerotation de fonctionner. - * - * @return boolean false si conflit, true si ok - */ - function canBeActivated() - { - return true; - } + /** + * Test si les numeros deja en vigueur dans la base ne provoquent pas d + * de conflits qui empechera cette numerotation de fonctionner. + * + * @return boolean false si conflit, true si ok + */ + public function canBeActivated() + { + return true; + } - /** - * Renvoi prochaine valeur attribuee - * - * @param Societe $objsoc Object third party - * @param Object $object Object delivery - * @return string Valeur - */ - function getNextValue($objsoc, $object) - { - global $langs; - return $langs->trans("NotAvailable"); - } + /** + * Renvoi prochaine valeur attribuee + * + * @param Societe $objsoc Object third party + * @param Object $object Object delivery + * @return string Valeur + */ + public function getNextValue($objsoc, $object) + { + global $langs; + return $langs->trans("NotAvailable"); + } - /** - * Renvoi version du module numerotation - * - * @return string Valeur - */ - function getVersion() - { - global $langs; - $langs->load("admin"); + /** + * Renvoi version du module numerotation + * + * @return string Valeur + */ + public function getVersion() + { + global $langs; + $langs->load("admin"); - if ($this->version == 'development') return $langs->trans("VersionDevelopment"); - if ($this->version == 'experimental') return $langs->trans("VersionExperimental"); - if ($this->version == 'dolibarr') return DOL_VERSION; - if ($this->version) return $this->version; - return $langs->trans("NotAvailable"); - } + if ($this->version == 'development') return $langs->trans("VersionDevelopment"); + elseif ($this->version == 'experimental') return $langs->trans("VersionExperimental"); + elseif ($this->version == 'dolibarr') return DOL_VERSION; + elseif ($this->version) return $this->version; + else return $langs->trans("NotAvailable"); + } } diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php index 77d1cc10d72..79c58b1c7ce 100644 --- a/htdocs/core/modules/mailings/contacts1.modules.php +++ b/htdocs/core/modules/mailings/contacts1.modules.php @@ -32,12 +32,12 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php'; */ class mailing_contacts1 extends MailingTargets { - var $name='ContactCompanies'; // Identifiant du module mailing + public $name='ContactCompanies'; // Identifiant du module mailing // This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found - var $desc='Contacts of thirdparties (prospects, customers, suppliers...)'; - var $require_module=array("societe"); // Module mailing actif si modules require_module actifs - var $require_admin=0; // Module mailing actif pour user admin ou non - var $picto='contact'; + public $desc='Contacts of thirdparties (prospects, customers, suppliers...)'; + public $require_module=array("societe"); // Module mailing actif si modules require_module actifs + public $require_admin=0; // Module mailing actif pour user admin ou non + public $picto='contact'; /** * @var DoliDB Database handler. @@ -45,15 +45,15 @@ class mailing_contacts1 extends MailingTargets public $db; - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - function __construct($db) - { - $this->db=$db; - } + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + $this->db=$db; + } /** @@ -64,8 +64,8 @@ class mailing_contacts1 extends MailingTargets * * @return string[] Array with SQL requests */ - function getSqlArrayForStats() - { + public function getSqlArrayForStats() + { global $conf, $langs; $langs->load("commercial"); @@ -80,7 +80,7 @@ class mailing_contacts1 extends MailingTargets $statssql[0].= " AND c.statut = 1"; return $statssql; - } + } /** @@ -91,8 +91,8 @@ class mailing_contacts1 extends MailingTargets * @param string $sql Requete sql de comptage * @return int */ - function getNbOfRecipients($sql = '') - { + public function getNbOfRecipients($sql = '') + { global $conf; $sql = "SELECT count(distinct(c.email)) as nb"; @@ -105,7 +105,7 @@ class mailing_contacts1 extends MailingTargets // The request must return a field called "nb" to be understandable by parent::getNbOfRecipients return parent::getNbOfRecipients($sql); - } + } /** @@ -113,8 +113,8 @@ class mailing_contacts1 extends MailingTargets * * @return string Retourne zone select */ - function formFilter() - { + public function formFilter() + { global $langs; // Load translation files required by the page @@ -311,7 +311,7 @@ class mailing_contacts1 extends MailingTargets $s.=''; return $s; - } + } /** @@ -320,21 +320,21 @@ class mailing_contacts1 extends MailingTargets * @param int $id ID * @return string Url lien */ - function url($id) - { - return ''.img_object('', "contact").''; - } + public function url($id) + { + return ''.img_object('', "contact").''; + } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Ajoute destinataires dans table des cibles * * @param int $mailing_id Id of emailing * @return int <0 si erreur, nb ajout si ok */ - function add_to_target($mailing_id) - { + public function add_to_target($mailing_id) + { // phpcs:enable global $conf, $langs; @@ -448,5 +448,5 @@ class mailing_contacts1 extends MailingTargets } return parent::add_to_target($mailing_id, $cibles); - } + } } diff --git a/htdocs/core/modules/mailings/example.modules.php b/htdocs/core/modules/mailings/example.modules.php index 8feadc6b6e2..45af3dd5b4d 100644 --- a/htdocs/core/modules/mailings/example.modules.php +++ b/htdocs/core/modules/mailings/example.modules.php @@ -26,17 +26,17 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php'; class mailing_example extends MailingTargets { // CHANGE THIS: Put here a name not already used - var $name='example'; + public $name='example'; // CHANGE THIS: Put here a description of your selector module. // This label is used if no translation is found for key MailingModuleDescXXX where XXX=name is found - var $desc='Put here a description'; - // CHANGE THIS: Set to 1 if selector is available for admin users only - var $require_admin=0; + public $desc='Put here a description'; + // CHANGE THIS: Set to 1 if selector is available for admin users only + public $require_admin=0; // CHANGE THIS: Add a tooltip language key to add a tooltip help icon after the email target selector - var $tooltip='MyTooltipLangKey'; + public $tooltip='MyTooltipLangKey'; - var $require_module=array(); - var $picto=''; + public $require_module=array(); + public $picto=''; /** * @var DoliDB Database handler. @@ -50,20 +50,20 @@ class mailing_example extends MailingTargets * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db=$db; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * This is the main function that returns the array of emails * * @param int $mailing_id Id of mailing. No need to use it. * @return int <0 if error, number of emails added if ok */ - function add_to_target($mailing_id) + public function add_to_target($mailing_id) { // phpcs:enable $target = array(); @@ -92,7 +92,7 @@ class mailing_example extends MailingTargets * * @return array Array with SQL requests */ - function getSqlArrayForStats() + public function getSqlArrayForStats() { // CHANGE THIS: Optionnal @@ -103,14 +103,14 @@ class mailing_example extends MailingTargets /** - * Return here number of distinct emails returned by your selector. - * For example if this selector is used to extract 500 different - * emails from a text file, this function must return 500. + * Return here number of distinct emails returned by your selector. + * For example if this selector is used to extract 500 different + * emails from a text file, this function must return 500. * * @param string $sql Requete sql de comptage - * @return int|string Number of recipient or '?' + * @return int|string Number of recipient or '?' */ - function getNbOfRecipients($sql = '') + public function getNbOfRecipients($sql = '') { // CHANGE THIS: Optionnal @@ -121,11 +121,11 @@ class mailing_example extends MailingTargets /** * This is to add a form filter to provide variant of selector - * If used, the HTML select must be called "filter" + * If used, the HTML select must be called "filter" * * @return string A html select zone */ - function formFilter() + public function formFilter() { // CHANGE THIS: Optionnal @@ -141,7 +141,7 @@ class mailing_example extends MailingTargets * @param int $id ID * @return string Url link */ - function url($id) + public function url($id) { // CHANGE THIS: Optionnal diff --git a/htdocs/core/modules/mailings/fraise.modules.php b/htdocs/core/modules/mailings/fraise.modules.php index d417bdc8bef..2ea4ba8e3b5 100644 --- a/htdocs/core/modules/mailings/fraise.modules.php +++ b/htdocs/core/modules/mailings/fraise.modules.php @@ -33,14 +33,14 @@ include_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; */ class mailing_fraise extends MailingTargets { - var $name='FundationMembers'; // Identifiant du module mailing + public $name='FundationMembers'; // Identifiant du module mailing // This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found - var $desc='Foundation members with emails'; + public $desc='Foundation members with emails'; // Set to 1 if selector is available for admin users only - var $require_admin=0; + public $require_admin=0; - var $require_module=array('adherent'); - var $picto='user'; + public $require_module=array('adherent'); + public $picto='user'; /** * @var DoliDB Database handler. @@ -52,7 +52,7 @@ class mailing_fraise extends MailingTargets * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db = $db; } @@ -66,7 +66,7 @@ class mailing_fraise extends MailingTargets * * @return string[] Array with SQL requests */ - function getSqlArrayForStats() + public function getSqlArrayForStats() { global $langs; @@ -90,7 +90,7 @@ class mailing_fraise extends MailingTargets * @param string $sql Requete sql de comptage * @return int Nb of recipients */ - function getNbOfRecipients($sql = '') + public function getNbOfRecipients($sql = '') { $sql = "SELECT count(distinct(a.email)) as nb"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as a"; @@ -107,7 +107,7 @@ class mailing_fraise extends MailingTargets * * @return string Retourne zone select */ - function formFilter() + public function formFilter() { global $conf, $langs; @@ -214,20 +214,20 @@ class mailing_fraise extends MailingTargets * @param int $id ID * @return string Url lien */ - function url($id) + public function url($id) { return ''.img_object('', "user").''; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Ajoute destinataires dans table des cibles * * @param int $mailing_id Id of emailing * @return int < 0 si erreur, nb ajout si ok */ - function add_to_target($mailing_id) + public function add_to_target($mailing_id) { // phpcs:enable global $langs,$_POST; diff --git a/htdocs/core/modules/mailings/modules_mailings.php b/htdocs/core/modules/mailings/modules_mailings.php index 0e28b156e09..f3ee3396acb 100644 --- a/htdocs/core/modules/mailings/modules_mailings.php +++ b/htdocs/core/modules/mailings/modules_mailings.php @@ -49,7 +49,7 @@ class MailingTargets // This can't be abstract as it is used for some method * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db = $db; } @@ -59,7 +59,7 @@ class MailingTargets // This can't be abstract as it is used for some method * * @return string Return translation of module label. Try translation of $this->name then translation of 'MailingModuleDesc'.$this->name, or $this->desc if not found */ - function getDesc() + public function getDesc() { global $langs, $form; @@ -80,7 +80,7 @@ class MailingTargets // This can't be abstract as it is used for some method * * @return integer Example */ - function getNbOfRecords() + public function getNbOfRecords() { return 0; } @@ -91,7 +91,7 @@ class MailingTargets // This can't be abstract as it is used for some method * @param string $sql Sql request to count * @return int Nb of recipient, or <0 if error */ - function getNbOfRecipients($sql) + public function getNbOfRecipients($sql) { $result=$this->db->query($sql); if ($result) @@ -112,19 +112,19 @@ class MailingTargets // This can't be abstract as it is used for some method * * @return string Retourne zone select */ - function formFilter() + public function formFilter() { return ''; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Met a jour nombre de destinataires * * @param int $mailing_id Id of emailing * @return int < 0 si erreur, nb destinataires si ok */ - function update_nb($mailing_id) + public function update_nb($mailing_id) { // phpcs:enable // Mise a jour nombre de destinataire dans table des mailings @@ -151,7 +151,7 @@ class MailingTargets // This can't be abstract as it is used for some method return $nb; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Ajoute destinataires dans table des cibles * @@ -159,7 +159,7 @@ class MailingTargets // This can't be abstract as it is used for some method * @param array $cibles Array with targets * @return int < 0 si erreur, nb ajout si ok */ - function add_to_target($mailing_id, $cibles) + public function add_to_target($mailing_id, $cibles) { // phpcs:enable global $conf; @@ -247,14 +247,14 @@ class MailingTargets // This can't be abstract as it is used for some method return $j; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Supprime tous les destinataires de la table des cibles * - * @param int $mailing_id Id of emailing - * @return void + * @param int $mailing_id Id of emailing + * @return void */ - function clear_target($mailing_id) + public function clear_target($mailing_id) { // phpcs:enable $sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing_cibles"; diff --git a/htdocs/core/modules/mailings/pomme.modules.php b/htdocs/core/modules/mailings/pomme.modules.php index a0815aac9ec..74dc86c1d9a 100644 --- a/htdocs/core/modules/mailings/pomme.modules.php +++ b/htdocs/core/modules/mailings/pomme.modules.php @@ -30,12 +30,12 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php'; */ class mailing_pomme extends MailingTargets { - var $name='DolibarrUsers'; // Identifiant du module mailing + public $name='DolibarrUsers'; // Identifiant du module mailing // This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found - var $desc='Dolibarr users with emails'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv�e - var $require_module=array(); // Module mailing actif si modules require_module actifs - var $require_admin=1; // Module mailing actif pour user admin ou non - var $picto='user'; + public $desc='Dolibarr users with emails'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv�e + public $require_module=array(); // Module mailing actif si modules require_module actifs + public $require_admin=1; // Module mailing actif pour user admin ou non + public $picto='user'; /** * @var DoliDB Database handler. @@ -48,7 +48,7 @@ class mailing_pomme extends MailingTargets * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db=$db; } @@ -62,7 +62,7 @@ class mailing_pomme extends MailingTargets * * @return string[] Array with SQL requests */ - function getSqlArrayForStats() + public function getSqlArrayForStats() { global $conf, $langs; @@ -88,7 +88,7 @@ class mailing_pomme extends MailingTargets * @param string $sql SQL request to use to count * @return int Number of recipients */ - function getNbOfRecipients($sql = '') + public function getNbOfRecipients($sql = '') { global $conf; @@ -108,7 +108,7 @@ class mailing_pomme extends MailingTargets * * @return string Retourne zone select */ - function formFilter() + public function formFilter() { global $langs; @@ -140,20 +140,20 @@ class mailing_pomme extends MailingTargets * @param int $id ID * @return string Url lien */ - function url($id) + public function url($id) { return ''.img_object('', "user").''; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Ajoute destinataires dans table des cibles * * @param int $mailing_id Id of emailing * @return int < 0 si erreur, nb ajout si ok */ - function add_to_target($mailing_id) + public function add_to_target($mailing_id) { // phpcs:enable global $conf, $langs; @@ -191,17 +191,17 @@ class mailing_pomme extends MailingTargets if ($old <> $obj->email) { $cibles[$j] = array( - 'email' => $obj->email, - 'fk_contact' => $obj->fk_contact, - 'lastname' => $obj->lastname, - 'firstname' => $obj->firstname, - 'other' => - ($langs->transnoentities("Login").'='.$obj->login).';'. - ($langs->transnoentities("UserTitle").'='.$obj->civility_id).';'. - ($langs->transnoentities("PhonePro").'='.$obj->office_phone), - 'source_url' => $this->url($obj->id), - 'source_id' => $obj->id, - 'source_type' => 'user' + 'email' => $obj->email, + 'fk_contact' => $obj->fk_contact, + 'lastname' => $obj->lastname, + 'firstname' => $obj->firstname, + 'other' => + ($langs->transnoentities("Login").'='.$obj->login).';'. + ($langs->transnoentities("UserTitle").'='.$obj->civility_id).';'. + ($langs->transnoentities("PhonePro").'='.$obj->office_phone), + 'source_url' => $this->url($obj->id), + 'source_id' => $obj->id, + 'source_type' => 'user' ); $old = $obj->email; $j++; @@ -218,5 +218,5 @@ class mailing_pomme extends MailingTargets } return parent::add_to_target($mailing_id, $cibles); - } + } } diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php index 4835fe5123d..9a30a063ad3 100644 --- a/htdocs/core/modules/mailings/thirdparties.modules.php +++ b/htdocs/core/modules/mailings/thirdparties.modules.php @@ -24,13 +24,13 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php'; */ class mailing_thirdparties extends MailingTargets { - var $name='ThirdPartiesByCategories'; + public $name='ThirdPartiesByCategories'; // This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found - var $desc="Third parties (by categories)"; - var $require_admin=0; + public $desc="Third parties (by categories)"; + public $require_admin=0; - var $require_module=array("societe"); // This module allows to select by categories must be also enabled if category module is not activated - var $picto='company'; + public $require_module=array("societe"); // This module allows to select by categories must be also enabled if category module is not activated + public $picto='company'; /** * @var DoliDB Database handler. @@ -43,7 +43,7 @@ class mailing_thirdparties extends MailingTargets * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { global $conf, $langs; $langs->load("companies"); @@ -52,14 +52,14 @@ class mailing_thirdparties extends MailingTargets } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * This is the main function that returns the array of emails * * @param int $mailing_id Id of mailing. No need to use it. * @return int <0 if error, number of emails added if ok */ - function add_to_target($mailing_id) + public function add_to_target($mailing_id) { // phpcs:enable global $conf, $langs; @@ -200,7 +200,7 @@ class mailing_thirdparties extends MailingTargets * * @return array Array with SQL requests */ - function getSqlArrayForStats() + public function getSqlArrayForStats() { // CHANGE THIS: Optionnal @@ -218,7 +218,7 @@ class mailing_thirdparties extends MailingTargets * @param string $sql Requete sql de comptage * @return int Nb of recipients */ - function getNbOfRecipients($sql = '') + public function getNbOfRecipients($sql = '') { global $conf; @@ -238,7 +238,7 @@ class mailing_thirdparties extends MailingTargets * * @return string A html select zone */ - function formFilter() + public function formFilter() { global $conf, $langs; @@ -319,7 +319,7 @@ class mailing_thirdparties extends MailingTargets * @param int $id ID * @return string Url link */ - function url($id) + public function url($id) { return ''.img_object('', "company").''; } diff --git a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php index 5c6438b469f..a19c5480722 100644 --- a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php +++ b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php @@ -22,20 +22,20 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; */ class mailing_thirdparties_services_expired extends MailingTargets { - var $name='DolibarrContractsLinesExpired'; + public $name='DolibarrContractsLinesExpired'; // This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found - var $desc='Third parties with expired contract\'s lines'; - var $require_admin=0; + public $desc='Third parties with expired contract\'s lines'; + public $require_admin=0; - var $require_module=array('contrat'); - var $picto='company'; + public $require_module=array('contrat'); + public $picto='company'; /** * @var DoliDB Database handler. */ public $db; - var $arrayofproducts=array(); + public $arrayofproducts=array(); /** @@ -43,7 +43,7 @@ class mailing_thirdparties_services_expired extends MailingTargets * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { global $conf; @@ -77,14 +77,14 @@ class mailing_thirdparties_services_expired extends MailingTargets } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * This is the main function that returns the array of emails * * @param int $mailing_id Id of mailing. No need to use it. * @return int <0 if error, number of emails added if ok */ - function add_to_target($mailing_id) + public function add_to_target($mailing_id) { // phpcs:enable $key=GETPOST('filter', 'int'); @@ -171,7 +171,7 @@ class mailing_thirdparties_services_expired extends MailingTargets * * @return array Array with SQL requests */ - function getSqlArrayForStats() + public function getSqlArrayForStats() { //var $statssql=array(); @@ -189,7 +189,7 @@ class mailing_thirdparties_services_expired extends MailingTargets * @param string $sql SQL request to use to count * @return int Number of recipients */ - function getNbOfRecipients($sql = '') + public function getNbOfRecipients($sql = '') { $now=dol_now(); @@ -215,7 +215,7 @@ class mailing_thirdparties_services_expired extends MailingTargets * * @return string A html select zone */ - function formFilter() + public function formFilter() { global $langs; @@ -238,7 +238,7 @@ class mailing_thirdparties_services_expired extends MailingTargets * @param int $id ID * @return string Url link */ - function url($id) + public function url($id) { return ''.img_object('', "company").''; } diff --git a/htdocs/core/modules/mailings/xinputfile.modules.php b/htdocs/core/modules/mailings/xinputfile.modules.php index 92f4bb3f059..adcd03b6307 100644 --- a/htdocs/core/modules/mailings/xinputfile.modules.php +++ b/htdocs/core/modules/mailings/xinputfile.modules.php @@ -30,24 +30,24 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; */ class mailing_xinputfile extends MailingTargets { - var $name='EmailsFromFile'; // Identifiant du module mailing - // This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found - var $desc='EMails from a file'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv�e - var $require_module=array(); // Module mailing actif si modules require_module actifs - var $require_admin=0; // Module mailing actif pour user admin ou non - var $picto='generic'; - var $tooltip='UseFormatFileEmailToTarget'; + public $name='EmailsFromFile'; // Identifiant du module mailing + // This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found + public $desc='EMails from a file'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv�e + public $require_module=array(); // Module mailing actif si modules require_module actifs + public $require_admin=0; // Module mailing actif pour user admin ou non + public $picto='generic'; + public $tooltip='UseFormatFileEmailToTarget'; - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - function __construct($db) - { - $this->db=$db; - } + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + $this->db=$db; + } /** @@ -58,7 +58,7 @@ class mailing_xinputfile extends MailingTargets * * @return array Array with SQL requests */ - function getSqlArrayForStats() + public function getSqlArrayForStats() { global $langs; $langs->load("users"); @@ -76,7 +76,7 @@ class mailing_xinputfile extends MailingTargets * @param string $sql Sql request to count * @return string '' means NA */ - function getNbOfRecipients($sql = '') + public function getNbOfRecipients($sql = '') { return ''; } @@ -88,7 +88,7 @@ class mailing_xinputfile extends MailingTargets * @param int $id ID * @return string Url lien */ - function url($id) + public function url($id) { global $langs; return $langs->trans('LineInFile', $id); @@ -101,7 +101,7 @@ class mailing_xinputfile extends MailingTargets * * @return string Retourne zone select */ - function formFilter() + public function formFilter() { global $langs; @@ -110,14 +110,14 @@ class mailing_xinputfile extends MailingTargets return $s; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Ajoute destinataires dans table des cibles * * @param int $mailing_id Id of emailing * @return int < 0 si erreur, nb ajout si ok */ - function add_to_target($mailing_id) + public function add_to_target($mailing_id) { // phpcs:enable global $conf,$langs,$_FILES; diff --git a/htdocs/core/modules/mailings/xinputuser.modules.php b/htdocs/core/modules/mailings/xinputuser.modules.php index 96177483542..62990ec6f90 100644 --- a/htdocs/core/modules/mailings/xinputuser.modules.php +++ b/htdocs/core/modules/mailings/xinputuser.modules.php @@ -30,13 +30,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; */ class mailing_xinputuser extends MailingTargets { - var $name='EmailsFromUser'; // Identifiant du module mailing + public $name='EmailsFromUser'; // Identifiant du module mailing // This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found - var $desc='EMails input by user'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv�e - var $require_module=array(); // Module mailing actif si modules require_module actifs - var $require_admin=0; // Module mailing actif pour user admin ou non - var $picto='generic'; - var $tooltip='UseFormatInputEmailToTarget'; + public $desc='EMails input by user'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv�e + public $require_module=array(); // Module mailing actif si modules require_module actifs + public $require_admin=0; // Module mailing actif pour user admin ou non + public $picto='generic'; + public $tooltip='UseFormatInputEmailToTarget'; /** @@ -44,7 +44,7 @@ class mailing_xinputuser extends MailingTargets * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db=$db; } @@ -58,7 +58,7 @@ class mailing_xinputuser extends MailingTargets * * @return array Array with SQL requests */ - function getSqlArrayForStats() + public function getSqlArrayForStats() { global $langs; $langs->load("users"); @@ -76,7 +76,7 @@ class mailing_xinputuser extends MailingTargets * @param string $sql Sql request to count * @return string '' means NA */ - function getNbOfRecipients($sql = '') + public function getNbOfRecipients($sql = '') { return ''; } @@ -88,7 +88,7 @@ class mailing_xinputuser extends MailingTargets * @param int $id ID * @return string Url lien */ - function url($id) + public function url($id) { return ''; } @@ -99,7 +99,7 @@ class mailing_xinputuser extends MailingTargets * * @return string Retourne zone select */ - function formFilter() + public function formFilter() { global $langs; @@ -108,14 +108,14 @@ class mailing_xinputuser extends MailingTargets return $s; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Ajoute destinataires dans table des cibles * * @param int $mailing_id Id of emailing * @return int < 0 si erreur, nb ajout si ok */ - function add_to_target($mailing_id) + public function add_to_target($mailing_id) { // phpcs:enable global $conf,$langs,$_FILES; diff --git a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php index fdd2a92d15b..4854af7bfac 100644 --- a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php +++ b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php @@ -58,8 +58,8 @@ class doc_generic_reception_odt extends ModelePdfReception * * @param DoliDB $db Database handler */ - function __construct($db) - { + public function __construct($db) + { global $conf,$langs,$mysoc; $langs->load("main"); @@ -94,18 +94,18 @@ class doc_generic_reception_odt extends ModelePdfReception // Recupere emetteur $this->emetteur=$mysoc; if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang, -2); // By default if not defined - } + } - /** - * Return description of a module - * - * @param Translate $langs Lang object to use for output - * @return string Description - */ - function info($langs) - { - global $conf,$langs; + /** + * Return description of a module + * + * @param Translate $langs Lang object to use for output + * @return string Description + */ + public function info($langs) + { + global $conf,$langs; $langs->load("companies"); $langs->load("errors"); @@ -183,22 +183,22 @@ class doc_generic_reception_odt extends ModelePdfReception $texte.= ''; return $texte; - } + } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Function to build a document on disk using the generic odt module. + * Function to build a document on disk using the generic odt module. * - * @param Reception $object Object source to build document - * @param Translate $outputlangs Lang output object + * @param Reception $object Object source to build document + * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file * @param int $hidedetails Do not show line details * @param int $hidedesc Do not show desc * @param int $hideref Do not show ref * @return int 1 if OK, <=0 if KO */ - function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0) - { + public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0) + { // phpcs:enable global $user,$langs,$conf,$mysoc,$hookmanager; diff --git a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php index 4fb3f4b2e9d..6f0cb59ca89 100644 --- a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php +++ b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php @@ -60,7 +60,7 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders /** * Constructor */ - function __construct() + public function __construct() { global $conf; @@ -72,7 +72,7 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders * * @return string Text with description */ - function info() + public function info() { global $langs; return $langs->trans("SimpleNumRefModelDesc", $this->prefix); @@ -84,7 +84,7 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders * * @return string Example */ - function getExample() + public function getExample() { return $this->prefix."0501-0001"; } @@ -96,7 +96,7 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders * * @return boolean false si conflit, true si ok */ - function canBeActivated() + public function canBeActivated() { global $conf,$langs,$db; @@ -132,7 +132,7 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders * @param Object $object Object * @return string Value if OK, 0 if KO */ - function getNextValue($objsoc = 0, $object = '') + public function getNextValue($objsoc = 0, $object = '') { global $db,$conf; @@ -163,7 +163,7 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Renvoie la reference de commande suivante non utilisee * @@ -171,7 +171,7 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders * @param Object $object Object * @return string Texte descripif */ - function commande_get_num($objsoc = 0, $object = '') + public function commande_get_num($objsoc = 0, $object = '') { // phpcs:enable return $this->getNextValue($objsoc, $object); diff --git a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php index 73350e85c30..320c33dce7d 100644 --- a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php +++ b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php @@ -102,7 +102,7 @@ class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders * * @return string Example */ - function getExample() + public function getExample() { global $conf,$langs,$mysoc; @@ -125,7 +125,7 @@ class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders * @param Object $object Object * @return string Value if OK, 0 if KO */ - function getNextValue($objsoc = 0, $object = '') + public function getNextValue($objsoc = 0, $object = '') { global $db,$conf; @@ -146,7 +146,7 @@ class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Renvoie la reference de commande suivante non utilisee * @@ -154,7 +154,7 @@ class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders * @param Object $object Object * @return string Texte descripif */ - function commande_get_num($objsoc = 0, $object = '') + public function commande_get_num($objsoc = 0, $object = '') { // phpcs:enable return $this->getNextValue($objsoc, $object); diff --git a/htdocs/core/modules/supplier_order/modules_commandefournisseur.php b/htdocs/core/modules/supplier_order/modules_commandefournisseur.php index 0dadee51592..e7cba73672d 100644 --- a/htdocs/core/modules/supplier_order/modules_commandefournisseur.php +++ b/htdocs/core/modules/supplier_order/modules_commandefournisseur.php @@ -43,7 +43,7 @@ abstract class ModelePDFSuppliersOrders extends CommonDocGenerator public $error=''; - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of active generation models * @@ -51,7 +51,7 @@ abstract class ModelePDFSuppliersOrders extends CommonDocGenerator * @param integer $maxfilenamelength Max length of value to show * @return array List of templates */ - static function liste_modeles($db, $maxfilenamelength = 0) + public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable global $conf; diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index a95440ad42f..0cc9d4f6af3 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -120,7 +120,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { global $conf, $langs, $mysoc; @@ -197,7 +197,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Function to build pdf onto disk * @@ -209,7 +209,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders * @param int $hideref Do not show ref * @return int 1=OK, 0=KO */ - function write_file($object, $outputlangs = '', $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) + public function write_file($object, $outputlangs = '', $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable global $user,$langs,$conf,$hookmanager,$mysoc,$nblignes; @@ -708,7 +708,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Show payments table * @@ -718,13 +718,13 @@ class pdf_muscadet extends ModelePDFSuppliersOrders * @param Translate $outputlangs Object langs for output * @return int <0 if KO, >0 if OK */ - function _tableau_versements(&$pdf, $object, $posy, $outputlangs) + private function _tableau_versements(&$pdf, $object, $posy, $outputlangs) { // phpcs:enable } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Show miscellaneous information (payment mode, payment term, ...) * @@ -734,7 +734,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders * @param Translate $outputlangs Langs object * @return integer */ - function _tableau_info(&$pdf, $object, $posy, $outputlangs) + private function _tableau_info(&$pdf, $object, $posy, $outputlangs) { // phpcs:enable global $conf; @@ -789,7 +789,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders return $posy; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Show total to pay * @@ -800,7 +800,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders * @param Translate $outputlangs Objet langs * @return int Position pour suite */ - function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) + private function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) { // phpcs:enable global $conf,$mysoc; @@ -1017,7 +1017,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders * @param string $currency Currency code * @return void */ - function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '') + private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '') { global $conf; @@ -1126,7 +1126,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders * @param Translate $outputlangs Object lang for output * @return void */ - function _pagehead(&$pdf, $object, $showaddress, $outputlangs) + private function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { global $langs, $conf, $mysoc; @@ -1363,15 +1363,15 @@ class pdf_muscadet extends ModelePDFSuppliersOrders } /** - * Show footer of page. Need this->emetteur object + * Show footer of page. Need this->emetteur object * - * @param PDF $pdf PDF - * @param CommandeFournisseur $object Object to show - * @param Translate $outputlangs Object lang for output - * @param int $hidefreetext 1=Hide free text - * @return int Return height of bottom margin including footer text + * @param PDF $pdf PDF + * @param CommandeFournisseur $object Object to show + * @param Translate $outputlangs Object lang for output + * @param int $hidefreetext 1=Hide free text + * @return int Return height of bottom margin including footer text */ - function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) + private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index daed4c8d432..e5759d9ff6d 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -1491,16 +1491,16 @@ class pdf_aurore extends ModelePDFSupplierProposal return $top_shift; } - /** - * Show footer of page. Need this->emetteur object + /** + * Show footer of page. Need this->emetteur object * - * @param PDF $pdf PDF - * @param Object $object Object to show - * @param Translate $outputlangs Object lang for output - * @param int $hidefreetext 1=Hide free text - * @return int Return height of bottom margin including footer text - */ - function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) + * @param PDF $pdf PDF + * @param Object $object Object to show + * @param Translate $outputlangs Object lang for output + * @param int $hidefreetext 1=Hide free text + * @return int Return height of bottom margin including footer text + */ + private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php index b58c327e1bc..80e95037d24 100644 --- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -59,7 +59,7 @@ class doc_generic_user_odt extends ModelePDFUser * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { global $conf, $langs, $mysoc; @@ -104,7 +104,7 @@ class doc_generic_user_odt extends ModelePDFUser * @param Translate $langs Lang object to use for output * @return string Description */ - function info($langs) + public function info($langs) { global $conf, $langs; @@ -203,9 +203,9 @@ class doc_generic_user_odt extends ModelePDFUser return $texte; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Function to build a document on disk using the generic odt module. + * Function to build a document on disk using the generic odt module. * * @param User $object Object source to build document * @param Translate $outputlangs Lang output object @@ -215,7 +215,7 @@ class doc_generic_user_odt extends ModelePDFUser * @param int $hideref Do not show ref * @return int 1 if OK, <=0 if KO */ - function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0) + public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable global $user, $langs, $conf, $mysoc, $hookmanager; @@ -330,7 +330,7 @@ class doc_generic_user_odt extends ModelePDFUser // Open and load template require_once ODTPHP_PATH.'odf.php'; try { - $odfHandler = new odf( + $odfHandler = new odf( $srctemplatepath, array( 'PATH_TO_TMP' => $conf->user->dir_temp, @@ -439,7 +439,7 @@ class doc_generic_user_odt extends ModelePDFUser return -1; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * get substitution array for object * @@ -448,7 +448,7 @@ class doc_generic_user_odt extends ModelePDFUser * @param string $array_key key for array * @return array array of substitutions */ - function get_substitutionarray_object($object, $outputlangs, $array_key = 'object') + public function get_substitutionarray_object($object, $outputlangs, $array_key = 'object') { // phpcs:enable $array_other = array(); diff --git a/htdocs/core/modules/user/modules_user.class.php b/htdocs/core/modules/user/modules_user.class.php index 7add1cf99d1..bdd04f1c097 100644 --- a/htdocs/core/modules/user/modules_user.class.php +++ b/htdocs/core/modules/user/modules_user.class.php @@ -44,7 +44,7 @@ abstract class ModelePDFUser extends CommonDocGenerator public $error=''; - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of active generation modules * @@ -52,7 +52,7 @@ abstract class ModelePDFUser extends CommonDocGenerator * @param integer $maxfilenamelength Max length of value to show * @return array List of templates */ - static function liste_modeles($db, $maxfilenamelength = 0) + public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable global $conf; diff --git a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php index 2dfd2cfcfee..0840f40a868 100644 --- a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php +++ b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php @@ -62,7 +62,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { global $conf, $langs, $mysoc; @@ -107,7 +107,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup * @param Translate $langs Lang object to use for output * @return string Description */ - function info($langs) + public function info($langs) { global $conf,$langs; @@ -206,7 +206,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup return $texte; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Function to build a document on disk using the generic odt module. * @@ -218,7 +218,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup * @param int $hideref Do not show ref * @return int 1 if OK, <=0 if KO */ - function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0) + public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable global $user, $langs, $conf, $mysoc, $hookmanager; @@ -353,7 +353,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup // Open and load template require_once ODTPHP_PATH.'odf.php'; try { - $odfHandler = new odf( + $odfHandler = new odf( $srctemplatepath, array( 'PATH_TO_TMP' => $conf->user->dir_temp, @@ -527,6 +527,6 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup } } - return -1; - } + return -1; + } } diff --git a/htdocs/core/modules/usergroup/modules_usergroup.class.php b/htdocs/core/modules/usergroup/modules_usergroup.class.php index 2bd717624d7..6259366aeed 100644 --- a/htdocs/core/modules/usergroup/modules_usergroup.class.php +++ b/htdocs/core/modules/usergroup/modules_usergroup.class.php @@ -38,30 +38,30 @@ */ abstract class ModelePDFUserGroup extends CommonDocGenerator { - /** - * @var string Error code (or message) - */ - public $error=''; - - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** - * Return list of active generation modules - * + * @var string Error code (or message) + */ + public $error=''; + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Return list of active generation modules + * * @param DoliDB $db Database handler * @param integer $maxfilenamelength Max length of value to show * @return array List of templates - */ - static function liste_modeles($db, $maxfilenamelength = 0) - { + */ + public static function liste_modeles($db, $maxfilenamelength = 0) + { // phpcs:enable - global $conf; + global $conf; - $type = 'group'; - $list = array(); + $type = 'group'; + $list = array(); - include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - $list = getListOfModels($db, $type, $maxfilenamelength); - return $list; - } + include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + $list = getListOfModels($db, $type, $maxfilenamelength); + return $list; + } } diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index 66b395c6c8b..3f94401bc9d 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -121,13 +121,20 @@ class SupplierInvoices extends DolibarrApi if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale // Filter by status - if ($status == 'draft') $sql.= " AND t.fk_statut IN (0)"; - if ($status == 'unpaid') $sql.= " AND t.fk_statut IN (1)"; - if ($status == 'paid') $sql.= " AND t.fk_statut IN (2)"; - if ($status == 'cancelled') $sql.= " AND t.fk_statut IN (3)"; + if ($status == 'draft') { + $sql.= " AND t.fk_statut IN (0)"; + } + if ($status == 'unpaid') { + $sql.= " AND t.fk_statut IN (1)"; + } + if ($status == 'paid') { + $sql.= " AND t.fk_statut IN (2)"; + } + if ($status == 'cancelled') { + $sql.= " AND t.fk_statut IN (3)"; + } // Insert sale filter - if ($search_sale > 0) - { + if ($search_sale > 0) { $sql .= " AND sc.fk_user = ".$search_sale; } // Add sql filters diff --git a/htdocs/fourn/class/api_supplier_orders.class.php b/htdocs/fourn/class/api_supplier_orders.class.php index 4da9a365e83..9a898fae3a7 100644 --- a/htdocs/fourn/class/api_supplier_orders.class.php +++ b/htdocs/fourn/class/api_supplier_orders.class.php @@ -63,21 +63,21 @@ class SupplierOrders extends DolibarrApi */ public function get($id) { - if(! DolibarrApiAccess::$user->rights->fournisseur->commande->lire) { - throw new RestException(401); - } + if(! DolibarrApiAccess::$user->rights->fournisseur->commande->lire) { + throw new RestException(401); + } $result = $this->order->fetch($id); if ( ! $result ) { throw new RestException(404, 'Supplier order not found'); } - if ( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } + if ( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } - $this->order->fetchObjectLinked(); - return $this->_cleanObjectDatas($this->order); + $this->order->fetchObjectLinked(); + return $this->_cleanObjectDatas($this->order); } /** @@ -94,7 +94,7 @@ class SupplierOrders extends DolibarrApi * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')" * @return array Array of order objects * - * @throws RestException + * @throws RestException */ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $status = '', $sqlfilters = '') { @@ -120,7 +120,7 @@ class SupplierOrders extends DolibarrApi if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")"; if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale - // Filter by status + // Filter by status if ($status == 'draft') $sql.= " AND t.fk_statut IN (0)"; if ($status == 'validated') $sql.= " AND t.fk_statut IN (1)"; if ($status == 'approved') $sql.= " AND t.fk_statut IN (2)"; @@ -141,7 +141,7 @@ class SupplierOrders extends DolibarrApi { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } @@ -178,7 +178,7 @@ class SupplierOrders extends DolibarrApi if( ! count($obj_ret)) { throw new RestException(404, 'No supplier order found'); } - return $obj_ret; + return $obj_ret; } /** @@ -234,9 +234,9 @@ class SupplierOrders extends DolibarrApi throw new RestException(404, 'Supplier order not found'); } - if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } + if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } foreach($request_data as $field => $value) { if ($field == 'id') continue; @@ -265,9 +265,9 @@ class SupplierOrders extends DolibarrApi throw new RestException(404, 'Supplier order not found'); } - if ( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } + if ( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } if ( $this->order->delete(DolibarrApiAccess::$user) < 0) { throw new RestException(500); @@ -302,32 +302,32 @@ class SupplierOrders extends DolibarrApi */ public function validate($id, $idwarehouse = 0, $notrigger = 0) { - if(! DolibarrApiAccess::$user->rights->fournisseur->commande->creer) { - throw new RestException(401); - } - $result = $this->order->fetch($id); - if( ! $result ) { - throw new RestException(404, 'Order not found'); - } + if(! DolibarrApiAccess::$user->rights->fournisseur->commande->creer) { + throw new RestException(401); + } + $result = $this->order->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Order not found'); + } - if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } + if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } - $result = $this->order->valid(DolibarrApiAccess::$user, $idwarehouse, $notrigger); - if ($result == 0) { - throw new RestException(304, 'Error nothing done. May be object is already validated'); - } - if ($result < 0) { - throw new RestException(500, 'Error when validating Order: '.$this->order->error); - } + $result = $this->order->valid(DolibarrApiAccess::$user, $idwarehouse, $notrigger); + if ($result == 0) { + throw new RestException(304, 'Error nothing done. May be object is already validated'); + } + if ($result < 0) { + throw new RestException(500, 'Error when validating Order: '.$this->order->error); + } - return array( - 'success' => array( - 'code' => 200, - 'message' => 'Order validated (Ref='.$this->order->ref.')' - ) - ); + return array( + 'success' => array( + 'code' => 200, + 'message' => 'Order validated (Ref='.$this->order->ref.')' + ) + ); } /** diff --git a/htdocs/fourn/class/fournisseur.class.php b/htdocs/fourn/class/fournisseur.class.php index 0636a356111..42e9b9153db 100644 --- a/htdocs/fourn/class/fournisseur.class.php +++ b/htdocs/fourn/class/fournisseur.class.php @@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; */ class Fournisseur extends Societe { - var $next_prev_filter="te.fournisseur = 1"; // Used to add a filter in Form::showrefnav method + public $next_prev_filter="te.fournisseur = 1"; // Used to add a filter in Form::showrefnav method /** @@ -41,7 +41,7 @@ class Fournisseur extends Societe * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db = $db; @@ -55,7 +55,7 @@ class Fournisseur extends Societe * * @return int Nb of orders */ - function getNbOfOrders() + public function getNbOfOrders() { $sql = "SELECT rowid"; $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf"; @@ -81,7 +81,7 @@ class Fournisseur extends Societe * * @return int Nb of ref prices, or <0 if error */ - function nbOfProductRefs() + public function nbOfProductRefs() { global $conf; @@ -102,13 +102,13 @@ class Fournisseur extends Societe } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load statistics indicators * * @return int <0 if KO, >0 if OK */ - function load_state_board() + public function load_state_board() { // phpcs:enable global $conf, $user; @@ -145,7 +145,7 @@ class Fournisseur extends Societe } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Create a supplier category * @@ -153,7 +153,7 @@ class Fournisseur extends Societe * @param string $name Category name * @return int <0 if KO, 0 if OK */ - function CreateCategory($user, $name) + public function CreateCategory($user, $name) { // phpcs:enable $sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie (label,visible,type)"; @@ -175,13 +175,13 @@ class Fournisseur extends Societe } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return the suppliers list * * @return array Array of suppliers */ - function ListArray() + public function ListArray() { // phpcs:enable global $conf; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 9ee3883bb60..fbc53183ea1 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -9,7 +9,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2019 Frédéric France * Copyright (C) 2018 Ferran Marcet * * This program is free software; you can redistribute it and/or modify @@ -262,7 +262,7 @@ class CommandeFournisseur extends CommonOrder $sql.= " c.date_commande as date_commande, c.date_livraison as date_livraison, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_projet as fk_project, c.remise_percent, c.source, c.fk_input_method,"; $sql.= " c.fk_account,"; $sql.= " c.note_private, c.note_public, c.model_pdf, c.extraparams, c.billed,"; - $sql.= " c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multicurrency_total_ht, c.multicurrency_total_tva, c.multicurrency_total_ttc,"; + $sql.= " c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multicurrency_total_ht, c.multicurrency_total_tva, c.multicurrency_total_ttc,"; $sql.= " cm.libelle as methode_commande,"; $sql.= " cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle,"; $sql.= " p.code as mode_reglement_code, p.libelle as mode_reglement_libelle"; @@ -272,7 +272,7 @@ class CommandeFournisseur extends CommonOrder $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_payment_term as cr ON c.fk_cond_reglement = cr.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as p ON c.fk_mode_reglement = p.id"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_input_method as cm ON cm.rowid = c.fk_input_method"; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON c.fk_incoterms = i.rowid'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON c.fk_incoterms = i.rowid'; $sql.= " WHERE c.entity = ".$conf->entity; if ($ref) $sql.= " AND c.ref='".$this->db->escape($ref)."'"; else $sql.= " AND c.rowid=".$id; @@ -375,14 +375,14 @@ class CommandeFournisseur extends CommonOrder } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load array lines * * @param int $only_product Return only physical products * @return int <0 if KO, >0 if OK */ - function fetch_lines($only_product = 0) + public function fetch_lines($only_product = 0) { // phpcs:enable //$result=$this->fetch_lines(); @@ -616,7 +616,7 @@ class CommandeFournisseur extends CommonOrder return $this->LibStatut($this->statut, $mode, $this->billed); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return label of a status * @@ -625,7 +625,7 @@ class CommandeFournisseur extends CommonOrder * @param int $billed 1=Billed * @return string Label of status */ - function LibStatut($statut, $mode = 0, $billed = 0) + public function LibStatut($statut, $mode = 0, $billed = 0) { // phpcs:enable global $conf, $langs; @@ -1079,7 +1079,7 @@ class CommandeFournisseur extends CommonOrder return $result ; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Cancel an approved order. * The cancellation is done after approval @@ -1088,12 +1088,12 @@ class CommandeFournisseur extends CommonOrder * @param int $idwarehouse Id warehouse to use for stock change (not used for supplier orders). * @return int >0 if Ok, <0 if Ko */ - function Cancel($user, $idwarehouse = -1) + public function Cancel($user, $idwarehouse = -1) { // phpcs:enable global $langs,$conf; - $error=0; + $error=0; //dol_syslog("CommandeFournisseur::Cancel"); $result = 0; @@ -2006,13 +2006,13 @@ class CommandeFournisseur extends CommonOrder } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Get list of order methods * * @return int 0 if OK, <0 if KO */ - function get_methodes_commande() + public function get_methodes_commande() { // phpcs:enable $sql = "SELECT rowid, libelle"; @@ -2093,7 +2093,7 @@ class CommandeFournisseur extends CommonOrder } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set a delivery in database for this supplier order * @@ -2103,7 +2103,7 @@ class CommandeFournisseur extends CommonOrder * @param string $comment Comment * @return int <0 if KO, >0 if OK */ - function Livraison($user, $date, $type, $comment) + public function Livraison($user, $date, $type, $comment) { // phpcs:enable global $conf, $langs; @@ -2210,7 +2210,7 @@ class CommandeFournisseur extends CommonOrder return $result ; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set the planned delivery date * @@ -2219,7 +2219,7 @@ class CommandeFournisseur extends CommonOrder * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function set_date_livraison($user, $date_livraison, $notrigger = 0) + public function set_date_livraison($user, $date_livraison, $notrigger = 0) { // phpcs:enable if ($user->rights->fournisseur->commande->creer) @@ -2276,7 +2276,7 @@ class CommandeFournisseur extends CommonOrder } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set the id projet * @@ -2285,7 +2285,7 @@ class CommandeFournisseur extends CommonOrder * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 si ko, >0 si ok */ - function set_id_projet($user, $id_projet, $notrigger = 0) + public function set_id_projet($user, $id_projet, $notrigger = 0) { // phpcs:enable if ($user->rights->fournisseur->commande->creer) @@ -2469,7 +2469,7 @@ class CommandeFournisseur extends CommonOrder */ public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $price_base_type = 'HT', $info_bits = 0, $type = 0, $notrigger = 0, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $ref_supplier = '') { - global $mysoc, $conf; + global $mysoc, $conf; dol_syslog(get_class($this)."::updateline $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $price_base_type, $info_bits, $type, $fk_unit"); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; @@ -2739,13 +2739,13 @@ class CommandeFournisseur extends CommonOrder } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Charge indicateurs this->nb de tableau de bord * * @return int <0 si ko, >0 si ok */ - function load_state_board() + public function load_state_board() { // phpcs:enable global $conf, $user; @@ -2782,14 +2782,14 @@ class CommandeFournisseur extends CommonOrder } } - // 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; @@ -2918,7 +2918,7 @@ class CommandeFournisseur extends CommonOrder * @return Translated string */ public function getMaxDeliveryTimeDay($langs) - { + { if (empty($this->lines)) return ''; $obj = new ProductFournisseur($this->db); @@ -3155,7 +3155,7 @@ class CommandeFournisseur extends CommonOrder * @param int $filtre_statut Filter on shipment status * @return int <0 if KO, Nb of lines found if OK */ - function loadReceptions($filtre_statut = -1) + public function loadReceptions($filtre_statut = -1) { $this->receptions = array(); @@ -3579,7 +3579,7 @@ class CommandeFournisseurLigne extends CommonOrderLine * @param int $notrigger 1=Disable call to triggers * @return int <0 if KO, >0 if OK */ - function delete($notrigger) + public function delete($notrigger) { global $user; diff --git a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php index 49f23cf5191..6db4607573c 100644 --- a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php +++ b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php @@ -17,21 +17,19 @@ */ /** - * \file fourn/class/fournisseur.commande.dispatch.class.php + * \file htdocs/fourn/class/fournisseur.commande.dispatch.class.php * \ingroup fournisseur stock * \brief This file is an example for a CRUD class file (Create/Read/Update/Delete) - * Initialy built by build_class_from_table on 2015-02-24 10:38 + * Initialy built by build_class_from_table on 2015-02-24 10:38 */ // Put here all includes required by your class file require_once DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php"; require_once DOL_DOCUMENT_ROOT."/reception/class/reception.class.php"; -//require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"; -//require_once DOL_DOCUMENT_ROOT."/product/class/product.class.php"; /** - * Class to manage table commandefournisseurdispatch + * Class to manage table commandefournisseurdispatch */ class CommandeFournisseurDispatch extends CommonObject { @@ -114,7 +112,7 @@ class CommandeFournisseurDispatch extends CommonObject * * @param DoliDb $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db = $db; @@ -135,7 +133,7 @@ class CommandeFournisseurDispatch extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, Id of created object if OK */ - function create($user, $notrigger = 0) + public function create($user, $notrigger = 0) { global $conf, $langs, $hookmanager; $error=0; @@ -256,7 +254,7 @@ class CommandeFournisseurDispatch extends CommonObject * @param string $ref Ref * @return int <0 if KO, >0 if OK */ - function fetch($id, $ref = '') + public function fetch($id, $ref = '') { global $langs; $sql = "SELECT"; @@ -325,7 +323,7 @@ class CommandeFournisseurDispatch 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) { global $conf, $langs; $error=0; @@ -420,7 +418,7 @@ class CommandeFournisseurDispatch 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; @@ -477,7 +475,7 @@ class CommandeFournisseurDispatch 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; @@ -531,15 +529,15 @@ class CommandeFournisseurDispatch extends CommonObject /** * Return label of the status of object * - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto + * @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 /** * Return label of a status * @@ -547,7 +545,7 @@ class CommandeFournisseurDispatch 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 of status */ - function LibStatut($statut, $mode = 0) + public function LibStatut($statut, $mode = 0) { // phpcs:enable global $langs; @@ -568,20 +566,20 @@ class CommandeFournisseurDispatch extends CommonObject elseif ($mode == 3) { if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0'); - if ($statut==1) return img_picto($langs->trans($this->statuts[$statut]), 'statut4'); - if ($statut==2) return img_picto($langs->trans($this->statuts[$statut]), 'statut8'); + elseif ($statut==1) return img_picto($langs->trans($this->statuts[$statut]), 'statut4'); + elseif ($statut==2) return img_picto($langs->trans($this->statuts[$statut]), 'statut8'); } elseif ($mode == 4) { if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]); - if ($statut==1) return img_picto($langs->trans($this->statuts[$statut]), 'statut4').' '.$langs->trans($this->statuts[$statut]); - if ($statut==2) return img_picto($langs->trans($this->statuts[$statut]), 'statut8').' '.$langs->trans($this->statuts[$statut]); + elseif ($statut==1) return img_picto($langs->trans($this->statuts[$statut]), 'statut4').' '.$langs->trans($this->statuts[$statut]); + elseif ($statut==2) return img_picto($langs->trans($this->statuts[$statut]), 'statut8').' '.$langs->trans($this->statuts[$statut]); } elseif ($mode == 5) { if ($statut==0) return ''.$langs->trans($this->statutshort[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut0'); - if ($statut==1) return ''.$langs->trans($this->statutshort[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut4'); - if ($statut==2) return ''.$langs->trans($this->statutshort[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut8'); + elseif ($statut==1) return ''.$langs->trans($this->statutshort[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut4'); + elseif ($statut==2) return ''.$langs->trans($this->statutshort[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut8'); } } @@ -592,7 +590,7 @@ class CommandeFournisseurDispatch extends CommonObject * * @return void */ - function initAsSpecimen() + public function initAsSpecimen() { $this->id=0; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 05b6754bc5d..d2c7ad43a00 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -29,9 +29,9 @@ */ /** - * \file htdocs/fourn/class/fournisseur.facture.class.php - * \ingroup fournisseur,facture - * \brief File of class to manage suppliers invoices + * \file htdocs/fourn/class/fournisseur.facture.class.php + * \ingroup fournisseur,facture + * \brief File of class to manage suppliers invoices */ include_once DOL_DOCUMENT_ROOT.'/core/class/commoninvoice.class.php'; @@ -53,14 +53,14 @@ class FactureFournisseur extends CommonInvoice public $table_element='facture_fourn'; /** - * @var int Name of subtable line - */ - public $table_element_line='facture_fourn_det'; + * @var int Name of subtable line + */ + public $table_element_line='facture_fourn_det'; /** - * @var int Field with ID of parent key if this field has a parent - */ - public $fk_element='fk_facture_fourn'; + * @var int Field with ID of parent key if this field has a parent + */ + public $fk_element='fk_facture_fourn'; public $picto='bill'; @@ -707,22 +707,22 @@ class FactureFournisseur extends CommonInvoice } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load this->lines * * @return int 1 si ok, < 0 si erreur */ - function fetch_lines() + public function fetch_lines() { // phpcs:enable - $this->lines = array(); + $this->lines = array(); $sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.date_start, f.date_end, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.vat_src_code, f.tva_tx'; $sql.= ', f.localtax1_tx, f.localtax2_tx, f.localtax1_type, f.localtax2_type, f.total_localtax1, f.total_localtax2, f.fk_facture_fourn '; $sql.= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_product, f.product_type, f.info_bits, f.rang, f.special_code, f.fk_parent_line, f.fk_unit'; $sql.= ', p.rowid as product_id, p.ref as product_ref, p.label as label, p.description as product_desc'; - $sql.= ', f.fk_multicurrency, f.multicurrency_code, f.multicurrency_subprice, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc'; + $sql.= ', f.fk_multicurrency, f.multicurrency_code, f.multicurrency_subprice, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det as f'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON f.fk_product = p.rowid'; $sql.= ' WHERE fk_facture_fourn='.$this->id; @@ -783,12 +783,12 @@ class FactureFournisseur extends CommonInvoice $line->fk_unit = $obj->fk_unit; // Multicurrency - $line->fk_multicurrency = $obj->fk_multicurrency; - $line->multicurrency_code = $obj->multicurrency_code; - $line->multicurrency_subprice = $obj->multicurrency_subprice; - $line->multicurrency_total_ht = $obj->multicurrency_total_ht; - $line->multicurrency_total_tva = $obj->multicurrency_total_tva; - $line->multicurrency_total_ttc = $obj->multicurrency_total_ttc; + $line->fk_multicurrency = $obj->fk_multicurrency; + $line->multicurrency_code = $obj->multicurrency_code; + $line->multicurrency_subprice = $obj->multicurrency_subprice; + $line->multicurrency_total_ht = $obj->multicurrency_total_ht; + $line->multicurrency_total_tva = $obj->multicurrency_total_tva; + $line->multicurrency_total_ttc = $obj->multicurrency_total_ttc; $this->lines[$i] = $line; @@ -934,14 +934,14 @@ class FactureFournisseur 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; @@ -1187,16 +1187,16 @@ class FactureFournisseur extends CommonInvoice } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Tag invoice as a payed invoice * * @param User $user Object user - * @param string $close_code Code renseigne si on classe a payee completement alors que paiement incomplet. Not implementd yet. - * @param string $close_note Commentaire renseigne si on classe a payee alors que paiement incomplet. Not implementd yet. + * @param string $close_code Code renseigne si on classe a payee completement alors que paiement incomplet. Not implementd yet. + * @param string $close_note Commentaire renseigne si on classe a payee alors que paiement incomplet. Not implementd yet. * @return int <0 si ko, >0 si ok */ - function set_paid($user, $close_code = '', $close_note = '') + public function set_paid($user, $close_code = '', $close_note = '') { // phpcs:enable global $conf,$langs; @@ -1237,7 +1237,7 @@ class FactureFournisseur 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, @@ -1246,7 +1246,7 @@ class FactureFournisseur extends CommonInvoice * @param User $user Object user that change status * @return int <0 si ok, >0 si ok */ - function set_unpaid($user) + public function set_unpaid($user) { // phpcs:enable global $conf,$langs; @@ -1450,7 +1450,7 @@ class FactureFournisseur extends CommonInvoice } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set draft status * @@ -1458,7 +1458,7 @@ class FactureFournisseur 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; @@ -2033,7 +2033,7 @@ class FactureFournisseur extends CommonInvoice } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Renvoi liste des factures remplacables * Statut validee ou abandonnee pour raison autre + non payee + aucun paiement + pas deja remplacee @@ -2042,7 +2042,7 @@ class FactureFournisseur extends CommonInvoice * @return array|int Tableau des factures ('id'=>id, 'ref'=>ref, 'status'=>status, 'paymentornot'=>0/1) * <0 if error */ - function list_replacable_supplier_invoices($socid = 0) + public function list_replacable_supplier_invoices($socid = 0) { // phpcs:enable global $conf; @@ -2084,7 +2084,7 @@ class FactureFournisseur extends CommonInvoice } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Renvoi liste des factures qualifiables pour correction par avoir * Les factures qui respectent les regles suivantes sont retournees: @@ -2094,7 +2094,7 @@ class FactureFournisseur extends CommonInvoice * @return array|int Tableau des factures ($id => array('ref'=>,'paymentornot'=>,'status'=>,'paye'=>) * <0 if error */ - function list_qualified_avoir_supplier_invoices($socid = 0) + public function list_qualified_avoir_supplier_invoices($socid = 0) { // phpcs:enable global $conf; @@ -2137,14 +2137,14 @@ class FactureFournisseur 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; @@ -2246,8 +2246,8 @@ class FactureFournisseur extends CommonInvoice if (! empty($this->total_ttc)) $label.= '
' . $langs->trans('AmountTTC') . ': ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); if ($this->type == self::TYPE_REPLACEMENT) $label=$langs->transnoentitiesnoconv("ShowInvoiceReplace").': '.$this->ref; - if ($this->type == self::TYPE_CREDIT_NOTE) $label=$langs->transnoentitiesnoconv("ShowInvoiceAvoir").': '.$this->ref; - if ($this->type == self::TYPE_DEPOSIT) $label=$langs->transnoentitiesnoconv("ShowInvoiceDeposit").': '.$this->ref; + elseif ($this->type == self::TYPE_CREDIT_NOTE) $label=$langs->transnoentitiesnoconv("ShowInvoiceAvoir").': '.$this->ref; + elseif ($this->type == self::TYPE_DEPOSIT) $label=$langs->transnoentitiesnoconv("ShowInvoiceDeposit").': '.$this->ref; if ($moretitle) $label.=' - '.$moretitle; $ref=$this->ref; @@ -2434,13 +2434,13 @@ class FactureFournisseur extends CommonInvoice $this->total_ttc = $xnbp*119.6; } - // 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; @@ -3187,13 +3187,13 @@ class SupplierInvoiceLine extends CommonObjectLine } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Mise a jour de l'objet ligne de commande en base * * @return int <0 si ko, >0 si ok */ - function update_total() + public function update_total() { // phpcs:enable $this->db->begin(); diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index d4018f76895..bbdea07270e 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -156,14 +156,14 @@ class ProductFournisseur extends Product } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Remove a price for a couple supplier-product * * @param int $rowid Line id of price * @return int <0 if KO, >0 if OK */ - function remove_product_fournisseur_price($rowid) + public function remove_product_fournisseur_price($rowid) { // phpcs:enable global $conf, $user; @@ -202,7 +202,7 @@ class ProductFournisseur extends Product } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Modify the purchase price for a supplier * @@ -229,7 +229,7 @@ class ProductFournisseur extends Product * @param string $desc_fourn Custom description for product_fourn_price * @return int <0 if KO, >=0 if OK */ - function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn, $availability, $ref_fourn, $tva_tx, $charges = 0, $remise_percent = 0, $remise = 0, $newnpr = 0, $delivery_time_days = 0, $supplier_reputation = '', $localtaxes_array = array(), $newdefaultvatcode = '', $multicurrency_buyprice = 0, $multicurrency_price_base_type = 'HT', $multicurrency_tx = 1, $multicurrency_code = '', $desc_fourn = '') + public function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn, $availability, $ref_fourn, $tva_tx, $charges = 0, $remise_percent = 0, $remise = 0, $newnpr = 0, $delivery_time_days = 0, $supplier_reputation = '', $localtaxes_array = array(), $newdefaultvatcode = '', $multicurrency_buyprice = 0, $multicurrency_price_base_type = 'HT', $multicurrency_tx = 1, $multicurrency_code = '', $desc_fourn = '') { // phpcs:enable global $conf, $langs; @@ -473,7 +473,7 @@ class ProductFournisseur extends Product } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Loads the price information of a provider * @@ -481,7 +481,7 @@ class ProductFournisseur extends Product * @param int $ignore_expression Ignores the math expression for calculating price and uses the db value instead * @return int < 0 if KO, 0 if OK but not found, > 0 if OK */ - function fetch_product_fournisseur_price($rowid, $ignore_expression = 0) + public function fetch_product_fournisseur_price($rowid, $ignore_expression = 0) { // phpcs:enable global $conf; @@ -563,7 +563,7 @@ class ProductFournisseur extends Product } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * List all supplier prices of a product * @@ -574,7 +574,7 @@ class ProductFournisseur extends Product * @param int $offset Offset * @return array Array of Products with new properties to define supplier price */ - function list_product_fournisseur_price($prodid, $sortfield = '', $sortorder = '', $limit = 0, $offset = 0) + public function list_product_fournisseur_price($prodid, $sortfield = '', $sortorder = '', $limit = 0, $offset = 0) { // phpcs:enable global $conf; @@ -666,7 +666,7 @@ class ProductFournisseur extends Product } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load properties for minimum price * @@ -675,7 +675,7 @@ class ProductFournisseur extends Product * @param int $socid get min price for specific supplier * @return int <0 if KO, 0=Not found of no product id provided, >0 if OK */ - function find_min_price_product_fournisseur($prodid, $qty = 0, $socid = 0) + public function find_min_price_product_fournisseur($prodid, $qty = 0, $socid = 0) { // phpcs:enable global $conf; @@ -810,7 +810,7 @@ class ProductFournisseur extends Product * @param int $expression_id Expression * @return int <0 if KO, >0 if OK */ - function setSupplierPriceExpression($expression_id) + public function setSupplierPriceExpression($expression_id) { global $conf; @@ -848,7 +848,7 @@ class ProductFournisseur extends Product * @return string String with supplier price * TODO Remove this method. Use getNomUrl directly. */ - function getSocNomUrl($withpicto = 0, $option = 'supplier', $maxlen = 0, $notooltip = 0) + public function getSocNomUrl($withpicto = 0, $option = 'supplier', $maxlen = 0, $notooltip = 0) { $thirdparty = new Fournisseur($this->db); $thirdparty->fetch($this->fourn_id); @@ -856,7 +856,7 @@ class ProductFournisseur extends Product return $thirdparty->getNomUrl($withpicto, $option, $maxlen, $notooltip); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Display price of product * @@ -868,7 +868,7 @@ class ProductFournisseur extends Product * to display in table format. * @return string String with supplier price */ - function display_price_product_fournisseur($showunitprice = 1, $showsuptitle = 1, $maxlen = 0, $notooltip = 0, $productFournList = array()) + public function display_price_product_fournisseur($showunitprice = 1, $showsuptitle = 1, $maxlen = 0, $notooltip = 0, $productFournList = array()) { // phpcs:enable global $langs; @@ -921,7 +921,7 @@ class ProductFournisseur extends Product * @param int $offset Offset * @return array Array of Log prices */ - function listProductFournisseurPriceLog($product_fourn_price_id, $sortfield = '', $sortorder = '', $limit = 0, $offset = 0) + public function listProductFournisseurPriceLog($product_fourn_price_id, $sortfield = '', $sortorder = '', $limit = 0, $offset = 0) { global $conf; @@ -967,7 +967,7 @@ class ProductFournisseur extends Product * to display in table format. * @return string HTML String with supplier price */ - function displayPriceProductFournisseurLog($productFournLogList = array()) + public function displayPriceProductFournisseurLog($productFournLogList = array()) { global $langs; @@ -1001,7 +1001,7 @@ class ProductFournisseur extends Product * @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; diff --git a/htdocs/hrm/class/establishment.class.php b/htdocs/hrm/class/establishment.class.php index 731767e78cd..8d8098642e2 100644 --- a/htdocs/hrm/class/establishment.class.php +++ b/htdocs/hrm/class/establishment.class.php @@ -398,7 +398,7 @@ class Establishment extends CommonObject * @param int $id Id of record * @return Object */ - function getEstablishment($id) + public function getEstablishment($id) { $sql = 'SELECT e.rowid, e.name, e.datec, e.fk_user_author, e.tms, e.fk_user_mod, e.entity'; $sql.= ' FROM '.MAIN_DB_PREFIX.'establishment as e'; @@ -455,13 +455,13 @@ class Establishment extends CommonObject * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @return string String with URL */ - function getNomUrlParent($id = 0, $withpicto = 0) + public function getNomUrlParent($id = 0, $withpicto = 0) { global $langs, $conf; $result=''; - $obj = $this->getEstablishment(($id>0)?$id:$conf->entity); + $obj = $this->getEstablishment(($id>0)?$id:$conf->entity); $link = ''; $linkend=''; diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php index c1e421d5ef9..f262805b3fe 100644 --- a/htdocs/loan/class/loan.class.php +++ b/htdocs/loan/class/loan.class.php @@ -66,7 +66,7 @@ class Loan extends CommonObject public $date_creation; public $date_modification; public $date_validation; - + public $insurance_amount; /** @@ -95,7 +95,7 @@ class Loan extends CommonObject * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db = $db; } @@ -106,7 +106,7 @@ class Loan extends CommonObject * @param int $id id object * @return int <0 error , >=0 no error */ - function fetch($id) + public function fetch($id) { $sql = "SELECT l.rowid, l.label, l.capital, l.datestart, l.dateend, l.nbterm, l.rate, l.note_private, l.note_public, l.insurance_amount,"; $sql.= " l.paid, l.accountancy_account_capital, l.accountancy_account_insurance, l.accountancy_account_interest, l.fk_projet as fk_project"; @@ -162,7 +162,7 @@ class Loan 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, $langs; @@ -255,7 +255,7 @@ class Loan 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; @@ -325,7 +325,7 @@ class Loan extends CommonObject * @param User $user User who modified * @return int <0 if error, >0 if ok */ - function update($user) + public function update($user) { $this->db->begin(); @@ -364,14 +364,14 @@ class Loan extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Tag loan 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."loan SET"; @@ -393,12 +393,12 @@ class Loan extends CommonObject * @param integer $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->paid, $mode, $alreadypaid); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return label for given status * @@ -407,7 +407,7 @@ class Loan extends CommonObject * @param integer $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; @@ -460,7 +460,7 @@ class Loan extends CommonObject * @param int $maxlen Label max length * @return string Chaine with URL */ - function getNomUrl($withpicto = 0, $maxlen = 0) + public function getNomUrl($withpicto = 0, $maxlen = 0) { global $langs; @@ -490,7 +490,7 @@ class Loan extends CommonObject * * @return void */ - function initAsSpecimen() + public function initAsSpecimen() { global $user, $langs, $conf; @@ -518,7 +518,7 @@ class Loan extends CommonObject * * @return int Amount of payment already done, <0 if KO */ - function getSumPayment() + public function getSumPayment() { $table='payment_loan'; $field='fk_loan'; @@ -552,7 +552,7 @@ class Loan extends CommonObject * @param int $id Id of record * @return integer|null */ - function info($id) + public function info($id) { $sql = 'SELECT l.rowid, l.datec, l.fk_user_author, l.fk_user_modif,'; $sql.= ' l.tms'; @@ -597,5 +597,5 @@ class Loan extends CommonObject $this->error=$this->db->lasterror(); return -1; } - } + } } diff --git a/htdocs/loan/class/loanschedule.class.php b/htdocs/loan/class/loanschedule.class.php index 8d73e667d52..c370f2115bd 100644 --- a/htdocs/loan/class/loanschedule.class.php +++ b/htdocs/loan/class/loanschedule.class.php @@ -354,22 +354,21 @@ class LoanSchedule extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - public function delete($user, $notrigger = 0) + public function delete($user, $notrigger = 0) { global $conf, $langs; $error=0; $this->db->begin(); - if (! $error) - { + if (! $error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element; $sql.= " WHERE rowid=".$this->id; dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } - } + } if (! $error) { @@ -403,7 +402,7 @@ class LoanSchedule extends CommonObject $this->db->commit(); return 1; } - } + } /** * Calculate Monthly Payments diff --git a/htdocs/loan/class/paymentloan.class.php b/htdocs/loan/class/paymentloan.class.php index 6e4bab7f444..f75ffde1849 100644 --- a/htdocs/loan/class/paymentloan.class.php +++ b/htdocs/loan/class/paymentloan.class.php @@ -113,7 +113,7 @@ class PaymentLoan extends CommonObject * @param User $user User making payment * @return int <0 if KO, id of payment if OK */ - function create($user) + public function create($user) { global $conf, $langs; @@ -196,7 +196,7 @@ class PaymentLoan 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"; @@ -273,7 +273,7 @@ class PaymentLoan extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user = 0, $notrigger = 0) + public function update($user = 0, $notrigger = 0) { global $conf, $langs; $error=0; @@ -361,7 +361,7 @@ class PaymentLoan 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; @@ -388,10 +388,10 @@ class PaymentLoan 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. @@ -401,8 +401,8 @@ class PaymentLoan 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) @@ -435,7 +435,7 @@ class PaymentLoan extends CommonObject * @param string $emetteur_banque Name of bank * @return int <0 if KO, >0 if OK */ - function addPaymentToBank($user, $fk_loan, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque) + public function addPaymentToBank($user, $fk_loan, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque) { global $conf; @@ -452,7 +452,7 @@ class PaymentLoan extends CommonObject if ($mode == 'payment_loan') $total=-$total; // Insert payment into llx_bank -$bank_line_id = $acc->addline( + $bank_line_id = $acc->addline( $this->datep, $this->paymenttype, // Payment mode id or code ("CHQ or VIR for example") $label, @@ -513,14 +513,14 @@ $bank_line_id = $acc->addline( } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Update link between loan's payment and the line generate in llx_bank * * @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."payment_loan SET fk_bank = ".$id_bank." WHERE rowid = ".$this->id; @@ -546,7 +546,7 @@ $bank_line_id = $acc->addline( * @param int $maxlen Max length label * @return string Chaine with URL */ - function getNomUrl($withpicto = 0, $maxlen = 0) + public function getNomUrl($withpicto = 0, $maxlen = 0) { global $langs; diff --git a/htdocs/modulebuilder/template/class/api_mymodule.class.php b/htdocs/modulebuilder/template/class/api_mymodule.class.php index 20de77def18..cdb5a4b74f4 100644 --- a/htdocs/modulebuilder/template/class/api_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/api_mymodule.class.php @@ -154,8 +154,7 @@ class MyModuleApi extends DolibarrApi $sql.= $db->order($sortfield, $sortorder); if ($limit) { - if ($page < 0) - { + if ($page < 0) { $page = 0; } $offset = $limit * $page; diff --git a/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php index a62cf3924d6..83644cd1f0e 100644 --- a/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php @@ -17,46 +17,46 @@ dol_include_once("/mymodule/class/myobject.class.php"); */ class mailing_mailinglist_mymodule_myobject extends MailingTargets { - // CHANGE THIS: Put here a name not already used - var $name='mailinglist_mymodule_myobject'; - // CHANGE THIS: Put here a description of your selector module - var $desc='My object emailing target selector'; - // CHANGE THIS: Set to 1 if selector is available for admin users only - var $require_admin=0; + // CHANGE THIS: Put here a name not already used + public $name='mailinglist_mymodule_myobject'; + // CHANGE THIS: Put here a description of your selector module + public $desc='My object emailing target selector'; + // CHANGE THIS: Set to 1 if selector is available for admin users only + public $require_admin=0; - var $enabled=0; - var $require_module=array(); - var $picto='mymodule@mymodule'; + public $enabled=0; + public $require_module=array(); + public $picto='mymodule@mymodule'; - /** + /** * @var DoliDB Database handler. */ public $db; - /** - * Constructor + /** + * Constructor * - * @param DoliDB $db Database handler + * @param DoliDB $db Database handler */ - function __construct($db) - { - global $conf; + public function __construct($db) + { + global $conf; - $this->db=$db; - if (is_array($conf->modules)) - { - $this->enabled=in_array('mymodule', $conf->modules)?1:0; - } - } + $this->db=$db; + if (is_array($conf->modules)) + { + $this->enabled=in_array('mymodule', $conf->modules)?1:0; + } + } /** - * Affiche formulaire de filtre qui apparait dans page de selection des destinataires de mailings + * Affiche formulaire de filtre qui apparait dans page de selection des destinataires de mailings * - * @return string Retourne zone select + * @return string Retourne zone select */ - function formFilter() + public function formFilter() { global $langs; $langs->load("members"); @@ -71,7 +71,7 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets $s.=''; foreach($arraystatus as $status) { - $s.=''; + $s.=''; } $s.=''; $s.='
'; @@ -81,122 +81,122 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets /** - * Renvoie url lien vers fiche de la source du destinataire du mailing - * - * @param int $id ID - * @return string Url lien - */ - function url($id) - { - return ''.img_object('', "generic").''; - } + * Renvoie url lien vers fiche de la source du destinataire du mailing + * + * @param int $id ID + * @return string Url lien + */ + public function url($id) + { + return ''.img_object('', "generic").''; + } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - /** - * This is the main function that returns the array of emails - * - * @param int $mailing_id Id of emailing - * @return int <0 if error, number of emails added if ok - */ - function add_to_target($mailing_id) - { + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * This is the main function that returns the array of emails + * + * @param int $mailing_id Id of emailing + * @return int <0 if error, number of emails added if ok + */ + public function add_to_target($mailing_id) + { // phpcs:enable - $target = array(); - $j = 0; + $target = array(); + $j = 0; - $sql = " select rowid as id, email, firstname, lastname, plan, partner"; - $sql.= " from ".MAIN_DB_PREFIX."myobject"; - $sql.= " where email IS NOT NULL AND email != ''"; - if (! empty($_POST['filter']) && $_POST['filter'] != 'none') $sql.= " AND status = '".$this->db->escape($_POST['filter'])."'"; - $sql.= " ORDER BY email"; + $sql = " select rowid as id, email, firstname, lastname, plan, partner"; + $sql.= " from ".MAIN_DB_PREFIX."myobject"; + $sql.= " where email IS NOT NULL AND email != ''"; + if (! empty($_POST['filter']) && $_POST['filter'] != 'none') $sql.= " AND status = '".$this->db->escape($_POST['filter'])."'"; + $sql.= " ORDER BY email"; - // Stocke destinataires dans target - $result=$this->db->query($sql); - if ($result) - { - $num = $this->db->num_rows($result); - $i = 0; + // Stocke destinataires dans target + $result=$this->db->query($sql); + if ($result) + { + $num = $this->db->num_rows($result); + $i = 0; - dol_syslog("mailinglist_mymodule_myobject.modules.php: mailing ".$num." targets found"); + dol_syslog("mailinglist_mymodule_myobject.modules.php: mailing ".$num." targets found"); - $old = ''; - while ($i < $num) - { - $obj = $this->db->fetch_object($result); - if ($old <> $obj->email) - { - $target[$j] = array( - 'email' => $obj->email, - 'name' => $obj->lastname, - 'id' => $obj->id, - 'firstname' => $obj->firstname, - 'other' => $obj->plan.';'.$obj->partner, - 'source_url' => $this->url($obj->id), - 'source_id' => $obj->id, - 'source_type' => 'dolicloud' - ); - $old = $obj->email; - $j++; - } + $old = ''; + while ($i < $num) + { + $obj = $this->db->fetch_object($result); + if ($old <> $obj->email) + { + $target[$j] = array( + 'email' => $obj->email, + 'name' => $obj->lastname, + 'id' => $obj->id, + 'firstname' => $obj->firstname, + 'other' => $obj->plan.';'.$obj->partner, + 'source_url' => $this->url($obj->id), + 'source_id' => $obj->id, + 'source_type' => 'dolicloud' + ); + $old = $obj->email; + $j++; + } - $i++; - } - } - else - { - dol_syslog($this->db->error()); - $this->error=$this->db->error(); - return -1; - } + $i++; + } + } + else + { + dol_syslog($this->db->error()); + $this->error=$this->db->error(); + return -1; + } - // You must fill the $target array with record like this - // $target[0]=array('email'=>'email_0','name'=>'name_0','firstname'=>'firstname_0'); - // ... - // $target[n]=array('email'=>'email_n','name'=>'name_n','firstname'=>'firstname_n'); + // You must fill the $target array with record like this + // $target[0]=array('email'=>'email_0','name'=>'name_0','firstname'=>'firstname_0'); + // ... + // $target[n]=array('email'=>'email_n','name'=>'name_n','firstname'=>'firstname_n'); - // Example: $target[0]=array('email'=>'myemail@mydomain.com','name'=>'Doe','firstname'=>'John'); + // Example: $target[0]=array('email'=>'myemail@mydomain.com','name'=>'Doe','firstname'=>'John'); - // ----- Your code end here ----- + // ----- Your code end here ----- - return parent::add_to_target($mailing_id, $target); - } + return parent::add_to_target($mailing_id, $target); + } - /** - * On the main mailing area, there is a box with statistics. - * If you want to add a line in this report you must provide an - * array of SQL request that returns two field: - * One called "label", One called "nb". - * - * @return array - */ - function getSqlArrayForStats() - { - // CHANGE THIS: Optionnal + /** + * On the main mailing area, there is a box with statistics. + * If you want to add a line in this report you must provide an + * array of SQL request that returns two field: + * One called "label", One called "nb". + * + * @return array + */ + public function getSqlArrayForStats() + { + // CHANGE THIS: Optionnal - //var $statssql=array(); - //$this->statssql[0]="SELECT field1 as label, count(distinct(email)) as nb FROM mytable WHERE email IS NOT NULL"; + //var $statssql=array(); + //$this->statssql[0]="SELECT field1 as label, count(distinct(email)) as nb FROM mytable WHERE email IS NOT NULL"; - return array(); - } + return array(); + } - /** - * Return here number of distinct emails returned by your selector. - * For example if this selector is used to extract 500 different - * emails from a text file, this function must return 500. - * - * @param string $filter Filter - * @param string $option Options - * @return int Nb of recipients or -1 if KO - */ - function getNbOfRecipients($filter = 1, $option = '') - { - $a=parent::getNbOfRecipients("select count(distinct(email)) as nb from ".MAIN_DB_PREFIX."myobject as p where email IS NOT NULL AND email != ''"); + /** + * Return here number of distinct emails returned by your selector. + * For example if this selector is used to extract 500 different + * emails from a text file, this function must return 500. + * + * @param string $filter Filter + * @param string $option Options + * @return int Nb of recipients or -1 if KO + */ + public function getNbOfRecipients($filter = 1, $option = '') + { + $a=parent::getNbOfRecipients("select count(distinct(email)) as nb from ".MAIN_DB_PREFIX."myobject as p where email IS NOT NULL AND email != ''"); - if ($a < 0) return -1; - return $a; - } + if ($a < 0) return -1; + return $a; + } } diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index d8bd86e36b2..0f350e83226 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -115,7 +115,8 @@ class modMyModule extends DolibarrModules ), 'entity' => '0', ), - 'moduleforexternal' => 0 // Set this to 1 if feature of module are opened to external users + // Set this to 1 if feature of module are opened to external users + 'moduleforexternal' => 0, ); // Data directories to create when module is enabled. @@ -126,8 +127,10 @@ class modMyModule extends DolibarrModules $this->config_page_url = array("setup.php@mymodule"); // Dependencies - $this->hidden = false; // A condition to hide module - $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled. Example: array('always1'=>'modModuleToEnable1','always2'=>'modModuleToEnable2', 'FR1'=>'modModuleToEnableFR'...) + // A condition to hide module + $this->hidden = false; + // List of module class names as string that must be enabled if this module is enabled. Example: array('always1'=>'modModuleToEnable1','always2'=>'modModuleToEnable2', 'FR1'=>'modModuleToEnableFR'...) + $this->depends = array(); $this->requiredby = array(); // List of module class names as string to disable if this one is disabled. Example: array('modModuleToDisable1', ...) $this->conflictwith = array(); // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...) $this->langfiles = array("mymodule@mymodule"); @@ -144,7 +147,7 @@ class modMyModule extends DolibarrModules // 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1) // ); $this->const = array( - 1=>array('MYMODULE_MYCONSTANT', 'chaine', 'avalue', 'This is a constant to add', 1, 'allentities', 1) + 1 => array('MYMODULE_MYCONSTANT', 'chaine', 'avalue', 'This is a constant to add', 1, 'allentities', 1) ); // Some keys to add into the overwriting translation tables diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index 6a524fa5a99..69c0b07958e 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -429,9 +429,9 @@ class MultiCurrency extends CommonObject * * @return int -1 if KO, 1 if OK, 2 if label found and OK */ - function addRateFromDolibarr($code, $rate) - { - global $db, $user; + public function addRateFromDolibarr($code, $rate) + { + global $db, $user; $currency = new MultiCurrency($db); $currency->code = $code; @@ -455,7 +455,7 @@ class MultiCurrency extends CommonObject } return -1; - } + } /** * Add new entry into llx_multicurrency_rate to historise @@ -463,9 +463,9 @@ class MultiCurrency extends CommonObject * @param double $rate rate value * * @return int <0 if KO, >0 if OK - */ - public function updateRate($rate) - { + */ + public function updateRate($rate) + { return $this->addRate($rate); } @@ -474,8 +474,8 @@ class MultiCurrency extends CommonObject * * @return int <0 if KO, 0 if not found, >0 if OK */ - public function getRate() - { + public function getRate() + { $sql = 'SELECT cr.rowid'; $sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line.' as cr'; $sql.= ' WHERE cr.fk_multicurrency = '.$this->id; @@ -497,8 +497,8 @@ class MultiCurrency extends CommonObject * * @return 0 if not found, >0 if OK */ - public static function getIdFromCode(&$db, $code) - { + public static function getIdFromCode(&$db, $code) + { global $conf; $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'multicurrency WHERE code = \''.$db->escape($code).'\' AND entity = '.$conf->entity; @@ -519,8 +519,8 @@ class MultiCurrency extends CommonObject * @return array [0] => id currency * [1] => rate */ - public static function getIdAndTxFromCode(&$db, $code, $date_document = '') - { + public static function getIdAndTxFromCode(&$db, $code, $date_document = '') + { global $conf; $sql1 = 'SELECT m.rowid, mc.rate FROM '.MAIN_DB_PREFIX.'multicurrency m'; diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index 5d06cb23faa..a688f12654b 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -34,72 +34,72 @@ require_once DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php"; */ class Opensurveysondage extends CommonObject { - /** - * @var string ID to identify managed object - */ - public $element='opensurvey_sondage'; + /** + * @var string ID to identify managed object + */ + public $element='opensurvey_sondage'; - /** - * @var string Name of table without prefix where object is stored - */ - public $table_element='opensurvey_sondage'; + /** + * @var string Name of table without prefix where object is stored + */ + public $table_element='opensurvey_sondage'; public $picto = 'opensurvey'; - public $id_sondage; - /** - * @deprecated - * @see description - */ - public $commentaires; + public $id_sondage; + /** + * @deprecated + * @see description + */ + public $commentaires; - /** - * @var string description - */ - public $description; + /** + * @var string description + */ + public $description; - public $mail_admin; - public $nom_admin; + public $mail_admin; + public $nom_admin; - /** - * Id of user author of the poll - * @var int - */ - public $fk_user_creat; + /** + * Id of user author of the poll + * @var int + */ + public $fk_user_creat; - public $titre; - public $date_fin=''; - public $status=1; - public $format; - public $mailsonde; + public $titre; + public $date_fin=''; + public $status=1; + public $format; + public $mailsonde; - public $sujet; + public $sujet; - /** - * Allow comments on this poll - * @var bool - */ - public $allow_comments; + /** + * Allow comments on this poll + * @var bool + */ + public $allow_comments; - /** - * Allow users see others vote - * @var bool - */ - public $allow_spy; + /** + * Allow users see others vote + * @var bool + */ + public $allow_spy; - /** - * Draft status (not used) - */ - const STATUS_DRAFT = 0; - /** - * Validated/Opened status - */ - const STATUS_VALIDATED = 1; - /** - * Closed - */ - const STATUS_CLOSED = 2; + /** + * Draft status (not used) + */ + const STATUS_DRAFT = 0; + /** + * Validated/Opened status + */ + const STATUS_VALIDATED = 1; + /** + * Closed + */ + const STATUS_CLOSED = 2; @@ -108,7 +108,7 @@ class Opensurveysondage extends CommonObject * * @param DoliDb $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db = $db; } @@ -117,87 +117,87 @@ class Opensurveysondage extends CommonObject /** * Create object into database * - * @param User $user User that creates - * @param int $notrigger 0=launch triggers after, 1=disable triggers - * @return int <0 if KO, Id of created object if OK + * @param User $user User that creates + * @param int $notrigger 0=launch triggers after, 1=disable triggers + * @return int <0 if KO, Id of created object if OK */ - function create(User $user, $notrigger = 0) + public function create(User $user, $notrigger = 0) { - $error=0; + $error=0; - // Clean parameters - $this->cleanParameters(); + // Clean parameters + $this->cleanParameters(); - // Check parameters - if (! $this->date_fin > 0) - { - $this->error='BadValueForEndDate'; - dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); - return -1; - } + // Check parameters + if (! $this->date_fin > 0) + { + $this->error='BadValueForEndDate'; + dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); + return -1; + } // Insert request - $sql = "INSERT INTO ".MAIN_DB_PREFIX."opensurvey_sondage("; - $sql.= "id_sondage,"; - $sql.= "commentaires,"; - $sql.= "fk_user_creat,"; - $sql.= "titre,"; - $sql.= "date_fin,"; - $sql.= "status,"; - $sql.= "format,"; - $sql.= "mailsonde,"; - $sql.= "allow_comments,"; - $sql.= "allow_spy,"; - $sql.= "sujet"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."opensurvey_sondage("; + $sql.= "id_sondage,"; + $sql.= "commentaires,"; + $sql.= "fk_user_creat,"; + $sql.= "titre,"; + $sql.= "date_fin,"; + $sql.= "status,"; + $sql.= "format,"; + $sql.= "mailsonde,"; + $sql.= "allow_comments,"; + $sql.= "allow_spy,"; + $sql.= "sujet"; $sql.= ") VALUES ("; - $sql.= "'".$this->db->escape($this->id_sondage)."',"; - $sql.= " ".(empty($this->commentaires)?'NULL':"'".$this->db->escape($this->commentaires)."'").","; - $sql.= " ".$user->id.","; - $sql.= " '".$this->db->escape($this->titre)."',"; - $sql.= " '".$this->db->idate($this->date_fin)."',"; - $sql.= " ".$this->status.","; - $sql.= " '".$this->db->escape($this->format)."',"; - $sql.= " ".$this->db->escape($this->mailsonde).","; - $sql.= " ".$this->db->escape($this->allow_comments).","; - $sql.= " ".$this->db->escape($this->allow_spy).","; - $sql.= " '".$this->db->escape($this->sujet)."'"; - $sql.= ")"; + $sql.= "'".$this->db->escape($this->id_sondage)."',"; + $sql.= " ".(empty($this->commentaires)?'NULL':"'".$this->db->escape($this->commentaires)."'").","; + $sql.= " ".$user->id.","; + $sql.= " '".$this->db->escape($this->titre)."',"; + $sql.= " '".$this->db->idate($this->date_fin)."',"; + $sql.= " ".$this->status.","; + $sql.= " '".$this->db->escape($this->format)."',"; + $sql.= " ".$this->db->escape($this->mailsonde).","; + $sql.= " ".$this->db->escape($this->allow_comments).","; + $sql.= " ".$this->db->escape($this->allow_spy).","; + $sql.= " '".$this->db->escape($this->sujet)."'"; + $sql.= ")"; - $this->db->begin(); + $this->db->begin(); - dol_syslog(get_class($this)."::create", LOG_DEBUG); + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); - if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } + if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } - if (! $error) + if (! $error) { - if (! $notrigger) - { - global $langs, $conf; + if (! $notrigger) + { + global $langs, $conf; // Call trigger $result=$this->call_trigger('OPENSURVEY_CREATE', $user); if ($result < 0) $error++; // End call triggers - } + } } // Commit or rollback if ($error) - { - foreach($this->errors as $errmsg) - { - dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR); - $this->error.=($this->error?', '.$errmsg:$errmsg); - } - $this->db->rollback(); - return -1*$error; - } - else - { - $this->db->commit(); + { + foreach($this->errors as $errmsg) + { + dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; + } + else + { + $this->db->commit(); return $this->id; - } + } } @@ -208,27 +208,27 @@ class Opensurveysondage extends CommonObject * @param string $numsurvey Ref of survey (admin or not) * @return int <0 if KO, >0 if OK */ - function fetch($id, $numsurvey = '') + public function fetch($id, $numsurvey = '') { - $sql = "SELECT"; - $sql.= " t.id_sondage,"; - $sql.= " t.commentaires as description,"; - $sql.= " t.mail_admin,"; - $sql.= " t.nom_admin,"; - $sql.= " t.fk_user_creat,"; - $sql.= " t.titre,"; - $sql.= " t.date_fin,"; - $sql.= " t.status,"; - $sql.= " t.format,"; - $sql.= " t.mailsonde,"; - $sql.= " t.allow_comments,"; - $sql.= " t.allow_spy,"; - $sql.= " t.sujet,"; - $sql.= " t.tms"; + $sql = "SELECT"; + $sql.= " t.id_sondage,"; + $sql.= " t.commentaires as description,"; + $sql.= " t.mail_admin,"; + $sql.= " t.nom_admin,"; + $sql.= " t.fk_user_creat,"; + $sql.= " t.titre,"; + $sql.= " t.date_fin,"; + $sql.= " t.status,"; + $sql.= " t.format,"; + $sql.= " t.mailsonde,"; + $sql.= " t.allow_comments,"; + $sql.= " t.allow_spy,"; + $sql.= " t.sujet,"; + $sql.= " t.tms"; $sql.= " FROM ".MAIN_DB_PREFIX."opensurvey_sondage as t"; $sql.= " WHERE t.id_sondage = '".$this->db->escape($id ? $id : $numsurvey)."'"; - dol_syslog(get_class($this)."::fetch", LOG_DEBUG); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -236,29 +236,29 @@ class Opensurveysondage extends CommonObject { $obj = $this->db->fetch_object($resql); - $this->id_sondage = $obj->id_sondage; - $this->ref = $this->id_sondage; //For compatibility + $this->id_sondage = $obj->id_sondage; + $this->ref = $this->id_sondage; //For compatibility - $this->commentaires = $obj->description; // deprecated - $this->description = $obj->description; - $this->mail_admin = $obj->mail_admin; - $this->nom_admin = $obj->nom_admin; - $this->titre = $obj->titre; - $this->date_fin = $this->db->jdate($obj->date_fin); - $this->status = $obj->status; - $this->format = $obj->format; - $this->mailsonde = $obj->mailsonde; - $this->allow_comments = $obj->allow_comments; - $this->allow_spy = $obj->allow_spy; - $this->sujet = $obj->sujet; - $this->fk_user_creat = $obj->fk_user_creat; + $this->commentaires = $obj->description; // deprecated + $this->description = $obj->description; + $this->mail_admin = $obj->mail_admin; + $this->nom_admin = $obj->nom_admin; + $this->titre = $obj->titre; + $this->date_fin = $this->db->jdate($obj->date_fin); + $this->status = $obj->status; + $this->format = $obj->format; + $this->mailsonde = $obj->mailsonde; + $this->allow_comments = $obj->allow_comments; + $this->allow_spy = $obj->allow_spy; + $this->sujet = $obj->sujet; + $this->fk_user_creat = $obj->fk_user_creat; - $this->date_m = $this->db->jdate($obj->tls); - $ret=1; + $this->date_m = $this->db->jdate($obj->tls); + $ret=1; } else { - $sondage = ($id ? 'id='.$id : 'sondageid='.$numsurvey); + $sondage = ($id ? 'id='.$id : 'sondageid='.$numsurvey); $this->error='Fetch no poll found for '.$sondage; dol_syslog($this->error, LOG_ERR); $ret = 0; @@ -268,7 +268,7 @@ class Opensurveysondage extends CommonObject } else { - $this->error="Error ".$this->db->lasterror(); + $this->error="Error ".$this->db->lasterror(); $ret=-1; } @@ -279,73 +279,73 @@ class Opensurveysondage extends CommonObject /** * Update object into database * - * @param User $user User that modifies - * @param int $notrigger 0=launch triggers after, 1=disable triggers + * @param User $user User that modifies + * @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, $langs; - $error=0; + global $conf, $langs; + $error=0; - // Clean parameters - $this->cleanParameters(); + // Clean parameters + $this->cleanParameters(); - // Check parameters - // Put here code to add a control on parameters values + // Check parameters + // Put here code to add a control on parameters values // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."opensurvey_sondage SET"; - $sql.= " id_sondage=".(isset($this->id_sondage)?"'".$this->db->escape($this->id_sondage)."'":"null").","; - $sql.= " commentaires=".(isset($this->commentaires)?"'".$this->db->escape($this->commentaires)."'":"null").","; - $sql.= " mail_admin=".(isset($this->mail_admin)?"'".$this->db->escape($this->mail_admin)."'":"null").","; - $sql.= " nom_admin=".(isset($this->nom_admin)?"'".$this->db->escape($this->nom_admin)."'":"null").","; - $sql.= " titre=".(isset($this->titre)?"'".$this->db->escape($this->titre)."'":"null").","; - $sql.= " date_fin=".(dol_strlen($this->date_fin)!=0 ? "'".$this->db->idate($this->date_fin)."'" : 'null').","; - $sql.= " status=".(isset($this->status)?"'".$this->db->escape($this->status)."'":"null").","; - $sql.= " format=".(isset($this->format)?"'".$this->db->escape($this->format)."'":"null").","; - $sql.= " mailsonde=".(isset($this->mailsonde)?$this->db->escape($this->mailsonde):"null").","; - $sql.= " allow_comments=".$this->db->escape($this->allow_comments).","; - $sql.= " allow_spy=".$this->db->escape($this->allow_spy); + $sql.= " id_sondage=".(isset($this->id_sondage)?"'".$this->db->escape($this->id_sondage)."'":"null").","; + $sql.= " commentaires=".(isset($this->commentaires)?"'".$this->db->escape($this->commentaires)."'":"null").","; + $sql.= " mail_admin=".(isset($this->mail_admin)?"'".$this->db->escape($this->mail_admin)."'":"null").","; + $sql.= " nom_admin=".(isset($this->nom_admin)?"'".$this->db->escape($this->nom_admin)."'":"null").","; + $sql.= " titre=".(isset($this->titre)?"'".$this->db->escape($this->titre)."'":"null").","; + $sql.= " date_fin=".(dol_strlen($this->date_fin)!=0 ? "'".$this->db->idate($this->date_fin)."'" : 'null').","; + $sql.= " status=".(isset($this->status)?"'".$this->db->escape($this->status)."'":"null").","; + $sql.= " format=".(isset($this->format)?"'".$this->db->escape($this->format)."'":"null").","; + $sql.= " mailsonde=".(isset($this->mailsonde)?$this->db->escape($this->mailsonde):"null").","; + $sql.= " allow_comments=".$this->db->escape($this->allow_comments).","; + $sql.= " allow_spy=".$this->db->escape($this->allow_spy); - $sql.= " WHERE id_sondage='".$this->db->escape($this->id_sondage)."'"; + $sql.= " WHERE id_sondage='".$this->db->escape($this->id_sondage)."'"; - $this->db->begin(); + $this->db->begin(); - dol_syslog(get_class($this)."::update", LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); - if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } + if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } - if (! $error) - { - if (! $notrigger) - { - // Call triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('OPENSURVEY_MODIFY', $this, $user, $langs, $conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // End call triggers - } - } + if (! $error) + { + if (! $notrigger) + { + // Call triggers + include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('OPENSURVEY_MODIFY', $this, $user, $langs, $conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } + // End call triggers + } + } // Commit or rollback - if ($error) - { - foreach($this->errors as $errmsg) - { - dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR); - $this->error.=($this->error?', '.$errmsg:$errmsg); - } - $this->db->rollback(); - return -1*$error; - } - else - { - $this->db->commit(); - return 1; - } + if ($error) + { + foreach($this->errors as $errmsg) + { + dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; + } + else + { + $this->db->commit(); + return 1; + } } /** @@ -356,328 +356,328 @@ class Opensurveysondage extends CommonObject * @param string $numsondage Num sondage admin to delete * @return int <0 if KO, >0 if OK */ - function delete(User $user, $notrigger = 0, $numsondage = '') + public function delete(User $user, $notrigger = 0, $numsondage = '') { - global $conf, $langs; - $error=0; + global $conf, $langs; + $error=0; - if (empty($numsondage)) - { - $numsondage = $this->id_sondage; - } + if (empty($numsondage)) + { + $numsondage = $this->id_sondage; + } - $this->db->begin(); + $this->db->begin(); - if (! $error) - { - if (! $notrigger) - { + if (! $error) + { + if (! $notrigger) + { // Call trigger $result=$this->call_trigger('OPENSURVEY_DELETE', $user); if ($result < 0) $error++; // End call triggers - } - } + } + } - if (! $error) - { + if (! $error) + { - $sql='DELETE FROM '.MAIN_DB_PREFIX."opensurvey_comments WHERE id_sondage = '".$this->db->escape($numsondage)."'"; - dol_syslog(get_class($this)."::delete", LOG_DEBUG); - $resql=$this->db->query($sql); - $sql='DELETE FROM '.MAIN_DB_PREFIX."opensurvey_user_studs WHERE id_sondage = '".$this->db->escape($numsondage)."'"; - dol_syslog(get_class($this)."::delete", LOG_DEBUG); - $resql=$this->db->query($sql); + $sql='DELETE FROM '.MAIN_DB_PREFIX."opensurvey_comments WHERE id_sondage = '".$this->db->escape($numsondage)."'"; + dol_syslog(get_class($this)."::delete", LOG_DEBUG); + $resql=$this->db->query($sql); + $sql='DELETE FROM '.MAIN_DB_PREFIX."opensurvey_user_studs WHERE id_sondage = '".$this->db->escape($numsondage)."'"; + dol_syslog(get_class($this)."::delete", LOG_DEBUG); + $resql=$this->db->query($sql); - $sql = "DELETE FROM ".MAIN_DB_PREFIX."opensurvey_sondage"; - $sql.= " WHERE id_sondage = '".$this->db->escape($numsondage)."'"; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."opensurvey_sondage"; + $sql.= " WHERE id_sondage = '".$this->db->escape($numsondage)."'"; - dol_syslog(get_class($this)."::delete", LOG_DEBUG); - $resql = $this->db->query($sql); - if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } - } + dol_syslog(get_class($this)."::delete", LOG_DEBUG); + $resql = $this->db->query($sql); + if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } + } // Commit or rollback - if ($error) - { - foreach($this->errors as $errmsg) - { - dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); - $this->error.=($this->error?', '.$errmsg:$errmsg); - } - $this->db->rollback(); - return -1*$error; - } - else - { - $this->db->commit(); - return 1; - } - } + if ($error) + { + foreach($this->errors as $errmsg) + { + dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; + } + else + { + $this->db->commit(); + return 1; + } + } - /** - * 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 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, $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) - { - global $db, $conf, $langs; - global $dolibarr_main_authentication, $dolibarr_main_demo; - global $menumanager; + /** + * 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 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 + */ + public function getNomUrl($withpicto = 0, $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) + { + global $db, $conf, $langs; + global $dolibarr_main_authentication, $dolibarr_main_demo; + global $menumanager; - if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips + if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips - $result = ''; - $companylink = ''; + $result = ''; + $companylink = ''; - $label = '' . $langs->trans("ShowSurvey") . ''; - $label.= '
'; - $label.= '' . $langs->trans('Ref') . ': ' . $this->ref.'
'; - $label.= '' . $langs->trans('Title') . ': ' . $this->title.'
'; + $label = '' . $langs->trans("ShowSurvey") . ''; + $label.= '
'; + $label.= '' . $langs->trans('Ref') . ': ' . $this->ref.'
'; + $label.= '' . $langs->trans('Title') . ': ' . $this->title.'
'; - $url = DOL_URL_ROOT.'/opensurvey/card.php?id='.$this->id; + $url = DOL_URL_ROOT.'/opensurvey/card.php?id='.$this->id; - // Add param to save lastsearch_values or not - $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); - if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; - if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; + // Add param to save lastsearch_values or not + $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; + if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; - $linkclose=''; - if (empty($notooltip)) - { - if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) - { - $label=$langs->trans("ShowMyObject"); - $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; - } - $linkclose.=' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"'; - } - else $linkclose = ($morecss?' class="'.$morecss.'"':''); + $linkclose=''; + if (empty($notooltip)) + { + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label=$langs->trans("ShowMyObject"); + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose.=' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"'; + } + else $linkclose = ($morecss?' class="'.$morecss.'"':''); - $linkstart = ''; - $linkend=''; + $linkstart = ''; + $linkend=''; - $result .= $linkstart; - if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); - if ($withpicto != 2) $result.= $this->ref; - $result .= $linkend; + $result .= $linkstart; + if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); + if ($withpicto != 2) $result.= $this->ref; + $result .= $linkend; - return $result; - } + return $result; + } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - /** - * Return array of lines - * - * @return int <0 if KO, >0 if OK - */ - function fetch_lines() - { + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Return array of lines + * + * @return int <0 if KO, >0 if OK + */ + public function fetch_lines() + { // phpcs:enable - $ret=array(); + $ret=array(); - $sql = "SELECT id_users, nom as name, reponses FROM ".MAIN_DB_PREFIX."opensurvey_user_studs"; - $sql.= " WHERE id_sondage = '".$this->db->escape($this->id_sondage)."'"; - $resql=$this->db->query($sql); + $sql = "SELECT id_users, nom as name, reponses FROM ".MAIN_DB_PREFIX."opensurvey_user_studs"; + $sql.= " WHERE id_sondage = '".$this->db->escape($this->id_sondage)."'"; + $resql=$this->db->query($sql); - if ($resql) - { - $num=$this->db->num_rows($resql); - $i=0; - while ($i < $num) - { - $obj=$this->db->fetch_object($resql); - $tmp=array('id_users'=>$obj->id_users, 'nom'=>$obj->name, 'reponses'=>$obj->reponses); + if ($resql) + { + $num=$this->db->num_rows($resql); + $i=0; + while ($i < $num) + { + $obj=$this->db->fetch_object($resql); + $tmp=array('id_users'=>$obj->id_users, 'nom'=>$obj->name, 'reponses'=>$obj->reponses); - $ret[]=$tmp; - $i++; - } - } - else dol_print_error($this->db); + $ret[]=$tmp; + $i++; + } + } + else dol_print_error($this->db); - $this->lines=$ret; + $this->lines=$ret; - return count($this->lines); - } + return count($this->lines); + } - /** - * Initialise object with example values - * Id must be 0 if object instance is a specimen - * - * @return void - */ - function initAsSpecimen() - { - $this->id=0; + /** + * Initialise object with example values + * Id must be 0 if object instance is a specimen + * + * @return void + */ + public function initAsSpecimen() + { + $this->id=0; - $this->id_sondage=''; - $this->commentaires='Comment of the specimen survey'; - $this->mail_admin=''; - $this->nom_admin=''; - $this->titre='This is a specimen survey'; - $this->date_fin=dol_now()+3600*24*10; - $this->status=1; - $this->format='classic'; - $this->mailsonde=''; - } + $this->id_sondage=''; + $this->commentaires='Comment of the specimen survey'; + $this->mail_admin=''; + $this->nom_admin=''; + $this->titre='This is a specimen survey'; + $this->date_fin=dol_now()+3600*24*10; + $this->status=1; + $this->format='classic'; + $this->mailsonde=''; + } - /** - * Returns all comments for the current opensurvey poll - * - * @return Object[] - */ - public function getComments() - { - $comments = array(); + /** + * Returns all comments for the current opensurvey poll + * + * @return Object[] + */ + public function getComments() + { + $comments = array(); - $sql = 'SELECT id_comment, usercomment, comment'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'opensurvey_comments'; - $sql.= " WHERE id_sondage='".$this->db->escape($this->id_sondage)."'"; - $sql.= " ORDER BY id_comment"; - $resql = $this->db->query($sql); + $sql = 'SELECT id_comment, usercomment, comment'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'opensurvey_comments'; + $sql.= " WHERE id_sondage='".$this->db->escape($this->id_sondage)."'"; + $sql.= " ORDER BY id_comment"; + $resql = $this->db->query($sql); - if ($resql) - { - $num_rows=$this->db->num_rows($resql); + if ($resql) + { + $num_rows=$this->db->num_rows($resql); - if ($num_rows > 0) - { - while ($obj = $this->db->fetch_object($resql)) - { - $comments[] = $obj; - } - } - } + if ($num_rows > 0) + { + while ($obj = $this->db->fetch_object($resql)) + { + $comments[] = $obj; + } + } + } - return $comments; - } + return $comments; + } - /** - * Adds a comment to the poll - * - * @param string $comment Comment content - * @param string $comment_user Comment author - * @return boolean False in case of the query fails, true if it was successful - */ - public function addComment($comment, $comment_user) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."opensurvey_comments (id_sondage, comment, usercomment)"; - $sql.= " VALUES ('".$this->db->escape($this->id_sondage)."','".$this->db->escape($comment)."','".$this->db->escape($comment_user)."')"; - $resql = $this->db->query($sql); + /** + * Adds a comment to the poll + * + * @param string $comment Comment content + * @param string $comment_user Comment author + * @return boolean False in case of the query fails, true if it was successful + */ + public function addComment($comment, $comment_user) + { + $sql = "INSERT INTO ".MAIN_DB_PREFIX."opensurvey_comments (id_sondage, comment, usercomment)"; + $sql.= " VALUES ('".$this->db->escape($this->id_sondage)."','".$this->db->escape($comment)."','".$this->db->escape($comment_user)."')"; + $resql = $this->db->query($sql); - if (!$resql) { - return false; - } + if (!$resql) { + return false; + } - return true; - } + return true; + } - /** - * Deletes a comment of the poll - * - * @param int $id_comment Id of the comment - * @return boolean False in case of the query fails, true if it was successful - */ - public function deleteComment($id_comment) - { - $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'opensurvey_comments WHERE id_comment = '.$id_comment.' AND id_sondage = "'.$this->db->escape($this->id_sondage).'"'; - $resql = $this->db->query($sql); + /** + * Deletes a comment of the poll + * + * @param int $id_comment Id of the comment + * @return boolean False in case of the query fails, true if it was successful + */ + public function deleteComment($id_comment) + { + $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'opensurvey_comments WHERE id_comment = '.$id_comment.' AND id_sondage = "'.$this->db->escape($this->id_sondage).'"'; + $resql = $this->db->query($sql); - if (!$resql) { - return false; - } + if (!$resql) { + return false; + } - return true; - } + return true; + } - /** - * Cleans all the class variables before doing an update or an insert - * - * @return void - */ - private function cleanParameters() - { - $this->id_sondage = trim($this->id_sondage); - $this->commentaires = trim($this->commentaires); - $this->mail_admin = trim($this->mail_admin); - $this->nom_admin = trim($this->nom_admin); - $this->titre = trim($this->titre); - $this->status = trim($this->status); - $this->format = trim($this->format); - $this->mailsonde = ($this->mailsonde ? 1 : 0); - $this->allow_comments = ($this->allow_comments ? 1 : 0); - $this->allow_spy = ($this->allow_spy ? 1 : 0); - $this->sujet = trim($this->sujet); - } + /** + * Cleans all the class variables before doing an update or an insert + * + * @return void + */ + private function cleanParameters() + { + $this->id_sondage = trim($this->id_sondage); + $this->commentaires = trim($this->commentaires); + $this->mail_admin = trim($this->mail_admin); + $this->nom_admin = trim($this->nom_admin); + $this->titre = trim($this->titre); + $this->status = trim($this->status); + $this->format = trim($this->format); + $this->mailsonde = ($this->mailsonde ? 1 : 0); + $this->allow_comments = ($this->allow_comments ? 1 : 0); + $this->allow_spy = ($this->allow_spy ? 1 : 0); + $this->sujet = trim($this->sujet); + } - /** - * Return status label of Order - * - * @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) - { - return $this->LibStatut($this->status, $mode); - } + /** + * Return status label of Order + * + * @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 + */ + public function getLibStatut($mode) + { + return $this->LibStatut($this->status, $mode); + } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - /** - * Return label of status - * - * @param int $status Id statut - * @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 LibStatut($status, $mode) - { + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Return label of status + * + * @param int $status Id statut + * @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 + */ + public function LibStatut($status, $mode) + { // phpcs:enable - global $langs, $conf; + global $langs, $conf; - //print 'x'.$status.'-'.$billed; - if ($mode == 0) - { - if ($status==self::STATUS_DRAFT) return $langs->trans('Draft'); - if ($status==self::STATUS_VALIDATED) return $langs->trans('Opened'); - if ($status==self::STATUS_CLOSED) return $langs->trans('Closed'); - } - elseif ($mode == 1) - { - if ($status==self::STATUS_DRAFT) return $langs->trans('Draft'); - if ($status==self::STATUS_VALIDATED) return $langs->trans('Opened'); - if ($status==self::STATUS_CLOSED) return $langs->trans('Closed'); - } - elseif ($mode == 2) - { - if ($status==self::STATUS_DRAFT) return img_picto($langs->trans('Draft'), 'statut0').' '.$langs->trans('Draft'); - if ($status==self::STATUS_VALIDATED) return img_picto($langs->trans('Opened'), 'statut1').' '.$langs->trans('Opened'); - if ($status==self::STATUS_CLOSED) return img_picto($langs->trans('Closed'), 'statut6').' '.$langs->trans('Closed'); - } - elseif ($mode == 3) - { - if ($status==self::STATUS_DRAFT) return img_picto($langs->trans('Draft'), 'statut0'); - if ($status==self::STATUS_VALIDATED) return img_picto($langs->trans('Opened'), 'statut1'); - if ($status==self::STATUS_CLOSED) return img_picto($langs->trans('Closed'), 'statut6'); - } - elseif ($mode == 4) - { - if ($status==self::STATUS_DRAFT) return img_picto($langs->trans('Draft'), 'statut0').' '.$langs->trans('Draft'); - if ($status==self::STATUS_VALIDATED) return img_picto($langs->trans('Opened').$billedtext, 'statut1').' '.$langs->trans('Opened'); - if ($status==self::STATUS_CLOSED) return img_picto($langs->trans('Closed'), 'statut6').' '.$langs->trans('Closed'); - } - elseif ($mode == 5) - { - if ($status==self::STATUS_DRAFT) return ''.$langs->trans('Draft').' '.img_picto($langs->trans('Draft'), 'statut0'); - if ($status==self::STATUS_VALIDATED) return ''.$langs->trans('Opened').' '.img_picto($langs->trans('Opened'), 'statut1'); - if ($status==self::STATUS_CLOSED) return ''.$langs->trans('Closed').' '.img_picto($langs->trans('Closed'), 'statut6'); - } - } + //print 'x'.$status.'-'.$billed; + if ($mode == 0) + { + if ($status==self::STATUS_DRAFT) return $langs->trans('Draft'); + elseif ($status==self::STATUS_VALIDATED) return $langs->trans('Opened'); + elseif ($status==self::STATUS_CLOSED) return $langs->trans('Closed'); + } + elseif ($mode == 1) + { + if ($status==self::STATUS_DRAFT) return $langs->trans('Draft'); + elseif ($status==self::STATUS_VALIDATED) return $langs->trans('Opened'); + elseif ($status==self::STATUS_CLOSED) return $langs->trans('Closed'); + } + elseif ($mode == 2) + { + if ($status==self::STATUS_DRAFT) return img_picto($langs->trans('Draft'), 'statut0').' '.$langs->trans('Draft'); + elseif ($status==self::STATUS_VALIDATED) return img_picto($langs->trans('Opened'), 'statut1').' '.$langs->trans('Opened'); + elseif ($status==self::STATUS_CLOSED) return img_picto($langs->trans('Closed'), 'statut6').' '.$langs->trans('Closed'); + } + elseif ($mode == 3) + { + if ($status==self::STATUS_DRAFT) return img_picto($langs->trans('Draft'), 'statut0'); + elseif ($status==self::STATUS_VALIDATED) return img_picto($langs->trans('Opened'), 'statut1'); + elseif ($status==self::STATUS_CLOSED) return img_picto($langs->trans('Closed'), 'statut6'); + } + elseif ($mode == 4) + { + if ($status==self::STATUS_DRAFT) return img_picto($langs->trans('Draft'), 'statut0').' '.$langs->trans('Draft'); + elseif ($status==self::STATUS_VALIDATED) return img_picto($langs->trans('Opened').$billedtext, 'statut1').' '.$langs->trans('Opened'); + elseif ($status==self::STATUS_CLOSED) return img_picto($langs->trans('Closed'), 'statut6').' '.$langs->trans('Closed'); + } + elseif ($mode == 5) + { + if ($status==self::STATUS_DRAFT) return ''.$langs->trans('Draft').' '.img_picto($langs->trans('Draft'), 'statut0'); + elseif ($status==self::STATUS_VALIDATED) return ''.$langs->trans('Opened').' '.img_picto($langs->trans('Opened'), 'statut1'); + elseif ($status==self::STATUS_CLOSED) return ''.$langs->trans('Closed').' '.img_picto($langs->trans('Closed'), 'statut6'); + } + } } diff --git a/htdocs/product/canvas/product/actions_card_product.class.php b/htdocs/product/canvas/product/actions_card_product.class.php index 98f296d5060..461fa942679 100644 --- a/htdocs/product/canvas/product/actions_card_product.class.php +++ b/htdocs/product/canvas/product/actions_card_product.class.php @@ -28,29 +28,29 @@ include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; */ class ActionsCardProduct { - var $targetmodule; - var $canvas; - var $card; + public $targetmodule; + public $canvas; + public $card; //! Template container - var $tpl = array(); + public $tpl = array(); // List of fiels for action=list - var $field_list =array(); + public $field_list =array(); public $list_datas = array(); /** - * Constructor - * + * Constructor + * * @param DoliDB $db Database handler * @param string $dirmodule Name of directory of module * @param string $targetmodule Name of directory where canvas is stored * @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; $this->targetmodule = $targetmodule; @@ -64,7 +64,7 @@ class ActionsCardProduct } - // 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) * @@ -73,7 +73,7 @@ class ActionsCardProduct * @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 $limit, $offset, $sortfield, $sortorder; @@ -86,8 +86,7 @@ class ActionsCardProduct //parent::assign_values($action); - foreach($this->object as $key => $value) - { + foreach($this->object as $key => $value) { $this->tpl[$key] = $value; } @@ -296,7 +295,7 @@ class ActionsCardProduct } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Fetch datas list and save into ->list_datas * @@ -306,7 +305,7 @@ class ActionsCardProduct * @param string $sortorder Sort order ('ASC' or 'DESC') * @return void */ - function LoadListDatas($limit, $offset, $sortfield, $sortorder) + public function LoadListDatas($limit, $offset, $sortfield, $sortorder) { // phpcs:enable global $conf, $langs; diff --git a/htdocs/product/canvas/service/actions_card_service.class.php b/htdocs/product/canvas/service/actions_card_service.class.php index 5f5c78cfbc1..fab5794c82a 100644 --- a/htdocs/product/canvas/service/actions_card_service.class.php +++ b/htdocs/product/canvas/service/actions_card_service.class.php @@ -28,15 +28,15 @@ include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; */ class ActionsCardService { - var $targetmodule; - var $canvas; - var $card; + public $targetmodule; + public $canvas; + public $card; //! Template container - var $tpl = array(); + public $tpl = array(); // List of fiels for action=list - var $field_list =array(); + public $field_list =array(); public $list_datas = array(); @@ -48,7 +48,7 @@ class ActionsCardService * @param string $canvas Name of canvas * @param string $card Name of tab (sub-canvas) */ - function __construct($db, $targetmodule, $canvas, $card) + public function __construct($db, $targetmodule, $canvas, $card) { $this->db = $db; $this->targetmodule = $targetmodule; @@ -63,7 +63,7 @@ class ActionsCardService } - // 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) * @@ -72,7 +72,7 @@ class ActionsCardService * @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 $limit, $offset, $sortfield, $sortorder; @@ -274,7 +274,7 @@ class ActionsCardService } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Fetch datas list and save into ->list_datas * @@ -284,7 +284,7 @@ class ActionsCardService * @param string $sortorder Sort order ('ASC' or 'DESC') * @return void */ - function LoadListDatas($limit, $offset, $sortfield, $sortorder) + public function LoadListDatas($limit, $offset, $sortfield, $sortorder) { // phpcs:enable global $conf; diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 0b451701600..1bafd063dec 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -49,7 +49,7 @@ class FormProduct * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db = $db; } diff --git a/htdocs/product/dynamic_price/class/price_expression.class.php b/htdocs/product/dynamic_price/class/price_expression.class.php index e3bcc181347..5e55a210096 100644 --- a/htdocs/product/dynamic_price/class/price_expression.class.php +++ b/htdocs/product/dynamic_price/class/price_expression.class.php @@ -29,25 +29,25 @@ */ class PriceExpression { - /** + /** * @var DoliDB Database handler. */ public $db; - /** - * @var string Error code (or message) - */ - public $error=''; - - /** - * @var string[] Error codes (or messages) - */ - public $errors = array(); + /** + * @var string Error code (or message) + */ + public $error=''; /** - * @var int ID - */ - public $id; + * @var string[] Error codes (or messages) + */ + public $errors = array(); + + /** + * @var int ID + */ + public $id; public $title; public $expression; @@ -62,7 +62,7 @@ class PriceExpression * * @param DoliDb $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db = $db; } @@ -75,60 +75,60 @@ class PriceExpression * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, Id of created object if OK */ - function create($user, $notrigger = 0) + public function create($user, $notrigger = 0) { $error=0; - // Clean parameters - if (isset($this->title)) $this->title=trim($this->title); - if (isset($this->expression)) $this->expression=trim($this->expression); + // Clean parameters + if (isset($this->title)) $this->title=trim($this->title); + if (isset($this->expression)) $this->expression=trim($this->expression); // Insert request - $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element." ("; - $sql.= "title, expression"; - $sql.= ") VALUES ("; - $sql.= " ".(isset($this->title)?"'".$this->db->escape($this->title)."'":"''").","; - $sql.= " ".(isset($this->expression)?"'".$this->db->escape($this->expression)."'":"''"); - $sql.= ")"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element." ("; + $sql.= "title, expression"; + $sql.= ") VALUES ("; + $sql.= " ".(isset($this->title)?"'".$this->db->escape($this->title)."'":"''").","; + $sql.= " ".(isset($this->expression)?"'".$this->db->escape($this->expression)."'":"''"); + $sql.= ")"; - $this->db->begin(); + $this->db->begin(); - dol_syslog(__METHOD__, LOG_DEBUG); + dol_syslog(__METHOD__, LOG_DEBUG); $resql=$this->db->query($sql); - if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } + if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } - if (! $error) + if (! $error) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element); - if (! $notrigger) - { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action calls a trigger. + //if (! $notrigger) + //{ + // Uncomment this and change MYOBJECT to your own tag if you + // want this action calls a trigger. - //// Call triggers - //$result=$this->call_trigger('MYOBJECT_CREATE',$user); - //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} - //// End call triggers - } + //// Call triggers + //$result=$this->call_trigger('MYOBJECT_CREATE',$user); + //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} + //// End call triggers + //} } // Commit or rollback if ($error) - { - foreach($this->errors as $errmsg) - { - dol_syslog(__METHOD__." ".$errmsg, LOG_ERR); - $this->error.=($this->error?', '.$errmsg:$errmsg); - } - $this->db->rollback(); - return -1*$error; - } - else - { - $this->db->commit(); + { + foreach($this->errors as $errmsg) + { + dol_syslog(__METHOD__." ".$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; + } + else + { + $this->db->commit(); return $this->id; - } + } } @@ -138,7 +138,7 @@ class PriceExpression * @param int $id Id object * @return int < 0 if KO, 0 if OK but not found, > 0 if OK */ - function fetch($id) + public function fetch($id) { // Check parameters if (empty($id)) @@ -151,7 +151,7 @@ class PriceExpression $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element; $sql.= " WHERE rowid = ".$id; - dol_syslog(__METHOD__); + dol_syslog(__METHOD__); $resql=$this->db->query($sql); if ($resql) { @@ -170,18 +170,18 @@ class PriceExpression } else { - $this->error="Error ".$this->db->lasterror(); + $this->error="Error ".$this->db->lasterror(); return -1; } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * List all price expressions * * @return array Array of price expressions */ - function list_price_expression() + public function list_price_expression() { // phpcs:enable $sql = "SELECT rowid, title, expression"; @@ -199,7 +199,7 @@ class PriceExpression $price_expression_obj = new PriceExpression($this->db); $price_expression_obj->id = $record["rowid"]; $price_expression_obj->title = $record["title"]; - $price_expression_obj->expression = $record["expression"]; + $price_expression_obj->expression = $record["expression"]; $retarray[]=$price_expression_obj; } @@ -214,28 +214,28 @@ class PriceExpression } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Returns any existing rowid with specified title * * @param String $title Title of expression * @return int < 0 if KO, 0 if OK but not found, > 0 rowid */ - function find_title($title) + public function find_title($title) { // phpcs:enable $sql = "SELECT rowid"; $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element; $sql.= " WHERE title = '".$this->db->escape($title)."'"; - dol_syslog(__METHOD__, LOG_DEBUG); + dol_syslog(__METHOD__, LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { $obj = $this->db->fetch_object($resql); if ($obj) { - return (int) $obj->rowid; + return (int) $obj->rowid; } else { @@ -244,7 +244,7 @@ class PriceExpression } else { - $this->error="Error ".$this->db->lasterror(); + $this->error="Error ".$this->db->lasterror(); return -1; } } @@ -257,125 +257,125 @@ class PriceExpression * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user = 0, $notrigger = 0) + public function update($user = 0, $notrigger = 0) { - $error=0; + $error=0; - // Clean parameters - if (isset($this->title)) $this->title=trim($this->title); - if (isset($this->expression)) $this->expression=trim($this->expression); + // Clean parameters + if (isset($this->title)) $this->title=trim($this->title); + if (isset($this->expression)) $this->expression=trim($this->expression); // Update request $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET"; - $sql.= " title = ".(isset($this->title)?"'".$this->db->escape($this->title)."'":"''").","; - $sql.= " expression = ".(isset($this->expression)?"'".$this->db->escape($this->expression)."'":"''").""; + $sql.= " title = ".(isset($this->title)?"'".$this->db->escape($this->title)."'":"''").","; + $sql.= " expression = ".(isset($this->expression)?"'".$this->db->escape($this->expression)."'":"''").""; $sql.= " WHERE rowid = ".$this->id; - $this->db->begin(); + $this->db->begin(); - dol_syslog(__METHOD__); + dol_syslog(__METHOD__); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } - // if (! $error) - // { - // if (! $notrigger) - // { - // // Uncomment this and change MYOBJECT to your own tag if you - // // want this action calls a trigger. + // if (! $error) + // { + // if (! $notrigger) + // { + // // Uncomment this and change MYOBJECT to your own tag if you + // // want this action calls a trigger. - // //// Call triggers - // //$result=$this->call_trigger('MYOBJECT_MODIFY',$user); - // //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} - // //// End call triggers - // } - // } + // //// Call triggers + // //$result=$this->call_trigger('MYOBJECT_MODIFY',$user); + // //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} + // //// End call triggers + // } + // } // Commit or rollback - if ($error) - { - foreach($this->errors as $errmsg) - { - dol_syslog(__METHOD__." ".$errmsg, LOG_ERR); - $this->error.=($this->error?', '.$errmsg:$errmsg); - } - $this->db->rollback(); - return -1*$error; - } - else - { - $this->db->commit(); - return 1; - } + if ($error) + { + foreach($this->errors as $errmsg) + { + dol_syslog(__METHOD__." ".$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; + } + else + { + $this->db->commit(); + return 1; + } } - /** - * Delete object in database - * + /** + * Delete object in database + * * @param User $user User that deletes * @param int $notrigger 0=launch triggers after, 1=disable triggers - * @return int <0 if KO, >0 if OK - */ - function delete(User $user, $notrigger = 0) - { - $error=0; + * @return int <0 if KO, >0 if OK + */ + public function delete(User $user, $notrigger = 0) + { + $error=0; - $rowid = $this->id; + $rowid = $this->id; - $this->db->begin(); + $this->db->begin(); - if (! $error) - { - if (! $notrigger) - { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action calls a trigger. + //if (! $error) + //{ + // if (! $notrigger) + // { + // Uncomment this and change MYOBJECT to your own tag if you + // want this action calls a trigger. - //// Call triggers - //$result=$this->call_trigger('MYOBJECT_DELETE',$user); - //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} - //// End call triggers - } - } + //// Call triggers + //$result=$this->call_trigger('MYOBJECT_DELETE',$user); + //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} + //// End call triggers + // } + //} - if (! $error) - { - $sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element; - $sql.= " WHERE rowid = ".$rowid; + if (! $error) + { + $sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element; + $sql.= " WHERE rowid = ".$rowid; - dol_syslog(__METHOD__); - $resql = $this->db->query($sql); - if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } - } + dol_syslog(__METHOD__); + $resql = $this->db->query($sql); + if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } + } // Commit or rollback - if ($error) - { - foreach($this->errors as $errmsg) - { - dol_syslog(__METHOD__." ".$errmsg, LOG_ERR); - $this->error.=($this->error?', '.$errmsg:$errmsg); - } - $this->db->rollback(); - return -1*$error; - } - else - { - $this->db->commit(); - return 1; - } - } + if ($error) + { + foreach($this->errors as $errmsg) + { + dol_syslog(__METHOD__." ".$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; + } + else + { + $this->db->commit(); + return 1; + } + } - /** - * Initialise object with example values - * Id must be 0 if object instance is a specimen - * - * @return void - */ - function initAsSpecimen() - { - $this->id=0; - $this->expression=''; - } + /** + * Initialise object with example values + * Id must be 0 if object instance is a specimen + * + * @return void + */ + public function initAsSpecimen() + { + $this->id=0; + $this->expression=''; + } } diff --git a/htdocs/product/dynamic_price/class/price_global_variable.class.php b/htdocs/product/dynamic_price/class/price_global_variable.class.php index 45847b98788..02c9b6af2cc 100644 --- a/htdocs/product/dynamic_price/class/price_global_variable.class.php +++ b/htdocs/product/dynamic_price/class/price_global_variable.class.php @@ -35,40 +35,40 @@ class PriceGlobalVariable public $db; /** - * @var string Error code (or message) - */ - public $error=''; + * @var string Error code (or message) + */ + public $error=''; /** - * @var string[] Error codes (or messages) - */ - public $errors = array(); + * @var string[] Error codes (or messages) + */ + public $errors = array(); /** - * @var int ID - */ - public $id; + * @var int ID + */ + public $id; public $code; /** - * @var string description - */ - public $description; + * @var string description + */ + public $description; public $value; /** - * @var string Name of table without prefix where object is stored - */ - public $table_element = "c_price_global_variable"; + * @var string Name of table without prefix where object is stored + */ + public $table_element = "c_price_global_variable"; /** * Constructor * * @param DoliDb $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db = $db; } @@ -81,7 +81,7 @@ class PriceGlobalVariable * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, Id of created object if OK */ - function create($user, $notrigger = 0) + public function create($user, $notrigger = 0) { $error=0; @@ -143,7 +143,7 @@ class PriceGlobalVariable * @param int $id Id object * @return int < 0 if KO, 0 if OK but not found, > 0 if OK */ - function fetch($id) + public function fetch($id) { $sql = "SELECT code, description, value"; $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element; @@ -182,7 +182,7 @@ class PriceGlobalVariable * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user = 0, $notrigger = 0) + public function update($user = 0, $notrigger = 0) { $error=0; @@ -242,7 +242,7 @@ class PriceGlobalVariable * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function delete($rowid, $user, $notrigger = 0) + public function delete($rowid, $user, $notrigger = 0) { $error=0; @@ -296,7 +296,7 @@ class PriceGlobalVariable * * @return void */ - function initAsSpecimen() + public function initAsSpecimen() { $this->id=0; $this->code=''; @@ -309,7 +309,7 @@ class PriceGlobalVariable * * @return void */ - function checkParameters() + public function checkParameters() { // Clean parameters if (isset($this->code)) $this->code=trim($this->code); @@ -324,7 +324,7 @@ class PriceGlobalVariable * * @return array Array of price global variables */ - function listGlobalVariables() + public function listGlobalVariables() { $sql = "SELECT rowid, code, description, value"; $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element; diff --git a/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php b/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php index 2fe696194f9..e881ba2bc97 100644 --- a/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php +++ b/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php @@ -35,29 +35,29 @@ class PriceGlobalVariableUpdater public $db; /** - * @var string Error code (or message) - */ - public $error=''; + * @var string Error code (or message) + */ + public $error=''; /** - * @var string[] Error codes (or messages) - */ - public $errors = array(); + * @var string[] Error codes (or messages) + */ + public $errors = array(); public $types=array(0, 1); //!< Updater types public $update_min = 5; //!< Minimal update rate /** - * @var int ID - */ - public $id; + * @var int ID + */ + public $id; public $type; /** - * @var string description - */ - public $description; + * @var string description + */ + public $description; public $parameters; @@ -71,16 +71,16 @@ class PriceGlobalVariableUpdater public $last_status; /** - * @var string Name of table without prefix where object is stored - */ - public $table_element = "c_price_global_variable_updater"; + * @var string Name of table without prefix where object is stored + */ + public $table_element = "c_price_global_variable_updater"; /** * Constructor * * @param DoliDb $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db = $db; } @@ -93,7 +93,7 @@ class PriceGlobalVariableUpdater * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, Id of created object if OK */ - function create($user, $notrigger = 0) + public function create($user, $notrigger = 0) { $error=0; @@ -159,7 +159,7 @@ class PriceGlobalVariableUpdater * @param int $id Id object * @return int < 0 if KO, 0 if OK but not found, > 0 if OK */ - function fetch($id) + public function fetch($id) { $sql = "SELECT type, description, parameters, fk_variable, update_interval, next_update, last_status"; $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element; @@ -202,7 +202,7 @@ class PriceGlobalVariableUpdater * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user = 0, $notrigger = 0) + public function update($user = 0, $notrigger = 0) { $error=0; @@ -265,16 +265,16 @@ class PriceGlobalVariableUpdater * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function delete($rowid, $user, $notrigger = 0) + public function delete($rowid, $user, $notrigger = 0) { $error=0; $this->db->begin(); - if (! $error) - { - if (! $notrigger) - { + //if (! $error) + //{ + // if (! $notrigger) + // { // Uncomment this and change MYOBJECT to your own tag if you // want this action calls a trigger. @@ -282,8 +282,8 @@ class PriceGlobalVariableUpdater //$result=$this->call_trigger('MYOBJECT_DELETE',$user); //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} //// End call triggers - } - } + // } + //} if (! $error) { @@ -319,7 +319,7 @@ class PriceGlobalVariableUpdater * * @return void */ - function initAsSpecimen() + public function initAsSpecimen() { $this->id=0; $this->type=0; @@ -332,11 +332,11 @@ class PriceGlobalVariableUpdater } /** - * Returns the last updated time in string html format, returns "never" if its less than 1 + * Returns the last updated time in string html format, returns "never" if its less than 1 * - * @return string + * @return string */ - function getLastUpdated() + public function getLastUpdated() { global $langs; $last = $this->next_update - ($this->update_interval * 60); @@ -352,7 +352,7 @@ class PriceGlobalVariableUpdater * * @return void */ - function checkParameters() + public function checkParameters() { // Clean parameters if (isset($this->description)) $this->description=trim($this->description); @@ -371,7 +371,7 @@ class PriceGlobalVariableUpdater * * @return array Array of price global variable updaters */ - function listUpdaters() + public function listUpdaters() { $sql = "SELECT rowid, type, description, parameters, fk_variable, update_interval, next_update, last_status"; $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element; @@ -412,7 +412,7 @@ class PriceGlobalVariableUpdater * * @return array Array of price global variable updaters */ - function listPendingUpdaters() + public function listPendingUpdaters() { $sql = "SELECT rowid, type, description, parameters, fk_variable, update_interval, next_update, last_status"; $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element; @@ -450,11 +450,11 @@ class PriceGlobalVariableUpdater } /** - * Handles the processing of this updater + * Handles the processing of this updater * * @return int <0 if KO, 0 if OK but no global variable found, >0 if OK */ - function process() + public function process() { global $langs, $user; $langs->load("errors"); @@ -560,7 +560,7 @@ class PriceGlobalVariableUpdater return 1; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Update next_update into database * @@ -569,7 +569,7 @@ class PriceGlobalVariableUpdater * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update_next_update($next_update, $user = 0, $notrigger = 0) + public function update_next_update($next_update, $user = 0, $notrigger = 0) { // phpcs:enable $error=0; @@ -606,7 +606,7 @@ class PriceGlobalVariableUpdater } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Update last_status into database * @@ -615,7 +615,7 @@ class PriceGlobalVariableUpdater * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update_status($last_status, $user = 0, $notrigger = 0) + public function update_status($last_status, $user = 0, $notrigger = 0) { // phpcs:enable $error=0; diff --git a/htdocs/product/dynamic_price/class/price_parser.class.php b/htdocs/product/dynamic_price/class/price_parser.class.php index d9f4a88533e..8e8b8e4fcc9 100644 --- a/htdocs/product/dynamic_price/class/price_parser.class.php +++ b/htdocs/product/dynamic_price/class/price_parser.class.php @@ -32,167 +32,167 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; */ class PriceParser { - protected $db; - // Limit of expressions per price - public $limit = 100; - // The error that occurred when parsing price - public $error_parser; - // The expression that caused the error - public $error_expr; - //The special char - public $special_chr = "#"; - //The separator char - public $separator_chr = ";"; + protected $db; + // Limit of expressions per price + public $limit = 100; + // The error that occurred when parsing price + public $error_parser; + // The expression that caused the error + public $error_expr; + //The special char + public $special_chr = "#"; + //The separator char + public $separator_chr = ";"; - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - function __construct($db) - { - $this->db = $db; - } + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + $this->db = $db; + } - /** - * Returns translated error - * - * @return string Translated error - */ - public function translatedError() - { - global $langs; - $langs->load("errors"); - /* - -No arg - 9, an unexpected error occured - 14, division by zero - 19, expression not found - 20, empty expression + /** + * Returns translated error + * + * @return string Translated error + */ + public function translatedError() + { + global $langs; + $langs->load("errors"); + /* + -No arg + 9, an unexpected error occured + 14, division by zero + 19, expression not found + 20, empty expression - -1 Arg - 1, cannot assign to constant '%s' - 2, cannot redefine built-in function '%s' - 3, undefined variable '%s' in function definition - 4, illegal character '%s' - 5, unexpected '%s' - 8, unexpected operator '%s' - 10, operator '%s' lacks operand - 11, expecting '%s' - 17, undefined variable '%s' - 21, empty result '%s' - 22, negative result '%s' - 24, variable '%s' exists but has no value + -1 Arg + 1, cannot assign to constant '%s' + 2, cannot redefine built-in function '%s' + 3, undefined variable '%s' in function definition + 4, illegal character '%s' + 5, unexpected '%s' + 8, unexpected operator '%s' + 10, operator '%s' lacks operand + 11, expecting '%s' + 17, undefined variable '%s' + 21, empty result '%s' + 22, negative result '%s' + 24, variable '%s' exists but has no value - -2 Args - 6, wrong number of arguments (%s given, %s expected) - 23, unknown or non set variable '%s' after %s + -2 Args + 6, wrong number of arguments (%s given, %s expected) + 23, unknown or non set variable '%s' after %s - -internal errors - 7, internal error - 12, internal error - 13, internal error - 15, internal error - 16, internal error - 18, internal error - */ - if (empty($this->error_parser)) { - return $langs->trans("ErrorPriceExpressionUnknown", 0); //this is not supposed to happen - } - list($code, $info) = $this->error_parser; - if (in_array($code, array(9, 14, 19, 20))) //Errors which have 0 arg - { - return $langs->trans("ErrorPriceExpression".$code); - } - elseif (in_array($code, array(1, 2, 3, 4, 5, 8, 10, 11, 17, 21, 22))) //Errors which have 1 arg - { - return $langs->trans("ErrorPriceExpression".$code, $info); - } - elseif (in_array($code, array(6, 23))) //Errors which have 2 args - { - return $langs->trans("ErrorPriceExpression".$code, $info[0], $info[1]); - } - elseif (in_array($code, array(7, 12, 13, 15, 16, 18))) //Internal errors - { - return $langs->trans("ErrorPriceExpressionInternal", $code); - } - else //Unknown errors - { - return $langs->trans("ErrorPriceExpressionUnknown", $code); - } - } + -internal errors + 7, internal error + 12, internal error + 13, internal error + 15, internal error + 16, internal error + 18, internal error + */ + if (empty($this->error_parser)) { + return $langs->trans("ErrorPriceExpressionUnknown", 0); //this is not supposed to happen + } + list($code, $info) = $this->error_parser; + if (in_array($code, array(9, 14, 19, 20))) //Errors which have 0 arg + { + return $langs->trans("ErrorPriceExpression".$code); + } + elseif (in_array($code, array(1, 2, 3, 4, 5, 8, 10, 11, 17, 21, 22))) //Errors which have 1 arg + { + return $langs->trans("ErrorPriceExpression".$code, $info); + } + elseif (in_array($code, array(6, 23))) //Errors which have 2 args + { + return $langs->trans("ErrorPriceExpression".$code, $info[0], $info[1]); + } + elseif (in_array($code, array(7, 12, 13, 15, 16, 18))) //Internal errors + { + return $langs->trans("ErrorPriceExpressionInternal", $code); + } + else //Unknown errors + { + return $langs->trans("ErrorPriceExpressionUnknown", $code); + } + } - /** - * Calculates price based on expression - * - * @param Product $product The Product object to get information - * @param String $expression The expression to parse - * @param array $values Strings to replaces - * @return int > 0 if OK, < 1 if KO - */ - public function parseExpression($product, $expression, $values) - { - global $user; + /** + * Calculates price based on expression + * + * @param Product $product The Product object to get information + * @param String $expression The expression to parse + * @param array $values Strings to replaces + * @return int > 0 if OK, < 1 if KO + */ + public function parseExpression($product, $expression, $values) + { + global $user; - //Check if empty - $expression = trim($expression); - if (empty($expression)) - { - $this->error_parser = array(20, null); - return -2; - } + //Check if empty + $expression = trim($expression); + if (empty($expression)) + { + $this->error_parser = array(20, null); + return -2; + } - //Accessible product values by expressions -$values = array_merge($values, array( - "tva_tx" => $product->tva_tx, - "localtax1_tx" => $product->localtax1_tx, - "localtax2_tx" => $product->localtax2_tx, - "weight" => $product->weight, - "length" => $product->length, - "surface" => $product->surface, - "price_min" => $product->price_min, - )); + //Accessible product values by expressions + $values = array_merge($values, array( + "tva_tx" => $product->tva_tx, + "localtax1_tx" => $product->localtax1_tx, + "localtax2_tx" => $product->localtax2_tx, + "weight" => $product->weight, + "length" => $product->length, + "surface" => $product->surface, + "price_min" => $product->price_min, + )); - //Retrieve all extrafield for product and add it to values - $extrafields = new ExtraFields($this->db); - $extralabels = $extrafields->fetch_name_optionals_label('product', true); - $product->fetch_optionals(); - foreach ($extrafields->attributes[$product->table_element]['label'] as $key=>$label) - { - $values["extrafield_".$key] = $product->array_options['options_'.$key]; - } + //Retrieve all extrafield for product and add it to values + $extrafields = new ExtraFields($this->db); + $extralabels = $extrafields->fetch_name_optionals_label('product', true); + $product->fetch_optionals(); + foreach ($extrafields->attributes[$product->table_element]['label'] as $key=>$label) + { + $values["extrafield_".$key] = $product->array_options['options_'.$key]; + } - //Process any pending updaters - $price_updaters = new PriceGlobalVariableUpdater($this->db); - foreach ($price_updaters->listPendingUpdaters() as $entry) { + //Process any pending updaters + $price_updaters = new PriceGlobalVariableUpdater($this->db); + foreach ($price_updaters->listPendingUpdaters() as $entry) { //Schedule the next update by adding current timestamp (secs) + interval (mins) $entry->update_next_update(dol_now() + ($entry->update_interval * 60), $user); //Do processing - $res = $entry->process(); + $res = $entry->process(); //Store any error or clear status if OK $entry->update_status($res < 1?$entry->error:'', $user); - } + } - //Get all global values - $price_globals = new PriceGlobalVariable($this->db); - foreach ($price_globals->listGlobalVariables() as $entry) - { - $values["global_".$entry->code] = $entry->value; - } + //Get all global values + $price_globals = new PriceGlobalVariable($this->db); + foreach ($price_globals->listGlobalVariables() as $entry) + { + $values["global_".$entry->code] = $entry->value; + } - //Remove internal variables - unset($values["supplier_id"]); + //Remove internal variables + unset($values["supplier_id"]); - //Prepare the lib, parameters and values - $em = new EvalMath(); - $em->suppress_errors = true; //Don't print errors on page - $this->error_expr = null; - $last_result = null; + //Prepare the lib, parameters and values + $em = new EvalMath(); + $em->suppress_errors = true; //Don't print errors on page + $this->error_expr = null; + $last_result = null; - //Fill each variable in expression from values - $expression = str_replace("\n", $this->separator_chr, $expression); - foreach ($values as $key => $value) - { + //Fill each variable in expression from values + $expression = str_replace("\n", $this->separator_chr, $expression); + foreach ($values as $key => $value) + { if ($value === null && strpos($expression, $key) !== false) { $this->error_parser = array(24, $key); return -7; @@ -200,139 +200,139 @@ $values = array_merge($values, array( $expression = str_replace($this->special_chr.$key.$this->special_chr, strval($value), $expression); } - //Check if there is unfilled variable - if (strpos($expression, $this->special_chr) !== false) - { - $data = explode($this->special_chr, $expression); - $variable = $this->special_chr.$data[1]; - if (isset($data[2])) $variable.= $this->special_chr; - $this->error_parser = array(23, array($variable, $expression)); - return -6; - } + //Check if there is unfilled variable + if (strpos($expression, $this->special_chr) !== false) + { + $data = explode($this->special_chr, $expression); + $variable = $this->special_chr.$data[1]; + if (isset($data[2])) $variable.= $this->special_chr; + $this->error_parser = array(23, array($variable, $expression)); + return -6; + } - //Iterate over each expression splitted by $separator_chr - $expressions = explode($this->separator_chr, $expression); - $expressions = array_slice($expressions, 0, $this->limit); - foreach ($expressions as $expr) { - $expr = trim($expr); - if (!empty($expr)) - { - $last_result = $em->evaluate($expr); - $this->error_parser = $em->last_error_code; - if ($this->error_parser !== null) { //$em->last_error_code is null if no error happened, so just check if error_parser is not null - $this->error_expr = $expr; - return -3; - } - } - } - $vars = $em->vars(); - if (empty($vars["price"])) { - $vars["price"] = $last_result; - } - if (!isset($vars["price"])) - { - $this->error_parser = array(21, $expression); - return -4; - } - if ($vars["price"] < 0) - { - $this->error_parser = array(22, $expression); - return -5; - } - return $vars["price"]; - } + //Iterate over each expression splitted by $separator_chr + $expressions = explode($this->separator_chr, $expression); + $expressions = array_slice($expressions, 0, $this->limit); + foreach ($expressions as $expr) { + $expr = trim($expr); + if (!empty($expr)) + { + $last_result = $em->evaluate($expr); + $this->error_parser = $em->last_error_code; + if ($this->error_parser !== null) { //$em->last_error_code is null if no error happened, so just check if error_parser is not null + $this->error_expr = $expr; + return -3; + } + } + } + $vars = $em->vars(); + if (empty($vars["price"])) { + $vars["price"] = $last_result; + } + if (!isset($vars["price"])) + { + $this->error_parser = array(21, $expression); + return -4; + } + if ($vars["price"] < 0) + { + $this->error_parser = array(22, $expression); + return -5; + } + return $vars["price"]; + } - /** - * Calculates product price based on product id and associated expression - * - * @param Product $product The Product object to get information - * @param array $extra_values Any aditional values for expression - * @return int > 0 if OK, < 1 if KO - */ - public function parseProduct($product, $extra_values = array()) - { - //Get the expression from db - $price_expression = new PriceExpression($this->db); - $res = $price_expression->fetch($product->fk_price_expression); - if ($res < 1) { - $this->error_parser = array(19, null); - return -1; - } + /** + * Calculates product price based on product id and associated expression + * + * @param Product $product The Product object to get information + * @param array $extra_values Any aditional values for expression + * @return int > 0 if OK, < 1 if KO + */ + public function parseProduct($product, $extra_values = array()) + { + //Get the expression from db + $price_expression = new PriceExpression($this->db); + $res = $price_expression->fetch($product->fk_price_expression); + if ($res < 1) { + $this->error_parser = array(19, null); + return -1; + } - //Get the supplier min - $productFournisseur = new ProductFournisseur($this->db); - $supplier_min_price = $productFournisseur->find_min_price_product_fournisseur($product->id, 0, 0); + //Get the supplier min + $productFournisseur = new ProductFournisseur($this->db); + $supplier_min_price = $productFournisseur->find_min_price_product_fournisseur($product->id, 0, 0); - //Accessible values by expressions -$extra_values = array_merge($extra_values, array( - "supplier_min_price" => $supplier_min_price, - )); + //Accessible values by expressions + $extra_values = array_merge($extra_values, array( + "supplier_min_price" => $supplier_min_price, + )); - //Parse the expression and return the price, if not error occurred check if price is higher than min - $result = $this->parseExpression($product, $price_expression->expression, $extra_values); - if (empty($this->error_parser)) { - if ($result < $product->price_min) { - $result = $product->price_min; - } - } - return $result; - } + //Parse the expression and return the price, if not error occurred check if price is higher than min + $result = $this->parseExpression($product, $price_expression->expression, $extra_values); + if (empty($this->error_parser)) { + if ($result < $product->price_min) { + $result = $product->price_min; + } + } + return $result; + } - /** - * Calculates supplier product price based on product supplier price and associated expression - * - * @param ProductFournisseur $product_supplier The Product supplier object to get information - * @param array $extra_values Any aditional values for expression - * @return int > 0 if OK, < 1 if KO - */ - public function parseProductSupplier($product_supplier, $extra_values = array()) - { - //Get the expression from db - $price_expression = new PriceExpression($this->db); - $res = $price_expression->fetch($product_supplier->fk_supplier_price_expression); - if ($res < 1) - { - $this->error_parser = array(19, null); - return -1; - } + /** + * Calculates supplier product price based on product supplier price and associated expression + * + * @param ProductFournisseur $product_supplier The Product supplier object to get information + * @param array $extra_values Any aditional values for expression + * @return int > 0 if OK, < 1 if KO + */ + public function parseProductSupplier($product_supplier, $extra_values = array()) + { + //Get the expression from db + $price_expression = new PriceExpression($this->db); + $res = $price_expression->fetch($product_supplier->fk_supplier_price_expression); + if ($res < 1) + { + $this->error_parser = array(19, null); + return -1; + } - //Get the product data (use ignore_expression to avoid possible recursion) - $product_supplier->fetch($product_supplier->id, '', '', 1); + //Get the product data (use ignore_expression to avoid possible recursion) + $product_supplier->fetch($product_supplier->id, '', '', 1); - //Accessible values by expressions -$extra_values = array_merge($extra_values, array( - "supplier_quantity" => $product_supplier->fourn_qty, - "supplier_tva_tx" => $product_supplier->fourn_tva_tx, - )); + //Accessible values by expressions + $extra_values = array_merge($extra_values, array( + "supplier_quantity" => $product_supplier->fourn_qty, + "supplier_tva_tx" => $product_supplier->fourn_tva_tx, + )); - //Parse the expression and return the price - return $this->parseExpression($product_supplier, $price_expression->expression, $extra_values); - } + //Parse the expression and return the price + return $this->parseExpression($product_supplier, $price_expression->expression, $extra_values); + } - /** - * Tests string expression for validity - * - * @param int $product_id The Product id to get information - * @param string $expression The expression to parse - * @param array $extra_values Any aditional values for expression - * @return int > 0 if OK, < 1 if KO - */ - public function testExpression($product_id, $expression, $extra_values = array()) - { - //Get the product data - $product = new Product($this->db); - $product->fetch($product_id, '', '', 1); + /** + * Tests string expression for validity + * + * @param int $product_id The Product id to get information + * @param string $expression The expression to parse + * @param array $extra_values Any aditional values for expression + * @return int > 0 if OK, < 1 if KO + */ + public function testExpression($product_id, $expression, $extra_values = array()) + { + //Get the product data + $product = new Product($this->db); + $product->fetch($product_id, '', '', 1); - //Values for product expressions -$extra_values = array_merge($extra_values, array( - "supplier_min_price" => 1, - )); + //Values for product expressions + $extra_values = array_merge($extra_values, array( + "supplier_min_price" => 1, + )); - //Values for supplier product expressions -$extra_values = array_merge($extra_values, array( - "supplier_quantity" => 2, - "supplier_tva_tx" => 3, - )); - return $this->parseExpression($product, $expression, $extra_values); - } + //Values for supplier product expressions + $extra_values = array_merge($extra_values, array( + "supplier_quantity" => 2, + "supplier_tva_tx" => 3, + )); + return $this->parseExpression($product, $expression, $extra_values); + } } diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index 78dde003214..9ee618df1ad 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -321,7 +321,7 @@ class Inventory 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; @@ -370,12 +370,12 @@ class Inventory 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 * @@ -383,7 +383,7 @@ class Inventory 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, 5=Long 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; @@ -439,7 +439,7 @@ class Inventory 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/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index c15f5f8dffc..607d1cc25f3 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -50,29 +50,29 @@ class Reception extends CommonObject protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe public $picto = 'reception'; - var $socid; - var $ref_supplier; - var $ref_int; - var $brouillon; - var $entrepot_id; - var $lines=array(); - var $tracking_number; - var $tracking_url; - var $billed; - var $model_pdf; + public $socid; + public $ref_supplier; + public $ref_int; + public $brouillon; + public $entrepot_id; + public $lines=array(); + public $tracking_number; + public $tracking_url; + public $billed; + public $model_pdf; - var $trueWeight; - var $weight_units; - var $trueWidth; - var $width_units; - var $trueHeight; - var $height_units; - var $trueDepth; - var $depth_units; + public $trueWeight; + public $weight_units; + public $trueWidth; + public $width_units; + public $trueHeight; + public $height_units; + public $trueDepth; + public $depth_units; // A denormalized value - var $trueSize; + public $trueSize; - var $date_delivery; // Date delivery planed + public $date_delivery; // Date delivery planed /** @@ -80,11 +80,11 @@ class Reception extends CommonObject * @var int */ public $date_reception; - var $date_creation; - var $date_valid; + public $date_creation; + public $date_valid; - var $meths; - var $listmeths; // List of carriers + public $meths; + public $listmeths; // List of carriers const STATUS_DRAFT = 0; @@ -98,7 +98,7 @@ class Reception extends CommonObject * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db = $db; $this->lines = array(); @@ -118,7 +118,7 @@ class Reception extends CommonObject * @param Societe $soc Thirdparty object * @return string Free reference for contract */ - function getNextNumRef($soc) + public function getNextNumRef($soc) { global $langs, $conf; $langs->load("receptions"); @@ -176,7 +176,7 @@ class Reception extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 si erreur, id reception creee si ok */ - function create($user, $notrigger = 0) + public function create($user, $notrigger = 0) { global $conf, $hookmanager; @@ -358,7 +358,7 @@ class Reception extends CommonObject * @param string $ref_int Internal reference of other object * @return int >0 if OK, 0 if not found, <0 if KO */ - function fetch($id, $ref = '', $ref_ext = '', $ref_int = '') + public function fetch($id, $ref = '', $ref_ext = '', $ref_int = '') { global $conf; @@ -488,7 +488,7 @@ class Reception extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if OK, >0 if KO */ - function valid($user, $notrigger = 0) + public function valid($user, $notrigger = 0) { global $conf, $langs; @@ -712,7 +712,7 @@ class Reception extends CommonObject * @param string $batch Lot number * @return int <0 if KO, >0 if OK */ - function addline($entrepot_id, $id, $qty, $array_options = 0, $comment = '', $eatby = '', $sellby = '', $batch = '') + public function addline($entrepot_id, $id, $qty, $array_options = 0, $comment = '', $eatby = '', $sellby = '', $batch = '') { global $conf, $langs, $user; @@ -763,7 +763,7 @@ class Reception 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; $error=0; @@ -864,7 +864,7 @@ class Reception extends CommonObject * @param User $user Object user * @return int >0 if OK, 0 if deletion done but failed to delete files, <0 if KO */ - function delete(User $user) + public function delete(User $user) { global $conf, $langs, $user; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -1014,13 +1014,13 @@ class Reception extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load lines * * @return int >0 if OK, Otherwise if KO */ - function fetch_lines() + public function fetch_lines() { // phpcs:enable global $db; @@ -1082,7 +1082,7 @@ class Reception extends CommonObject * @param int $notooltip 1=No tooltip * @return string String with URL */ - function getNomUrl($withpicto = 0, $option = 0, $max = 0, $short = 0, $notooltip = 0) + public function getNomUrl($withpicto = 0, $option = 0, $max = 0, $short = 0, $notooltip = 0) { global $langs; $result=''; @@ -1123,12 +1123,12 @@ class Reception 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) - { - 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 * @@ -1136,40 +1136,40 @@ class Reception 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 of status */ - function LibStatut($statut, $mode) - { + public function LibStatut($statut, $mode) + { // phpcs:enable global $langs; if ($mode==0) { if ($statut==0) return $langs->trans($this->statuts[$statut]); - if ($statut==1) return $langs->trans($this->statuts[$statut]); - if ($statut==2) return $langs->trans($this->statuts[$statut]); + elseif ($statut==1) return $langs->trans($this->statuts[$statut]); + elseif ($statut==2) return $langs->trans($this->statuts[$statut]); } - if ($mode==1) + elseif ($mode==1) { if ($statut==0) return $langs->trans('StatusReceptionDraftShort'); - if ($statut==1) return $langs->trans('StatusReceptionValidatedShort'); - if ($statut==2) return $langs->trans('StatusReceptionProcessedShort'); + elseif ($statut==1) return $langs->trans('StatusReceptionValidatedShort'); + elseif ($statut==2) return $langs->trans('StatusReceptionProcessedShort'); } - if ($mode == 3) + elseif ($mode == 3) { if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0'); - if ($statut==1) return img_picto($langs->trans($this->statuts[$statut]), 'statut4'); - if ($statut==2) return img_picto($langs->trans('StatusReceptionProcessed'), 'statut6'); + elseif ($statut==1) return img_picto($langs->trans($this->statuts[$statut]), 'statut4'); + elseif ($statut==2) return img_picto($langs->trans('StatusReceptionProcessed'), 'statut6'); } - if ($mode == 4) + elseif ($mode == 4) { if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]); - if ($statut==1) return img_picto($langs->trans($this->statuts[$statut]), 'statut4').' '.$langs->trans($this->statuts[$statut]); - if ($statut==2) return img_picto($langs->trans('StatusReceptionProcessed'), 'statut6').' '.$langs->trans('StatusReceptionProcessed'); + elseif ($statut==1) return img_picto($langs->trans($this->statuts[$statut]), 'statut4').' '.$langs->trans($this->statuts[$statut]); + elseif ($statut==2) return img_picto($langs->trans('StatusReceptionProcessed'), 'statut6').' '.$langs->trans('StatusReceptionProcessed'); } - if ($mode == 5) + elseif ($mode == 5) { if ($statut==0) return $langs->trans('StatusReceptionDraftShort').' '.img_picto($langs->trans($this->statuts[$statut]), 'statut0'); - if ($statut==1) return $langs->trans('StatusReceptionValidatedShort').' '.img_picto($langs->trans($this->statuts[$statut]), 'statut4'); - if ($statut==2) return $langs->trans('StatusReceptionProcessedShort').' '.img_picto($langs->trans('StatusReceptionProcessedShort'), 'statut6'); + elseif ($statut==1) return $langs->trans('StatusReceptionValidatedShort').' '.img_picto($langs->trans($this->statuts[$statut]), 'statut4'); + elseif ($statut==2) return $langs->trans('StatusReceptionProcessedShort').' '.img_picto($langs->trans('StatusReceptionProcessedShort'), 'statut6'); } } @@ -1179,9 +1179,9 @@ class Reception extends CommonObject * id must be 0 if object instance is a specimen. * * @return void - */ - function initAsSpecimen() - { + */ + public function initAsSpecimen() + { global $langs; dol_include_once('/fourn/class/fournisseur.commande.dispatch.class.php'); $now=dol_now(); @@ -1232,8 +1232,8 @@ class Reception extends CommonObject $this->origin_id = 1; $this->origin = 'commande'; - $this->note_private = 'Private note'; - $this->note_public = 'Public note'; + $this->note_private = 'Private note'; + $this->note_public = 'Public note'; $nbp = 5; $xnbp = 0; @@ -1251,7 +1251,7 @@ class Reception extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set the planned delivery date * @@ -1259,7 +1259,7 @@ class Reception extends CommonObject * @param timestamp $date_livraison Date de livraison * @return int <0 if KO, >0 if OK */ - function set_date_livraison($user, $date_livraison) + public function set_date_livraison($user, $date_livraison) { // phpcs:enable if ($user->rights->reception->creer) @@ -1287,13 +1287,13 @@ class Reception extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Fetch deliveries method and return an array. Load array this->meths(rowid=>label). * * @return void */ - function fetch_delivery_methods() + public function fetch_delivery_methods() { // phpcs:enable global $langs; @@ -1315,16 +1315,16 @@ class Reception extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Fetch all deliveries method and return an array. Load array this->listmeths. * * @param int $id only this carrier, all if none * @return void */ - function list_delivery_methods($id = '') + public function list_delivery_methods($id = '') { - // phpcs:enable + // phpcs:enable global $langs; $this->listmeths = array(); @@ -1335,10 +1335,8 @@ class Reception extends CommonObject if ($id!='') $sql.= " WHERE em.rowid=".$id; $resql = $this->db->query($sql); - if ($resql) - { - while ($obj = $this->db->fetch_object($resql)) - { + if ($resql) { + while ($obj = $this->db->fetch_object($resql)) { $this->listmeths[$i]['rowid'] = $obj->rowid; $this->listmeths[$i]['code'] = $obj->code; $label=$langs->trans('ReceptionMethod'.$obj->code); @@ -1351,7 +1349,7 @@ class Reception extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Update/create delivery method. * @@ -1359,7 +1357,7 @@ class Reception extends CommonObject * * @return void */ - function update_delivery_method($id = '') + public function update_delivery_method($id = '') { // phpcs:enable if ($id=='') @@ -1381,7 +1379,7 @@ class Reception extends CommonObject if ($resql < 0) dol_print_error($this->db, ''); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Activate delivery method. * @@ -1389,7 +1387,7 @@ class Reception extends CommonObject * * @return void */ - function activ_delivery_method($id) + public function activ_delivery_method($id) { // phpcs:enable $sql = 'UPDATE '.MAIN_DB_PREFIX.'c_shipment_mode SET active=1'; @@ -1398,7 +1396,7 @@ class Reception extends CommonObject $resql = $this->db->query($sql); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * DesActivate delivery method. * @@ -1406,7 +1404,7 @@ class Reception extends CommonObject * * @return void */ - function disable_delivery_method($id) + public function disable_delivery_method($id) { // phpcs:enable $sql = 'UPDATE '.MAIN_DB_PREFIX.'c_shipment_mode SET active=0'; @@ -1422,7 +1420,7 @@ class Reception extends CommonObject * @param string $value Value * @return void */ - function getUrlTrackingStatus($value = '') + public function getUrlTrackingStatus($value = '') { if (! empty($this->shipping_method_id)) { @@ -1456,7 +1454,7 @@ class Reception extends CommonObject * * @return int <0 if KO, >0 if OK */ - function setClosed() + public function setClosed() { global $conf,$langs,$user; @@ -1597,13 +1595,13 @@ class Reception extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Classify the reception as invoiced (used when WORKFLOW_BILL_ON_RECEPTION is on) * * @return int <0 if ko, >0 if ok */ - function set_billed() + public function set_billed() { // phpcs:enable global $user; @@ -1648,7 +1646,7 @@ class Reception extends CommonObject * * @return int <0 if ko, >0 if ok */ - function reOpen() + public function reOpen() { global $conf,$langs,$user; @@ -1766,14 +1764,14 @@ class Reception extends CommonObject } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set draft status * * @param User $user Object user that modify * @return int <0 if KO, >0 if OK */ - function set_draft($user) + public function set_draft($user) { // phpcs:enable global $conf,$langs; @@ -1908,13 +1906,13 @@ class Reception extends CommonObject } } - if (!$error) { - $this->statut=self::STATUS_DRAFT; - $this->db->commit(); - return 1; - }else { - $this->db->rollback(); - return -1; + if (!$error) { + $this->statut=self::STATUS_DRAFT; + $this->db->commit(); + return 1; + } else { + $this->db->rollback(); + return -1; } } else diff --git a/htdocs/reception/class/receptionstats.class.php b/htdocs/reception/class/receptionstats.class.php index bcdc8e8d774..ddcbe0ecf96 100644 --- a/htdocs/reception/class/receptionstats.class.php +++ b/htdocs/reception/class/receptionstats.class.php @@ -34,14 +34,14 @@ include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; */ class ReceptionStats extends Stats { - public $table_element; + public $table_element; - var $socid; - var $userid; + public $socid; + public $userid; - var $from; - var $field; - var $where; + public $from; + public $field; + public $where; /** @@ -52,7 +52,7 @@ class ReceptionStats extends Stats * @param string $mode Option (not used) * @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; @@ -84,13 +84,15 @@ class ReceptionStats extends Stats * @param int $year Year to scan * @return array Array with number by month */ - function getNbByMonth($year) + public function getNbByMonth($year) { global $user; $sql = "SELECT date_format(c.date_valid,'%m') as dm, COUNT(*) as nb"; $sql.= " FROM ".$this->from; - if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$this->socid) { + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + } $sql.= " WHERE c.date_valid BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'"; $sql.= " AND ".$this->where; $sql.= " GROUP BY dm"; @@ -106,7 +108,7 @@ class ReceptionStats extends Stats * @return array Array with number by year * */ - function getNbByYear() + public function getNbByYear() { global $user; @@ -121,11 +123,11 @@ class ReceptionStats extends Stats } /** - * Return nb, total and average + * Return nb, total and average * - * @return array Array of values + * @return array Array of values */ - function getAllByYear() + public function getAllByYear() { global $user; diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php index ce527ee7258..290d07ab857 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -242,7 +242,7 @@ class Dolresource 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, $hookmanager; $error=0; @@ -405,7 +405,7 @@ class Dolresource extends CommonObject * @param int $notrigger Disable all triggers * @return int >0 if OK, <0 if KO */ - function delete($rowid, $notrigger = 0) + public function delete($rowid, $notrigger = 0) { global $user,$langs,$conf; diff --git a/htdocs/stripe/class/actions_stripe.class.php b/htdocs/stripe/class/actions_stripe.class.php index 598cb19dd62..5e11e81ed3e 100644 --- a/htdocs/stripe/class/actions_stripe.class.php +++ b/htdocs/stripe/class/actions_stripe.class.php @@ -53,10 +53,10 @@ class ActionsStripeconnect * * @param DoliDB $db Database handler */ - function __construct($db) - { - $this->db = $db; - } + public function __construct($db) + { + $this->db = $db; + } /** @@ -67,8 +67,8 @@ class ActionsStripeconnect * @param string $action Action * @return bool */ - function formObjectOptions($parameters, &$object, &$action) - { + public function formObjectOptions($parameters, &$object, &$action) + { global $db,$conf,$user,$langs,$form; if (! empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))) @@ -123,8 +123,7 @@ class ActionsStripeconnect $object->fetch_thirdparty(); $customer=$stripe->customerStripe($object->thirdparty, $stripe->getStripeAccount($service)); $this->resprints.= $customer->id; - } - else { + } else { $this->resprints.= $langs->trans("NoStripe"); } $this->resprints.= ''; @@ -141,13 +140,11 @@ class ActionsStripeconnect $object->fetch_thirdparty(); $customer=$stripe->customerStripe($object, $stripe->getStripeAccount($service)); $this->resprints.= $customer->id; - } - else { + } else { $this->resprints.= $langs->trans("NoStripe"); } $this->resprints.= ''; - } - elseif (is_object($object) && $object->element == 'adherent_type'){ + } elseif (is_object($object) && $object->element == 'adherent_type'){ $this->resprints.= ''; $this->resprints.= ''; } return 0; - } + } /** * addMoreActionsButtons @@ -178,8 +174,8 @@ class ActionsStripeconnect * @param string $action action * @return int 0 */ - function addMoreActionsButtons($parameters, &$object, &$action) - { + public function addMoreActionsButtons($parameters, &$object, &$action) + { global $db,$conf,$user,$langs,$form; if (is_object($object) && $object->element == 'facture'){ // On verifie si la facture a des paiements @@ -234,5 +230,5 @@ class ActionsStripeconnect print ''.$langs->trans("StripeAutoSubscription").''; } return 0; - } + } } diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index fa881a834ea..8aad2a1b891 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -91,17 +91,14 @@ class Stripe extends CommonObject dol_syslog(get_class($this) . "::fetch", LOG_DEBUG); $result = $this->db->query($sql); - if ($result) - { - if ($this->db->num_rows($result)) - { + if ($result) { + if ($this->db->num_rows($result)) { $obj = $this->db->fetch_object($result); $tokenstring=$obj->tokenstring; $tmparray = dol_json_decode($tokenstring); $key = $tmparray->stripe_user_id; - } - else { + } else { $tokenstring=''; } } @@ -311,8 +308,7 @@ class Stripe extends CommonObject $fee = round(($object->total_ttc * ($conf->global->STRIPE_APPLICATION_FEE_PERCENT / 100) + $conf->global->STRIPE_APPLICATION_FEE) * 100); if ($fee >= ($conf->global->STRIPE_APPLICATION_FEE_MAXIMAL * 100) && $conf->global->STRIPE_APPLICATION_FEE_MAXIMAL>$conf->global->STRIPE_APPLICATION_FEE_MINIMAL) { $fee = round($conf->global->STRIPE_APPLICATION_FEE_MAXIMAL * 100); - } - elseif ($fee < ($conf->global->STRIPE_APPLICATION_FEE_MINIMAL * 100)) { + } elseif ($fee < ($conf->global->STRIPE_APPLICATION_FEE_MINIMAL * 100)) { $fee = round($conf->global->STRIPE_APPLICATION_FEE_MINIMAL * 100); }
'; $this->resprints.= $langs->trans('PlanStripe'); @@ -161,14 +158,13 @@ class ActionsStripeconnect $object->fetch_thirdparty(); $customer=$stripe->customerStripe($object, $stripe->getStripeAccount($service)); $this->resprints.= $customer->id; - } - else { + } else { $this->resprints.= $langs->trans("NoStripe"); } $this->resprints.= '