diff --git a/htdocs/comm/action/class/ical.class.php b/htdocs/comm/action/class/ical.class.php index 4d8675bc8ee..d3c2070d321 100644 --- a/htdocs/comm/action/class/ical.class.php +++ b/htdocs/comm/action/class/ical.class.php @@ -27,7 +27,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/xcal.lib.php'; /** - * Class to read/parse ICal calendars + * Class to read/parse ICal calendars */ class ICal { @@ -39,22 +39,23 @@ class ICal var $last_key; //Help variable save last key (multiline string) - /** - * Constructor - */ - public function __construct() - { - } + /** + * Constructor + */ + public function __construct() + { + } - /** + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** * Read text file, icalender text file * * @param string $file File * @return string */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function read_file($file) { + // phpcs:enable $this->file = $file; $file_text=''; @@ -67,25 +68,27 @@ class ICal return $file_text; // return all text } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns the number of calendar events * * @return int */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_event_count() { + // phpcs:enable return $this->event_count; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns the number of to do * * @return int */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_todo_count() { + // phpcs:enable return $this->todo_count; } @@ -197,6 +200,7 @@ class ICal return $this->cal; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add to $this->ical array one value and key. * @@ -205,9 +209,9 @@ class ICal * @param string $value Value * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_to_array($type, $key, $value) { + // phpcs:enable //print 'type='.$type.' key='.$key.' value='.$value.'
'."\n"; @@ -258,16 +262,17 @@ class ICal $this->last_key = $key; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Parse text "XXXX:value text some with : " and return array($key = "XXXX", $value="value"); * * @param string $text Text * @return array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function retun_key_value($text) { - /* + // phpcs:enable + /* preg_match("/([^:]+)[:]([\w\W]+)/", $text, $matches); if (empty($matches)) @@ -279,19 +284,20 @@ class ICal $matches = array_splice($matches, 1, 2); return $matches; }*/ - return explode(':',$text,2); + return explode(':',$text,2); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Parse RRULE return array * * @param string $value string * @return array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function ical_rrule($value) { - $result=array(); + // phpcs:enable + $result = array(); $rrule = explode(';',$value); foreach ($rrule as $line) { @@ -300,15 +306,17 @@ class ICal } return $result; } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return Unix time from ical date time fomrat (YYYYMMDD[T]HHMMSS[Z] or YYYYMMDD[T]HHMMSS) * * @param string $ical_date String date * @return int */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function ical_date_to_unix($ical_date) { + // phpcs:enable $ical_date = str_replace('T', '', $ical_date); $ical_date = str_replace('Z', '', $ical_date); @@ -322,6 +330,7 @@ class ICal return $ntime; // ntime is a GTM time } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return unix date from iCal date format * @@ -329,10 +338,10 @@ class ICal * @param string $value Value * @return array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function ical_dt_date($key, $value) { - $return_value=array(); + // phpcs:enable + $return_value = array(); $value = $this->ical_date_to_unix($value); // Analyse TZID @@ -352,14 +361,15 @@ class ICal return array($key,$return_value); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return sorted eventlist as array or false if calenar is empty * * @return array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_sort_event_list() { + // phpcs:enable $temp = $this->get_event_list(); if (!empty($temp)) { @@ -372,6 +382,7 @@ class ICal } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Compare two unix timestamp * @@ -379,64 +390,69 @@ class ICal * @param array $b Operand b * @return integer */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function ical_dtstart_compare($a, $b) { + // phpcs:enable return strnatcasecmp($a['DTSTART']['unixtime'], $b['DTSTART']['unixtime']); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return eventlist array (not sort eventlist array) * * @return array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_event_list() { + // phpcs:enable return (! empty($this->cal['VEVENT'])?$this->cal['VEVENT']:''); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return eventlist array (not sort eventlist array) * * @return array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_freebusy_list() { + // phpcs:enable return $this->cal['VFREEBUSY']; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return to do array (not sort to do array) * * @return array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_todo_list() { + // phpcs:enable return $this->cal['VTODO']; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return base calendar data * * @return array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_calender_data() { + // phpcs:enable return $this->cal['VCALENDAR']; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return array with all data * * @return array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_all_data() { + // phpcs:enable return $this->cal; } } diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 0fdd3333549..45998a78869 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -827,15 +827,16 @@ class CMailFile return '=?'.$conf->file->character_set_client.'?B?'.base64_encode($stringtoencode).'?='; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * 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 */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _encode_file($sourcefile) { + // phpcs:enable $newsourcefile=dol_osencode($sourcefile); if (is_readable($newsourcefile)) @@ -853,6 +854,7 @@ class CMailFile } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Write content of a SMTP request into a dump file (mode = all) * Used for debugging. @@ -860,9 +862,9 @@ class CMailFile * * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function dump_mail() { + // phpcs:enable global $conf,$dolibarr_main_data_root; if (@is_writeable($dolibarr_main_data_root)) // Avoid fatal error on fopen with open_basedir @@ -947,14 +949,15 @@ class CMailFile } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create SMTP headers (mode = 'mail') * * @return string headers */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_smtpheaders() { + // phpcs:enable global $conf; $out = ""; @@ -1010,6 +1013,7 @@ class CMailFile } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create header MIME (mode = 'mail') * @@ -1017,9 +1021,9 @@ class CMailFile * @param array $mimefilename_list Array of mime types * @return string mime headers */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_mimeheaders($filename_list, $mimefilename_list) { + // phpcs:enable $mimedone=0; $out = ""; @@ -1040,15 +1044,16 @@ class CMailFile return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return email content (mode = 'mail') * * @param string $msgtext Message string * @return string String content */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_body($msgtext) { + // phpcs:enable global $conf; $out=''; @@ -1141,6 +1146,7 @@ class CMailFile return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Attach file to email (mode = 'mail') * @@ -1149,9 +1155,9 @@ class CMailFile * @param array $mimefilename_list Tableau * @return string Chaine fichiers encodes */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_files($filename_list,$mimetype_list,$mimefilename_list) { + // phpcs:enable $out = ''; $filename_list_size=count($filename_list); @@ -1189,15 +1195,16 @@ class CMailFile } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Attach an image to email (mode = 'mail') * * @param array $images_list Tableau * @return string Chaine images encodees */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_images($images_list) { + // phpcs:enable $out = ''; if ($images_list) @@ -1221,6 +1228,7 @@ class CMailFile } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Try to create a socket connection * @@ -1228,9 +1236,9 @@ class CMailFile * @param int $port Example: 25, 465 * @return int Socket id if ok, 0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function check_server_port($host,$port) { + // phpcs:enable global $conf; $_retVal=0; @@ -1285,6 +1293,7 @@ class CMailFile return $_retVal; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * This function has been modified as provided by SirSir to allow multiline responses when * using SMTP Extensions. @@ -1293,9 +1302,9 @@ class CMailFile * @param string $response Response string * @return boolean true if success */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function server_parse($socket, $response) { + // phpcs:enable $_retVal = true; // Indicates if Object was created or not $server_response = ''; diff --git a/htdocs/core/class/antivir.class.php b/htdocs/core/class/antivir.class.php index e1a50c63083..d18501d54d9 100644 --- a/htdocs/core/class/antivir.class.php +++ b/htdocs/core/class/antivir.class.php @@ -41,7 +41,7 @@ class AntiVir public $errors = array(); var $output; - + /** * @var DoliDB Database handler. */ @@ -57,6 +57,7 @@ class AntiVir $this->db=$db; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Scan a file with antivirus. * This function runs the command defined in setup. This antivirus command must return 0 if OK. @@ -65,9 +66,9 @@ class AntiVir * @param string $file File to scan * @return int <0 if KO (-98 if error, -99 if virus), 0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function dol_avscan_file($file) { + // phpcs:enable global $conf; $return = 0; diff --git a/htdocs/core/class/canvas.class.php b/htdocs/core/class/canvas.class.php index c65b2ba6fe1..a4665701661 100644 --- a/htdocs/core/class/canvas.class.php +++ b/htdocs/core/class/canvas.class.php @@ -32,7 +32,7 @@ class Canvas * @var DoliDB Database handler. */ public $db; - + /** * @var string Error code (or message) */ @@ -133,6 +133,7 @@ class Canvas //print ' => template_dir='.$this->template_dir.'
'; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Shared method for canvas to assign values for templates * @@ -141,9 +142,9 @@ class Canvas * @param string $ref Object ref (if id not provided) * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function assign_values(&$action='view', $id=0, $ref='') { + // phpcs:enable if (method_exists($this->control,'assign_values')) $this->control->assign_values($action, $id, $ref); } @@ -161,6 +162,7 @@ class Canvas else return 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * 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. @@ -168,9 +170,9 @@ class Canvas * @param string $action Action code * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function display_canvas($action) { + // phpcs:enable global $db, $conf, $langs, $user, $canvas; global $form, $formfile; diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php index 6393d201188..349cea676f1 100644 --- a/htdocs/ecm/class/ecmdirectory.class.php +++ b/htdocs/ecm/class/ecmdirectory.class.php @@ -31,12 +31,12 @@ class EcmDirectory // extends CommonObject * @var string ID to identify managed object */ public $element='ecm_directories'; - + /** * @var string Name of table without prefix where object is stored */ //public $table_element='ecm_directories'; - + var $picto = 'dir'; /** @@ -48,7 +48,7 @@ class EcmDirectory // extends CommonObject * @var string proper name for given parameter */ public $label; - + var $fk_parent; var $description; var $cachenbofdoc=-1; // By default cache initialized with value 'not calculated' @@ -70,7 +70,7 @@ class EcmDirectory // extends CommonObject * @var string Error code (or message) */ public $error; - + /** * @var string[] Error codes (or messages) */ @@ -512,14 +512,15 @@ class EcmDirectory // extends CommonObject return $ret; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load this->motherof that is array(id_son=>id_parent, ...) * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_motherof() { + // phpcs:enable global $conf; $this->motherof=array(); @@ -560,6 +561,7 @@ class EcmDirectory // extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return the status * @@ -567,14 +569,15 @@ class EcmDirectory // 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 * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function LibStatut($status,$mode=0) { + // phpcs:enable global $langs; return ''; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Reconstruit l'arborescence des categories sous la forme d'un tableau à partir de la base de donnée * Renvoi un tableau de tableau('id','id_mere',...) trie selon arbre et avec: @@ -594,9 +597,9 @@ class EcmDirectory // extends CommonObject * @param int $force Force reload of full arbo even if already loaded in cache $this->cats * @return array Tableau de array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_full_arbo($force=0) { + // phpcs:enable global $conf; if (empty($force) && ! empty($this->full_arbo_loaded)) @@ -676,6 +679,7 @@ class EcmDirectory // extends CommonObject return $this->cats; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define properties fullpath, fullrelativename, fulllabel of a directory of array this->cats and all its childs. * Separator between directories is always '/', whatever is OS. @@ -684,9 +688,9 @@ class EcmDirectory // extends CommonObject * @param int $protection Deep counter to avoid infinite loop * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function build_path_from_id_categ($id_categ,$protection=0) { + // phpcs:enable // Define fullpath if (! empty($this->cats[$id_categ]['id_mere'])) { @@ -761,6 +765,7 @@ class EcmDirectory // extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Call trigger based on this instance * @@ -772,9 +777,9 @@ class EcmDirectory // extends CommonObject * @param User $user Object user * @return int Result of run_triggers */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function call_trigger($trigger_name, $user) { + // phpcs:enable global $langs,$conf; include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index 95d4b42a4b6..38d155f3328 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -40,12 +40,12 @@ class EcmFiles extends CommonObject * @var string Id to identify managed objects */ public $element = 'ecmfiles'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element = 'ecm_files'; - + public $picto = 'generic'; public $ref; // hash of file path @@ -68,7 +68,7 @@ class EcmFiles extends CommonObject public $acl; public $src_object_type; public $src_object_id; - + /** * Constructor @@ -779,6 +779,7 @@ class EcmFiles extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return the status * @@ -786,9 +787,9 @@ class EcmFiles 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 * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function LibStatut($status,$mode=0) { + // phpcs:enable global $langs; return ''; } diff --git a/htdocs/societe/class/companypaymentmode.class.php b/htdocs/societe/class/companypaymentmode.class.php index 4f3b666049b..7ff2e2de6f9 100644 --- a/htdocs/societe/class/companypaymentmode.class.php +++ b/htdocs/societe/class/companypaymentmode.class.php @@ -36,22 +36,22 @@ class CompanyPaymentMode extends CommonObject * @var string ID to identify managed object */ public $element = 'companypaymentmode'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element = 'societe_rib'; - + /** * @var int Does companypaymentmode support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe */ public $ismultientitymanaged = 2; - + /** * @var int Does companypaymentmode support extrafields ? 0=No, 1=Yes */ public $isextrafieldmanaged = 0; - + /** * @var string String with name of icon for companypaymentmode. Must be the part after the 'object_' into object_companypaymentmode.png */ @@ -452,6 +452,7 @@ class CompanyPaymentMode extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return the status * @@ -459,43 +460,37 @@ class CompanyPaymentMode extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function LibStatut($status,$mode=0) { + // phpcs:enable global $langs; - if ($mode == 0) - { - $prefix=''; - if ($status == 1) return $langs->trans('Enabled'); - if ($status == 0) return $langs->trans('Disabled'); - } - if ($mode == 1) + if ($mode == 0 || $mode == 1) { if ($status == 1) return $langs->trans('Enabled'); if ($status == 0) return $langs->trans('Disabled'); } - if ($mode == 2) + elseif ($mode == 2) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); } - if ($mode == 3) + elseif ($mode == 3) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4'); if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5'); } - if ($mode == 4) + elseif ($mode == 4) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); } - if ($mode == 5) + elseif ($mode == 5) { if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); } - if ($mode == 6) + elseif ($mode == 6) { if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 5c15f82952f..2cd3ba2f6d8 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -571,15 +571,16 @@ class Societe extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a contact/address from thirdparty * * @param User $user Object user * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function create_individual(User $user) { + // phpcs:enable require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; $contact=new Contact($this->db); @@ -1475,14 +1476,15 @@ class Societe extends CommonObject return 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define third party as a customer * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_as_client() { + // phpcs:enable if ($this->id) { $newclient=1; @@ -1502,6 +1504,7 @@ class Societe extends CommonObject return 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Definit la societe comme un client * @@ -1510,9 +1513,9 @@ class Societe extends CommonObject * @param User $user Utilisateur qui definie la remise * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise_client($remise, $note, User $user) { + // phpcs:enable global $conf, $langs; // Nettoyage parametres @@ -1564,6 +1567,7 @@ class Societe extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Definit la societe comme un client * @@ -1572,9 +1576,9 @@ class Societe extends CommonObject * @param User $user Utilisateur qui definie la remise * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise_supplier($remise, $note, User $user) { + // phpcs:enable global $conf, $langs; // Nettoyage parametres @@ -1626,6 +1630,7 @@ class Societe extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add a discount for third party * @@ -1636,9 +1641,9 @@ class Societe extends CommonObject * @param int $discount_type 0 => customer discount, 1 => supplier discount * @return int <0 if KO, id of discount record if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise_except($remise, User $user, $desc, $tva_tx=0, $discount_type=0) { + // phpcs:enable global $langs; // Clean parameters @@ -1771,6 +1776,7 @@ class Societe extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set the price level * @@ -1778,9 +1784,9 @@ class Societe extends CommonObject * @param User $user Use making change * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_price_level($price_level, User $user) { + // phpcs:enable if ($this->id) { $now=dol_now(); @@ -1809,6 +1815,7 @@ class Societe extends CommonObject return -1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add link to sales representative * @@ -1816,14 +1823,12 @@ class Societe extends CommonObject * @param int $commid Id of user * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_commercial(User $user, $commid) { + // phpcs:enable $error=0; - - if ($this->id > 0 && $commid > 0) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_commerciaux"; @@ -1848,6 +1853,7 @@ class Societe extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add link to sales representative * @@ -1855,9 +1861,9 @@ class Societe extends CommonObject * @param int $commid Id of user * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function del_commercial(User $user, $commid) { + // phpcs:enable $error=0; $this->context=array('commercial_modified'=>$commid); @@ -2069,6 +2075,7 @@ class Societe extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -2076,9 +2083,9 @@ class Societe extends CommonObject * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto * @return string Libelle du statut */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { + // phpcs:enable global $langs; $langs->load('companies'); @@ -2119,15 +2126,16 @@ class Societe extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of contacts emails existing for third party * * @param int $addthirdparty 1=Add also a record for thirdparty email * @return array Array of contacts emails */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function thirdparty_and_contact_email_array($addthirdparty=0) { + // phpcs:enable global $langs; $contact_emails = $this->contact_property_array('email',1); @@ -2140,14 +2148,15 @@ class Societe extends CommonObject return $contact_emails; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of contacts mobile phone existing for third party * * @return array Array of contacts emails */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function thirdparty_and_contact_phone_array() { + // phpcs:enable global $langs; $contact_phone = $this->contact_property_array('mobile'); @@ -2161,6 +2170,7 @@ class Societe extends CommonObject return $contact_phone; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of contacts emails or mobile existing for third party * @@ -2168,9 +2178,9 @@ class Societe extends CommonObject * @param int $hidedisabled 1=Hide contact if disabled * @return array Array of contacts emails or mobile. Example: array(id=>'Name ') */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function contact_property_array($mode='email', $hidedisabled=0) { + // phpcs:enable global $langs; $contact_property = array(); @@ -2230,14 +2240,15 @@ class Societe extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoie la liste des contacts de cette societe * * @return array tableau des contacts */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function contact_array() { + // phpcs:enable $contacts = array(); $sql = "SELECT rowid, lastname, firstname FROM ".MAIN_DB_PREFIX."socpeople WHERE fk_soc = ".$this->id; @@ -2263,14 +2274,15 @@ class Societe extends CommonObject return $contacts; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoie la liste des contacts de cette societe * * @return array $contacts tableau des contacts */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function contact_array_objects() { + // phpcs:enable require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; $contacts = array(); @@ -2299,6 +2311,7 @@ class Societe extends CommonObject return $contacts; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return property of contact from its id * @@ -2306,9 +2319,9 @@ class Societe extends CommonObject * @param string $mode 'email' or 'mobile' * @return string Email of contact with format: "Full name " */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function contact_get_property($rowid,$mode) { + // phpcs:enable $contact_property=''; if (empty($rowid)) return ''; @@ -2338,15 +2351,16 @@ class Societe extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return bank number property of thirdparty (label or rum) * * @param string $mode 'label' or 'rum' or 'format' * @return string Bank number */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function display_rib($mode='label') { + // phpcs:enable require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php'; $bac = new CompanyBankAccount($this->db); @@ -2375,14 +2389,15 @@ class Societe extends CommonObject return 'BadParameterToFunctionDisplayRib'; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return Array of RIB * * @return array|int 0 if KO, Array of CompanyBanckAccount if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_all_rib() { + // phpcs:enable require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php'; $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_rib WHERE type='ban' AND fk_soc = ".$this->id; $result = $this->db->query($sql); @@ -2404,6 +2419,7 @@ class Societe extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Attribut un code client a partir du module de controle des codes. * Return value is stored into this->code_client @@ -2412,9 +2428,9 @@ class Societe extends CommonObject * @param int $type Should be 0 to say customer * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_codeclient($objsoc=0,$type=0) { + // phpcs:enable global $conf; if (! empty($conf->global->SOCIETE_CODECLIENT_ADDON)) { @@ -2435,6 +2451,7 @@ class Societe extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Attribut un code fournisseur a partir du module de controle des codes. * Return value is stored into this->code_fournisseur @@ -2443,9 +2460,9 @@ class Societe extends CommonObject * @param int $type Should be 1 to say supplier * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_codefournisseur($objsoc=0,$type=1) { + // phpcs:enable global $conf; if (! empty($conf->global->SOCIETE_CODECLIENT_ADDON)) { @@ -2465,15 +2482,16 @@ class Societe extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Verifie si un code client est modifiable en fonction des parametres * du module de controle des codes. * * @return int 0=No, 1=Yes */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function codeclient_modifiable() { + // phpcs:enable global $conf; if (! empty($conf->global->SOCIETE_CODECLIENT_ADDON)) { @@ -2501,14 +2519,15 @@ class Societe extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Verifie si un code fournisseur est modifiable dans configuration du module de controle des codes * * @return int 0=No, 1=Yes */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function codefournisseur_modifiable() { + // phpcs:enable global $conf; if (! empty($conf->global->SOCIETE_CODECLIENT_ADDON)) { @@ -2536,6 +2555,7 @@ class Societe extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Check customer code * @@ -2545,9 +2565,9 @@ class Societe extends CommonObject * -3 ErrorCustomerCodeAlreadyUsed * -4 ErrorPrefixRequired */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function check_codeclient() { + // phpcs:enable global $conf; if (! empty($conf->global->SOCIETE_CODECLIENT_ADDON)) { @@ -2572,6 +2592,7 @@ class Societe extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Check supplier code * @@ -2581,9 +2602,9 @@ class Societe extends CommonObject * -3 ErrorCustomerCodeAlreadyUsed * -4 ErrorPrefixRequired */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function check_codefournisseur() { + // phpcs:enable global $conf; if (! empty($conf->global->SOCIETE_CODECLIENT_ADDON)) { @@ -2608,6 +2629,7 @@ class Societe extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoie un code compta, suivant le module de code compta. * Peut etre identique a celui saisit ou genere automatiquement. @@ -2616,9 +2638,9 @@ class Societe extends CommonObject * @param string $type Type of thirdparty ('customer' or 'supplier') * @return string Code compta si ok, 0 si aucun, <0 si ko */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_codecompta($type) { + // phpcs:enable global $conf; if (! empty($conf->global->SOCIETE_CODECOMPTA_ADDON)) @@ -2659,15 +2681,16 @@ class Societe extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define parent commany of current company * * @param int $id Id of thirdparty to set or '' to remove * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_parent($id) { + // phpcs:enable if ($this->id) { $sql = "UPDATE ".MAIN_DB_PREFIX."societe"; @@ -2688,15 +2711,16 @@ class Societe extends CommonObject else return -1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns if a profid sould be verified * * @param int $idprof 1,2,3,4,5,6 (Exemple: 1=siren,2=siret,3=naf,4=rcs/rm,5=idprof5,6=idprof6) * @return boolean true , false */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function id_prof_verifiable($idprof) { + // phpcs:enable global $conf; switch($idprof) @@ -2726,6 +2750,7 @@ class Societe extends CommonObject return $ret; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Verify if a profid exists into database for others thirds * @@ -2734,9 +2759,9 @@ class Societe extends CommonObject * @param int $socid Id of thirdparty to exclude (if update) * @return boolean True if exists, False if not */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function id_prof_exists($idprof, $value, $socid=0) { + // phpcs:enable $field = $idprof; switch($idprof) // For backward compatibility @@ -2785,6 +2810,7 @@ class Societe extends CommonObject else return false; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Verifie la validite d'un identifiant professionnel en fonction du pays de la societe (siren, siret, ...) * @@ -2793,9 +2819,9 @@ class Societe extends CommonObject * @return int <=0 if KO, >0 if OK * TODO better to have this in a lib than into a business class */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function id_prof_check($idprof,$soc) { + // phpcs:enable global $conf; $ok=1; @@ -2935,6 +2961,7 @@ class Societe extends CommonObject return $ok; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return an url to check online a professional id or empty string * @@ -2943,9 +2970,9 @@ class Societe extends CommonObject * @return string Url or empty string if no URL known * TODO better in a lib than into business class */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function id_prof_url($idprof,$thirdparty) { + // phpcs:enable global $conf,$langs,$hookmanager; $url=''; @@ -2988,14 +3015,15 @@ class Societe extends CommonObject return ''; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Indique si la societe a des projets * * @return bool true si la societe a des projets, false sinon */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function has_projects() { + // phpcs:enable $sql = 'SELECT COUNT(*) as numproj FROM '.MAIN_DB_PREFIX.'projet WHERE fk_soc = ' . $this->id; $resql = $this->db->query($sql); if ($resql) @@ -3090,14 +3118,15 @@ class Societe extends CommonObject return isInEEC($this); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge la liste des categories fournisseurs * * @return int 0 if success, <> 0 if error */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LoadSupplierCateg() { + // phpcs:enable $this->SupplierCategories = array(); $sql = "SELECT rowid, label"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie"; @@ -3118,15 +3147,16 @@ class Societe extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Insert link supplier - category * * @param int $categorie_id Id of category * @return int 0 if success, <> 0 if error */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function AddFournisseurInCategory($categorie_id) { + // phpcs:enable if ($categorie_id > 0 && $this->id > 0) { $sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie_fournisseur (fk_categorie, fk_soc) "; @@ -3142,6 +3172,7 @@ class Societe extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a third party into database from a member object * @@ -3150,9 +3181,9 @@ class Societe extends CommonObject * @param string $socalias Alias name of third party to force * @return int <0 if KO, id of created account if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function create_from_member(Adherent $member, $socname='', $socalias='') { + // phpcs:enable global $user,$langs; dol_syslog(get_class($this)."::create_from_member", LOG_DEBUG); @@ -3419,15 +3450,16 @@ class Societe extends CommonObject return $this->LibProspLevel($this->fk_prospectlevel); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of prospect level * * @param int $fk_prospectlevel Prospect level * @return string label of level */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibProspLevel($fk_prospectlevel) { + // phpcs:enable global $langs; $lib=$langs->trans("ProspectLevel".$fk_prospectlevel); @@ -3440,6 +3472,7 @@ class Societe extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set prospect level * @@ -3447,9 +3480,9 @@ class Societe extends CommonObject * @return int <0 if KO, >0 if OK * @deprecated Use update function instead */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_prospect_level(User $user) { + // phpcs:enable return $this->update($this->id, $user); } @@ -3465,6 +3498,7 @@ class Societe extends CommonObject return $this->LibProspCommStatut($this->stcomm_id, $mode, $label); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of a given status * @@ -3473,9 +3507,9 @@ class Societe extends CommonObject * @param string $label Label to use for status for added status * @return string Libelle du statut */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibProspCommStatut($statut, $mode=0, $label='') { + // phpcs:enable global $langs; $langs->load('customers'); @@ -3519,6 +3553,7 @@ class Societe extends CommonObject return "Error, mode/status not found"; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set outstanding value * @@ -3526,9 +3561,9 @@ class Societe extends CommonObject * @return int <0 if KO, >0 if OK * @deprecated Use update function instead */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_OutstandingBill(User $user) { + // phpcs:enable return $this->update($this->id, $user); } @@ -3685,15 +3720,16 @@ class Societe extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return amount of bill not paid * * @return int Amount in debt for thirdparty * @deprecated */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_OutstandingBill() { + // phpcs:enable /* Accurate value of remain to pay is to sum remaintopay for each invoice $paiement = $invoice->getSommePaiement(); $creditnotes=$invoice->getSumCreditNotesUsed(); @@ -3739,15 +3775,16 @@ class Societe extends CommonObject return $this->LibCustProspStatut($this->client); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * * @param int $statut Id statut * @return string Libelle du statut */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibCustProspStatut($statut) { + // phpcs:enable global $langs; $langs->load('companies'); diff --git a/htdocs/societe/class/societeaccount.class.php b/htdocs/societe/class/societeaccount.class.php index e6aabf68f6d..61e7303a35b 100644 --- a/htdocs/societe/class/societeaccount.class.php +++ b/htdocs/societe/class/societeaccount.class.php @@ -39,17 +39,17 @@ class SocieteAccount extends CommonObject * @var string ID to identify managed object */ public $element = 'societeaccount'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element = 'societe_account'; - + /** * @var array Does societeaccount support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe */ public $ismultientitymanaged = 0; - + /** * @var string String with name of icon for societeaccount. Must be the part after the 'object_' into object_myobject.png */ @@ -395,6 +395,7 @@ class SocieteAccount extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return the status * @@ -402,9 +403,9 @@ class SocieteAccount extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function LibStatut($status,$mode=0) { + // phpcs:enable global $langs; if ($mode == 0)