From c89e4d79b807318b51c284ea5b81cf060b21c2a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 25 Feb 2019 22:27:04 +0100 Subject: [PATCH] wip --- dev/translation/autotranslator.class.php | 4 +- .../actions_contactcard_common.class.php | 24 +- .../actions_contactcard_default.class.php | 20 +- htdocs/contact/class/contact.class.php | 4 +- htdocs/core/class/CMailFile.class.php | 102 +++---- htdocs/core/class/antivir.class.php | 8 +- htdocs/core/class/canvas.class.php | 18 +- htdocs/core/class/ccountry.class.php | 10 +- htdocs/core/class/comment.class.php | 10 +- .../core/class/commondocgenerator.class.php | 98 +++---- htdocs/core/class/commoninvoice.class.php | 38 ++- htdocs/core/class/commonobject.class.php | 270 +++++++++--------- .../class/commonstickergenerator.class.php | 34 +-- htdocs/core/class/conf.class.php | 10 +- htdocs/core/class/vcard.class.php | 6 +- .../barcode/doc/phpbarcode.modules.php | 15 +- .../barcode/doc/tcpdfbarcode.modules.php | 12 +- .../modules/barcode/modules_barcode.class.php | 48 ++-- .../class/supplier_proposal.class.php | 18 +- 19 files changed, 376 insertions(+), 373 deletions(-) diff --git a/dev/translation/autotranslator.class.php b/dev/translation/autotranslator.class.php index 4da15890045..789bd8173c4 100644 --- a/dev/translation/autotranslator.class.php +++ b/dev/translation/autotranslator.class.php @@ -50,7 +50,7 @@ class autoTranslator * @param string $_apikey Api key * @return void */ - function __construct($_destlang, $_refLang, $_langDir, $_limittofile, $_apikey) + public function __construct($_destlang, $_refLang, $_langDir, $_limittofile, $_apikey) { // Set enviorment variables @@ -346,5 +346,5 @@ class autoTranslator //print "OK ".join('',$src_texts).' => '.$rep."\n"; return $rep; - } + } } diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php index b78b279122b..9dafaa58f05 100644 --- a/htdocs/contact/canvas/actions_contactcard_common.class.php +++ b/htdocs/contact/canvas/actions_contactcard_common.class.php @@ -32,15 +32,15 @@ abstract class ActionsContactCardCommon */ public $db; - var $dirmodule; - var $targetmodule; - var $canvas; - var $card; + public $dirmodule; + public $targetmodule; + public $canvas; + public $card; //! Template container - var $tpl = array(); + public $tpl = array(); //! Object container - var $object; + public $object; /** * @var string Error code (or message) @@ -60,7 +60,7 @@ abstract class ActionsContactCardCommon * @param int $id Object id * @return object Object loaded */ - function getObject($id) + public function getObject($id) { /*$ret = $this->getInstanceDao(); @@ -76,7 +76,7 @@ abstract class ActionsContactCardCommon //} } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set content of ->tpl array, to use into template * @@ -84,7 +84,7 @@ abstract class ActionsContactCardCommon * @param int $id Id * @return string HTML output */ - function assign_values(&$action, $id) + public function assign_values(&$action, $id) { // phpcs:enable global $conf, $langs, $user, $canvas; @@ -315,9 +315,9 @@ abstract class ActionsContactCardCommon { dol_print_error($this->db); } - $this->object->country_id = $langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->label; - $this->object->country_code = $obj->code; - $this->object->country = $langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->label; + $this->object->country_id = $langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->label; + $this->object->country_code = $obj->code; + $this->object->country = $langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->label; } } } diff --git a/htdocs/contact/canvas/default/actions_contactcard_default.class.php b/htdocs/contact/canvas/default/actions_contactcard_default.class.php index eee24315dab..4bc23beb2d3 100644 --- a/htdocs/contact/canvas/default/actions_contactcard_default.class.php +++ b/htdocs/contact/canvas/default/actions_contactcard_default.class.php @@ -37,9 +37,9 @@ class ActionsContactCardDefault extends ActionsContactCardCommon * @param string $targetmodule Name of directory of module 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; @@ -66,7 +66,7 @@ class ActionsContactCardDefault extends ActionsContactCardCommon return $out; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Assign custom values for canvas * @@ -74,7 +74,7 @@ class ActionsContactCardDefault extends ActionsContactCardCommon * @param int $id Id * @return void */ - function assign_values(&$action, $id) + public function assign_values(&$action, $id) { // phpcs:enable global $limit, $offset, $sortfield, $sortorder; @@ -121,7 +121,7 @@ class ActionsContactCardDefault extends ActionsContactCardCommon } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Fetch datas list and save into ->list_datas * @@ -131,13 +131,13 @@ class ActionsContactCardDefault extends ActionsContactCardCommon * @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; + global $conf, $langs; //$this->getFieldList(); $this->list_datas = array(); - } + } } diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index dd095792c40..b2865e8f36f 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -273,7 +273,7 @@ class Contact extends CommonObject } } - if (! $error) + if (! $error) { // Call trigger $result=$this->call_trigger('CONTACT_CREATE', $user); @@ -588,7 +588,7 @@ class Contact extends CommonObject } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Update field alert birthday * diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index c64b408336c..1ad61007ec6 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -40,53 +40,53 @@ class CMailFile public $sendmode; public $sendsetup; - var $subject; // Topic: Subject of email - var $addr_from; // From: Label and EMail of sender (must include '<>'). For example '' or 'John Doe ' or ''). Note that with gmail smtps, value here is forced by google to account (but not the reply-to). + public $subject; // Topic: Subject of email + public $addr_from; // From: Label and EMail of sender (must include '<>'). For example '' or 'John Doe ' or ''). Note that with gmail smtps, value here is forced by google to account (but not the reply-to). // Sender: Who send the email ("Sender" has sent emails on behalf of "From"). // Use it when the "From" is an email of a domain that is a SPF protected domain, and sending smtp server is not this domain. In such case, add Sender field with an email of the protected domain. // Return-Path: Email where to send bounds. - var $reply_to; // Reply-To: Email where to send replies from mailer software (mailer use From if reply-to not defined, Gmail use gmail account if reply-to not defined) - var $errors_to; // Errors-To: Email where to send errors. - var $addr_to; - var $addr_cc; - var $addr_bcc; - var $trackid; + public $reply_to; // Reply-To: Email where to send replies from mailer software (mailer use From if reply-to not defined, Gmail use gmail account if reply-to not defined) + public $errors_to; // Errors-To: Email where to send errors. + public $addr_to; + public $addr_cc; + public $addr_bcc; + public $trackid; - var $mixed_boundary; - var $related_boundary; - var $alternative_boundary; - var $deliveryreceipt; + public $mixed_boundary; + public $related_boundary; + public $alternative_boundary; + public $deliveryreceipt; - var $eol; - var $eol2; + public $eol; + public $eol2; /** * @var string Error code (or message) */ public $error=''; - var $smtps; // Contains SMTPs object (if this method is used) - var $phpmailer; // Contains PHPMailer object (if this method is used) + public $smtps; // Contains SMTPs object (if this method is used) + public $phpmailer; // Contains PHPMailer object (if this method is used) /** * @var string CSS */ public $css; //! Defined css style for body background - var $styleCSS; + public $styleCSS; //! Defined background directly in body tag - var $bodyCSS; + public $bodyCSS; - var $headers; - var $message; + public $headers; + public $message; // Image - var $html; - var $image_boundary; - var $atleastoneimage=0; // at least one image file with file=xxx.ext into content (TODO Debug this. How can this case be tested. Remove if not used). - var $html_images=array(); - var $images_encoded=array(); - var $image_types = array( + public $html; + public $image_boundary; + public $atleastoneimage=0; // at least one image file with file=xxx.ext into content (TODO Debug this. How can this case be tested. Remove if not used). + public $html_images=array(); + public $images_encoded=array(); + public $image_types = array( 'gif' => 'image/gif', 'jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', @@ -119,7 +119,7 @@ class CMailFile * @param string $sendcontext 'standard', 'emailing', ... (used to define with sending mode and parameters to use) * @param string $replyto Reply-to email (will be set to same value than From by default if not provided) */ - function __construct($subject, $to, $from, $msg, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = 0, $errors_to = '', $css = '', $trackid = '', $moreinheader = '', $sendcontext = 'standard', $replyto = '') + public function __construct($subject, $to, $from, $msg, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = 0, $errors_to = '', $css = '', $trackid = '', $moreinheader = '', $sendcontext = 'standard', $replyto = '') { global $conf, $dolibarr_main_data_root; @@ -493,7 +493,7 @@ class CMailFile * * @return boolean True if mail sent, false otherwise */ - function sendfile() + public function sendfile() { global $conf,$db,$langs; @@ -844,20 +844,20 @@ class CMailFile * @param string $stringtoencode String to encode * @return string string encoded */ - static function encodetorfc2822($stringtoencode) + public static function encodetorfc2822($stringtoencode) { global $conf; return '=?'.$conf->file->character_set_client.'?B?'.base64_encode($stringtoencode).'?='; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Read a file on disk and return encoded content for emails (mode = 'mail') * * @param string $sourcefile Path to file to encode * @return int <0 if KO, encoded string if OK */ - function _encode_file($sourcefile) + private function _encode_file($sourcefile) { // phpcs:enable $newsourcefile=dol_osencode($sourcefile); @@ -877,7 +877,7 @@ class CMailFile } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Write content of a SMTP request into a dump file (mode = all) * Used for debugging. @@ -885,7 +885,7 @@ class CMailFile * * @return void */ - function dump_mail() + public function dump_mail() { // phpcs:enable global $conf,$dolibarr_main_data_root; @@ -923,7 +923,7 @@ class CMailFile * @param string $msg String * @return string Completed string */ - function checkIfHTML($msg) + public function checkIfHTML($msg) { if (!preg_match('/^[\s\t]*css)) { @@ -972,13 +972,13 @@ class CMailFile } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Create SMTP headers (mode = 'mail') * * @return string headers */ - function write_smtpheaders() + public function write_smtpheaders() { // phpcs:enable global $conf; @@ -1036,7 +1036,7 @@ class CMailFile } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Create header MIME (mode = 'mail') * @@ -1044,7 +1044,7 @@ class CMailFile * @param array $mimefilename_list Array of mime types * @return string mime headers */ - function write_mimeheaders($filename_list, $mimefilename_list) + public function write_mimeheaders($filename_list, $mimefilename_list) { // phpcs:enable $mimedone=0; @@ -1067,14 +1067,14 @@ class CMailFile return $out; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return email content (mode = 'mail') * * @param string $msgtext Message string * @return string String content */ - function write_body($msgtext) + public function write_body($msgtext) { // phpcs:enable global $conf; @@ -1169,7 +1169,7 @@ class CMailFile return $out; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Attach file to email (mode = 'mail') * @@ -1178,7 +1178,7 @@ class CMailFile * @param array $mimefilename_list Tableau * @return string Chaine fichiers encodes */ - function write_files($filename_list, $mimetype_list, $mimefilename_list) + public function write_files($filename_list, $mimetype_list, $mimefilename_list) { // phpcs:enable $out = ''; @@ -1218,14 +1218,14 @@ class CMailFile } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Attach an image to email (mode = 'mail') * * @param array $images_list Array of array image * @return string Chaine images encodees */ - function write_images($images_list) + public function write_images($images_list) { // phpcs:enable $out = ''; @@ -1259,7 +1259,7 @@ class CMailFile * @param int $port Example: 25, 465 * @return int Socket id if ok, 0 if KO */ - function check_server_port($host, $port) + public function check_server_port($host, $port) { // phpcs:enable global $conf; @@ -1315,7 +1315,7 @@ class CMailFile return $_retVal; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * This function has been modified as provided by SirSir to allow multiline responses when * using SMTP Extensions. @@ -1324,7 +1324,7 @@ class CMailFile * @param string $response Response string * @return boolean true if success */ - function server_parse($socket, $response) + public function server_parse($socket, $response) { // phpcs:enable $_retVal = true; // Indicates if Object was created or not @@ -1354,7 +1354,7 @@ class CMailFile * @param string $images_dir Location of physical images files * @return int >0 if OK, <0 if KO */ - function findHtmlImages($images_dir) + public function findHtmlImages($images_dir) { // Build the list of image extensions $extensions = array_keys($this->image_types); @@ -1456,7 +1456,7 @@ class CMailFile * If format 3: '' or '"John Doe" ' or '"=?UTF-8?B?Sm9obiBEb2U=?=" ' * If format 4: 'John Doe' or 'john@doe.com' if no label exists */ - static function getValidAddress($address, $format, $encode = 0, $maxnumberofemail = 0) + public static function getValidAddress($address, $format, $encode = 0, $maxnumberofemail = 0) { global $conf; @@ -1523,7 +1523,7 @@ class CMailFile * @param string $address Example: 'John Doe , Alan Smith ' or 'john@doe.com, alan@smith.com' * @return array array of email => name */ - function getArrayAddress($address) + public function getArrayAddress($address) { global $conf; diff --git a/htdocs/core/class/antivir.class.php b/htdocs/core/class/antivir.class.php index dc0490285be..55bd3a8381d 100644 --- a/htdocs/core/class/antivir.class.php +++ b/htdocs/core/class/antivir.class.php @@ -55,12 +55,12 @@ class AntiVir * * @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 /** * Scan a file with antivirus. * This function runs the command defined in setup. This antivirus command must return 0 if OK. @@ -69,7 +69,7 @@ class AntiVir * @param string $file File to scan * @return int <0 if KO (-98 if error, -99 if virus), 0 if OK */ - function dol_avscan_file($file) + public function dol_avscan_file($file) { // phpcs:enable global $conf; @@ -153,7 +153,7 @@ class AntiVir * @param string $file File to scan * @return string Full command line to run */ - function getCliCommand($file) + public function getCliCommand($file) { global $conf; diff --git a/htdocs/core/class/canvas.class.php b/htdocs/core/class/canvas.class.php index 0250a138fb8..1351f0ea3c7 100644 --- a/htdocs/core/class/canvas.class.php +++ b/htdocs/core/class/canvas.class.php @@ -60,7 +60,7 @@ class Canvas * @param DoliDB $db Database handler * @param string $actiontype Action type ('create', 'view', 'edit', 'list') */ - function __construct($db, $actiontype = 'view') + public function __construct($db, $actiontype = 'view') { $this->db = $db; @@ -91,7 +91,7 @@ class Canvas * @param string $canvas Name of canvas (ex: mycanvas, default, or mycanvas@myexternalmodule) * @return void */ - function getCanvas($module, $card, $canvas) + public function getCanvas($module, $card, $canvas) { global $conf, $langs; @@ -133,7 +133,7 @@ class Canvas //print ' => template_dir='.$this->template_dir.'
'; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Shared method for canvas to assign values for templates * @@ -142,7 +142,7 @@ class Canvas * @param string $ref Object ref (if id not provided) * @return void */ - function assign_values(&$action = 'view', $id = 0, $ref = '') + public function assign_values(&$action = 'view', $id = 0, $ref = '') { // phpcs:enable if (method_exists($this->control, 'assign_values')) $this->control->assign_values($action, $id, $ref); @@ -154,7 +154,7 @@ class Canvas * @param string $action Action code * @return int 0=Canvas template file does not exist, 1=Canvas template file exists */ - function displayCanvasExists($action) + public function displayCanvasExists($action) { if (empty($this->template_dir)) return 0; @@ -162,7 +162,7 @@ class Canvas else return 0; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Display a canvas page. This will include the template for output. * Variables used by templates may have been defined or loaded before into the assign_values function. @@ -170,7 +170,7 @@ class Canvas * @param string $action Action code * @return void */ - function display_canvas($action) + public function display_canvas($action) { // phpcs:enable global $db, $conf, $langs, $user, $canvas; @@ -188,7 +188,7 @@ class Canvas * * @return boolean Return if canvas contains actions (old feature. now actions should be inside hooks) */ - function hasActions() + public function hasActions() { return (is_object($this->control)); } @@ -204,7 +204,7 @@ class Canvas * @return mixed Return return code of doActions of canvas * @see http://wiki.dolibarr.org/index.php/Canvas_development */ - function doActions(&$action = 'view', $id = 0) + public function doActions(&$action = 'view', $id = 0) { if (method_exists($this->control, 'doActions')) { diff --git a/htdocs/core/class/ccountry.class.php b/htdocs/core/class/ccountry.class.php index e93af622a27..a97d992bf89 100644 --- a/htdocs/core/class/ccountry.class.php +++ b/htdocs/core/class/ccountry.class.php @@ -73,7 +73,7 @@ class Ccountry // extends CommonObject * * @param DoliDb $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db = $db; } @@ -86,7 +86,7 @@ class Ccountry // 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; $error=0; @@ -165,7 +165,7 @@ class Ccountry // extends CommonObject * @param string $code Code * @return int >0 if OK, 0 if not found, <0 if KO */ - function fetch($id, $code = '') + public function fetch($id, $code = '') { global $langs; $sql = "SELECT"; @@ -214,7 +214,7 @@ class Ccountry // extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user = null, $notrigger = 0) + public function update($user = null, $notrigger = 0) { global $conf, $langs; $error=0; @@ -285,7 +285,7 @@ class Ccountry // 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; diff --git a/htdocs/core/class/comment.class.php b/htdocs/core/class/comment.class.php index 6d00b4b8d8d..502ba924513 100644 --- a/htdocs/core/class/comment.class.php +++ b/htdocs/core/class/comment.class.php @@ -69,7 +69,7 @@ class Comment extends CommonObject * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db = $db; } @@ -82,7 +82,7 @@ class Comment 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; @@ -155,7 +155,7 @@ class Comment extends CommonObject * @param int $ref ref object * @return int <0 if KO, 0 if not found, >0 if OK */ - function fetch($id, $ref = '') + public function fetch($id, $ref = '') { global $langs; @@ -213,7 +213,7 @@ class Comment extends CommonObject * @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; @@ -278,7 +278,7 @@ class Comment 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; require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index c1b483efe8c..d4a89c18e19 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -61,7 +61,7 @@ abstract class CommonDocGenerator } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Define array with couple subtitution key => subtitution value * @@ -69,7 +69,7 @@ abstract class CommonDocGenerator * @param Translate $outputlangs Language object for output * @return array Array of substitution key->code */ - function get_substitutionarray_user($user, $outputlangs) + public function get_substitutionarray_user($user, $outputlangs) { // phpcs:enable global $conf; @@ -99,7 +99,7 @@ abstract class CommonDocGenerator } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Define array with couple subtitution key => subtitution value * @@ -107,7 +107,7 @@ abstract class CommonDocGenerator * @param Translate $outputlangs Language object for output * @return array Array of substitution key->code */ - function get_substitutionarray_mysoc($mysoc, $outputlangs) + public function get_substitutionarray_mysoc($mysoc, $outputlangs) { // phpcs:enable global $conf; @@ -159,7 +159,7 @@ abstract class CommonDocGenerator } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Define array with couple subtitution key => subtitution value * @@ -167,7 +167,7 @@ abstract class CommonDocGenerator * @param Translate $outputlangs Language object for output * @return array Array of substitution key->code */ - function get_substitutionarray_thirdparty($object, $outputlangs) + public function get_substitutionarray_thirdparty($object, $outputlangs) { // phpcs:enable global $conf; @@ -240,7 +240,7 @@ abstract class CommonDocGenerator return $array_thirdparty; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Define array with couple subtitution key => subtitution value * @@ -249,7 +249,7 @@ abstract class CommonDocGenerator * @param array $array_key Name of the key for return array * @return array Array of substitution key->code */ - function get_substitutionarray_contact($object, $outputlangs, $array_key = 'object') + public function get_substitutionarray_contact($object, $outputlangs, $array_key = 'object') { // phpcs:enable global $conf; @@ -314,14 +314,14 @@ abstract class CommonDocGenerator } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Define array with couple subtitution key => subtitution value * * @param Translate $outputlangs Language object for output * @return array Array of substitution key->code */ - function get_substitutionarray_other($outputlangs) + public function get_substitutionarray_other($outputlangs) { // phpcs:enable global $conf; @@ -352,7 +352,7 @@ abstract class CommonDocGenerator } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Define array with couple substitution key => substitution value * @@ -361,7 +361,7 @@ abstract class CommonDocGenerator * @param string $array_key Name of the key for return array * @return array Array of substitution */ - function get_substitutionarray_object($object, $outputlangs, $array_key = 'object') + public function get_substitutionarray_object($object, $outputlangs, $array_key = 'object') { // phpcs:enable global $conf; @@ -518,7 +518,7 @@ abstract class CommonDocGenerator return $resarray; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Define array with couple substitution key => substitution value * @@ -526,7 +526,7 @@ abstract class CommonDocGenerator * @param Translate $outputlangs Lang object to use for output * @return array Return a substitution array */ - function get_substitutionarray_lines($line, $outputlangs) + public function get_substitutionarray_lines($line, $outputlangs) { // phpcs:enable global $conf; @@ -599,7 +599,7 @@ abstract class CommonDocGenerator return $resarray; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Define array with couple substitution key => substitution value * @@ -608,7 +608,7 @@ abstract class CommonDocGenerator * @param array $array_key Name of the key for return array * @return array Array of substitution */ - function get_substitutionarray_shipment($object, $outputlangs, $array_key = 'object') + public function get_substitutionarray_shipment($object, $outputlangs, $array_key = 'object') { // phpcs:enable global $conf; @@ -662,7 +662,7 @@ abstract class CommonDocGenerator } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Define array with couple substitution key => substitution value * @@ -670,7 +670,7 @@ abstract class CommonDocGenerator * @param Translate $outputlangs Lang object to use for output * @return array Substitution array */ - function get_substitutionarray_shipment_lines($line, $outputlangs) + public function get_substitutionarray_shipment_lines($line, $outputlangs) { // phpcs:enable global $conf; @@ -683,7 +683,7 @@ abstract class CommonDocGenerator 'line_desc'=>$line->desc, 'line_vatrate'=>vatrate($line->tva_tx, true, $line->info_bits), 'line_up'=>price($line->subprice), - 'line_total_up'=>price($line->subprice * $line->qty), + 'line_total_up'=>price($line->subprice * $line->qty), 'line_qty'=>$line->qty, 'line_qty_shipped'=>$line->qty_shipped, 'line_qty_asked'=>$line->qty_asked, @@ -711,7 +711,7 @@ abstract class CommonDocGenerator } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Define array with couple subtitution key => subtitution value * @@ -720,7 +720,7 @@ abstract class CommonDocGenerator * @param boolean $recursive Want to fetch child array or child object * @return array Array of substitution key->code */ - function get_substitutionarray_each_var_object(&$object, $outputlangs, $recursive = true) + public function get_substitutionarray_each_var_object(&$object, $outputlangs, $recursive = true) { // phpcs:enable $array_other = array(); @@ -740,7 +740,7 @@ abstract class CommonDocGenerator } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Fill array with couple extrafield key => extrafield value * @@ -751,8 +751,8 @@ abstract class CommonDocGenerator * @param Translate $outputlangs Lang object to use for output * @return array Substitution array */ - function fill_substitutionarray_with_extrafields($object, $array_to_fill, $extrafields, $array_key, $outputlangs) - { + public function fill_substitutionarray_with_extrafields($object, $array_to_fill, $extrafields, $array_key, $outputlangs) + { // phpcs:enable global $conf; foreach($extrafields->attribute_label as $key=>$label) @@ -838,7 +838,7 @@ abstract class CommonDocGenerator * @param int $hidebottom Hide bottom * @return void */ - function printRect($pdf, $x, $y, $l, $h, $hidetop = 0, $hidebottom = 0) + public function printRect($pdf, $x, $y, $l, $h, $hidetop = 0, $hidebottom = 0) { if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y); $pdf->line($x+$l, $y, $x+$l, $y+$h); @@ -848,13 +848,13 @@ abstract class CommonDocGenerator /** - * uasort callback function to Sort colums fields + * uasort callback function to Sort colums fields * - * @param array $a PDF lines array fields configs - * @param array $b PDF lines array fields configs - * @return int Return compare result + * @param array $a PDF lines array fields configs + * @param array $b PDF lines array fields configs + * @return int Return compare result */ - function columnSort($a, $b) + public function columnSort($a, $b) { if(empty($a['rank'])){ $a['rank'] = 0; } if(empty($b['rank'])){ $b['rank'] = 0; } @@ -874,7 +874,7 @@ abstract class CommonDocGenerator * @param int $hideref Do not show ref * @return null */ - function prepareArrayColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0) + public function prepareArrayColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0) { global $conf; @@ -950,7 +950,7 @@ abstract class CommonDocGenerator * @param string $colKey the column key * @return float width in mm */ - function getColumnContentWidth($colKey) + public function getColumnContentWidth($colKey) { $colDef = $this->cols[$colKey]; return $colDef['width'] - $colDef['content']['padding'][3] - $colDef['content']['padding'][1]; @@ -958,12 +958,12 @@ abstract class CommonDocGenerator /** - * get column content X (abscissa) left position from column key + * get column content X (abscissa) left position from column key * - * @param string $colKey the column key - * @return float X position in mm + * @param string $colKey the column key + * @return float X position in mm */ - function getColumnContentXStart($colKey) + public function getColumnContentXStart($colKey) { $colDef = $this->cols[$colKey]; return $colDef['xStartPos'] + $colDef['content']['padding'][3]; @@ -975,22 +975,22 @@ abstract class CommonDocGenerator * @param string $colKey the column key * @return int rank on success and -1 on error */ - function getColumnRank($colKey) + public function getColumnRank($colKey) { if(!isset($this->cols[$colKey]['rank'])) return -1; return $this->cols[$colKey]['rank']; } /** - * get column position rank from column key + * get column position rank from column key * - * @param string $newColKey the new column key - * @param array $defArray a single column definition array - * @param string $targetCol target column used to place the new column beside - * @param bool $insertAfterTarget insert before or after target column ? - * @return int new rank on success and -1 on error + * @param string $newColKey the new column key + * @param array $defArray a single column definition array + * @param string $targetCol target column used to place the new column beside + * @param bool $insertAfterTarget insert before or after target column ? + * @return int new rank on success and -1 on error */ - function insertNewColumnDef($newColKey, $defArray, $targetCol = false, $insertAfterTarget = false) + public function insertNewColumnDef($newColKey, $defArray, $targetCol = false, $insertAfterTarget = false) { // prepare wanted rank $rank = -1; @@ -1033,7 +1033,7 @@ abstract class CommonDocGenerator * @param string $columnText column text * @return int new rank on success and -1 on error */ - function printStdColumnContent($pdf, &$curY, $colKey, $columnText = '') + public function printStdColumnContent($pdf, &$curY, $colKey, $columnText = '') { global $hookmanager; @@ -1055,12 +1055,12 @@ abstract class CommonDocGenerator /** - * get column status from column key + * get column status from column key * - * @param string $colKey the column key - * @return float width in mm + * @param string $colKey the column key + * @return float width in mm */ - function getColumnStatus($colKey) + public function getColumnStatus($colKey) { if( !empty($this->cols[$colKey]['status'])){ return true; diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 7e8c9002042..5926f954a46 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -97,7 +97,7 @@ abstract class CommonInvoice extends CommonObject * @param int $multicurrency Return multicurrency_amount instead of amount * @return double Remain of amount to pay */ - function getRemainToPay($multicurrency = 0) + public function getRemainToPay($multicurrency = 0) { $alreadypaid=0; $alreadypaid+=$this->getSommePaiement($multicurrency); @@ -112,7 +112,7 @@ abstract class CommonInvoice extends CommonObject * @param int $multicurrency Return multicurrency_amount instead of amount * @return int Amount of payment already done, <0 if KO */ - function getSommePaiement($multicurrency = 0) + public function getSommePaiement($multicurrency = 0) { $table='paiement_facture'; $field='fk_facture'; @@ -149,7 +149,7 @@ abstract class CommonInvoice extends CommonObject * @param int $multicurrency Return multicurrency_amount instead of amount * @return int <0 if KO, Sum of deposits amount otherwise */ - function getSumDepositsUsed($multicurrency = 0) + public function getSumDepositsUsed($multicurrency = 0) { if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier') { @@ -178,7 +178,7 @@ abstract class CommonInvoice extends CommonObject * @param int $multicurrency Return multicurrency_amount instead of amount * @return int <0 if KO, Sum of credit notes and deposits amount otherwise */ - function getSumCreditNotesUsed($multicurrency = 0) + public function getSumCreditNotesUsed($multicurrency = 0) { require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; @@ -200,7 +200,7 @@ abstract class CommonInvoice extends CommonObject * * @return array Tableau d'id de factures avoirs */ - function getListIdAvoirFromInvoice() + public function getListIdAvoirFromInvoice() { $idarray=array(); @@ -233,7 +233,7 @@ abstract class CommonInvoice extends CommonObject * @param string $option filtre sur statut ('', 'validated', ...) * @return int <0 si KO, 0 si aucune facture ne remplace, id facture sinon */ - function getIdReplacingInvoice($option = '') + public function getIdReplacingInvoice($option = '') { $sql = 'SELECT rowid'; $sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element; @@ -274,7 +274,7 @@ abstract class CommonInvoice extends CommonObject * @param string $filtertype 1 to filter on type of payment == 'PRE' * @return array Array with list of payments */ - function getListOfPayments($filtertype = '') + public function getListOfPayments($filtertype = '') { $retarray=array(); @@ -325,7 +325,7 @@ abstract class CommonInvoice extends CommonObject } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return if an invoice can be deleted * Rule is: @@ -339,8 +339,8 @@ abstract class CommonInvoice extends CommonObject * * @return int <=0 if no, >0 if yes */ - function is_erasable() - { + public function is_erasable() + { // phpcs:enable global $conf; @@ -428,7 +428,7 @@ abstract class CommonInvoice extends CommonObject * * @return string Label of type of invoice */ - function getLibType() + public function getLibType() { global $langs; if ($this->type == CommonInvoice::TYPE_STANDARD) return $langs->trans("InvoiceStandard"); @@ -447,12 +447,12 @@ abstract class CommonInvoice 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 of status */ - function getLibStatut($mode = 0, $alreadypaid = -1) + public function getLibStatut($mode = 0, $alreadypaid = -1) { return $this->LibStatut($this->paye, $this->statut, $mode, $alreadypaid, $this->type); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return label of a status * @@ -463,18 +463,16 @@ abstract class CommonInvoice extends CommonObject * @param int $type Type invoice * @return string Label of status */ - function LibStatut($paye, $status, $mode = 0, $alreadypaid = -1, $type = 0) + public function LibStatut($paye, $status, $mode = 0, $alreadypaid = -1, $type = 0) { // phpcs:enable global $langs; $langs->load('bills'); //print "$paye,$status,$mode,$alreadypaid,$type"; - if ($mode == 0) - { + if ($mode == 0) { $prefix=''; - if (! $paye) - { + if (! $paye) { if ($status == 0) return $langs->trans('Bill'.$prefix.'StatusDraft'); elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusClosedUnpaid'); elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return $langs->trans('Bill'.$prefix.'StatusClosedPaidPartially'); @@ -585,7 +583,7 @@ abstract class CommonInvoice extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Renvoi une date limite de reglement de facture en fonction des * conditions de reglements de la facture et date de facturation. @@ -593,7 +591,7 @@ abstract class CommonInvoice extends CommonObject * @param integer $cond_reglement Condition of payment (code or id) to use. If 0, we use current condition. * @return date Date limite de reglement si ok, <0 si ko */ - function calculate_date_lim_reglement($cond_reglement = 0) + public function calculate_date_lim_reglement($cond_reglement = 0) { // phpcs:enable if (! $cond_reglement) $cond_reglement=$this->cond_reglement_code; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 1f86d60598c..b5a166e764b 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -423,7 +423,7 @@ abstract class CommonObject * @param string $ref_ext Ref ext of object to check * @return int <0 if KO, 0 if OK but not found, >0 if OK and exists */ - static function isExistingObject($element, $id, $ref = '', $ref_ext = '') + public static function isExistingObject($element, $id, $ref = '', $ref_ext = '') { global $db,$conf; @@ -457,7 +457,7 @@ abstract class CommonObject * * @return string String with errors */ - function errorsToString() + public function errorsToString() { return $this->error.(is_array($this->errors)?(($this->error!=''?', ':'').join(', ', $this->errors)):''); } @@ -468,7 +468,7 @@ abstract class CommonObject * @param string $objref Customer ref * @return string Customer ref formated */ - function getFormatedCustomerRef($objref) + public function getFormatedCustomerRef($objref) { global $hookmanager; @@ -488,7 +488,7 @@ abstract class CommonObject * @param string $objref Supplier ref * @return string Supplier ref formated */ - function getFormatedSupplierRef($objref) + public function getFormatedSupplierRef($objref) { global $hookmanager; @@ -511,7 +511,7 @@ abstract class CommonObject * @param int $maxlen Maximum length * @return string String with full name */ - function getFullName($langs, $option = 0, $nameorder = -1, $maxlen = 0) + public function getFullName($langs, $option = 0, $nameorder = -1, $maxlen = 0) { //print "lastname=".$this->lastname." name=".$this->name." nom=".$this->nom."
\n"; $lastname=$this->lastname; @@ -538,7 +538,7 @@ abstract class CommonObject * @param int $withregion 1=Add region into address string * @return string Full address string */ - function getFullAddress($withcountry = 0, $sep = "\n", $withregion = 0) + public function getFullAddress($withcountry = 0, $sep = "\n", $withregion = 0) { if ($withcountry && $this->country_id && (empty($this->country_code) || empty($this->country))) { @@ -569,7 +569,7 @@ abstract class CommonObject * @param Object $object Object (thirdparty, thirdparty of contact for contact, null for a member) * @return string Full address string */ - function getBannerAddress($htmlkey, $object) + public function getBannerAddress($htmlkey, $object) { global $conf, $langs; @@ -688,7 +688,7 @@ abstract class CommonObject * @param int $relativelink 0=Return full external link, 1=Return link relative to root of file * @return string Link or empty string if there is no download link */ - function getLastMainDocLink($modulepart, $initsharekey = 0, $relativelink = 0) + public function getLastMainDocLink($modulepart, $initsharekey = 0, $relativelink = 0) { global $user, $dolibarr_main_url_root; @@ -775,7 +775,7 @@ abstract class CommonObject } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Add a link between element $this->element and a contact * @@ -785,7 +785,7 @@ abstract class CommonObject * @param int $notrigger Disable all triggers * @return int <0 if KO, >0 if OK */ - function add_contact($fk_socpeople, $type_contact, $source = 'external', $notrigger = 0) + public function add_contact($fk_socpeople, $type_contact, $source = 'external', $notrigger = 0) { // phpcs:enable global $user,$langs; @@ -899,7 +899,7 @@ abstract class CommonObject } else return 0; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Copy contact from one element to current * @@ -907,7 +907,7 @@ abstract class CommonObject * @param string $source Nature of contact ('internal' or 'external') * @return int >0 if OK, <0 if KO */ - function copy_linked_contact($objFrom, $source = 'internal') + public function copy_linked_contact($objFrom, $source = 'internal') { // phpcs:enable $contacts = $objFrom->liste_contact(-1, $source); @@ -922,7 +922,7 @@ abstract class CommonObject return 1; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Update a link to contact line * @@ -932,7 +932,7 @@ abstract class CommonObject * @param int $fk_socpeople Id of soc_people to update (not modified if 0) * @return int <0 if KO, >= 0 if OK */ - function update_contact($rowid, $statut, $type_contact_id = 0, $fk_socpeople = 0) + public function update_contact($rowid, $statut, $type_contact_id = 0, $fk_socpeople = 0) { // phpcs:enable // Insert into database @@ -953,7 +953,7 @@ abstract class CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Delete a link to contact line * @@ -961,7 +961,7 @@ abstract class CommonObject * @param int $notrigger Disable all triggers * @return int >0 if OK, <0 if KO */ - function delete_contact($rowid, $notrigger = 0) + public function delete_contact($rowid, $notrigger = 0) { // phpcs:enable global $user; @@ -992,7 +992,7 @@ abstract class CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Delete all links between an object $this and all its contacts * @@ -1000,7 +1000,7 @@ abstract class CommonObject * @param string $code Type of contact (code or id) * @return int >0 if OK, <0 if KO */ - function delete_linked_contact($source = '', $code = '') + public function delete_linked_contact($source = '', $code = '') { // phpcs:enable $temp = array(); @@ -1029,7 +1029,7 @@ abstract class CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Get array of all contacts for an object * @@ -1039,7 +1039,7 @@ abstract class CommonObject * @param string $code Filter on this code of contact type ('SHIPPING', 'BILLING', ...) * @return array|int Array of contacts, -1 if error */ - function liste_contact($statut = -1, $source = 'external', $list = 0, $code = '') + public function liste_contact($statut = -1, $source = 'external', $list = 0, $code = '') { // phpcs:enable global $langs; @@ -1109,7 +1109,7 @@ abstract class CommonObject * @param int $rowid Id of link between object and contact * @return int <0 if KO, >=0 if OK */ - function swapContactStatus($rowid) + public function swapContactStatus($rowid) { $sql = "SELECT ec.datecreate, ec.statut, ec.fk_socpeople, ec.fk_c_type_contact,"; $sql.= " tc.code, tc.libelle"; @@ -1138,7 +1138,7 @@ abstract class CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return array with list of possible values for type of contacts * @@ -1149,7 +1149,7 @@ abstract class CommonObject * @param string $code Type of contact (Example: 'CUSTOMER', 'SERVICE') * @return array Array list of type of contacts (id->label if option=0, code->label if option=1) */ - function liste_type_contact($source = 'internal', $order = 'position', $option = 0, $activeonly = 0, $code = '') + public function liste_type_contact($source = 'internal', $order = 'position', $option = 0, $activeonly = 0, $code = '') { // phpcs:enable global $langs; @@ -1203,7 +1203,7 @@ abstract class CommonObject * @param int $status limited to a certain status * @return array List of id for such contacts */ - function getIdContact($source, $code, $status = 0) + public function getIdContact($source, $code, $status = 0) { global $conf; @@ -1256,14 +1256,14 @@ abstract class CommonObject return $result; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load object contact with id=$this->contactid into $this->contact * * @param int $contactid Id du contact. Use this->contactid if empty. * @return int <0 if KO, >0 if OK */ - function fetch_contact($contactid = null) + public function fetch_contact($contactid = null) { // phpcs:enable if (empty($contactid)) $contactid=$this->contactid; @@ -1277,14 +1277,14 @@ abstract class CommonObject return $result; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load the third party of object, from id $this->socid or $this->fk_soc, into this->thirdparty * * @param int $force_thirdparty_id Force thirdparty id * @return int <0 if KO, >0 if OK */ - function fetch_thirdparty($force_thirdparty_id = 0) + public function fetch_thirdparty($force_thirdparty_id = 0) { // phpcs:enable global $conf; @@ -1340,7 +1340,7 @@ abstract class CommonObject return $this->fetch($result->rowid); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load data for barcode into properties ->barcode_type* * Properties ->barcode_type that is id of barcode. Type is used to find other properties, but @@ -1348,7 +1348,7 @@ abstract class CommonObject * * @return int <0 if KO, 0 if can't guess type of barcode (ISBN, EAN13...), >0 if OK (all barcode properties loaded) */ - function fetch_barcode() + public function fetch_barcode() { // phpcs:enable global $conf; @@ -1391,13 +1391,13 @@ abstract class CommonObject return 0; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load the project with id $this->fk_project into this->project * * @return int <0 if KO, >=0 if OK */ - function fetch_projet() + public function fetch_projet() { // phpcs:enable include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; @@ -1413,13 +1413,13 @@ abstract class CommonObject return $result; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load the product with id $this->fk_product into this->product * * @return int <0 if KO, >=0 if OK */ - function fetch_product() + public function fetch_product() { // phpcs:enable include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; @@ -1433,14 +1433,14 @@ abstract class CommonObject return $result; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load the user with id $userid into this->user * * @param int $userid Id du contact * @return int <0 if KO, >0 if OK */ - function fetch_user($userid) + public function fetch_user($userid) { // phpcs:enable $user = new User($this->db); @@ -1449,13 +1449,13 @@ abstract class CommonObject return $result; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Read linked origin object * * @return void */ - function fetch_origin() + public function fetch_origin() { // phpcs:enable if ($this->origin == 'shipping') $this->origin = 'expedition'; @@ -1478,7 +1478,7 @@ abstract class CommonObject * @param string $element Element name * @return int <0 if KO, >0 if OK */ - function fetchObjectFrom($table, $field, $key, $element = null) + public function fetchObjectFrom($table, $field, $key, $element = null) { global $conf; @@ -1514,7 +1514,7 @@ abstract class CommonObject * @param string $field Field selected * @return int <0 if KO, >0 if OK */ - function getValueFrom($table, $id, $field) + public function getValueFrom($table, $id, $field) { $result=false; if (!empty($id) && !empty($field) && !empty($table)) { @@ -1548,7 +1548,7 @@ abstract class CommonObject * @return int <0 if KO, >0 if OK * @see updateExtraField() */ - function setValueFrom($field, $value, $table = '', $id = null, $format = '', $id_field = '', $fuser = null, $trigkey = '', $fk_user_field = 'fk_user_modif') + public function setValueFrom($field, $value, $table = '', $id = null, $format = '', $id_field = '', $fuser = null, $trigkey = '', $fk_user_field = 'fk_user_modif') { global $user,$langs,$conf; @@ -1618,7 +1618,7 @@ abstract class CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load properties id_previous and id_next by comparing $fieldid with $this->ref * @@ -1627,7 +1627,7 @@ abstract class CommonObject * @param int $nodbprefix Do not include DB prefix to forge table name * @return int <0 if KO, >0 if OK */ - function load_previous_next_ref($filter, $fieldid, $nodbprefix = 0) + public function load_previous_next_ref($filter, $fieldid, $nodbprefix = 0) { // phpcs:enable global $conf, $user; @@ -1751,7 +1751,7 @@ abstract class CommonObject * @return array Array of id of contacts (if source=external or internal) * Array of id of third parties with at least one contact on object (if source=thirdparty) */ - function getListContactId($source = 'external') + public function getListContactId($source = 'external') { $contactAlreadySelected = array(); $tab = $this->liste_contact(-1, $source); @@ -1773,7 +1773,7 @@ abstract class CommonObject * @param int $projectid Project id to link element to * @return int <0 if KO, >0 if OK */ - function setProject($projectid) + public function setProject($projectid) { if (! $this->table_element) { @@ -1814,7 +1814,7 @@ abstract class CommonObject * @param int $id Id of new payment method * @return int >0 if OK, <0 if KO */ - function setPaymentMethods($id) + public function setPaymentMethods($id) { dol_syslog(get_class($this).'::setPaymentMethods('.$id.')'); if ($this->statut >= 0 || $this->element == 'societe') @@ -1856,7 +1856,7 @@ abstract class CommonObject * @param string $code multicurrency code * @return int >0 if OK, <0 if KO */ - function setMulticurrencyCode($code) + public function setMulticurrencyCode($code) { dol_syslog(get_class($this).'::setMulticurrencyCode('.$id.')'); if ($this->statut >= 0 || $this->element == 'societe') @@ -1898,7 +1898,7 @@ abstract class CommonObject * @param int $mode mode 1 : amounts in company currency will be recalculated, mode 2 : amounts in foreign currency * @return int >0 if OK, <0 if KO */ - function setMulticurrencyRate($rate, $mode = 1) + public function setMulticurrencyRate($rate, $mode = 1) { dol_syslog(get_class($this).'::setMulticurrencyRate('.$id.')'); if ($this->statut >= 0 || $this->element == 'societe') @@ -1999,7 +1999,7 @@ abstract class CommonObject * @param int $id Id of new payment terms * @return int >0 if OK, <0 if KO */ - function setPaymentTerms($id) + public function setPaymentTerms($id) { dol_syslog(get_class($this).'::setPaymentTerms('.$id.')'); if ($this->statut >= 0 || $this->element == 'societe') @@ -2043,7 +2043,7 @@ abstract class CommonObject * @param int $id Address id * @return int <0 si ko, >0 si ok */ - function setDeliveryAddress($id) + public function setDeliveryAddress($id) { $fieldname = 'fk_delivery_address'; if ($this->element == 'delivery' || $this->element == 'shipping') $fieldname = 'fk_address'; @@ -2074,7 +2074,7 @@ abstract class CommonObject * * @return int 1 if OK, 0 if KO */ - function setShippingMethod($shipping_method_id, $notrigger = false, $userused = null) + public function setShippingMethod($shipping_method_id, $notrigger = false, $userused = null) { global $user; @@ -2128,7 +2128,7 @@ abstract class CommonObject * @param int $warehouse_id Id of warehouse * @return int 1 if OK, 0 if KO */ - function setWarehouse($warehouse_id) + public function setWarehouse($warehouse_id) { if (! $this->table_element) { dol_syslog(get_class($this)."::setWarehouse was called on objet with property table_element not defined", LOG_ERR); @@ -2159,7 +2159,7 @@ abstract class CommonObject * @param string $modelpdf Modele name * @return int <0 if KO, >0 if OK */ - function setDocModel($user, $modelpdf) + public function setDocModel($user, $modelpdf) { if (! $this->table_element) { @@ -2198,7 +2198,7 @@ abstract class CommonObject * @param User $userused Object user * @return int 1 if OK, 0 if KO */ - function setBankAccount($fk_account, $notrigger = false, $userused = null) + public function setBankAccount($fk_account, $notrigger = false, $userused = null) { global $user; @@ -2253,7 +2253,7 @@ abstract class CommonObject // TODO: Move line related operations to CommonObjectLine? - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Save a new position (field rang) for details lines. * You can choose to set position for lines with already a position or lines without any position defined. @@ -2263,7 +2263,7 @@ abstract class CommonObject * @param boolean $fk_parent_line Table with fk_parent_line field or not * @return int <0 if KO, >0 if OK */ - function line_order($renum = false, $rowidorder = 'ASC', $fk_parent_line = true) + public function line_order($renum = false, $rowidorder = 'ASC', $fk_parent_line = true) { // phpcs:enable if (! $this->table_element_line) @@ -2348,7 +2348,7 @@ abstract class CommonObject * @param int $id Id of parent line * @return array Array with list of children lines id */ - function getChildrenOfLine($id) + public function getChildrenOfLine($id) { $rows=array(); @@ -2374,7 +2374,7 @@ abstract class CommonObject return $rows; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Update a line to have a lower rank * @@ -2382,7 +2382,7 @@ abstract class CommonObject * @param boolean $fk_parent_line Table with fk_parent_line field or not * @return void */ - function line_up($rowid, $fk_parent_line = true) + public function line_up($rowid, $fk_parent_line = true) { // phpcs:enable $this->line_order(false, 'ASC', $fk_parent_line); @@ -2394,7 +2394,7 @@ abstract class CommonObject $this->updateLineUp($rowid, $rang); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Update a line to have a higher rank * @@ -2402,7 +2402,7 @@ abstract class CommonObject * @param boolean $fk_parent_line Table with fk_parent_line field or not * @return void */ - function line_down($rowid, $fk_parent_line = true) + public function line_down($rowid, $fk_parent_line = true) { // phpcs:enable $this->line_order(false, 'ASC', $fk_parent_line); @@ -2424,7 +2424,7 @@ abstract class CommonObject * @param int $rang Position * @return void */ - function updateRangOfLine($rowid, $rang) + public function updateRangOfLine($rowid, $rang) { $fieldposition = 'rang'; if (in_array($this->table_element_line, array('ecm_files', 'emailcollector_emailcollectoraction'))) $fieldposition = 'position'; @@ -2439,14 +2439,14 @@ abstract class CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Update position of line with ajax (rang) * * @param array $rows Array of rows * @return void */ - function line_ajaxorder($rows) + public function line_ajaxorder($rows) { // phpcs:enable $num = count($rows); @@ -2463,7 +2463,7 @@ abstract class CommonObject * @param int $rang Position * @return void */ - function updateLineUp($rowid, $rang) + public function updateLineUp($rowid, $rang) { if ($rang > 1) { @@ -2497,7 +2497,7 @@ abstract class CommonObject * @param int $max Max * @return void */ - function updateLineDown($rowid, $rang, $max) + public function updateLineDown($rowid, $rang, $max) { if ($rang < $max) { @@ -2529,7 +2529,7 @@ abstract class CommonObject * @param int $rowid Id of line * @return int Value of rang in table of lines */ - function getRangOfLine($rowid) + public function getRangOfLine($rowid) { $sql = 'SELECT rang FROM '.MAIN_DB_PREFIX.$this->table_element_line; $sql.= ' WHERE rowid ='.$rowid; @@ -2549,7 +2549,7 @@ abstract class CommonObject * @param int $rang Rang value * @return int Rowid of the line */ - function getIdOfLine($rang) + public function getIdOfLine($rang) { $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.$this->table_element_line; $sql.= ' WHERE '.$this->fk_element.' = '.$this->id; @@ -2562,14 +2562,14 @@ abstract class CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Get max value used for position of line (rang) * * @param int $fk_parent_line Parent line id * @return int Max value of rang in table of lines */ - function line_max($fk_parent_line = 0) + public function line_max($fk_parent_line = 0) { // phpcs:enable // Search the last rang with fk_parent_line @@ -2610,14 +2610,14 @@ abstract class CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Update external ref of element * * @param string $ref_ext Update field ref_ext * @return int <0 if KO, >0 if OK */ - function update_ref_ext($ref_ext) + public function update_ref_ext($ref_ext) { // phpcs:enable if (! $this->table_element) @@ -2643,7 +2643,7 @@ abstract class CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Update note of element * @@ -2651,7 +2651,7 @@ abstract class CommonObject * @param string $suffix '', '_public' or '_private' * @return int <0 if KO, >0 if OK */ - function update_note($note, $suffix = '') + public function update_note($note, $suffix = '') { // phpcs:enable global $user; @@ -2696,7 +2696,7 @@ abstract class CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Update public note (kept for backward compatibility) * @@ -2705,13 +2705,13 @@ abstract class CommonObject * @deprecated * @see update_note() */ - function update_note_public($note) + public function update_note_public($note) { // phpcs:enable return $this->update_note($note, '_public'); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Update total_ht, total_ttc, total_vat, total_localtax1, total_localtax2 for an object (sum of lines). * Must be called at end of methods addline or updateline. @@ -2722,7 +2722,7 @@ abstract class CommonObject * @param Societe $seller If roundingadjust is '0' or '1' or maybe 'auto', it means we recalculate total for lines before calculating total for object and for this, we need seller object. * @return int <0 if KO, >0 if OK */ - function update_price($exclspec = 0, $roundingadjust = 'none', $nodatabaseupdate = 0, $seller = null) + public function update_price($exclspec = 0, $roundingadjust = 'none', $nodatabaseupdate = 0, $seller = null) { // phpcs:enable global $conf, $hookmanager, $action; @@ -2950,7 +2950,7 @@ abstract class CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Add objects linked in llx_element_element. * @@ -2959,7 +2959,7 @@ abstract class CommonObject * @return int <=0 if KO, >0 if OK * @see fetchObjectLinked(), updateObjectLinked(), deleteObjectLinked() */ - function add_object_linked($origin = null, $origin_id = null) + public function add_object_linked($origin = null, $origin_id = null) { // phpcs:enable $origin = (! empty($origin) ? $origin : $this->origin); @@ -3020,7 +3020,7 @@ abstract class CommonObject * @return int <0 if KO, >0 if OK * @see add_object_linked(), updateObjectLinked(), deleteObjectLinked() */ - function fetchObjectLinked($sourceid = null, $sourcetype = '', $targetid = null, $targettype = '', $clause = 'OR', $alsosametype = 1, $orderby = 'sourcetype', $loadalsoobjects = 1) + public function fetchObjectLinked($sourceid = null, $sourcetype = '', $targetid = null, $targettype = '', $clause = 'OR', $alsosametype = 1, $orderby = 'sourcetype', $loadalsoobjects = 1) { global $conf; @@ -3224,7 +3224,7 @@ abstract class CommonObject * @return int >0 if OK, <0 if KO * @see add_object_linked(), fetObjectLinked(), deleteObjectLinked() */ - function updateObjectLinked($sourceid = null, $sourcetype = '', $targetid = null, $targettype = '') + public function updateObjectLinked($sourceid = null, $sourcetype = '', $targetid = null, $targettype = '') { $updatesource=false; $updatetarget=false; @@ -3271,7 +3271,7 @@ abstract class CommonObject * @return int >0 if OK, <0 if KO * @see add_object_linked, updateObjectLinked, fetchObjectLinked */ - function deleteObjectLinked($sourceid = null, $sourcetype = '', $targetid = null, $targettype = '', $rowid = '') + public function deleteObjectLinked($sourceid = null, $sourcetype = '', $targetid = null, $targettype = '', $rowid = '') { $deletesource=false; $deletetarget=false; @@ -3332,7 +3332,7 @@ abstract class CommonObject * @param string $trigkey Trigger key to use for trigger * @return int <0 if KO, >0 if OK */ - function setStatut($status, $elementId = null, $elementType = '', $trigkey = '') + public function setStatut($status, $elementId = null, $elementType = '', $trigkey = '') { global $user,$langs,$conf; @@ -3420,7 +3420,7 @@ abstract class CommonObject * @param string $ref Record ref * @return int <0 if KO, 0 if nothing done, >0 if OK */ - function getCanvas($id = 0, $ref = '') + public function getCanvas($id = 0, $ref = '') { global $conf; @@ -3461,7 +3461,7 @@ abstract class CommonObject * @param int $lineid Id of line * @return int Special code */ - function getSpecialCode($lineid) + public function getSpecialCode($lineid) { $sql = 'SELECT special_code FROM '.MAIN_DB_PREFIX.$this->table_element_line; $sql.= ' WHERE rowid = '.$lineid; @@ -3480,7 +3480,7 @@ abstract class CommonObject * @param int $id Force id of object * @return int <0 if KO, 0 if not used, >0 if already used */ - function isObjectUsed($id = 0) + public function isObjectUsed($id = 0) { global $langs; @@ -3549,7 +3549,7 @@ abstract class CommonObject * @param int $predefined -1=All, 0=Count free product/service only, 1=Count predefined product/service only, 2=Count predefined product, 3=Count predefined service * @return int <0 if KO, 0 if no predefined products, nb of lines with predefined products if found */ - function hasProductsOrServices($predefined = -1) + public function hasProductsOrServices($predefined = -1) { $nb=0; @@ -3572,7 +3572,7 @@ abstract class CommonObject * * @return float */ - function getTotalDiscount() + public function getTotalDiscount() { $total_discount=0.00; @@ -3612,7 +3612,7 @@ abstract class CommonObject * * @return array array('weight'=>...,'volume'=>...) */ - function getTotalWeightVolume() + public function getTotalWeightVolume() { $totalWeight = 0; $totalVolume = 0; @@ -3706,7 +3706,7 @@ abstract class CommonObject * * @return int <0 if KO, >0 if OK */ - function setExtraParameters() + public function setExtraParameters() { $this->db->begin(); @@ -3739,7 +3739,7 @@ abstract class CommonObject * * @return string incoterms info */ - function display_incoterms() + public function display_incoterms() { // phpcs:enable $out = ''; @@ -3765,7 +3765,7 @@ abstract class CommonObject * * @return string incoterms info */ - function getIncotermsForPDF() + public function getIncotermsForPDF() { $sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'c_incoterms WHERE rowid = '.(int) $this->fk_incoterms; $resql = $this->db->query($sql); @@ -3796,7 +3796,7 @@ abstract class CommonObject * @param string $location location of incoterm * @return int <0 if KO, >0 if OK */ - function setIncoterms($id_incoterm, $location) + public function setIncoterms($id_incoterm, $location) { if ($this->id && $this->table_element) { @@ -3844,7 +3844,7 @@ abstract class CommonObject * @param Societe $buyer Object thirdparty who buy * @return void */ - function formAddObjectLine($dateSelector, $seller, $buyer) + public function formAddObjectLine($dateSelector, $seller, $buyer) { global $conf,$user,$langs,$object,$hookmanager; global $form,$bcnd,$var; @@ -3887,7 +3887,7 @@ abstract class CommonObject * @param int $dateSelector 1=Show also date range input fields * @return void */ - function printObjectLines($action, $seller, $buyer, $selected = 0, $dateSelector = 0) + public function printObjectLines($action, $seller, $buyer, $selected = 0, $dateSelector = 0) { global $conf, $hookmanager, $langs, $user; // TODO We should not use global var for this ! @@ -4029,8 +4029,8 @@ abstract class CommonObject * Return HTML content of a detail line * TODO Move this into an output class file (htmlline.class.php) * - * @param string $action GET/POST action - * @param CommonObjectLine $line Selected object line to output + * @param string $action GET/POST action + * @param CommonObjectLine $line Selected object line to output * @param string $var Is it a an odd line (true) * @param int $num Number of line (0) * @param int $i I @@ -4041,7 +4041,7 @@ abstract class CommonObject * @param int $extrafieldsline Object of extrafield line attribute * @return void */ - function printObjectLine($action, $line, $var, $num, $i, $dateSelector, $seller, $buyer, $selected = 0, $extrafieldsline = 0) + public function printObjectLine($action, $line, $var, $num, $i, $dateSelector, $seller, $buyer, $selected = 0, $extrafieldsline = 0) { global $conf,$langs,$user,$object,$hookmanager; global $form,$bc,$bcdd; @@ -4159,7 +4159,7 @@ abstract class CommonObject * @param string $restrictlist ''=All lines, 'services'=Restrict to services only * @return void */ - function printOriginLinesList($restrictlist = '') + public function printOriginLinesList($restrictlist = '') { global $langs, $hookmanager, $conf; @@ -4213,7 +4213,7 @@ abstract class CommonObject * @param string $restrictlist ''=All lines, 'services'=Restrict to services only (strike line if not) * @return void */ - function printOriginLine($line, $var, $restrictlist = '') + public function printOriginLine($line, $var, $restrictlist = '') { global $langs, $conf; @@ -4348,7 +4348,7 @@ abstract class CommonObject } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Add resources to the current object : add entry into llx_element_resources * Need $this->element & $this->id @@ -4359,7 +4359,7 @@ abstract class CommonObject * @param int $mandatory Mandatory or not * @return int <=0 if KO, >0 if OK */ - function add_element_resource($resource_id, $resource_type, $busy = 0, $mandatory = 0) + public function add_element_resource($resource_id, $resource_type, $busy = 0, $mandatory = 0) { // phpcs:enable $this->db->begin(); @@ -4394,7 +4394,7 @@ abstract class CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Delete a link to resource line * @@ -4403,7 +4403,7 @@ abstract class CommonObject * @param int $notrigger Disable all triggers * @return int >0 if OK, <0 if KO */ - function delete_resource($rowid, $element, $notrigger = 0) + public function delete_resource($rowid, $element, $notrigger = 0) { // phpcs:enable global $user; @@ -4440,7 +4440,7 @@ abstract class CommonObject * * @return void */ - function __clone() + public function __clone() { // Force a copy of this->lines, otherwise it will point to same object. if (isset($this->lines) && is_array($this->lines)) @@ -4617,9 +4617,15 @@ abstract class CommonObject if ($useonlinesignature) $setsharekey=true; if (! empty($conf->global->PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD)) $setsharekey=true; } - if ($this->element == 'commande' && ! empty($conf->global->ORDER_ALLOW_EXTERNAL_DOWNLOAD)) $setsharekey=true; - if ($this->element == 'facture' && ! empty($conf->global->INVOICE_ALLOW_EXTERNAL_DOWNLOAD)) $setsharekey=true; - if ($this->element == 'bank_account' && ! empty($conf->global->BANK_ACCOUNT_ALLOW_EXTERNAL_DOWNLOAD)) $setsharekey=true; + if ($this->element == 'commande' && ! empty($conf->global->ORDER_ALLOW_EXTERNAL_DOWNLOAD)) { + $setsharekey=true; + } + if ($this->element == 'facture' && ! empty($conf->global->INVOICE_ALLOW_EXTERNAL_DOWNLOAD)) { + $setsharekey=true; + } + if ($this->element == 'bank_account' && ! empty($conf->global->BANK_ACCOUNT_ALLOW_EXTERNAL_DOWNLOAD)) { + $setsharekey=true; + } if ($setsharekey) { @@ -4717,7 +4723,7 @@ abstract class CommonObject * @param string $file Path file in UTF8 to original file to create thumbs from. * @return void */ - function addThumbs($file) + public function addThumbs($file) { global $maxwidthsmall, $maxheightsmall, $maxwidthmini, $maxheightmini, $quality; @@ -4753,7 +4759,7 @@ abstract class CommonObject * @param string $alternatevalue Alternate value to use * @return string|string[] Default value (can be an array if the GETPOST return an array) **/ - function getDefaultCreateValueFor($fieldname, $alternatevalue = null) + public function getDefaultCreateValueFor($fieldname, $alternatevalue = null) { global $conf, $_POST; @@ -4782,7 +4788,7 @@ abstract class CommonObject /* For triggers */ - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Call trigger based on this instance. * Some context information may also be provided into array property this->context. @@ -4793,7 +4799,7 @@ abstract class CommonObject * @param User $user Object user * @return int Result of run_triggers */ - function call_trigger($trigger_name, $user) + public function call_trigger($trigger_name, $user) { // phpcs:enable global $langs,$conf; @@ -4820,7 +4826,7 @@ abstract class CommonObject /* Functions for extrafields */ - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Function to get extra fields of an object into $this->array_options * This method is in most cases called by method fetch of objects but you can call it separately. @@ -4829,7 +4835,7 @@ abstract class CommonObject * @param array $optionsArray Array resulting of call of extrafields->fetch_name_optionals_label(). Deprecated. Function must be called without parameters. * @return int <0 if error, 0 if no values of extrafield to find nor found, 1 if an attribute is found and value loaded */ - function fetch_optionals($rowid = null, $optionsArray = null) + public function fetch_optionals($rowid = null, $optionsArray = null) { // phpcs:enable if (empty($rowid)) $rowid=$this->id; @@ -4940,7 +4946,7 @@ abstract class CommonObject * * @return int <0 if KO, >0 if OK */ - function deleteExtraFields() + public function deleteExtraFields() { $this->db->begin(); @@ -4973,7 +4979,7 @@ abstract class CommonObject * @return int -1=error, O=did nothing, 1=OK * @see updateExtraField(), setValueFrom() */ - function insertExtraFields($trigger = '', $userused = null) + public function insertExtraFields($trigger = '', $userused = null) { global $conf,$langs,$user; @@ -5219,7 +5225,7 @@ abstract class CommonObject * @return int -1=error, O=did nothing, 1=OK * @see setValueFrom(), insertExtraFields() */ - function updateExtraField($key, $trigger = null, $userused = null) + public function updateExtraField($key, $trigger = null, $userused = null) { global $conf,$langs,$user; @@ -5353,7 +5359,7 @@ abstract class CommonObject * @param string|int $morecss Value for css to define style/length of field. May also be a numeric. * @return string */ - function showInputField($val, $key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = 0) + public function showInputField($val, $key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = 0) { global $conf,$langs,$form; @@ -5963,7 +5969,7 @@ abstract class CommonObject * @param mixed $showsize Value for css to define size. May also be a numeric. * @return string */ - function showOutputField($val, $key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $showsize = 0) + public function showOutputField($val, $key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $showsize = 0) { global $conf,$langs,$form; @@ -6334,7 +6340,7 @@ abstract class CommonObject * @param string $onetrtd All fields in same tr td * @return string */ - function showOptionals($extrafields, $mode = 'view', $params = null, $keysuffix = '', $keyprefix = '', $onetrtd = 0) + public function showOptionals($extrafields, $mode = 'view', $params = null, $keysuffix = '', $keyprefix = '', $onetrtd = 0) { global $db, $conf, $langs, $action, $form; @@ -6642,7 +6648,7 @@ abstract class CommonObject return $buyPrice; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Show photos of an object (nbmax maximum), into several columns * @@ -6660,7 +6666,7 @@ abstract class CommonObject * @param int $usesharelink Use the public shared link of image (if not available, the 'nophoto' image will be shown instead) * @return string Html code to show photo. Number of photos shown is saved in this->nbphoto */ - function show_photos($modulepart, $sdir, $size = 0, $nbmax = 0, $nbbyrow = 5, $showfilename = 0, $showaction = 0, $maxHeight = 120, $maxWidth = 160, $nolink = 0, $notitle = 0, $usesharelink = 0) + public function show_photos($modulepart, $sdir, $size = 0, $nbmax = 0, $nbbyrow = 5, $showfilename = 0, $showaction = 0, $maxHeight = 120, $maxWidth = 160, $nolink = 0, $notitle = 0, $usesharelink = 0) { // phpcs:enable global $conf,$user,$langs; @@ -7474,15 +7480,15 @@ abstract class CommonObject return count($this->comments); } - /** - * Return nb comments already posted - * - * @return int - */ - public function getNbComments() - { - return count($this->comments); - } + /** + * Return nb comments already posted + * + * @return int + */ + public function getNbComments() + { + return count($this->comments); + } /** * Trim object parameters diff --git a/htdocs/core/class/commonstickergenerator.class.php b/htdocs/core/class/commonstickergenerator.class.php index 0055559c4dc..bbdc6222921 100644 --- a/htdocs/core/class/commonstickergenerator.class.php +++ b/htdocs/core/class/commonstickergenerator.class.php @@ -69,23 +69,23 @@ abstract class CommonStickerGenerator public $format; // protected - var $_Avery_Name = ''; // Nom du format de l'etiquette - var $_Margin_Left = 0; // Marge de gauche de l'etiquette - var $_Margin_Top = 0; // marge en haut de la page avant la premiere etiquette - var $_X_Space = 0; // Espace horizontal entre 2 bandes d'etiquettes - var $_Y_Space = 0; // Espace vertical entre 2 bandes d'etiquettes - var $_X_Number = 0; // NX Nombre d'etiquettes sur la largeur de la page - var $_Y_Number = 0; // NY Nombre d'etiquettes sur la hauteur de la page - var $_Width = 0; // Largeur de chaque etiquette - var $_Height = 0; // Hauteur de chaque etiquette - var $_Char_Size = 10; // Hauteur des caracteres - var $_Line_Height = 10; // Hauteur par defaut d'une ligne - var $_Metric = 'mm'; // Type of metric.. Will help to calculate good values - var $_Metric_Doc = 'mm'; // Type of metric for the doc.. - var $_COUNTX = 1; - var $_COUNTY = 1; - var $_First = 1; - var $Tformat; + public $_Avery_Name = ''; // Nom du format de l'etiquette + public $_Margin_Left = 0; // Marge de gauche de l'etiquette + public $_Margin_Top = 0; // marge en haut de la page avant la premiere etiquette + public $_X_Space = 0; // Espace horizontal entre 2 bandes d'etiquettes + public $_Y_Space = 0; // Espace vertical entre 2 bandes d'etiquettes + public $_X_Number = 0; // NX Nombre d'etiquettes sur la largeur de la page + public $_Y_Number = 0; // NY Nombre d'etiquettes sur la hauteur de la page + public $_Width = 0; // Largeur de chaque etiquette + public $_Height = 0; // Hauteur de chaque etiquette + public $_Char_Size = 10; // Hauteur des caracteres + public $_Line_Height = 10; // Hauteur par defaut d'une ligne + public $_Metric = 'mm'; // Type of metric.. Will help to calculate good values + public $_Metric_Doc = 'mm'; // Type of metric for the doc.. + public $_COUNTX = 1; + public $_COUNTY = 1; + public $_First = 1; + public $Tformat; /** * Constructor diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 5de1475a3f0..2e7ef692324 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -34,7 +34,7 @@ class Conf { /** \public */ //! To store properties found in conf file - var $file; + public $file; /** * @var DoliDB Database handler. @@ -42,9 +42,9 @@ class Conf public $db; //! To store properties found into database - var $global; + public $global; //! To store browser info - var $browser; + public $browser; //! To store if javascript/ajax is enabked public $use_javascript_ajax; @@ -59,12 +59,12 @@ class Conf public $modules = array(); // List of activated modules public $modules_parts = array('css'=>array(),'js'=>array(),'tabs'=>array(),'triggers'=>array(),'login'=>array(),'substitutions'=>array(),'menus'=>array(),'theme'=>array(),'sms'=>array(),'tpl'=>array(),'barcode'=>array(),'models'=>array(),'societe'=>array(),'hooks'=>array(),'dir'=>array(), 'syslog' =>array()); - var $logbuffer = array(); + public $logbuffer = array(); /** * @var LogHandlerInterface[] */ - var $loghandlers = array(); + public $loghandlers = array(); //! To store properties of multi-company public $multicompany; diff --git a/htdocs/core/class/vcard.class.php b/htdocs/core/class/vcard.class.php index cf19b43145d..3a2b9e70830 100644 --- a/htdocs/core/class/vcard.class.php +++ b/htdocs/core/class/vcard.class.php @@ -84,11 +84,11 @@ function dol_quoted_printable_encode($input, $line_max = 76) */ class vCard { - var $properties; - var $filename; + public $properties; + public $filename; //var $encoding="UTF-8"; - var $encoding="ISO-8859-1;ENCODING=QUOTED-PRINTABLE"; + public $encoding="ISO-8859-1;ENCODING=QUOTED-PRINTABLE"; /** diff --git a/htdocs/core/modules/barcode/doc/phpbarcode.modules.php b/htdocs/core/modules/barcode/doc/phpbarcode.modules.php index cfbe51b0579..19744177e40 100644 --- a/htdocs/core/modules/barcode/doc/phpbarcode.modules.php +++ b/htdocs/core/modules/barcode/doc/phpbarcode.modules.php @@ -49,7 +49,7 @@ class modPhpbarcode extends ModeleBarCode * * @return boolean true if module can be used */ - function isEnabled() + public function isEnabled() { return true; } @@ -60,7 +60,7 @@ class modPhpbarcode extends ModeleBarCode * * @return string Texte descripif */ - function info() + public function info() { global $langs; @@ -76,7 +76,7 @@ class modPhpbarcode extends ModeleBarCode * * @return boolean false si conflit, true si ok */ - function canBeActivated() + public function canBeActivated() { global $langs; @@ -90,7 +90,7 @@ class modPhpbarcode extends ModeleBarCode * @param string $encoding Encoding norm * @return int >0 if supported, 0 if not */ - function encodingIsSupported($encoding) + public function encodingIsSupported($encoding) { global $genbarcode_loc; //print 'genbarcode_loc='.$genbarcode_loc.' encoding='.$encoding;exit; @@ -100,8 +100,7 @@ class modPhpbarcode extends ModeleBarCode if ($encoding == 'ISBN') $supported=1; // Formats that hangs on Windows (when genbarcode.exe for Windows is called, so they are not // activated on Windows) - if (file_exists($genbarcode_loc) && empty($_SERVER["WINDIR"])) - { + if (file_exists($genbarcode_loc) && empty($_SERVER["WINDIR"])) { if ($encoding == 'EAN8') $supported=1; if ($encoding == 'UPC') $supported=1; if ($encoding == 'C39') $supported=1; @@ -120,7 +119,7 @@ class modPhpbarcode extends ModeleBarCode * @param integer $nooutputiferror No output if error * @return int <0 if KO, >0 if OK */ - function buildBarCode($code, $encoding, $readable = 'Y', $scale = 1, $nooutputiferror = 0) + public function buildBarCode($code, $encoding, $readable = 'Y', $scale = 1, $nooutputiferror = 0) { global $_GET,$_SERVER; global $conf; @@ -161,7 +160,7 @@ class modPhpbarcode extends ModeleBarCode * @param integer $nooutputiferror No output if error * @return int <0 if KO, >0 if OK */ - function writeBarCode($code, $encoding, $readable = 'Y', $scale = 1, $nooutputiferror = 0) + public function writeBarCode($code, $encoding, $readable = 'Y', $scale = 1, $nooutputiferror = 0) { global $conf,$filebarcode; diff --git a/htdocs/core/modules/barcode/doc/tcpdfbarcode.modules.php b/htdocs/core/modules/barcode/doc/tcpdfbarcode.modules.php index f6eff1e2c5d..17793a5dfd4 100644 --- a/htdocs/core/modules/barcode/doc/tcpdfbarcode.modules.php +++ b/htdocs/core/modules/barcode/doc/tcpdfbarcode.modules.php @@ -49,7 +49,7 @@ class modTcpdfbarcode extends ModeleBarCode * * @return string Text with description */ - function info() + public function info() { global $langs; @@ -61,7 +61,7 @@ class modTcpdfbarcode extends ModeleBarCode * * @return boolean true if module can be used */ - function isEnabled() + public function isEnabled() { return true; } @@ -72,7 +72,7 @@ class modTcpdfbarcode extends ModeleBarCode * * @return boolean false si conflit, true si ok */ - function canBeActivated() + public function canBeActivated() { global $langs; @@ -85,7 +85,7 @@ class modTcpdfbarcode extends ModeleBarCode * @param string $encoding Encoding norm * @return int >0 if supported, 0 if not */ - function encodingIsSupported($encoding) + public function encodingIsSupported($encoding) { $tcpdfEncoding = $this->getTcpdfEncodingType($encoding); if (empty($tcpdfEncoding)) { @@ -105,7 +105,7 @@ class modTcpdfbarcode extends ModeleBarCode * @param integer $nooutputiferror No output if error (not used with this engine) * @return int <0 if KO, >0 if OK */ - function buildBarCode($code, $encoding, $readable = 'Y', $scale = 1, $nooutputiferror = 0) + public function buildBarCode($code, $encoding, $readable = 'Y', $scale = 1, $nooutputiferror = 0) { global $_GET; @@ -152,7 +152,7 @@ class modTcpdfbarcode extends ModeleBarCode * @param integer $nooutputiferror No output if error (not used with this engine) * @return int <0 if KO, >0 if OK */ - function writeBarCode($code, $encoding, $readable = 'Y', $scale = 1, $nooutputiferror = 0) + public function writeBarCode($code, $encoding, $readable = 'Y', $scale = 1, $nooutputiferror = 0) { global $conf,$_GET; diff --git a/htdocs/core/modules/barcode/modules_barcode.class.php b/htdocs/core/modules/barcode/modules_barcode.class.php index 7e0eba53571..6a205b57d8c 100644 --- a/htdocs/core/modules/barcode/modules_barcode.class.php +++ b/htdocs/core/modules/barcode/modules_barcode.class.php @@ -29,21 +29,21 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; */ abstract class ModeleBarCode { - /** - * @var string Error code (or message) - */ - public $error=''; + /** + * @var string Error code (or message) + */ + public $error=''; - /** - * Return if a model can be used or not - * - * @return boolean true if model can be used - */ - function isEnabled() - { - return true; - } + /** + * Return if a model can be used or not + * + * @return boolean true if model can be used + */ + public function isEnabled() + { + return true; + } } @@ -52,17 +52,17 @@ abstract class ModeleBarCode */ abstract class ModeleNumRefBarCode { - /** - * @var string Error code (or message) - */ - public $error=''; + /** + * @var string Error code (or message) + */ + public $error=''; /** Return default description of numbering model * * @param Translate $langs Object langs * @return string Descriptive text */ - function info($langs) + public function info($langs) { $langs->load("bills"); return $langs->trans("NoDescription"); @@ -73,7 +73,7 @@ abstract class ModeleNumRefBarCode * @param Translate $langs Object langs * @return string Model name */ - function getNom($langs) + public function getNom($langs) { return empty($this->name)?$this->nom:$this->name; } @@ -83,7 +83,7 @@ abstract class ModeleNumRefBarCode * @param Translate $langs Object langs * @return string Example */ - function getExample($langs) + public function getExample($langs) { $langs->load("bills"); return $langs->trans("NoExample"); @@ -96,17 +96,17 @@ abstract class ModeleNumRefBarCode * @param string $type Type of barcode (EAN, ISBN, ...) * @return string Value */ - function getNextValue($objproduct, $type = '') + public function getNextValue($objproduct, $type = '') { global $langs; return $langs->trans("Function_getNextValue_InModuleNotWorking"); } - /** Return version of module + /** Return version of module * * @return string Version */ - function getVersion() + public function getVersion() { global $langs; $langs->load("admin"); @@ -126,7 +126,7 @@ abstract class ModeleNumRefBarCode * @param int $type -1=Nothing, 0=Product, 1=Service * @return string HTML translated description */ - function getToolTip($langs, $soc, $type) + public function getToolTip($langs, $soc, $type) { global $conf; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 6b9c5d3db26..bf731262cbd 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -1047,13 +1047,13 @@ class SupplierProposal extends CommonObject $action='update'; // Actions on extra fields - if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) - { - $result=$this->insertExtraFields(); - if ($result < 0) - { - $error++; - } + if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) + { + $result=$this->insertExtraFields(); + if ($result < 0) + { + $error++; + } } if (! $error && ! $notrigger) @@ -1871,7 +1871,7 @@ class SupplierProposal extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set draft status * @@ -1984,7 +1984,7 @@ class SupplierProposal extends CommonObject * @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,$langs; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';