From 9b165f6b3f031d94b1a32dcf82b631795aba8e62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 27 Feb 2019 20:45:07 +0100 Subject: [PATCH] add visibility --- htdocs/admin/receiptprinter.php | 10 +- htdocs/comm/action/class/actioncomm.class.php | 206 ++++++------ .../action/class/actioncommreminder.class.php | 12 +- .../action/class/api_agendaevents.class.php | 126 ++++---- .../comm/action/class/cactioncomm.class.php | 28 +- htdocs/comm/action/class/ical.class.php | 87 ++--- .../mailing/class/advtargetemailing.class.php | 54 ++-- .../html.formadvtargetemailing.class.php | 20 +- htdocs/comm/mailing/class/mailing.class.php | 130 ++++---- .../comm/propal/class/api_proposals.class.php | 108 ++++--- htdocs/core/class/commonobject.class.php | 2 +- .../class/commonstickergenerator.class.php | 88 +++--- htdocs/core/class/conf.class.php | 47 ++- htdocs/core/class/coreobject.class.php | 296 +++++++++--------- htdocs/core/class/cstate.class.php | 68 ++-- htdocs/core/class/ctypent.class.php | 40 +-- htdocs/core/class/cunits.class.php | 10 +- htdocs/core/class/discount.class.php | 61 ++-- htdocs/core/class/doleditor.class.php | 64 ++-- htdocs/core/class/dolexception.class.php | 12 +- htdocs/core/class/dolgeoip.class.php | 52 +-- htdocs/core/class/dolgraph.class.php | 144 ++++----- htdocs/core/class/dolreceiptprinter.class.php | 61 ++-- .../core/class/emailsenderprofile.class.php | 37 ++- htdocs/core/class/events.class.php | 18 +- htdocs/core/class/extrafields.class.php | 24 +- htdocs/core/class/fiscalyear.class.php | 6 +- htdocs/core/class/genericobject.class.php | 2 +- htdocs/core/class/html.formcompany.class.php | 56 ++-- htdocs/core/class/html.formcontract.class.php | 34 +- htdocs/core/class/html.formfile.class.php | 24 +- .../class/html.formintervention.class.php | 4 +- htdocs/core/class/html.formmail.class.php | 55 ++-- htdocs/core/class/html.formmailing.class.php | 40 +-- htdocs/core/class/html.formmargin.class.php | 6 +- htdocs/core/class/html.formorder.class.php | 12 +- htdocs/core/class/html.formother.class.php | 130 ++++---- htdocs/core/class/html.formprojet.class.php | 42 +-- htdocs/core/class/html.formpropal.class.php | 51 ++- .../class/html.formsocialcontrib.class.php | 4 +- htdocs/core/class/html.formwebsite.class.php | 22 +- htdocs/cron/class/cronjob.class.php | 7 +- htdocs/exports/class/export.class.php | 12 +- 43 files changed, 1156 insertions(+), 1156 deletions(-) diff --git a/htdocs/admin/receiptprinter.php b/htdocs/admin/receiptprinter.php index 5bbd6746573..f532db76ce4 100644 --- a/htdocs/admin/receiptprinter.php +++ b/htdocs/admin/receiptprinter.php @@ -81,7 +81,7 @@ if ($action == 'addprinter' && $user->admin) { } if (! $error) { - $result= $printer->AddPrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter); + $result= $printer->addPrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter); if ($result > 0) $error++; if (! $error) @@ -107,7 +107,7 @@ if ($action == 'deleteprinter' && $user->admin) { } if (! $error) { - $result= $printer->DeletePrinter($printerid); + $result= $printer->deletePrinter($printerid); if ($result > 0) $error++; if (! $error) @@ -133,7 +133,7 @@ if ($action == 'updateprinter' && $user->admin) { } if (! $error) { - $result= $printer->UpdatePrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter, $printerid); + $result= $printer->updatePrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter, $printerid); if ($result > 0) $error++; if (! $error) { @@ -156,7 +156,7 @@ if ($action == 'testprinter' && $user->admin) { if (! $error) { // test - $ret = $printer->SendTestToPrinter($printerid); + $ret = $printer->sendTestToPrinter($printerid); if ($ret == 0) { setEventMessages($langs->trans("TestSentToPrinter", $printername), null); } else { @@ -176,7 +176,7 @@ if ($action == 'updatetemplate' && $user->admin) { } if (! $error) { - $result= $printer->UpdateTemplate($templatename, $template, $templateid); + $result= $printer->updateTemplate($templatename, $template, $templateid); if ($result > 0) $error++; if (! $error) { diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 4ac6579592e..fba891a848a 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -480,13 +480,13 @@ class ActionComm extends CommonObject } /** - * Load an object from its id and create a new one in database + * Load an object from its id and create a new one in database * - * @param user $fuser Object user making action - * @param int $socid Id of thirdparty - * @return int New id of clone + * @param user $fuser Object user making action + * @param int $socid Id of thirdparty + * @return int New id of clone */ - function createFromClone($fuser, $socid) + public function createFromClone($fuser, $socid) { global $db, $user, $langs, $conf, $hookmanager; @@ -502,7 +502,7 @@ class ActionComm extends CommonObject // fetch optionals attributes and labels $this->fetch_optionals(); -// $this->fetch_userassigned(); + //$this->fetch_userassigned(); $this->fetchResources(); $this->id=0; @@ -559,14 +559,14 @@ class ActionComm extends CommonObject } /** - * Load object from database + * Load object from database * - * @param int $id Id of action to get - * @param string $ref Ref of action to get - * @param string $ref_ext Ref ext to get - * @return int <0 if KO, >0 if OK + * @param int $id Id of action to get + * @param string $ref Ref of action to get + * @param string $ref_ext Ref ext to get + * @return int <0 if KO, >0 if OK */ - function fetch($id, $ref = '', $ref_ext = '') + public function fetch($id, $ref = '', $ref_ext = '') { global $langs; @@ -637,11 +637,11 @@ class ActionComm extends CommonObject $this->usermodid = $obj->fk_user_mod; if (!is_object($this->author)) $this->author = new stdClass(); // To avoid warning - $this->author->id = $obj->fk_user_author; // deprecated - $this->author->firstname = $obj->firstname; // deprecated - $this->author->lastname = $obj->lastname; // deprecated + $this->author->id = $obj->fk_user_author; // deprecated + $this->author->firstname = $obj->firstname; // deprecated + $this->author->lastname = $obj->lastname; // deprecated if (!is_object($this->usermod)) $this->usermod = new stdClass(); // To avoid warning - $this->usermod->id = $obj->fk_user_mod; // deprecated + $this->usermod->id = $obj->fk_user_mod; // deprecated $this->userownerid = $obj->fk_user_action; $this->userdoneid = $obj->fk_user_done; @@ -675,13 +675,13 @@ class ActionComm extends CommonObject return $num; } - /** + /** * Initialize $this->userassigned & this->socpeopleassigned array with list of id of user and contact assigned to event * - * @return int <0 if KO, >0 if OK + * @return int <0 if KO, >0 if OK */ - function fetchResources() - { + public function fetchResources() + { $sql ='SELECT fk_actioncomm, element_type, fk_element, answer_status, mandatory, transparency'; $sql.=' FROM '.MAIN_DB_PREFIX.'actioncomm_resources'; $sql.=' WHERE fk_actioncomm = '.$this->id; @@ -720,13 +720,13 @@ class ActionComm extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Initialize this->userassigned array with list of id of user assigned to event * * @return int <0 if KO, >0 if OK */ - function fetch_userassigned() + public function fetch_userassigned() { // phpcs:enable $sql ="SELECT fk_actioncomm, element_type, fk_element, answer_status, mandatory, transparency"; @@ -761,7 +761,7 @@ class ActionComm extends CommonObject * @param int $notrigger 1 = disable triggers, 0 = enable triggers * @return int <0 if KO, >0 if OK */ - function delete($notrigger = 0) + public function delete($notrigger = 0) { global $user,$langs,$conf; @@ -780,15 +780,15 @@ class ActionComm extends CommonObject } if (! $error) { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm_resources"; - $sql.= " WHERE fk_actioncomm=".$this->id; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm_resources"; + $sql.= " WHERE fk_actioncomm=".$this->id; - dol_syslog(get_class($this)."::delete", LOG_DEBUG); - $res=$this->db->query($sql); - if ($res < 0) { - $this->error=$this->db->lasterror(); - $error++; - } + dol_syslog(get_class($this)."::delete", LOG_DEBUG); + $res=$this->db->query($sql); + if ($res < 0) { + $this->error=$this->db->lasterror(); + $error++; + } } // Removed extrafields @@ -838,7 +838,7 @@ class ActionComm extends CommonObject * @param int $notrigger 1 = disable triggers, 0 = enable triggers * @return int <0 if KO, >0 if OK */ - function update($user, $notrigger = 0) + public function update($user, $notrigger = 0) { global $langs,$conf,$hookmanager; @@ -986,20 +986,20 @@ class ActionComm extends CommonObject } /** - * Load all objects with filters. - * WARNING: This make a fetch on all records instead of making one request with a join. + * Load all objects with filters. + * WARNING: This make a fetch on all records instead of making one request with a join. * - * @param DoliDb $db Database handler - * @param int $socid Filter by thirdparty - * @param int $fk_element Id of element action is linked to - * @param string $elementtype Type of element action is linked to - * @param string $filter Other filter - * @param string $sortfield Sort on this field - * @param string $sortorder ASC or DESC - * @param string $limit Limit number of answers - * @return array or string Error string if KO, array with actions if OK + * @param DoliDb $db Database handler + * @param int $socid Filter by thirdparty + * @param int $fk_element Id of element action is linked to + * @param string $elementtype Type of element action is linked to + * @param string $filter Other filter + * @param string $sortfield Sort on this field + * @param string $sortorder ASC or DESC + * @param string $limit Limit number of answers + * @return array or string Error string if KO, array with actions if OK */ - static function getActions($db, $socid = 0, $fk_element = 0, $elementtype = '', $filter = '', $sortfield = 'a.datep', $sortorder = 'DESC', $limit = 0) + public static function getActions($db, $socid = 0, $fk_element = 0, $elementtype = '', $filter = '', $sortfield = 'a.datep', $sortorder = 'DESC', $limit = 0) { global $conf, $langs; @@ -1043,7 +1043,7 @@ class ActionComm extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * @@ -1051,7 +1051,7 @@ class ActionComm extends CommonObject * @param int $load_state_board Charge indicateurs this->nb de tableau de bord * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ - function load_board($user, $load_state_board = 0) + public function load_board($user, $load_state_board = 0) { // phpcs:enable global $conf, $langs; @@ -1107,12 +1107,12 @@ class ActionComm extends CommonObject /** - * Charge les informations d'ordre info dans l'objet facture + * Charge les informations d'ordre info dans l'objet facture * - * @param int $id Id de la facture a charger - * @return void + * @param int $id Id de la facture a charger + * @return void */ - function info($id) + public function info($id) { $sql = 'SELECT '; $sql.= ' a.id,'; @@ -1157,38 +1157,38 @@ class ActionComm extends CommonObject /** - * Return label of status + * Return label of status * - * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto - * @param int $hidenastatus 1=Show nothing if status is "Not applicable" - * @return string String with status + * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @param int $hidenastatus 1=Show nothing if status is "Not applicable" + * @return string String with status */ - function getLibStatut($mode, $hidenastatus = 0) + public function getLibStatut($mode, $hidenastatus = 0) { return $this->LibStatut($this->percentage, $mode, $hidenastatus, $this->datep); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Return label of action status + * Return label of action status * - * @param int $percent Percent - * @param int $mode 0=Long label, 1=Short label, 2=Picto+Short label, 3=Picto, 4=Picto+Short label, 5=Short label+Picto, 6=Picto+Long label, 7=Very short label+Picto - * @param int $hidenastatus 1=Show nothing if status is "Not applicable" - * @param int $datestart Date start of event - * @return string Label + * @param int $percent Percent + * @param int $mode 0=Long label, 1=Short label, 2=Picto+Short label, 3=Picto, 4=Picto+Short label, 5=Short label+Picto, 6=Picto+Long label, 7=Very short label+Picto + * @param int $hidenastatus 1=Show nothing if status is "Not applicable" + * @param int $datestart Date start of event + * @return string Label */ - function LibStatut($percent, $mode, $hidenastatus = 0, $datestart = '') + public function LibStatut($percent, $mode, $hidenastatus = 0, $datestart = '') { // phpcs:enable global $langs; if ($mode == 0) { - if ($percent==-1 && ! $hidenastatus) return $langs->trans('StatusNotApplicable'); - elseif ($percent==0) return $langs->trans('StatusActionToDo').' (0%)'; - elseif ($percent > 0 && $percent < 100) return $langs->trans('StatusActionInProcess').' ('.$percent.'%)'; - elseif ($percent >= 100) return $langs->trans('StatusActionDone').' (100%)'; + if ($percent==-1 && ! $hidenastatus) return $langs->trans('StatusNotApplicable'); + elseif ($percent==0) return $langs->trans('StatusActionToDo').' (0%)'; + elseif ($percent > 0 && $percent < 100) return $langs->trans('StatusActionInProcess').' ('.$percent.'%)'; + elseif ($percent >= 100) return $langs->trans('StatusActionDone').' (100%)'; } elseif ($mode == 1) { @@ -1244,28 +1244,28 @@ class ActionComm extends CommonObject } /** - * Return URL of event - * Use $this->id, $this->type_code, $this->label and $this->type_label + * Return URL of event + * Use $this->id, $this->type_code, $this->label and $this->type_label * - * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto - * @param int $maxlength Max number of charaters into label. If negative, use the ref as label. - * @param string $classname Force style class on a link - * @param string $option ''=Link to action, 'birthday'=Link to contact - * @param int $overwritepicto 1=Overwrite picto - * @param int $notooltip 1=Disable tooltip - * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking - * @return string Chaine avec URL + * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto + * @param int $maxlength Max number of charaters into label. If negative, use the ref as label. + * @param string $classname Force style class on a link + * @param string $option ''=Link to action, 'birthday'=Link to contact + * @param int $overwritepicto 1=Overwrite picto + * @param int $notooltip 1=Disable tooltip + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @return string Chaine avec URL */ - function getNomUrl($withpicto = 0, $maxlength = 0, $classname = '', $option = '', $overwritepicto = 0, $notooltip = 0, $save_lastsearch_value = -1) + public function getNomUrl($withpicto = 0, $maxlength = 0, $classname = '', $option = '', $overwritepicto = 0, $notooltip = 0, $save_lastsearch_value = -1) { - global $conf, $langs, $user, $hookmanager, $action; + global $conf, $langs, $user, $hookmanager, $action; - if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips + if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips - if ((!$user->rights->agenda->allactions->read && $this->author->id != $user->id) || (!$user->rights->agenda->myactions->read && $this->author->id == $user->id)) - $option = 'nolink'; + if ((!$user->rights->agenda->allactions->read && $this->author->id != $user->id) || (!$user->rights->agenda->myactions->read && $this->author->id == $user->id)) + $option = 'nolink'; - $label = $this->label; + $label = $this->label; if (empty($label)) $label=$this->libelle; // For backward compatibility $result=''; @@ -1379,7 +1379,7 @@ class ActionComm extends CommonObject } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Export events from database into a cal file. * @@ -1390,7 +1390,7 @@ class ActionComm extends CommonObject * @param array $filters Array of filters. Exemple array('notolderthan'=>99, 'year'=>..., 'idfrom'=>..., 'notactiontype'=>'systemauto', 'project'=>123, ...) * @return int <0 if error, nb of events in new file if ok */ - function build_exportfile($format, $type, $cachedelay, $filename, $filters) + public function build_exportfile($format, $type, $cachedelay, $filename, $filters) { // phpcs:enable global $conf,$langs,$dolibarr_main_url_root,$mysoc; @@ -1614,11 +1614,11 @@ class ActionComm extends CommonObject /** * Initialise an instance with random values. * Used to build previews or test instances. - * id must be 0 if object instance is a specimen. + * id must be 0 if object instance is a specimen. * * @return void */ - function initAsSpecimen() + public function initAsSpecimen() { global $user; @@ -1651,12 +1651,12 @@ class ActionComm extends CommonObject } /** - * Function used to replace a thirdparty id with another one. + * Function used to replace a thirdparty id with another one. * - * @param DoliDB $db Database handler - * @param int $origin_id Old thirdparty id - * @param int $dest_id New thirdparty id - * @return bool + * @param DoliDB $db Database handler + * @param int $origin_id Old thirdparty id + * @param int $dest_id New thirdparty id + * @return bool */ public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) { @@ -1668,9 +1668,9 @@ class ActionComm extends CommonObject } /** - * Is the action delayed? + * Is the action delayed? * - * @return bool + * @return bool */ public function hasDelay() { @@ -1683,10 +1683,10 @@ class ActionComm extends CommonObject /** - * Send reminders by emails - * CAN BE A CRON TASK + * Send reminders by emails + * CAN BE A CRON TASK * - * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK) + * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK) */ public function sendEmailsReminder() { @@ -1715,14 +1715,14 @@ class ActionComm extends CommonObject $this->db->begin(); - // TODO Scan events of type 'email' into table llx_actioncomm_reminder with status todo, send email, then set status to done + // TODO Scan events of type 'email' into table llx_actioncomm_reminder with status todo, send email, then set status to done - // Delete also very old past events (we do not keep more than 1 month record in past) - $sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm_reminder WHERE dateremind < '".$this->db->jdate($now - (3600 * 24 * 32))."'"; - $this->db->query($sql); + // Delete also very old past events (we do not keep more than 1 month record in past) + $sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm_reminder WHERE dateremind < '".$this->db->jdate($now - (3600 * 24 * 32))."'"; + $this->db->query($sql); - $this->db->commit(); + $this->db->commit(); - return $error; + return $error; } } diff --git a/htdocs/comm/action/class/actioncommreminder.class.php b/htdocs/comm/action/class/actioncommreminder.class.php index f157c90f95d..b01e0e6a544 100644 --- a/htdocs/comm/action/class/actioncommreminder.class.php +++ b/htdocs/comm/action/class/actioncommreminder.class.php @@ -178,20 +178,20 @@ class ActionCommReminder extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ - function getLibStatut($mode = 0) + public function getLibStatut($mode = 0) { return $this->LibStatut($this->status, $mode); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return the status * - * @param int $status Id status - * @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 + * @param int $status Id status + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto + * @return string Label of status */ - static function LibStatut($status, $mode = 0) + public static function LibStatut($status, $mode = 0) { // phpcs:enable global $langs; diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index 6b14bb6e884..b6df9ec7d96 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -44,7 +44,7 @@ class AgendaEvents extends DolibarrApi /** * Constructor */ - function __construct() + public function __construct() { global $db, $conf; $this->db = $db; @@ -61,7 +61,7 @@ class AgendaEvents extends DolibarrApi * * @throws RestException */ - function get($id) + public function get($id) { if (! DolibarrApiAccess::$user->rights->agenda->myactions->read) { throw new RestException(401, "Insuffisant rights to read an event"); @@ -76,11 +76,11 @@ class AgendaEvents extends DolibarrApi throw new RestException(401, "Insuffisant rights to read event for owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id); } - if ( ! DolibarrApi::_checkAccessToResource('agenda', $this->actioncomm->id, 'actioncomm', '', 'fk_soc', 'id')) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } + if ( ! DolibarrApi::_checkAccessToResource('agenda', $this->actioncomm->id, 'actioncomm', '', 'fk_soc', 'id')) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } - $result = $this->actioncomm->fetch_optionals(); + $result = $this->actioncomm->fetch_optionals(); $this->actioncomm->fetchObjectLinked(); return $this->_cleanObjectDatas($this->actioncomm); @@ -99,7 +99,7 @@ class AgendaEvents extends DolibarrApi * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.label:like:'%dol%') and (t.datec:<:'20160101')" * @return array Array of Agenda Events objects */ - function index($sortfield = "t.id", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = 0, $sqlfilters = '') + public function index($sortfield = "t.id", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = 0, $sqlfilters = '') { global $db, $conf; @@ -120,13 +120,13 @@ class AgendaEvents extends DolibarrApi $sql = "SELECT t.id as rowid"; if (! empty($conf->societe->enabled)) - if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as t"; if (! empty($conf->societe->enabled)) - if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale $sql.= ' WHERE t.entity IN ('.getEntity('agenda').')'; if (! empty($conf->societe->enabled)) - if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc"; + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc"; if ($user_ids) $sql.=" AND t.fk_user_action IN (".$user_ids.")"; if ($socid > 0) $sql.= " AND t.fk_soc = ".$socid; // Insert sale filter @@ -141,7 +141,7 @@ class AgendaEvents extends DolibarrApi { throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); } - $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } @@ -188,7 +188,7 @@ class AgendaEvents extends DolibarrApi * @param array $request_data Request data * @return int ID of Agenda Event */ - function post($request_data = null) + public function post($request_data = null) { if (! DolibarrApiAccess::$user->rights->agenda->myactions->create) { throw new RestException(401, "Insuffisant rights to create your Agenda Event"); @@ -227,7 +227,7 @@ class AgendaEvents extends DolibarrApi * @return int */ /* - function put($id, $request_data = null) + public function put($id, $request_data = null) { if (! DolibarrApiAccess::$user->rights->agenda->myactions->create) { throw new RestException(401, "Insuffisant rights to create your Agenda Event"); @@ -263,25 +263,25 @@ class AgendaEvents extends DolibarrApi * * @return array */ - function delete($id) + public function delete($id) { if(! DolibarrApiAccess::$user->rights->agenda->myactions->delete) { throw new RestException(401, "Insuffisant rights to delete your Agenda Event"); } - $result = $this->actioncomm->fetch($id); + $result = $this->actioncomm->fetch($id); if(! DolibarrApiAccess::$user->rights->agenda->allactions->delete && DolibarrApiAccess::$user->id != $this->actioncomm->userownerid) { throw new RestException(401, "Insuffisant rights to delete an Agenda Event of owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id); - } + } - if( ! $result ) { + if( ! $result ) { throw new RestException(404, 'Agenda Event not found'); } - if( ! DolibarrApi::_checkAccessToResource('actioncomm', $this->actioncomm->id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } + if( ! DolibarrApi::_checkAccessToResource('actioncomm', $this->actioncomm->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } if( ! $this->actioncomm->delete(DolibarrApiAccess::$user)) { throw new RestException(500, 'Error when delete Agenda Event : '.$this->actioncomm->error); @@ -302,7 +302,7 @@ class AgendaEvents extends DolibarrApi * @return array * @throws RestException */ - function _validate($data) + private function _validate($data) { $event = array(); foreach (AgendaEvents::$FIELDS as $field) { @@ -319,51 +319,51 @@ class AgendaEvents extends DolibarrApi * @param object $object Object to clean * @return array Array of cleaned object properties */ - function _cleanObjectDatas($object) + private function _cleanObjectDatas($object) { - $object = parent::_cleanObjectDatas($object); + $object = parent::_cleanObjectDatas($object); - unset($object->usermod); - unset($object->libelle); - unset($object->context); - unset($object->canvas); - unset($object->contact); - unset($object->contact_id); - unset($object->thirdparty); - unset($object->user); - unset($object->origin); - unset($object->origin_id); - unset($object->ref_ext); - unset($object->statut); - unset($object->country); - unset($object->country_id); - unset($object->country_code); - unset($object->barcode_type); - unset($object->barcode_type_code); - unset($object->barcode_type_label); - unset($object->barcode_type_coder); - unset($object->mode_reglement_id); - unset($object->cond_reglement_id); - unset($object->cond_reglement); - unset($object->fk_delivery_address); - unset($object->shipping_method_id); - unset($object->fk_account); - unset($object->total_ht); - unset($object->total_tva); - unset($object->total_localtax1); - unset($object->total_localtax2); - unset($object->total_ttc); - unset($object->fk_incoterms); - unset($object->libelle_incoterms); - unset($object->location_incoterms); - unset($object->name); - unset($object->lastname); - unset($object->firstname); - unset($object->civility_id); - unset($object->contact); - unset($object->societe); + unset($object->usermod); + unset($object->libelle); + unset($object->context); + unset($object->canvas); + unset($object->contact); + unset($object->contact_id); + unset($object->thirdparty); + unset($object->user); + unset($object->origin); + unset($object->origin_id); + unset($object->ref_ext); + unset($object->statut); + unset($object->country); + unset($object->country_id); + unset($object->country_code); + unset($object->barcode_type); + unset($object->barcode_type_code); + unset($object->barcode_type_label); + unset($object->barcode_type_coder); + unset($object->mode_reglement_id); + unset($object->cond_reglement_id); + unset($object->cond_reglement); + unset($object->fk_delivery_address); + unset($object->shipping_method_id); + unset($object->fk_account); + unset($object->total_ht); + unset($object->total_tva); + unset($object->total_localtax1); + unset($object->total_localtax2); + unset($object->total_ttc); + unset($object->fk_incoterms); + unset($object->libelle_incoterms); + unset($object->location_incoterms); + unset($object->name); + unset($object->lastname); + unset($object->firstname); + unset($object->civility_id); + unset($object->contact); + unset($object->societe); - return $object; + return $object; } } diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index f69030e806c..eb7fb885d8d 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -68,7 +68,7 @@ class CActionComm * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db = $db; } @@ -76,10 +76,10 @@ class CActionComm /** * Load action type from database * - * @param int $id id or code of action type to read - * @return int 1=ok, 0=not found, -1=error + * @param int $id id or code of action type to read + * @return int 1=ok, 0=not found, -1=error */ - function fetch($id) + public function fetch($id) { $sql = "SELECT id, code, type, libelle as label, color, active, picto"; $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm"; @@ -118,19 +118,19 @@ class CActionComm } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of event types: array(id=>label) or array(code=>label) * - * @param string|int $active 1 or 0 to filter on event state active or not ('' by default = no filter) - * @param string $idorcode 'id' or 'code' - * @param string $excludetype Type to exclude ('system' or 'systemauto') - * @param int $onlyautoornot 1=Group all type AC_XXX into 1 line AC_MANUAL. 0=Keep details of type, -1=Keep details and add a combined line "All manual" + * @param string|int $active 1 or 0 to filter on event state active or not ('' by default = no filter) + * @param string $idorcode 'id' or 'code' + * @param string $excludetype Type to exclude ('system' or 'systemauto') + * @param int $onlyautoornot 1=Group all type AC_XXX into 1 line AC_MANUAL. 0=Keep details of type, -1=Keep details and add a combined line "All manual" * @param string $morefilter Add more SQL filter - * @param int $shortlabel 1=Get short label instead of long label - * @return mixed Array of all event types if OK, <0 if KO. Key of array is id or code depending on parameter $idorcode. + * @param int $shortlabel 1=Get short label instead of long label + * @return mixed Array of all event types if OK, <0 if KO. Key of array is id or code depending on parameter $idorcode. */ - function liste_array($active = '', $idorcode = 'id', $excludetype = '', $onlyautoornot = 0, $morefilter = '', $shortlabel = 0) + public function liste_array($active = '', $idorcode = 'id', $excludetype = '', $onlyautoornot = 0, $morefilter = '', $shortlabel = 0) { // phpcs:enable global $langs,$conf; @@ -176,7 +176,7 @@ class CActionComm if ($qualified) { - $keyfortrans=''; + $keyfortrans=''; $transcode=''; $code=$obj->code; if ($onlyautoornot > 0 && $code == 'AC_OTH') $code='AC_MANUAL'; @@ -223,7 +223,7 @@ class CActionComm * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Picto only * @return string Label of action type */ - function getNomUrl($withpicto = 0) + public function getNomUrl($withpicto = 0) { global $langs; diff --git a/htdocs/comm/action/class/ical.class.php b/htdocs/comm/action/class/ical.class.php index 00efd44a1a7..41fe3c42e90 100644 --- a/htdocs/comm/action/class/ical.class.php +++ b/htdocs/comm/action/class/ical.class.php @@ -32,12 +32,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/xcal.lib.php'; */ class ICal { - var $file_text; // Text in file - var $cal; // Array to save iCalendar parse data - var $event_count; // Number of Events - var $todo_count; // Number of Todos - var $freebusy_count; // Number of Freebusy - var $last_key; //Help variable save last key (multiline string) + // Text in file + public $file_text; + public $cal; // Array to save iCalendar parse data + public $event_count; // Number of Events + public $todo_count; // Number of Todos + public $freebusy_count; // Number of Freebusy + public $last_key; //Help variable save last key (multiline string) /** @@ -47,14 +48,14 @@ class ICal { } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Read text file, icalender text file + * Read text file, icalender text file * - * @param string $file File - * @return string + * @param string $file File + * @return string */ - function read_file($file) + public function read_file($file) { // phpcs:enable $this->file = $file; @@ -63,31 +64,31 @@ class ICal $tmparray=file($file); if (is_array($tmparray)) { - $file_text = join("", $tmparray); //load file - $file_text = preg_replace("/[\r\n]{1,} /", "", $file_text); + $file_text = join("", $tmparray); //load file + $file_text = preg_replace("/[\r\n]{1,} /", "", $file_text); } return $file_text; // return all text } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Returns the number of calendar events * * @return int */ - function get_event_count() + public function get_event_count() { // phpcs:enable return $this->event_count; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Returns the number of to do * * @return int */ - function get_todo_count() + public function get_todo_count() { // phpcs:enable return $this->todo_count; @@ -99,7 +100,7 @@ class ICal * @param string $uri Url * @return array|string */ - function parse($uri) + public function parse($uri) { $this->cal = array(); // new empty array @@ -122,7 +123,7 @@ class ICal { // get Key and Value VCALENDAR:Begin -> Key = VCALENDAR, Value = begin list($key, $value) = $this->retun_key_value($text); - //var_dump($text.' -> '.$key.' - '.$value); + //var_dump($text.' -> '.$key.' - '.$value); switch ($text) // search special string { @@ -201,7 +202,7 @@ class ICal return $this->cal; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Add to $this->ical array one value and key. * @@ -210,7 +211,7 @@ class ICal * @param string $value Value * @return void */ - function add_to_array($type, $key, $value) + public function add_to_array($type, $key, $value) { // phpcs:enable @@ -263,14 +264,14 @@ class ICal $this->last_key = $key; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Parse text "XXXX:value text some with : " and return array($key = "XXXX", $value="value"); * * @param string $text Text * @return array */ - function retun_key_value($text) + public function retun_key_value($text) { // phpcs:enable /* @@ -288,14 +289,14 @@ class ICal return explode(':', $text, 2); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Parse RRULE return array * * @param string $value string * @return array */ - function ical_rrule($value) + public function ical_rrule($value) { // phpcs:enable $result = array(); @@ -308,14 +309,14 @@ class ICal return $result; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return Unix time from ical date time fomrat (YYYYMMDD[T]HHMMSS[Z] or YYYYMMDD[T]HHMMSS) * * @param string $ical_date String date * @return int */ - function ical_date_to_unix($ical_date) + public function ical_date_to_unix($ical_date) { // phpcs:enable $ical_date = str_replace('T', '', $ical_date); @@ -331,7 +332,7 @@ class ICal return $ntime; // ntime is a GTM time } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return unix date from iCal date format * @@ -339,7 +340,7 @@ class ICal * @param string $value Value * @return array */ - function ical_dt_date($key, $value) + public function ical_dt_date($key, $value) { // phpcs:enable $return_value = array(); @@ -362,13 +363,13 @@ class ICal return array($key,$return_value); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return sorted eventlist as array or false if calendar is empty * * @return array|false */ - function get_sort_event_list() + public function get_sort_event_list() { // phpcs:enable $temp = $this->get_event_list(); @@ -383,7 +384,7 @@ class ICal } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Compare two unix timestamp * @@ -391,67 +392,67 @@ class ICal * @param array $b Operand b * @return integer */ - function ical_dtstart_compare($a, $b) + public function ical_dtstart_compare($a, $b) { // phpcs:enable return strnatcasecmp($a['DTSTART']['unixtime'], $b['DTSTART']['unixtime']); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return eventlist array (not sorted eventlist array) * * @return array */ - function get_event_list() + public function get_event_list() { // phpcs:enable return (! empty($this->cal['VEVENT'])?$this->cal['VEVENT']:''); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return eventlist array (not sort eventlist array) * * @return array */ - function get_freebusy_list() + public function get_freebusy_list() { // phpcs:enable return $this->cal['VFREEBUSY']; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return to do array (not sorted todo array) * * @return array */ - function get_todo_list() + public function get_todo_list() { // phpcs:enable return $this->cal['VTODO']; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return base calendar data * * @return array */ - function get_calender_data() + public function get_calender_data() { // phpcs:enable return $this->cal['VCALENDAR']; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return array with all data * * @return array */ - function get_all_data() + public function get_all_data() { // phpcs:enable return $this->cal; diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index 567f968e3d2..b450f5a0872 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -58,20 +58,20 @@ class AdvanceTargetingMailing extends CommonObject */ public $id; - var $name; - var $entity; - var $fk_element; - var $type_element; - var $filtervalue; - var $fk_user_author; - var $datec=''; - var $fk_user_mod; - var $tms=''; + public $name; + public $entity; + public $fk_element; + public $type_element; + public $filtervalue; + public $fk_user_author; + public $datec=''; + public $fk_user_mod; + public $tms=''; - var $select_target_type = array(); - var $type_statuscommprospect=array(); - var $thirdparty_lines; - var $contact_lines; + public $select_target_type = array(); + public $type_statuscommprospect=array(); + public $thirdparty_lines; + public $contact_lines; /** @@ -79,7 +79,7 @@ class AdvanceTargetingMailing extends CommonObject * * @param DoliDb $db Database handler */ - function __construct($db) + public function __construct($db) { global $langs; $langs->load('customers'); @@ -108,7 +108,7 @@ class AdvanceTargetingMailing 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; @@ -202,7 +202,7 @@ class AdvanceTargetingMailing extends CommonObject * @param int $id Id object * @return int <0 if KO, >0 if OK */ - function fetch($id) + public function fetch($id) { global $langs; $sql = "SELECT"; @@ -253,14 +253,14 @@ class AdvanceTargetingMailing extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load object in memory from the database * * @param int $id Id object * @return int <0 if KO, >0 if OK */ - function fetch_by_mailing($id = 0) + public function fetch_by_mailing($id = 0) { // phpcs:enable global $langs; @@ -319,7 +319,7 @@ class AdvanceTargetingMailing extends CommonObject - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load object in memory from the database * @@ -327,7 +327,7 @@ class AdvanceTargetingMailing extends CommonObject * @param string $type_element Type target * @return int <0 if KO, >0 if OK */ - function fetch_by_element($id = 0, $type_element = 'mailing') + public function fetch_by_element($id = 0, $type_element = 'mailing') { // phpcs:enable global $langs; @@ -390,7 +390,7 @@ class AdvanceTargetingMailing extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user, $notrigger = 0) + public function update($user, $notrigger = 0) { global $conf, $langs; $error=0; @@ -469,7 +469,7 @@ class AdvanceTargetingMailing 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; @@ -528,7 +528,7 @@ class AdvanceTargetingMailing extends CommonObject * @param array $arrayquery All element to Query * @return int <0 if KO, >0 if OK */ - function savequery($user, $arrayquery) + public function savequery($user, $arrayquery) { global $langs,$conf; @@ -548,14 +548,14 @@ class AdvanceTargetingMailing extends CommonObject - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load object in memory from database * * @param array $arrayquery All element to Query * @return int <0 if KO, >0 if OK */ - function query_thirdparty($arrayquery) + public function query_thirdparty($arrayquery) { // phpcs:enable global $langs,$conf; @@ -699,7 +699,7 @@ class AdvanceTargetingMailing extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load object in memory from database * @@ -707,7 +707,7 @@ class AdvanceTargetingMailing extends CommonObject * @param int $withThirdpartyFilter add contact with tridparty filter * @return int <0 if KO, >0 if OK */ - function query_contact($arrayquery, $withThirdpartyFilter = 0) + public function query_contact($arrayquery, $withThirdpartyFilter = 0) { // phpcs:enable global $langs,$conf; diff --git a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php index 66303647dbc..9048d5a46e2 100644 --- a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php +++ b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php @@ -42,7 +42,7 @@ class FormAdvTargetEmailing extends Form * * @param DoliDB $db handler */ - function __construct($db) + public function __construct($db) { global $langs; @@ -56,7 +56,7 @@ class FormAdvTargetEmailing extends Form * @param string $htmlname select field * @return string select field */ - function multiselectProspectionStatus($selected_array = array(), $htmlname = 'cust_prospect_status') + public function multiselectProspectionStatus($selected_array = array(), $htmlname = 'cust_prospect_status') { global $conf, $langs; $options_array = array(); @@ -93,7 +93,7 @@ class FormAdvTargetEmailing extends Form * @param array $selected_array or Code or Label of preselected country * @return string HTML string with select */ - function multiselectCountry($htmlname = 'country_id', $selected_array = array()) + public function multiselectCountry($htmlname = 'country_id', $selected_array = array()) { global $conf, $langs; @@ -154,7 +154,7 @@ class FormAdvTargetEmailing extends Form * @param User $user User action * @return string combo list code */ - function multiselectselectSalesRepresentatives($htmlname, $selected_array, $user) + public function multiselectselectSalesRepresentatives($htmlname, $selected_array, $user) { global $conf; @@ -195,7 +195,7 @@ class FormAdvTargetEmailing extends Form * @param array $selected_array selected array * @return string combo list code */ - function multiselectselectLanguage($htmlname = '', $selected_array = array()) + public function multiselectselectLanguage($htmlname = '', $selected_array = array()) { global $conf,$langs; @@ -222,7 +222,7 @@ class FormAdvTargetEmailing extends Form * * @return string HTML combo */ - function advMultiselectarraySelllist($htmlname, $sqlqueryparam = array(), $selected_array = array()) + public function advMultiselectarraySelllist($htmlname, $sqlqueryparam = array(), $selected_array = array()) { $options_array=array(); @@ -291,7 +291,7 @@ class FormAdvTargetEmailing extends Form * @param array $selected_array Array * @return string HTML combo */ - function multiselectCivility($htmlname = 'civilite_id', $selected_array = array()) + public function multiselectCivility($htmlname = 'civilite_id', $selected_array = array()) { global $conf,$langs,$user; $langs->load("dict"); @@ -341,7 +341,7 @@ class FormAdvTargetEmailing extends Form * @param int $showempty show empty * @return string HTML combo */ - function advMultiselectarray($htmlname, $options_array = array(), $selected_array = array(), $showempty = 0) + public function advMultiselectarray($htmlname, $options_array = array(), $selected_array = array(), $showempty = 0) { global $conf, $langs; @@ -357,7 +357,7 @@ class FormAdvTargetEmailing extends Form * @param array $selected_array value selected * @return string HTML combo */ - function multiselectCustomerCategories($htmlname = 'cust_cat', $selected_array = array()) + public function multiselectCustomerCategories($htmlname = 'cust_cat', $selected_array = array()) { return $this->multiselectCategories($htmlname, $selected_array, 2); } @@ -369,7 +369,7 @@ class FormAdvTargetEmailing extends Form * @param array $selected_array value selected * @return string HTML combo */ - function multiselectContactCategories($htmlname = 'contact_cat', $selected_array = array()) + public function multiselectContactCategories($htmlname = 'contact_cat', $selected_array = array()) { return $this->multiselectCategories($htmlname, $selected_array, 4); } diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index 580a36425c8..c94c516d27d 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -80,9 +80,9 @@ class Mailing extends CommonObject * Constructor * * @param DoliDb $db Database handler - */ - function __construct($db) - { + */ + public function __construct($db) + { $this->db = $db; // List of language codes for status @@ -96,7 +96,7 @@ class Mailing extends CommonObject $this->statut_dest[1] = 'MailingStatusSent'; $this->statut_dest[2] = 'MailingStatusRead'; $this->statut_dest[3] = 'MailingStatusReadAndUnsubscribe'; // Read but ask to not be contacted anymore - } + } /** * Create an EMailing @@ -104,7 +104,7 @@ class Mailing extends CommonObject * @param User $user Object of user making creation * @return int -1 if error, Id of created object if OK */ - function create($user) + public function create($user) { global $conf, $langs; @@ -163,7 +163,7 @@ class Mailing extends CommonObject * @param User $user Object of user making change * @return int < 0 if KO, > 0 if OK */ - function update($user) + public function update($user) { $sql = "UPDATE ".MAIN_DB_PREFIX."mailing "; $sql .= " SET titre = '".$this->db->escape($this->titre)."'"; @@ -195,7 +195,7 @@ class Mailing extends CommonObject * @param int $rowid Id of emailing * @return int <0 if KO, >0 if OK */ - function fetch($rowid) + public function fetch($rowid) { global $conf; @@ -218,34 +218,34 @@ class Mailing extends CommonObject { $obj = $this->db->fetch_object($result); - $this->id = $obj->rowid; - $this->ref = $obj->rowid; - $this->statut = $obj->statut; - $this->nbemail = $obj->nbemail; - $this->titre = $obj->titre; + $this->id = $obj->rowid; + $this->ref = $obj->rowid; + $this->statut = $obj->statut; + $this->nbemail = $obj->nbemail; + $this->titre = $obj->titre; - $this->sujet = $obj->sujet; + $this->sujet = $obj->sujet; if (!empty($conf->global->FCKEDITOR_ENABLE_MAILING) && dol_textishtml(dol_html_entity_decode($obj->body, ENT_COMPAT | ENT_HTML401))) { - $this->body = dol_html_entity_decode($obj->body, ENT_COMPAT | ENT_HTML401); + $this->body = dol_html_entity_decode($obj->body, ENT_COMPAT | ENT_HTML401); }else { - $this->body = $obj->body; + $this->body = $obj->body; } - $this->bgcolor = $obj->bgcolor; - $this->bgimage = $obj->bgimage; + $this->bgcolor = $obj->bgcolor; + $this->bgimage = $obj->bgimage; - $this->email_from = $obj->email_from; - $this->email_replyto = $obj->email_replyto; - $this->email_errorsto = $obj->email_errorsto; + $this->email_from = $obj->email_from; + $this->email_replyto = $obj->email_replyto; + $this->email_errorsto = $obj->email_errorsto; - $this->user_creat = $obj->fk_user_creat; - $this->user_valid = $obj->fk_user_valid; + $this->user_creat = $obj->fk_user_creat; + $this->user_valid = $obj->fk_user_valid; - $this->date_creat = $this->db->jdate($obj->date_creat); - $this->date_valid = $this->db->jdate($obj->date_valid); - $this->date_envoi = $this->db->jdate($obj->date_envoi); + $this->date_creat = $this->db->jdate($obj->date_creat); + $this->date_valid = $this->db->jdate($obj->date_valid); + $this->date_envoi = $this->db->jdate($obj->date_envoi); - $this->extraparams = (array) json_decode($obj->extraparams, true); + $this->extraparams = (array) json_decode($obj->extraparams, true); return 1; } @@ -271,7 +271,7 @@ class Mailing extends CommonObject * @param int $option2 Not used * @return int New id of clone */ - function createFromClone($fromid, $option1, $option2) + public function createFromClone($fromid, $option1, $option2) { global $user,$langs; @@ -394,7 +394,7 @@ class Mailing extends CommonObject * @param User $user Objet user qui valide * @return int <0 if KO, >0 if OK */ - function valid($user) + public function valid($user) { $now=dol_now(); @@ -421,7 +421,7 @@ class Mailing extends CommonObject * @param int $rowid id du mailing a supprimer * @return int 1 en cas de succes */ - function delete($rowid) + public function delete($rowid) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing"; $sql.= " WHERE rowid = ".$rowid; @@ -439,13 +439,13 @@ class Mailing extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Delete targets emailing * * @return int 1 if OK, 0 if error */ - function delete_targets() + public function delete_targets() { // phpcs:enable $sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing_cibles"; @@ -465,14 +465,14 @@ class Mailing extends CommonObject } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Change status of each recipient * * @param User $user Objet user qui valide * @return int <0 if KO, >0 if OK */ - function reset_targets_status($user) + public function reset_targets_status($user) { // phpcs:enable $sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles"; @@ -499,7 +499,7 @@ class Mailing extends CommonObject * @param string $mode Mode ('alreadysent' = Sent success or error, 'alreadysentok' = Sent success, 'alreadysentko' = Sent error) * @return int Nb of target with status */ - function countNbOfTargets($mode) + public function countNbOfTargets($mode) { $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."mailing_cibles"; $sql.= " WHERE fk_mailing = ".$this->id; @@ -537,7 +537,7 @@ class Mailing extends CommonObject * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @return string String with URL */ - function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) + public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) { global $db, $conf, $langs, $hookmanager; global $dolibarr_main_authentication, $dolibarr_main_demo; @@ -608,12 +608,12 @@ class Mailing extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long * @return string Label */ - function getLibStatut($mode = 0) + public function getLibStatut($mode = 0) { return $this->LibStatut($this->statut, $mode); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -621,7 +621,7 @@ class Mailing extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label */ - function LibStatut($statut, $mode = 0) + public function LibStatut($statut, $mode = 0) { // phpcs:enable global $langs; @@ -634,30 +634,30 @@ class Mailing extends CommonObject elseif ($mode == 2) { if ($statut == 0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]); - if ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]), 'statut1').' '.$langs->trans($this->statuts[$statut]); - if ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]), 'statut3').' '.$langs->trans($this->statuts[$statut]); - if ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]); + elseif ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]), 'statut1').' '.$langs->trans($this->statuts[$statut]); + elseif ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]), 'statut3').' '.$langs->trans($this->statuts[$statut]); + elseif ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]); } elseif ($mode == 3) { if ($statut == 0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0'); - if ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]), 'statut1'); - if ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]), 'statut3'); - if ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]), 'statut6'); + elseif ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]), 'statut1'); + elseif ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]), 'statut3'); + elseif ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]), 'statut6'); } elseif ($mode == 4) { if ($statut == 0) return img_picto($langs->trans($this->statuts[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]); - if ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]), 'statut1').' '.$langs->trans($this->statuts[$statut]); - if ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]), 'statut3').' '.$langs->trans($this->statuts[$statut]); - if ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]); + elseif ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]), 'statut1').' '.$langs->trans($this->statuts[$statut]); + elseif ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]), 'statut3').' '.$langs->trans($this->statuts[$statut]); + elseif ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]); } elseif ($mode == 5) { if ($statut == 0) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut0'); - if ($statut == 1) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut1'); - if ($statut == 2) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut3'); - if ($statut == 3) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut6'); + elseif ($statut == 1) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut1'); + elseif ($statut == 2) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut3'); + elseif ($statut == 3) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]), 'statut6'); } } @@ -687,37 +687,37 @@ class Mailing extends CommonObject elseif ($mode == 2) { if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); - if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6'); - if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4'); - if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3'); + elseif ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6'); + elseif ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4'); + elseif ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3'); } elseif ($mode == 3) { if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); - if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6'); - if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4'); - if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3'); + elseif ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6'); + elseif ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4'); + elseif ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3'); } elseif ($mode == 4) { if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); - if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6'); - if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4'); - if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3'); + elseif ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6'); + elseif ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4'); + elseif ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3'); } elseif ($mode == 5) { if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); - if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6'); - if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4'); - if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3'); + elseif ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6'); + elseif ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4'); + elseif ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3'); } elseif ($mode == 6) { if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); - if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6'); - if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4'); - if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3'); + elseif ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"), 'statut6'); + elseif ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"), 'statut4'); + elseif ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"), 'statut3'); } } } diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index c72c54294ae..4951f365ec2 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -29,8 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; */ class Proposals extends DolibarrApi { - - /** + /** * @var array $FIELDS Mandatory fields, checked when create and update object */ static $FIELDS = array( @@ -45,7 +44,7 @@ class Proposals extends DolibarrApi /** * Constructor */ - function __construct() + public function __construct() { global $db, $conf; $this->db = $db; @@ -63,7 +62,7 @@ class Proposals extends DolibarrApi * * @throws RestException */ - function get($id, $contact_list = 1) + public function get($id, $contact_list = 1) { if(! DolibarrApiAccess::$user->rights->propal->lire) { throw new RestException(401); @@ -97,7 +96,7 @@ class Proposals extends DolibarrApi * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')" * @return array Array of order objects */ - function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') { global $db, $conf; @@ -182,7 +181,7 @@ class Proposals extends DolibarrApi * @param array $request_data Request data * @return int ID of proposal */ - function post($request_data = null) + public function post($request_data = null) { if(! DolibarrApiAccess::$user->rights->propal->creer) { throw new RestException(401, "Insuffisant rights"); @@ -216,7 +215,7 @@ class Proposals extends DolibarrApi * * @return int */ - function getLines($id) + public function getLines($id) { if(! DolibarrApiAccess::$user->rights->propal->lire) { throw new RestException(401); @@ -248,9 +247,9 @@ class Proposals extends DolibarrApi * * @return int */ - function postLine($id, $request_data = null) + public function postLine($id, $request_data = null) { - if(! DolibarrApiAccess::$user->rights->propal->creer) { + if (! DolibarrApiAccess::$user->rights->propal->creer) { throw new RestException(401); } @@ -259,12 +258,11 @@ class Proposals extends DolibarrApi throw new RestException(404, 'Commercial Proposal not found'); } - if (! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) - { + if (! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - $request_data = (object) $request_data; + $request_data = (object) $request_data; $updateRes = $this->propal->addline( $request_data->desc, @@ -313,7 +311,7 @@ class Proposals extends DolibarrApi * * @return object */ - function putLine($id, $lineid, $request_data = null) + public function putLine($id, $lineid, $request_data = null) { if(! DolibarrApiAccess::$user->rights->propal->creer) { throw new RestException(401); @@ -336,30 +334,30 @@ class Proposals extends DolibarrApi throw new RestException(404, 'Proposal line not found'); } - $updateRes = $this->propal->updateline( - $lineid, - isset($request_data->subprice)?$request_data->subprice:$propalline->subprice, - isset($request_data->qty)?$request_data->qty:$propalline->qty, - isset($request_data->remise_percent)?$request_data->remise_percent:$propalline->remise_percent, - isset($request_data->tva_tx)?$request_data->tva_tx:$propalline->tva_tx, - isset($request_data->localtax1_tx)?$request_data->localtax1_tx:$propalline->localtax1_tx, - isset($request_data->localtax2_tx)?$request_data->localtax2_tx:$propalline->localtax2_tx, - isset($request_data->desc)?$request_data->desc:$propalline->desc, - 'HT', - isset($request_data->info_bits)?$request_data->info_bits:$propalline->info_bits, - isset($request_data->special_code)?$request_data->special_code:$propalline->special_code, - isset($request_data->fk_parent_line)?$request_data->fk_parent_line:$propalline->fk_parent_line, - 0, - isset($request_data->fk_fournprice)?$request_data->fk_fournprice:$propalline->fk_fournprice, - isset($request_data->pa_ht)?$request_data->pa_ht:$propalline->pa_ht, - isset($request_data->label)?$request_data->label:$propalline->label, - isset($request_data->product_type)?$request_data->product_type:$propalline->product_type, - isset($request_data->date_start)?$request_data->date_start:$propalline->date_start, - isset($request_data->date_end)?$request_data->date_end:$propalline->date_end, - isset($request_data->array_options)?$request_data->array_options:$propalline->array_options, - isset($request_data->fk_unit)?$request_data->fk_unit:$propalline->fk_unit, - isset($request_data->multicurrency_subprice)?$request_data->multicurrency_subprice:$propalline->subprice - ); + $updateRes = $this->propal->updateline( + $lineid, + isset($request_data->subprice)?$request_data->subprice:$propalline->subprice, + isset($request_data->qty)?$request_data->qty:$propalline->qty, + isset($request_data->remise_percent)?$request_data->remise_percent:$propalline->remise_percent, + isset($request_data->tva_tx)?$request_data->tva_tx:$propalline->tva_tx, + isset($request_data->localtax1_tx)?$request_data->localtax1_tx:$propalline->localtax1_tx, + isset($request_data->localtax2_tx)?$request_data->localtax2_tx:$propalline->localtax2_tx, + isset($request_data->desc)?$request_data->desc:$propalline->desc, + 'HT', + isset($request_data->info_bits)?$request_data->info_bits:$propalline->info_bits, + isset($request_data->special_code)?$request_data->special_code:$propalline->special_code, + isset($request_data->fk_parent_line)?$request_data->fk_parent_line:$propalline->fk_parent_line, + 0, + isset($request_data->fk_fournprice)?$request_data->fk_fournprice:$propalline->fk_fournprice, + isset($request_data->pa_ht)?$request_data->pa_ht:$propalline->pa_ht, + isset($request_data->label)?$request_data->label:$propalline->label, + isset($request_data->product_type)?$request_data->product_type:$propalline->product_type, + isset($request_data->date_start)?$request_data->date_start:$propalline->date_start, + isset($request_data->date_end)?$request_data->date_end:$propalline->date_end, + isset($request_data->array_options)?$request_data->array_options:$propalline->array_options, + isset($request_data->fk_unit)?$request_data->fk_unit:$propalline->fk_unit, + isset($request_data->multicurrency_subprice)?$request_data->multicurrency_subprice:$propalline->subprice + ); if ($updateRes > 0) { $result = $this->get($id); @@ -382,7 +380,7 @@ class Proposals extends DolibarrApi * @throws 401 * @throws 404 */ - function deleteLine($id, $lineid) + public function deleteLine($id, $lineid) { if(! DolibarrApiAccess::$user->rights->propal->creer) { throw new RestException(401); @@ -422,7 +420,7 @@ class Proposals extends DolibarrApi * @throws 401 * @throws 404 */ - function postContact($id, $contactid, $type) + public function postContact($id, $contactid, $type) { if(!DolibarrApiAccess::$user->rights->propal->creer) { throw new RestException(401); @@ -464,7 +462,7 @@ class Proposals extends DolibarrApi * @throws 404 * @throws 500 */ - function deleteContact($id, $rowid) + public function deleteContact($id, $rowid) { if(!DolibarrApiAccess::$user->rights->propal->creer) { throw new RestException(401); @@ -497,21 +495,21 @@ class Proposals extends DolibarrApi * * @return int */ - function put($id, $request_data = null) + public function put($id, $request_data = null) { - if(! DolibarrApiAccess::$user->rights->propal->creer) { + if (! DolibarrApiAccess::$user->rights->propal->creer) { throw new RestException(401); } $result = $this->propal->fetch($id); - if( ! $result ) { + if ( ! $result ) { throw new RestException(404, 'Proposal not found'); } - if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) { + if ( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - foreach($request_data as $field => $value) { + foreach ($request_data as $field => $value) { if ($field == 'id') continue; $this->propal->$field = $value; } @@ -546,7 +544,7 @@ class Proposals extends DolibarrApi * * @return array */ - function delete($id) + public function delete($id) { if(! DolibarrApiAccess::$user->rights->propal->supprimer) { throw new RestException(401); @@ -581,7 +579,7 @@ class Proposals extends DolibarrApi * * @return array */ - function settodraft($id) + public function settodraft($id) { if(! DolibarrApiAccess::$user->rights->propal->creer) { throw new RestException(401); @@ -637,9 +635,9 @@ class Proposals extends DolibarrApi * @throws 500 * * @return array - */ - function validate($id, $notrigger = 0) - { + */ + public function validate($id, $notrigger = 0) + { if(! DolibarrApiAccess::$user->rights->propal->creer) { throw new RestException(401); } @@ -672,7 +670,7 @@ class Proposals extends DolibarrApi $this->propal->fetchObjectLinked(); return $this->_cleanObjectDatas($this->propal); - } + } /** * Close (Accept or refuse) a quote / commercial proposal @@ -686,7 +684,7 @@ class Proposals extends DolibarrApi * * @return array */ - function close($id, $status, $note_private = '', $notrigger = 0) + public function close($id, $status, $note_private = '', $notrigger = 0) { if(! DolibarrApiAccess::$user->rights->propal->creer) { throw new RestException(401); @@ -731,7 +729,7 @@ class Proposals extends DolibarrApi * * @return array */ - function setinvoiced($id) + public function setinvoiced($id) { if (! DolibarrApiAccess::$user->rights->propal->creer) { throw new RestException(401); @@ -772,7 +770,7 @@ class Proposals extends DolibarrApi * @return array * @throws RestException */ - function _validate($data) + private function _validate($data) { $propal = array(); foreach (Proposals::$FIELDS as $field) { @@ -790,7 +788,7 @@ class Proposals extends DolibarrApi * @param object $object Object to clean * @return array Array of cleaned object properties */ - function _cleanObjectDatas($object) + private function _cleanObjectDatas($object) { $object = parent::_cleanObjectDatas($object); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 69d0c49e6e7..e0b852f32d8 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3734,7 +3734,7 @@ abstract class CommonObject } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return incoterms informations * TODO Use a cache for label get diff --git a/htdocs/core/class/commonstickergenerator.class.php b/htdocs/core/class/commonstickergenerator.class.php index bbdc6222921..18bcfcee8d5 100644 --- a/htdocs/core/class/commonstickergenerator.class.php +++ b/htdocs/core/class/commonstickergenerator.class.php @@ -61,43 +61,57 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php'; */ abstract class CommonStickerGenerator { - public $code; // Code of format + public $code; // Code of format - /** + /** * @var array format Array with informations */ public $format; - // protected - 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; + // phpcs:disable PEAR.NamingConventions.ValidVariableName.PublicUnderscore + // protected + // Nom du format de l'etiquette + protected $_Avery_Name = ''; + // Marge de gauche de l'etiquette + protected $_Margin_Left = 0; + // marge en haut de la page avant la premiere etiquette + protected $_Margin_Top = 0; + // Espace horizontal entre 2 bandes d'etiquettes + protected $_X_Space = 0; + // Espace vertical entre 2 bandes d'etiquettes + protected $_Y_Space = 0; + // NX Nombre d'etiquettes sur la largeur de la page + protected $_X_Number = 0; + // NY Nombre d'etiquettes sur la hauteur de la page + protected $_Y_Number = 0; + // Largeur de chaque etiquette + protected $_Width = 0; + // Hauteur de chaque etiquette + protected $_Height = 0; + // Hauteur des caracteres + protected $_Char_Size = 10; + // Hauteur par defaut d'une ligne + protected $_Line_Height = 10; + // Type of metric.. Will help to calculate good values + protected $_Metric = 'mm'; + // Type of metric for the doc.. + protected $_Metric_Doc = 'mm'; + protected $_COUNTX = 1; + protected $_COUNTY = 1; + protected $_First = 1; public $Tformat; - + // phpcs:enable /** * Constructor * * @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 /** * Function to build PDF on disk, then output on HTTP strem. * @@ -107,7 +121,7 @@ abstract class CommonStickerGenerator * @param string $outputdir Output directory for pdf file * @return int 1=OK, 0=KO */ - abstract function write_file($arrayofrecords, $outputlangs, $srctemplatepath, $outputdir = ''); + public abstract function write_file($arrayofrecords, $outputlangs, $srctemplatepath, $outputdir = ''); // phpcs:enable /** @@ -118,9 +132,9 @@ abstract class CommonStickerGenerator * @param array $param Associative array containing label content and optional parameters * @return void */ - abstract function addSticker(&$pdf, $outputlangs, $param); + public abstract function addSticker(&$pdf, $outputlangs, $param); - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Methode qui permet de modifier la taille des caracteres * Cela modiera aussi l'espace entre chaque ligne @@ -129,7 +143,7 @@ abstract class CommonStickerGenerator * @param int $pt point * @return void */ - function Set_Char_Size(&$pdf, $pt) + public function Set_Char_Size(&$pdf, $pt) { // phpcs:enable if ($pt > 3) { @@ -139,7 +153,8 @@ abstract class CommonStickerGenerator } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * protected Print dot line * @@ -152,8 +167,8 @@ abstract class CommonStickerGenerator * @param int $nbPointilles Nb pointilles * @return void */ - function _Pointille(&$pdf, $x1 = 0, $y1 = 0, $x2 = 210, $y2 = 297, $epaisseur = 1, $nbPointilles = 15) - { + protected function _Pointille(&$pdf, $x1 = 0, $y1 = 0, $x2 = 210, $y2 = 297, $epaisseur = 1, $nbPointilles = 15) + { // phpcs:enable $pdf->SetLineWidth($epaisseur); $length=abs($x1-$x2); @@ -182,7 +197,8 @@ abstract class CommonStickerGenerator } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * protected Function realisant une croix aux 4 coins des cartes * @@ -195,7 +211,7 @@ abstract class CommonStickerGenerator * @param int $taille Size * @return void */ - function _Croix(&$pdf, $x1 = 0, $y1 = 0, $x2 = 210, $y2 = 297, $epaisseur = 1, $taille = 4) + protected function _Croix(&$pdf, $x1 = 0, $y1 = 0, $x2 = 210, $y2 = 297, $epaisseur = 1, $taille = 4) { // phpcs:enable $pdf->SetDrawColor(192, 192, 192); @@ -240,14 +256,15 @@ abstract class CommonStickerGenerator return $value; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * protected Give the height for a char size given. * * @param int $pt Point * @return int Height chars */ - function _Get_Height_Chars($pt) + protected function _Get_Height_Chars($pt) { // phpcs:enable // Tableau de concordance entre la hauteur des caracteres et de l'espacement entre les lignes @@ -259,7 +276,8 @@ abstract class CommonStickerGenerator } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * protected Set format * @@ -267,7 +285,7 @@ abstract class CommonStickerGenerator * @param string $format Format * @return void */ - function _Set_Format(&$pdf, $format) + protected function _Set_Format(&$pdf, $format) { // phpcs:enable $this->_Metric = $format['metric']; diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 2e7ef692324..f2d9f10ae06 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -32,11 +32,11 @@ */ class Conf { - /** \public */ - //! To store properties found in conf file + /** \public */ + //! To store properties found in conf file public $file; - /** + /** * @var DoliDB Database handler. */ public $db; @@ -55,19 +55,36 @@ class Conf public $css; // Contains full path of css page ("/theme/eldy/style.css.php", ...) //! Used to store current menu handler public $standard_menu; + // List of activated modules + public $modules = array(); + 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(), + ); - 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()); + public $logbuffer = array(); - public $logbuffer = array(); + /** + * @var LogHandlerInterface[] + */ + public $loghandlers = array(); - /** - * @var LogHandlerInterface[] - */ - public $loghandlers = array(); - - //! To store properties of multi-company - public $multicompany; + //! To store properties of multi-company + public $multicompany; //! Used to store running instance for multi-company (default 1) public $entity = 1; //! Used to store list of entities to use for each element @@ -83,7 +100,7 @@ class Conf /** * Constructor */ - function __construct() + public function __construct() { // Properly declare multi-modules objects. $this->file = new stdClass(); @@ -130,7 +147,7 @@ class Conf * @param DoliDB $db Database handler * @return int < 0 if KO, >= 0 if OK */ - function setValues($db) + public function setValues($db) { global $conf; diff --git a/htdocs/core/class/coreobject.class.php b/htdocs/core/class/coreobject.class.php index a3a8a0dd5ff..cb31a287656 100644 --- a/htdocs/core/class/coreobject.class.php +++ b/htdocs/core/class/coreobject.class.php @@ -27,55 +27,55 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; class CoreObject extends CommonObject { - public $withChild = true; - - /** - * @var Array $_fields Fields to synchronize with Database - */ - protected $fields=array(); + public $withChild = true; /** - * Constructor - * - * @param DoliDB $db Database handler - */ - function __construct(DoliDB &$db) + * @var Array $_fields Fields to synchronize with Database + */ + protected $fields=array(); + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct(DoliDB &$db) { $this->db = $db; - } + } /** * Function to init fields * * @return bool */ - protected function init() + protected function init() { - $this->id = 0; - $this->datec = 0; - $this->tms = 0; + $this->id = 0; + $this->datec = 0; + $this->tms = 0; - if (!empty($this->fields)) - { - foreach ($this->fields as $field=>$info) - { - if ($this->isDate($info)) $this->{$field} = time(); - elseif ($this->isArray($info)) $this->{$field} = array(); - elseif ($this->isInt($info)) $this->{$field} = (int) 0; - elseif ($this->isFloat($info)) $this->{$field} = (double) 0; - else $this->{$field} = ''; - } + if (!empty($this->fields)) + { + foreach ($this->fields as $field=>$info) + { + if ($this->isDate($info)) $this->{$field} = time(); + elseif ($this->isArray($info)) $this->{$field} = array(); + elseif ($this->isInt($info)) $this->{$field} = (int) 0; + elseif ($this->isFloat($info)) $this->{$field} = (double) 0; + else $this->{$field} = ''; + } $this->to_delete=false; $this->is_clone=false; - return true; - } - else + return true; + } + else { - return false; - } - } + return false; + } + } /** * Test type of field @@ -86,15 +86,15 @@ class CoreObject extends CommonObject */ private function checkFieldType($field, $type) { - if (isset($this->fields[$field]) && method_exists($this, 'is_'.$type)) - { - return $this->{'is_'.$type}($this->fields[$field]); - } - else + if (isset($this->fields[$field]) && method_exists($this, 'is_'.$type)) + { + return $this->{'is_'.$type}($this->fields[$field]); + } + else { return false; } - } + } /** * Get object and children from database @@ -103,15 +103,15 @@ class CoreObject extends CommonObject * @param bool $loadChild used to load children from database * @return int >0 if OK, <0 if KO, 0 if not found */ - public function fetch($id, $loadChild = true) + public function fetch($id, $loadChild = true) { - $res = $this->fetchCommon($id); - if($res>0) { - if ($loadChild) $this->fetchChild(); - } + $res = $this->fetchCommon($id); + if($res>0) { + if ($loadChild) $this->fetchChild(); + } - return $res; - } + return $res; + } /** @@ -125,25 +125,25 @@ class CoreObject extends CommonObject */ public function addChild($tabName, $id = 0, $key = 'id', $try_to_load = false) { - if(!empty($id)) - { - foreach($this->{$tabName} as $k=>&$object) - { - if($object->{$key} === $id) return $k; - } - } + if(!empty($id)) + { + foreach($this->{$tabName} as $k=>&$object) + { + if($object->{$key} === $id) return $k; + } + } - $k = count($this->{$tabName}); + $k = count($this->{$tabName}); - $className = ucfirst($tabName); - $this->{$tabName}[$k] = new $className($this->db); - if($id>0 && $key==='id' && $try_to_load) - { - $this->{$tabName}[$k]->fetch($id); - } + $className = ucfirst($tabName); + $this->{$tabName}[$k] = new $className($this->db); + if($id>0 && $key==='id' && $try_to_load) + { + $this->{$tabName}[$k]->fetch($id); + } - return $k; - } + return $k; + } /** @@ -156,16 +156,16 @@ class CoreObject extends CommonObject */ public function removeChild($tabName, $id, $key = 'id') { - foreach ($this->{$tabName} as &$object) - { - if ($object->{$key} == $id) - { - $object->to_delete = true; - return true; - } - } - return false; - } + foreach ($this->{$tabName} as &$object) + { + if ($object->{$key} == $id) + { + $object->to_delete = true; + return true; + } + } + return false; + } /** @@ -175,10 +175,10 @@ class CoreObject extends CommonObject */ public function fetchChild() { - if($this->withChild && !empty($this->childtables) && !empty($this->fk_element)) - { - foreach($this->childtables as &$childTable) - { + if($this->withChild && !empty($this->childtables) && !empty($this->fk_element)) + { + foreach($this->childtables as &$childTable) + { $className = ucfirst($childTable); $this->{$className}=array(); @@ -200,9 +200,9 @@ class CoreObject extends CommonObject { $this->errors[] = $this->db->lasterror(); } - } - } - } + } + } + } /** * Function to update children data @@ -210,26 +210,26 @@ class CoreObject extends CommonObject * @param User $user user object * @return void */ - public function saveChild(User &$user) + public function saveChild(User &$user) { - if($this->withChild && !empty($this->childtables) && !empty($this->fk_element)) - { - foreach($this->childtables as &$childTable) - { - $className = ucfirst($childTable); - if(!empty($this->{$className})) - { - foreach($this->{$className} as $i => &$object) - { - $object->{$this->fk_element} = $this->id; + if($this->withChild && !empty($this->childtables) && !empty($this->fk_element)) + { + foreach($this->childtables as &$childTable) + { + $className = ucfirst($childTable); + if(!empty($this->{$className})) + { + foreach($this->{$className} as $i => &$object) + { + $object->{$this->fk_element} = $this->id; - $object->update($user); - if($this->unsetChildDeleted && isset($object->to_delete) && $object->to_delete==true) unset($this->{$className}[$i]); - } - } - } - } - } + $object->update($user); + if($this->unsetChildDeleted && isset($object->to_delete) && $object->to_delete==true) unset($this->{$className}[$i]); + } + } + } + } + } /** @@ -240,7 +240,7 @@ class CoreObject extends CommonObject */ public function update(User &$user) { - if (empty($this->id)) return $this->create($user); // To test, with that, no need to test on high level object, the core decide it, update just needed + if (empty($this->id)) return $this->create($user); // To test, with that, no need to test on high level object, the core decide it, update just needed elseif (isset($this->to_delete) && $this->to_delete==true) return $this->delete($user); $error = 0; @@ -270,7 +270,7 @@ class CoreObject extends CommonObject $this->db->rollback(); return -1; } - } + } /** * Function to create object in database @@ -280,26 +280,26 @@ class CoreObject extends CommonObject */ public function create(User &$user) { - if($this->id > 0) return $this->update($user); + if($this->id > 0) return $this->update($user); $error = 0; $this->db->begin(); $res = $this->createCommon($user); - if($res) - { - $this->id = $this->db->last_insert_id($this->table_element); + if($res) + { + $this->id = $this->db->last_insert_id($this->table_element); - $result = $this->call_trigger(strtoupper($this->element). '_CREATE', $user); + $result = $this->call_trigger(strtoupper($this->element). '_CREATE', $user); if ($result < 0) $error++; else $this->saveChild($user); - } - else + } + else { $error++; $this->error = $this->db->lasterror(); $this->errors[] = $this->error; - } + } if (empty($error)) { @@ -311,7 +311,7 @@ class CoreObject extends CommonObject $this->db->rollback(); return -1; } - } + } /** * Function to delete object in database @@ -319,9 +319,9 @@ class CoreObject extends CommonObject * @param User $user user object * @return < 0 if ko, > 0 if ok */ - public function delete(User &$user) + public function delete(User &$user) { - if ($this->id <= 0) return 0; + if ($this->id <= 0) return 0; $error = 0; $this->db->begin(); @@ -360,7 +360,7 @@ class CoreObject extends CommonObject $this->db->rollback(); return -1; } - } + } /** @@ -372,12 +372,12 @@ class CoreObject extends CommonObject */ public function getDate($field, $format = '') { - if(empty($this->{$field})) return ''; - else + if(empty($this->{$field})) return ''; + else { - return dol_print_date($this->{$field}, $format); - } - } + return dol_print_date($this->{$field}, $format); + } + } /** * Function to set date in field @@ -388,18 +388,18 @@ class CoreObject extends CommonObject */ public function setDate($field, $date) { - if (empty($date)) - { - $this->{$field} = 0; - } - else + if (empty($date)) + { + $this->{$field} = 0; + } + else { - require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; - $this->{$field} = dol_stringtotime($date); - } + require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + $this->{$field} = dol_stringtotime($date); + } - return $this->{$field}; - } + return $this->{$field}; + } /** @@ -410,29 +410,29 @@ class CoreObject extends CommonObject */ public function setValues(&$Tab) { - foreach ($Tab as $key => $value) - { - if($this->checkFieldType($key, 'date')) - { - $this->setDate($key, $value); - } - elseif( $this->checkFieldType($key, 'array')) - { - $this->{$key} = $value; - } - elseif( $this->checkFieldType($key, 'float') ) - { - $this->{$key} = (double) price2num($value); - } - elseif( $this->checkFieldType($key, 'int') ) { - $this->{$key} = (int) price2num($value); - } - else + foreach ($Tab as $key => $value) + { + if($this->checkFieldType($key, 'date')) { - $this->{$key} = $value; - } - } + $this->setDate($key, $value); + } + elseif( $this->checkFieldType($key, 'array')) + { + $this->{$key} = $value; + } + elseif( $this->checkFieldType($key, 'float') ) + { + $this->{$key} = (double) price2num($value); + } + elseif( $this->checkFieldType($key, 'int') ) { + $this->{$key} = (int) price2num($value); + } + else + { + $this->{$key} = $value; + } + } - return 1; - } + return 1; + } } diff --git a/htdocs/core/class/cstate.class.php b/htdocs/core/class/cstate.class.php index 6ad6523f199..97f5b9b016f 100644 --- a/htdocs/core/class/cstate.class.php +++ b/htdocs/core/class/cstate.class.php @@ -21,14 +21,8 @@ * \brief This file is a CRUD class file (Create/Read/Update/Delete) for c_departements dictionary */ -// Put here all includes required by your class file -//require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; -//require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; -//require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; - - /** - * Class to manage dictionary States (used by imports) + * Class to manage dictionary States (used by imports) */ class Cstate // extends CommonObject { @@ -79,7 +73,7 @@ class Cstate // extends CommonObject * * @param DoliDb $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db = $db; } @@ -92,7 +86,7 @@ class Cstate // 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; @@ -124,22 +118,20 @@ class Cstate // extends CommonObject $resql=$this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } - if (! $error) - { + if (! $error) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."c_departements"); - if (! $notrigger) - { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action call a trigger. + //if (! $notrigger) { + // Uncomment this and change MYOBJECT to your own tag if you + // want this action call a trigger. - //// Call triggers - //include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - //$interface=new Interfaces($this->db); - //$result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf); - //if ($result < 0) { $error++; $this->errors=$interface->errors; } - //// End call triggers - } + //// Call triggers + //include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; + //$interface=new Interfaces($this->db); + //$result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf); + //if ($result < 0) { $error++; $this->errors=$interface->errors; } + //// End call triggers + //} } // Commit or rollback @@ -168,7 +160,7 @@ class Cstate // extends CommonObject * @param string $code Code * @return int <0 if KO, >0 if OK */ - function fetch($id, $code = '') + public function fetch($id, $code = '') { global $langs; $sql = "SELECT"; @@ -212,7 +204,7 @@ class Cstate // 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; @@ -239,10 +231,10 @@ class Cstate // extends CommonObject $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } - if (! $error) - { - if (! $notrigger) - { + //if (! $error) + //{ + // if (! $notrigger) + // { // Uncomment this and change MYOBJECT to your own tag if you // want this action call a trigger. @@ -252,11 +244,11 @@ class Cstate // extends CommonObject //$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf); //if ($result < 0) { $error++; $this->errors=$interface->errors; } //// End call triggers - } - } + // } + //} // Commit or rollback - if ($error) + if ($error) { foreach($this->errors as $errmsg) { @@ -281,7 +273,7 @@ class Cstate // 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; @@ -295,10 +287,10 @@ class Cstate // extends CommonObject $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } - if (! $error) - { - if (! $notrigger) - { + //if (! $error) + //{ + // if (! $notrigger) + // { // Uncomment this and change MYOBJECT to your own tag if you // want this action call a trigger. @@ -308,8 +300,8 @@ class Cstate // extends CommonObject //$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf); //if ($result < 0) { $error++; $this->errors=$interface->errors; } //// End call triggers - } - } + // } + //} // Commit or rollback if ($error) diff --git a/htdocs/core/class/ctypent.class.php b/htdocs/core/class/ctypent.class.php index ffaccbfe964..6c86c987d17 100644 --- a/htdocs/core/class/ctypent.class.php +++ b/htdocs/core/class/ctypent.class.php @@ -63,7 +63,7 @@ class Ctypent // extends CommonObject * * @param DoliDb $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db = $db; } @@ -76,7 +76,7 @@ class Ctypent // 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; @@ -166,7 +166,7 @@ class Ctypent // extends CommonObject * @param string $label Label * @return int <0 if KO, >0 if OK */ - function fetch($id, $code = '', $label = '') + public function fetch($id, $code = '', $label = '') { global $langs; $sql = "SELECT"; @@ -214,7 +214,7 @@ class Ctypent // 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 Ctypent // 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; @@ -299,10 +299,10 @@ class Ctypent // extends CommonObject $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } - if (! $error) - { - if (! $notrigger) - { + //if (! $error) + //{ + // if (! $notrigger) + // { // Uncomment this and change MYOBJECT to your own tag if you // want this action call a trigger. @@ -312,12 +312,12 @@ class Ctypent // extends CommonObject //$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf); //if ($result < 0) { $error++; $this->errors=$interface->errors; } //// End call triggers - } - } + // } + //} // Commit or rollback - if ($error) - { + if ($error) + { foreach($this->errors as $errmsg) { dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); @@ -325,11 +325,11 @@ class Ctypent // extends CommonObject } $this->db->rollback(); return -1*$error; - } - else - { - $this->db->commit(); - return 1; - } - } + } + else + { + $this->db->commit(); + return 1; + } + } } diff --git a/htdocs/core/class/cunits.class.php b/htdocs/core/class/cunits.class.php index 3970ff2df27..0e3987da516 100644 --- a/htdocs/core/class/cunits.class.php +++ b/htdocs/core/class/cunits.class.php @@ -66,7 +66,7 @@ class CUnits // extends CommonObject * * @param DoliDb $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db = $db; } @@ -79,7 +79,7 @@ class CUnits // 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; @@ -170,7 +170,7 @@ class CUnits // extends CommonObject * @param string $unit_type unit type * @return int <0 if KO, >0 if OK */ - function fetch($id, $code = '', $short_label = '', $unit_type = '') + public function fetch($id, $code = '', $short_label = '', $unit_type = '') { global $langs; @@ -310,7 +310,7 @@ class CUnits // 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; @@ -383,7 +383,7 @@ class CUnits // 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/discount.class.php b/htdocs/core/class/discount.class.php index 9615c040eb0..0a681b95b18 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -60,7 +60,8 @@ class DiscountAbsolute public $multicurrency_amount_ht; public $multicurrency_amount_tva; public $multicurrency_amount_ttc; - public $tva_tx; // Vat rate + // Vat rate + public $tva_tx; /** * @var int User ID Id utilisateur qui accorde la remise @@ -98,7 +99,7 @@ class DiscountAbsolute * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { $this->db = $db; } @@ -112,7 +113,7 @@ class DiscountAbsolute * @param int $fk_invoice_supplier_source fk_invoice_supplier_source * @return int <0 if KO, =0 if not found, >0 if OK */ - function fetch($rowid, $fk_facture_source = 0, $fk_invoice_supplier_source = 0) + public function fetch($rowid, $fk_facture_source = 0, $fk_invoice_supplier_source = 0) { global $conf; @@ -194,7 +195,7 @@ class DiscountAbsolute * @param User $user User that create * @return int <0 if KO, >0 if OK */ - function create($user) + public function create($user) { global $conf, $langs; @@ -253,10 +254,10 @@ class DiscountAbsolute /** * Delete object in database. If fk_facture_source is defined, we delete all familiy with same fk_facture_source. If not, only with id is removed * - * @param User $user Object of user asking to delete - * @return int <0 if KO, >0 if OK + * @param User $user Object of user asking to delete + * @return int <0 if KO, >0 if OK */ - function delete($user) + public function delete($user) { global $conf, $langs; @@ -291,8 +292,8 @@ class DiscountAbsolute // Check if we can remove the discount if ($this->fk_invoice_supplier_source) { - $sql="SELECT COUNT(rowid) as nb"; - $sql.=" FROM ".MAIN_DB_PREFIX."societe_remise_except"; + $sql="SELECT COUNT(rowid) as nb"; + $sql.=" FROM ".MAIN_DB_PREFIX."societe_remise_except"; $sql.=" WHERE (fk_invoice_supplier_line IS NOT NULL"; // Not used as absolute simple discount $sql.=" OR fk_invoice_supplier IS NOT NULL)"; // Not used as credit note and not used as deposit $sql.=" AND fk_invoice_supplier_source = ".$this->fk_invoice_supplier_source; @@ -389,7 +390,7 @@ class DiscountAbsolute - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Link the discount to a particular invoice line or a particular invoice. * When discount is a global discount used as an invoice line, we link using rowidline. @@ -399,7 +400,7 @@ class DiscountAbsolute * @param int $rowidinvoice Invoice id (To use discount as a credit note to reduc payment of invoice) * @return int <0 if KO, >0 if OK */ - function link_to_invoice($rowidline, $rowidinvoice) + public function link_to_invoice($rowidline, $rowidinvoice) { // phpcs:enable // Check parameters @@ -445,20 +446,20 @@ class DiscountAbsolute } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Link the discount to a particular invoice line or a particular invoice. * Do not call this if discount is linked to a reconcialiated invoice * * @return int <0 if KO, >0 if OK */ - function unlink_invoice() + public function unlink_invoice() { // phpcs:enable $sql ="UPDATE ".MAIN_DB_PREFIX."societe_remise_except"; - if(! empty($this->discount_type)) { - $sql.=" SET fk_invoice_supplier_line = NULL, fk_invoice_supplier = NULL"; - } else { + if (! empty($this->discount_type)) { + $sql.=" SET fk_invoice_supplier_line = NULL, fk_invoice_supplier = NULL"; + } else { $sql.=" SET fk_facture_line = NULL, fk_facture = NULL"; } $sql.=" WHERE rowid = ".$this->id; @@ -487,9 +488,9 @@ class DiscountAbsolute * @param int $discount_type 0 => customer discount, 1 => supplier discount * @return int <0 if KO, amount otherwise */ - function getAvailableDiscounts($company = '', $user = '', $filter = '', $maxvalue = 0, $discount_type = 0) + public function getAvailableDiscounts($company = '', $user = '', $filter = '', $maxvalue = 0, $discount_type = 0) { - global $conf; + global $conf; $sql = "SELECT SUM(rc.amount_ttc) as amount"; //$sql = "SELECT rc.amount_ttc as amount"; @@ -527,10 +528,10 @@ class DiscountAbsolute * Should always be empty, except if option FACTURE_DEPOSITS_ARE_JUST_PAYMENTS is on (not recommended). * * @param CommonInvoice $invoice Object invoice (customer of supplier) - * @param int $multicurrency Return multicurrency_amount instead of amount + * @param int $multicurrency Return multicurrency_amount instead of amount * @return int <0 if KO, Sum of credit notes and deposits amount otherwise */ - function getSumDepositsUsed($invoice, $multicurrency = 0) + public function getSumDepositsUsed($invoice, $multicurrency = 0) { dol_syslog(get_class($this)."::getSumDepositsUsed", LOG_DEBUG); @@ -572,11 +573,11 @@ class DiscountAbsolute /** * Return amount (with tax) of all credit notes invoices + excess received used by invoice as a payment * - * @param CommonInvoice $invoice Object invoice - * @param int $multicurrency Return multicurrency_amount instead of amount - * @return int <0 if KO, Sum of credit notes and excess received amount otherwise + * @param CommonInvoice $invoice Object invoice + * @param int $multicurrency Return multicurrency_amount instead of amount + * @return int <0 if KO, Sum of credit notes and excess received amount otherwise */ - function getSumCreditNotesUsed($invoice, $multicurrency = 0) + public function getSumCreditNotesUsed($invoice, $multicurrency = 0) { dol_syslog(get_class($this)."::getSumCreditNotesUsed", LOG_DEBUG); @@ -616,13 +617,13 @@ class DiscountAbsolute } /** - * Return clickable ref of object (with picto or not) + * Return clickable ref of object (with picto or not) * - * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Picto only - * @param string $option Where to link to ('invoice' or 'discount') - * @return string String with URL + * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Picto only + * @param string $option Where to link to ('invoice' or 'discount') + * @return string String with URL */ - function getNomUrl($withpicto, $option = 'invoice') + public function getNomUrl($withpicto, $option = 'invoice') { global $langs; @@ -660,7 +661,7 @@ class DiscountAbsolute * * @return void */ - function initAsSpecimen() + public function initAsSpecimen() { global $user,$langs,$conf; diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index 4cbf20a8a75..110d850bfd0 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -28,43 +28,43 @@ */ class DolEditor { - var $tool; // Store the selected tool + public $tool; // Store the selected tool - // If using fckeditor - var $editor; + // If using fckeditor + public $editor; - // If not using fckeditor - var $content; - var $htmlname; - var $toolbarname; - var $toolbarstartexpanded; - var $rows; - var $cols; - var $height; - var $width; - var $readonly; + // If not using fckeditor + public $content; + public $htmlname; + public $toolbarname; + public $toolbarstartexpanded; + public $rows; + public $cols; + public $height; + public $width; + public $readonly; /** - * Create an object to build an HTML area to edit a large string content + * Create an object to build an HTML area to edit a large string content * - * @param string $htmlname HTML name of WYSIWIG field - * @param string $content Content of WYSIWIG field - * @param int $width Width in pixel of edit area (auto by default) - * @param int $height Height in pixel of edit area (200px by default) - * @param string $toolbarname Name of bar set to use ('Full', 'dolibarr_notes[_encoded]', 'dolibarr_details[_encoded]'=the less featured, 'dolibarr_mailings[_encoded]', 'dolibarr_readonly'). - * @param string $toolbarlocation Where bar is stored : - * 'In' each window has its own toolbar - * 'Out:name' share toolbar into the div called 'name' - * @param boolean $toolbarstartexpanded Bar is visible or not at start - * @param int $uselocalbrowser Enabled to add links to local object with local browser. If false, only external images can be added in content. - * @param boolean|string $okforextendededitor True=Allow usage of extended editor tool if qualified (like ckeditor). If 'textarea', force use of simple textarea. If 'ace', force use of Ace. - * Warning: If you use 'ace', don't forget to also include ace.js in page header. Also, the button "save" must have class="buttonforacesave". - * @param int $rows Size of rows for textarea tool - * @param string $cols Size of cols for textarea tool (textarea number of cols '70' or percent 'x%') - * @param int $readonly 0=Read/Edit, 1=Read only + * @param string $htmlname HTML name of WYSIWIG field + * @param string $content Content of WYSIWIG field + * @param int $width Width in pixel of edit area (auto by default) + * @param int $height Height in pixel of edit area (200px by default) + * @param string $toolbarname Name of bar set to use ('Full', 'dolibarr_notes[_encoded]', 'dolibarr_details[_encoded]'=the less featured, 'dolibarr_mailings[_encoded]', 'dolibarr_readonly'). + * @param string $toolbarlocation Where bar is stored : + * 'In' each window has its own toolbar + * 'Out:name' share toolbar into the div called 'name' + * @param boolean $toolbarstartexpanded Bar is visible or not at start + * @param int $uselocalbrowser Enabled to add links to local object with local browser. If false, only external images can be added in content. + * @param boolean|string $okforextendededitor True=Allow usage of extended editor tool if qualified (like ckeditor). If 'textarea', force use of simple textarea. If 'ace', force use of Ace. + * Warning: If you use 'ace', don't forget to also include ace.js in page header. Also, the button "save" must have class="buttonforacesave". + * @param int $rows Size of rows for textarea tool + * @param string $cols Size of cols for textarea tool (textarea number of cols '70' or percent 'x%') + * @param int $readonly 0=Read/Edit, 1=Read only */ - function __construct($htmlname, $content, $width = '', $height = 200, $toolbarname = 'Basic', $toolbarlocation = 'In', $toolbarstartexpanded = false, $uselocalbrowser = true, $okforextendededitor = true, $rows = 0, $cols = 0, $readonly = 0) + public function __construct($htmlname, $content, $width = '', $height = 200, $toolbarname = 'Basic', $toolbarlocation = 'In', $toolbarstartexpanded = false, $uselocalbrowser = true, $okforextendededitor = true, $rows = 0, $cols = 0, $readonly = 0) { global $conf,$langs; @@ -137,7 +137,7 @@ class DolEditor } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Output edit area inside the HTML stream. * Output depends on this->tool (fckeditor, ckeditor, textarea, ...) @@ -149,7 +149,7 @@ class DolEditor * @param string $option For ACE editor, set the source language ('html', 'php', 'javascript', ...) * @return void|string */ - function Create($noprint = 0, $morejs = '', $disallowAnyContent = true, $titlecontent = '', $option = '') + public function Create($noprint = 0, $morejs = '', $disallowAnyContent = true, $titlecontent = '', $option = '') { // phpcs:enable global $conf,$langs; diff --git a/htdocs/core/class/dolexception.class.php b/htdocs/core/class/dolexception.class.php index b61bc6e388c..be04c9fd741 100644 --- a/htdocs/core/class/dolexception.class.php +++ b/htdocs/core/class/dolexception.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2010 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,21 +16,21 @@ */ /** - * \file htdocs/core/class/dolexception.class.php - * \ingroup core - * \brief File of class for exceptions + * \file htdocs/core/class/dolexception.class.php + * \ingroup core + * \brief File of class for exceptions */ /** - * Class to manage exceptions + * Class to manage exceptions */ class DolException extends Exception { /** * Constructor */ - function __construct() + public function __construct() { } } diff --git a/htdocs/core/class/dolgeoip.class.php b/htdocs/core/class/dolgeoip.class.php index 22ec32045a0..79515725aa1 100644 --- a/htdocs/core/class/dolgeoip.class.php +++ b/htdocs/core/class/dolgeoip.class.php @@ -33,7 +33,7 @@ */ class DolGeoIP { - var $gi; + public $gi; /** * Constructor @@ -41,7 +41,7 @@ class DolGeoIP * @param string $type 'country' or 'city' * @param string $datfile Data file */ - function __construct($type, $datfile) + public function __construct($type, $datfile) { if ($type == 'country') { @@ -88,7 +88,7 @@ class DolGeoIP * @param string $ip IP to scan * @return string Country code (two letters) */ - function getCountryCodeFromIP($ip) + public function getCountryCodeFromIP($ip) { if (empty($this->gi)) { @@ -112,7 +112,7 @@ class DolGeoIP * @param string $name FQN of host (example: myserver.xyz.com) * @return string Country code (two letters) */ - function getCountryCodeFromName($name) + public function getCountryCodeFromName($name) { if (empty($this->gi)) { @@ -121,27 +121,27 @@ class DolGeoIP return geoip_country_code_by_name($this->gi, $name); } - /** - * Return verion of data file - * - * @return string Version of datafile - */ - function getVersion() - { - if ($this->gi == 'NOGI') return geoip_database_info(); - return 'Not available (not using PHP internal geo functions)'; - } + /** + * Return verion of data file + * + * @return string Version of datafile + */ + public function getVersion() + { + if ($this->gi == 'NOGI') return geoip_database_info(); + return 'Not available (not using PHP internal geo functions)'; + } - /** - * Close geoip object - * - * @return void - */ - function close() - { - if (function_exists('geoip_close')) // With some geoip with PEAR, geoip_close function may not exists - { - geoip_close($this->gi); - } - } + /** + * Close geoip object + * + * @return void + */ + public function close() + { + if (function_exists('geoip_close')) { + // With some geoip with PEAR, geoip_close function may not exists + geoip_close($this->gi); + } + } } diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 7fd9258ddd7..386b378abdd 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -88,7 +88,7 @@ class DolGraph * * @param string $library 'jflot' (default) or 'artichow' (no more supported) */ - function __construct($library = 'jflot') + public function __construct($library = 'jflot') { global $conf; global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet; @@ -128,130 +128,130 @@ class DolGraph } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set Y precision * * @param float $which_prec Precision * @return boolean */ - function SetPrecisionY($which_prec) + public function SetPrecisionY($which_prec) { // phpcs:enable $this->PrecisionY = $which_prec; return true; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Utiliser SetNumTicks ou SetHorizTickIncrement mais pas les 2 * * @param float $xi Xi * @return boolean True */ - function SetHorizTickIncrement($xi) + public function SetHorizTickIncrement($xi) { // phpcs:enable $this->horizTickIncrement = $xi; return true; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Utiliser SetNumTicks ou SetHorizTickIncrement mais pas les 2 * * @param float $xt Xt * @return boolean True */ - function SetNumXTicks($xt) + public function SetNumXTicks($xt) { // phpcs:enable $this->SetNumXTicks = $xt; return true; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set label interval to reduce number of labels * * @param float $x Label interval * @return boolean True */ - function SetLabelInterval($x) + public function SetLabelInterval($x) { // phpcs:enable $this->labelInterval = $x; return true; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Hide X grid * * @param boolean $bool XGrid or not * @return boolean true */ - function SetHideXGrid($bool) + public function SetHideXGrid($bool) { // phpcs:enable $this->hideXGrid = $bool; return true; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Hide Y grid * * @param boolean $bool YGrid or not * @return boolean true */ - function SetHideYGrid($bool) + public function SetHideYGrid($bool) { // phpcs:enable $this->hideYGrid = $bool; return true; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set y label * * @param string $label Y label * @return boolean|null True */ - function SetYLabel($label) + public function SetYLabel($label) { // phpcs:enable $this->YLabel = $label; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set width * * @param int $w Width * @return boolean|null True */ - function SetWidth($w) + public function SetWidth($w) { // phpcs:enable $this->width = $w; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set title * * @param string $title Title * @return void */ - function SetTitle($title) + public function SetTitle($title) { // phpcs:enable $this->title = $title; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set data * @@ -259,172 +259,172 @@ class DolGraph * @return void * @see draw_jflot for syntax of data array */ - function SetData($data) + public function SetData($data) { // phpcs:enable $this->data = $data; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set data * * @param array $datacolor Data color array(array(R,G,B),array(R,G,B)...) * @return void */ - function SetDataColor($datacolor) + public function SetDataColor($datacolor) { // phpcs:enable $this->datacolor = $datacolor; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set type * * @param array $type Array with type for each serie. Example: array('pie'), array('lines',...,'bars') * @return void */ - function SetType($type) + public function SetType($type) { // phpcs:enable $this->type = $type; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set legend * * @param array $legend Legend. Example: array('seriename1','seriname2',...) * @return void */ - function SetLegend($legend) + public function SetLegend($legend) { // phpcs:enable $this->Legend = $legend; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set min width * * @param int $legendwidthmin Min width * @return void */ - function SetLegendWidthMin($legendwidthmin) + public function SetLegendWidthMin($legendwidthmin) { // phpcs:enable $this->LegendWidthMin = $legendwidthmin; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set max value * * @param int $max Max value * @return void */ - function SetMaxValue($max) + public function SetMaxValue($max) { // phpcs:enable $this->MaxValue = $max; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Get max value * * @return int Max value */ - function GetMaxValue() + public function GetMaxValue() { // phpcs:enable return $this->MaxValue; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set min value * * @param int $min Min value * @return void */ - function SetMinValue($min) + public function SetMinValue($min) { // phpcs:enable $this->MinValue = $min; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Get min value * * @return int Max value */ - function GetMinValue() + public function GetMinValue() { // phpcs:enable return $this->MinValue; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set height * * @param int $h Height * @return void */ - function SetHeight($h) + public function SetHeight($h) { // phpcs:enable $this->height = $h; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set shading * * @param string $s Shading * @return void */ - function SetShading($s) + public function SetShading($s) { // phpcs:enable $this->SetShading = $s; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set shading * * @param string $s Shading * @return void */ - function SetCssPrefix($s) + public function SetCssPrefix($s) { // phpcs:enable $this->cssprefix = $s; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Reset bg color * * @return void */ - function ResetBgColor() + public function ResetBgColor() { // phpcs:enable unset($this->bgcolor); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Reset bgcolorgrid * * @return void */ - function ResetBgColorGrid() + public function ResetBgColorGrid() { // phpcs:enable unset($this->bgcolorgrid); @@ -435,7 +435,7 @@ class DolGraph * * @return string Error */ - function isGraphKo() + public function isGraphKo() { return $this->error; } @@ -446,7 +446,7 @@ class DolGraph * @param int $showlegend 1=Show legend (default), 0=Hide legend * @return void */ - function setShowLegend($showlegend) + public function setShowLegend($showlegend) { $this->showlegend=$showlegend; } @@ -457,7 +457,7 @@ class DolGraph * @param int $showpointvalue 1=Show value for each point, as tooltip or inline (default), 0=Hide value * @return void */ - function setShowPointValue($showpointvalue) + public function setShowPointValue($showpointvalue) { $this->showpointvalue=$showpointvalue; } @@ -468,21 +468,21 @@ class DolGraph * @param int $showpercent 1=Show percent for each point, as tooltip or inline, 0=Hide percent (default) * @return void */ - function setShowPercent($showpercent) + public function setShowPercent($showpercent) { $this->showpercent=$showpercent; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Define background color of complete image * * @param array $bg_color array(R,G,B) ou 'onglet' ou 'default' * @return void */ - function SetBgColor($bg_color = array(255,255,255)) + public function SetBgColor($bg_color = array(255,255,255)) { // phpcs:enable global $theme_bgcolor,$theme_bgcoloronglet; @@ -505,14 +505,14 @@ class DolGraph } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Define background color of grid * * @param array $bg_colorgrid array(R,G,B) ou 'onglet' ou 'default' * @return void */ - function SetBgColorGrid($bg_colorgrid = array(255,255,255)) + public function SetBgColorGrid($bg_colorgrid = array(255,255,255)) { // phpcs:enable global $theme_bgcolor,$theme_bgcoloronglet; @@ -535,25 +535,25 @@ class DolGraph } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Reset data color * * @return void */ - function ResetDataColor() - { + public function ResetDataColor() + { // phpcs:enable - unset($this->datacolor); - } + unset($this->datacolor); + } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - /** + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** * Get max value * * @return int Max value */ - function GetMaxValueInData() + public function GetMaxValueInData() { // phpcs:enable $k = 0; @@ -574,13 +574,13 @@ class DolGraph return $vals[0]; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return min value of all data * * @return int Min value of all data */ - function GetMinValueInData() + public function GetMinValueInData() { // phpcs:enable $k = 0; @@ -601,13 +601,13 @@ class DolGraph return $vals[0]; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return max value of all data * * @return int Max value of all data */ - function GetCeilMaxValue() + public function GetCeilMaxValue() { // phpcs:enable $max = $this->GetMaxValueInData(); @@ -626,13 +626,13 @@ class DolGraph return $res; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return min value of all data * * @return double Max value of all data */ - function GetFloorMinValue() + public function GetFloorMinValue() { // phpcs:enable $min = $this->GetMinValueInData(); @@ -658,7 +658,7 @@ class DolGraph * @param string $fileurl Url path to show image if saved onto disk * @return integer|null */ - function draw($file, $fileurl = '') + public function draw($file, $fileurl = '') { if (empty($file)) { @@ -1127,7 +1127,7 @@ class DolGraph * @param int $shownographyet Show graph to say there is not enough data * @return string HTML string to show graph */ - function show($shownographyet = 0) + public function show($shownographyet = 0) { global $langs; @@ -1149,7 +1149,7 @@ class DolGraph * @param string $defaultsize Value we want as default size * @return int Value of width or height to use by default */ - static function getDefaultGraphSizeForStats($direction, $defaultsize = '') + public static function getDefaultGraphSizeForStats($direction, $defaultsize = '') { global $conf; diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php index 19de8abb3f6..0a98925e46a 100644 --- a/htdocs/core/class/dolreceiptprinter.class.php +++ b/htdocs/core/class/dolreceiptprinter.class.php @@ -111,9 +111,9 @@ class dolReceiptPrinter extends Escpos */ public $db; - var $tags; - var $printer; - var $template; + public $tags; + public $printer; + public $template; /** * @var string Error code (or message) @@ -132,7 +132,7 @@ class dolReceiptPrinter extends Escpos * * @param DoliDB $db database */ - function __construct($db) + public function __construct($db) { $this->db=$db; $this->tags = array( @@ -211,7 +211,7 @@ class dolReceiptPrinter extends Escpos * * @return int 0 if OK; >0 if KO */ - function listPrinters() + public function listPrinters() { global $conf; $error = 0; @@ -279,7 +279,7 @@ class dolReceiptPrinter extends Escpos * * @return int 0 if OK; >0 if KO */ - function listPrintersTemplates() + public function listPrintersTemplates() { global $conf; $error = 0; @@ -311,7 +311,7 @@ class dolReceiptPrinter extends Escpos * @param string $htmlname select html name * @return int 0 if OK; >0 if KO */ - function selectTypePrinter($selected = '', $htmlname = 'printertypeid') + public function selectTypePrinter($selected = '', $htmlname = 'printertypeid') { global $langs; @@ -335,7 +335,7 @@ class dolReceiptPrinter extends Escpos * @param string $htmlname select html name * @return int 0 if OK; >0 if KO */ - function selectProfilePrinter($selected = '', $htmlname = 'printerprofileid') + public function selectProfilePrinter($selected = '', $htmlname = 'printerprofileid') { global $langs; @@ -352,7 +352,6 @@ class dolReceiptPrinter extends Escpos } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to Add a printer in db * @@ -362,9 +361,8 @@ class dolReceiptPrinter extends Escpos * @param string $parameter Printer parameter * @return int 0 if OK; >0 if KO */ - function AddPrinter($name, $type, $profile, $parameter) + public function addPrinter($name, $type, $profile, $parameter) { - // phpcs:enable global $conf; $error = 0; $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'printer_receipt'; @@ -378,7 +376,6 @@ class dolReceiptPrinter extends Escpos return $error; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to Update a printer in db * @@ -389,9 +386,8 @@ class dolReceiptPrinter extends Escpos * @param int $printerid Printer id * @return int 0 if OK; >0 if KO */ - function UpdatePrinter($name, $type, $profile, $parameter, $printerid) + public function updatePrinter($name, $type, $profile, $parameter, $printerid) { - // phpcs:enable global $conf; $error = 0; $sql = 'UPDATE '.MAIN_DB_PREFIX.'printer_receipt'; @@ -408,16 +404,14 @@ class dolReceiptPrinter extends Escpos return $error; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to Delete a printer from db * * @param int $printerid Printer id * @return int 0 if OK; >0 if KO */ - function DeletePrinter($printerid) + public function deletePrinter($printerid) { - // phpcs:enable global $conf; $error = 0; $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'printer_receipt'; @@ -430,7 +424,6 @@ class dolReceiptPrinter extends Escpos return $error; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to Update a printer template in db * @@ -439,9 +432,8 @@ class dolReceiptPrinter extends Escpos * @param int $templateid Template id * @return int 0 if OK; >0 if KO */ - function UpdateTemplate($name, $template, $templateid) + public function updateTemplate($name, $template, $templateid) { - // phpcs:enable global $conf; $error = 0; $sql = 'UPDATE '.MAIN_DB_PREFIX.'printer_receipt_template'; @@ -457,20 +449,18 @@ class dolReceiptPrinter extends Escpos } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to Send Test page to Printer * * @param int $printerid Printer id * @return int 0 if OK; >0 if KO */ - function SendTestToPrinter($printerid) + public function sendTestToPrinter($printerid) { - // phpcs:enable global $conf; $error = 0; $img = new EscposImage(DOL_DOCUMENT_ROOT .'/theme/common/dolibarr_logo_bw.png'); - $ret = $this->InitPrinter($printerid); + $ret = $this->initPrinter($printerid); if ($ret>0) { setEventMessages($this->error, $this->errors, 'errors'); } else { @@ -492,7 +482,6 @@ class dolReceiptPrinter extends Escpos return $error; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to Print Receipt Ticket * @@ -501,9 +490,8 @@ class dolReceiptPrinter extends Escpos * @param int $printerid Printer id * @return int 0 if OK; >0 if KO */ - function SendToPrinter($object, $templateid, $printerid) + public function sendToPrinter($object, $templateid, $printerid) { - // phpcs:enable global $conf; $error = 0; $ret = $this->loadTemplate($templateid); @@ -542,15 +530,12 @@ class dolReceiptPrinter extends Escpos // print ticket $level = 0; $html = '
';
-        $ret = $this->InitPrinter($printerid);
+        $ret = $this->initPrinter($printerid);
         if ($ret>0) {
             setEventMessages($this->error, $this->errors, 'errors');
-        }
-        else
-        {
+        } else {
             $nboflines = count($vals);
-            for ($line=0; $line < $nboflines; $line++)
-            {
+            for ($line=0; $line < $nboflines; $line++) {
                 switch ($vals[$line]['tag']) {
                     case 'DOL_ALIGN_CENTER':
                         $this->printer->setJustification(Escpos::JUSTIFY_CENTER);
@@ -627,10 +612,10 @@ class dolReceiptPrinter extends Escpos
     /**
      *  Function to load Template
      *
-     *  @param   int       $templateid        Template id
-     *  @return  int                        0 if OK; >0 if KO
+     *  @param   int       $templateid          Template id
+     *  @return  int                            0 if OK; >0 if KO
      */
-    function loadTemplate($templateid)
+    public function loadTemplate($templateid)
     {
         global $conf;
         $error = 0;
@@ -656,16 +641,14 @@ class dolReceiptPrinter extends Escpos
     }
 
 
-    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
     /**
      *  Function Init Printer
      *
      *  @param   int       $printerid       Printer id
      *  @return  int                        0 if OK; >0 if KO
      */
-    function InitPrinter($printerid)
+    public function initPrinter($printerid)
     {
-        // phpcs:enable
         global $conf;
         $error=0;
         $sql = 'SELECT rowid, name, fk_type, fk_profile, parameter';
diff --git a/htdocs/core/class/emailsenderprofile.class.php b/htdocs/core/class/emailsenderprofile.class.php
index 63172d17566..f9eeeabf4c6 100644
--- a/htdocs/core/class/emailsenderprofile.class.php
+++ b/htdocs/core/class/emailsenderprofile.class.php
@@ -277,7 +277,7 @@ class EmailSenderProfile extends CommonObject
 	 *	@param	int		$withpicto					Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
 	 *	@return	string								String with URL
 	 */
-	function getNomUrl($withpicto = 0)
+	public function getNomUrl($withpicto = 0)
 	{
 		global $db, $conf, $langs;
 		global $dolibarr_main_authentication, $dolibarr_main_demo;
@@ -286,16 +286,15 @@ class EmailSenderProfile extends CommonObject
 		$result = '';
 		$companylink = '';
 
-    $label=$this->label;
+        $label=$this->label;
 
-    $url='';
+        $url='';
 		//$url = dol_buildpath('/monmodule/emailsenderprofile_card.php',1).'?id='.$this->id;
 
 		$linkstart = '';
 		$linkend='';
 
-		if ($withpicto)
-		{
+		if ($withpicto) {
 			$result.=($linkstart.img_object($label, 'label', 'class="classfortooltip"').$linkend);
 			if ($withpicto != 2) $result.=' ';
 		}
@@ -309,12 +308,12 @@ class EmailSenderProfile extends CommonObject
 	 *  @param	int		$mode          0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
 	 *  @return	string 			       Label of status
 	 */
-	function getLibStatut($mode = 0)
+	public function getLibStatut($mode = 0)
 	{
 		return $this->LibStatut($this->status, $mode);
 	}
 
-    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
 	/**
 	 *  Return the status
 	 *
@@ -322,49 +321,49 @@ class EmailSenderProfile extends CommonObject
 	 *  @param  int		$mode          	0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
 	 *  @return string 			       	Label of status
 	 */
-	static function LibStatut($status, $mode = 0)
+	public static function LibStatut($status, $mode = 0)
 	{
 		global $langs;
 
 		if ($mode == 0 || $mode == 1)
 		{
 			if ($status == 1) return $langs->trans('Enabled');
-			if ($status == 0) return $langs->trans('Disabled');
+			elseif ($status == 0) return $langs->trans('Disabled');
 		}
 		elseif ($mode == 2)
 		{
 			if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled');
-			if ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled');
+			elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled');
 		}
 		elseif ($mode == 3)
 		{
 			if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4');
-			if ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5');
+			elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5');
 		}
 		elseif ($mode == 4)
 		{
 			if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled');
-			if ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled');
+			elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled');
 		}
 		elseif ($mode == 5)
 		{
 			if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4');
-			if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5');
+			elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5');
 		}
 		elseif ($mode == 6)
 		{
 			if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4');
-			if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5');
+			elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5');
 		}
 	}
 
-	/**
-	 *	Charge les informations d'ordre info dans l'objet commande
+    /**
+     *  Charge les informations d'ordre info dans l'objet commande
 	 *
-	 *	@param  int		$id       Id of order
-	 *	@return	void
+	 *  @param  int     $id       Id of order
+	 *  @return	void
 	 */
-	function info($id)
+	public function info($id)
 	{
 		$sql = 'SELECT rowid, date_creation as datec, tms as datem,';
 		$sql.= ' fk_user_creat, fk_user_modif';
diff --git a/htdocs/core/class/events.class.php b/htdocs/core/class/events.class.php
index 50b948a85be..50fc116611a 100644
--- a/htdocs/core/class/events.class.php
+++ b/htdocs/core/class/events.class.php
@@ -119,7 +119,7 @@ class Events // extends CommonObject
 	 *
 	 *  @param		DoliDB		$db      Database handler
 	 */
-	function __construct($db)
+	public function __construct($db)
 	{
 		$this->db = $db;
 	}
@@ -129,9 +129,9 @@ class Events // extends CommonObject
 	 *   Create in database
 	 *
 	 *   @param      User	$user       User that create
-	 *   @return     int     		    <0 if KO, >0 if OK
+	 *   @return     int                <0 if KO, >0 if OK
 	 */
-	function create($user)
+	public function create($user)
 	{
 		global $conf, $langs;
 
@@ -183,7 +183,7 @@ class Events // extends CommonObject
 	 * @param   int		$notrigger	    0=no, 1=yes (no update trigger)
 	 * @return  int         			<0 if KO, >0 if OK
 	 */
-	function update($user = null, $notrigger = 0)
+    public function update($user = null, $notrigger = 0)
 	{
 		global $conf, $langs;
 
@@ -220,7 +220,7 @@ class Events // extends CommonObject
 	 *  @param  User	$user       User that load
 	 *  @return int         		<0 if KO, >0 if OK
 	 */
-	function fetch($id, $user = null)
+    public function fetch($id, $user = null)
 	{
 		global $langs;
 
@@ -271,7 +271,7 @@ class Events // extends CommonObject
 	 *	@param	User	$user       User that delete
 	 *	@return	int					<0 if KO, >0 if OK
 	 */
-	function delete($user)
+    public function delete($user)
 	{
 		global $conf, $langs;
 
@@ -296,8 +296,8 @@ class Events // extends CommonObject
      *	id must be 0 if object instance is a specimen.
      *
      *  @return	void
-	 */
-	function initAsSpecimen()
+     */
+    public function initAsSpecimen()
 	{
 		$this->id=0;
 
@@ -305,5 +305,5 @@ class Events // extends CommonObject
 		$this->type='';
 		$this->dateevent=time();
 		$this->description='This is a specimen event';
-	}
+    }
 }
diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index c23f40a0283..ce8916c1871 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -182,7 +182,7 @@ class ExtraFields
 	 *
 	 *  @param		DoliDB		$db      Database handler
 	*/
-	function __construct($db)
+	public function __construct($db)
 	{
 		$this->db = $db;
 		$this->error = '';
@@ -226,7 +226,7 @@ class ExtraFields
 	 *  @param  string  		$enabled  		 	Condition to have the field enabled or not
 	 *  @return int      							<=0 if KO, >0 if OK
 	 */
-	function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique = 0, $required = 0, $default_value = '', $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $computed = '', $entity = '', $langfile = '', $enabled = '1')
+	public function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique = 0, $required = 0, $default_value = '', $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $computed = '', $entity = '', $langfile = '', $enabled = '1')
 	{
 		if (empty($attrname)) return -1;
 		if (empty($label)) return -1;
@@ -469,7 +469,7 @@ class ExtraFields
 	 *  @param  string	$elementtype    Element type ('member', 'product', 'thirdparty', 'contact', ...)
 	 *  @return int              		< 0 if KO, 0 if nothing is done, 1 if OK
 	 */
-	function delete($attrname, $elementtype = 'member')
+	public function delete($attrname, $elementtype = 'member')
 	{
 		if ($elementtype == 'thirdparty') $elementtype='societe';
 		if ($elementtype == 'contact') $elementtype='socpeople';
@@ -586,7 +586,7 @@ class ExtraFields
      *  @param  int     $totalizable        Is extrafield totalizable on list
 	 * 	@return	int							>0 if OK, <=0 if KO
 	 */
-	function update($attrname, $label, $type, $length, $elementtype, $unique = 0, $required = 0, $pos = 0, $param = '', $alwayseditable = 0, $perms = '', $list = '', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0)
+	public function update($attrname, $label, $type, $length, $elementtype, $unique = 0, $required = 0, $pos = 0, $param = '', $alwayseditable = 0, $perms = '', $list = '', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0)
 	{
 		if ($elementtype == 'thirdparty') $elementtype='societe';
 		if ($elementtype == 'contact') $elementtype='socpeople';
@@ -819,7 +819,7 @@ class ExtraFields
 	}
 
 
-    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
 	/**
 	 * 	Load array this->attributes, or old this->attribute_xxx like attribute_label, attribute_type, ...
 	 *
@@ -827,7 +827,7 @@ class ExtraFields
 	 * 	@param	boolean		$forceload			Force load of extra fields whatever is option MAIN_EXTRAFIELDS_DISABLED. Deprecated. Should not be required.
 	 * 	@return	array							Array of attributes keys+label for all extra fields.
 	 */
-	function fetch_name_optionals_label($elementtype, $forceload = false)
+	public function fetch_name_optionals_label($elementtype, $forceload = false)
 	{
         // phpcs:enable
 		global $conf;
@@ -950,7 +950,7 @@ class ExtraFields
 	 * @param  string  $extrafieldsobjectkey	If defined (for example $object->table_element), use the new method to get extrafields data
 	 * @return string
 	 */
-	function showInputField($key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = '', $objectid = 0, $extrafieldsobjectkey = '')
+	public function showInputField($key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = '', $objectid = 0, $extrafieldsobjectkey = '')
 	{
 		global $conf,$langs,$form;
 
@@ -1565,7 +1565,7 @@ class ExtraFields
 	 * @param	string	$extrafieldsobjectkey	If defined (for example $object->table_element), use the new method to get extrafields data
 	 * @return	string							Formated value
 	 */
-	function showOutputField($key, $value, $moreparam = '', $extrafieldsobjectkey = '')
+	public function showOutputField($key, $value, $moreparam = '', $extrafieldsobjectkey = '')
 	{
 		global $conf,$langs;
 
@@ -1877,7 +1877,7 @@ class ExtraFields
 	 * @param	string	$extrafieldsobjectkey	If defined, use the new method to get extrafields data
 	 * @return	string							Formated value
 	 */
-	function getAlignFlag($key, $extrafieldsobjectkey = '')
+	public function getAlignFlag($key, $extrafieldsobjectkey = '')
 	{
 		global $conf,$langs;
 
@@ -1929,7 +1929,7 @@ class ExtraFields
 	 * @param	string	$object			Object
 	 * @return 	string					HTML code with line for separator
 	 */
-	function showSeparator($key, $object)
+	public function showSeparator($key, $object)
 	{
 		global $langs;
 
@@ -1947,7 +1947,7 @@ class ExtraFields
 	 * @param	string	$onlykey		Only following key is filled. When we make update of only one extrafield ($action = 'update_extras'), calling page must must set this to avoid to have other extrafields being reset.
 	 * @return	int						1 if array_options set, 0 if no value, -1 if error (field required missing for example)
 	 */
-	function setOptionalsFromPost($extralabels, &$object, $onlykey = '')
+	public function setOptionalsFromPost($extralabels, &$object, $onlykey = '')
 	{
 		global $_POST, $langs;
 		$nofillrequired='';// For error when required field left blank
@@ -2046,7 +2046,7 @@ class ExtraFields
 	 * @param  string			$keysuffix      		Suffix string to add into name and id of field (can be used to avoid duplicate names)
 	 * @return array|int								array_options set or 0 if no value
 	 */
-	function getOptionalsFromPost($extrafieldsobjectkey, $keyprefix = '', $keysuffix = '')
+	public function getOptionalsFromPost($extrafieldsobjectkey, $keyprefix = '', $keysuffix = '')
 	{
 		global $_POST;
 
diff --git a/htdocs/core/class/fiscalyear.class.php b/htdocs/core/class/fiscalyear.class.php
index 930cbce341f..014946434be 100644
--- a/htdocs/core/class/fiscalyear.class.php
+++ b/htdocs/core/class/fiscalyear.class.php
@@ -386,9 +386,9 @@ class Fiscalyear extends CommonObject
 	/**
 	 *  Return the number of movements by fiscal year
 	 *
-	 *	@param	int		$datestart	Date start to scan
-	 *	@param	int		$dateend	Date end to scan
-	 *	@return	string				Number of movements
+	 *  @param	int		$datestart	Date start to scan
+	 *  @param	int		$dateend	Date end to scan
+	 *  @return	string				Number of movements
 	 */
 	public function getAccountancyMovementsByFiscalYear($datestart, $dateend)
 	{
diff --git a/htdocs/core/class/genericobject.class.php b/htdocs/core/class/genericobject.class.php
index 993d884c88b..a8d837bbaba 100644
--- a/htdocs/core/class/genericobject.class.php
+++ b/htdocs/core/class/genericobject.class.php
@@ -34,7 +34,7 @@ class GenericObject extends CommonObject
      *
      * @param       DoliDB      $db     Database handler
      */
-    function __construct($db)
+    public function __construct($db)
     {
         $this->db=$db;
     }
diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php
index f92bee4519f..65f92c86948 100644
--- a/htdocs/core/class/html.formcompany.class.php
+++ b/htdocs/core/class/html.formcompany.class.php
@@ -46,13 +46,13 @@ class FormCompany
 	 *
 	 *	@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
 	/**
 	 *    	Return list of labels (translated) of third parties type
 	 *
@@ -60,7 +60,7 @@ class FormCompany
 	 *      @param  string	$filter     Add a SQL filter to select
 	 *    	@return array      			Array of types
 	 */
-	function typent_array($mode = 0, $filter = '')
+	public function typent_array($mode = 0, $filter = '')
 	{
         // phpcs:enable
 		global $langs,$mysoc;
@@ -95,7 +95,7 @@ class FormCompany
 		return $effs;
 	}
 
-    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
 	/**
 	 *	Renvoie la liste des types d'effectifs possibles (pas de traduction car nombre)
 	 *
@@ -103,7 +103,7 @@ class FormCompany
 	 *	@param  string	$filter     Add a SQL filter to select
 	 *  @return array				Array of types d'effectifs
 	 */
-	function effectif_array($mode = 0, $filter = '')
+	public function effectif_array($mode = 0, $filter = '')
 	{
         // phpcs:enable
 		$effs = array();
@@ -135,7 +135,7 @@ class FormCompany
 	}
 
 
-    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
 	/**
 	 *  Affiche formulaire de selection des modes de reglement
 	 *
@@ -145,7 +145,7 @@ class FormCompany
 	 *	@param	int		$empty			Add empty value in list
 	 *	@return	void
 	 */
-	function form_prospect_level($page, $selected = '', $htmlname = 'prospect_level_id', $empty = 0)
+	public function form_prospect_level($page, $selected = '', $htmlname = 'prospect_level_id', $empty = 0)
 	{
         // phpcs:enable
 		global $user, $langs;
@@ -186,7 +186,7 @@ class FormCompany
 		print '';
 	}
 
-    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
 	/**
 	 *   Returns the drop-down list of departments/provinces/cantons for all countries or for a given country.
      *   In the case of an all-country list, the display breaks on the country.
@@ -198,13 +198,13 @@ class FormCompany
 	 *   @param     string	$htmlname			Id of department
 	 *   @return	void
 	 */
-	function select_departement($selected = '', $country_codeid = 0, $htmlname = 'state_id')
+	public function select_departement($selected = '', $country_codeid = 0, $htmlname = 'state_id')
 	{
         // phpcs:enable
 		print $this->select_state($selected, $country_codeid, $htmlname);
 	}
 
-    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
 	/**
 	 *   Returns the drop-down list of departments/provinces/cantons for all countries or for a given country.
      *   In the case of an all-country list, the display breaks on the country.
@@ -217,7 +217,7 @@ class FormCompany
 	 * 	  @return	string						String with HTML select
 	 *    @see select_country
 	 */
-	function select_state($selected = '', $country_codeid = 0, $htmlname = 'state_id')
+	public function select_state($selected = '', $country_codeid = 0, $htmlname = 'state_id')
 	{
         // phpcs:enable
 		global $conf,$langs,$user;
@@ -319,7 +319,7 @@ class FormCompany
 	}
 
 
-    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
 	/**
 	 *   Retourne la liste deroulante des regions actives dont le pays est actif
 	 *   La cle de la liste est le code (il peut y avoir plusieurs entree pour
@@ -330,7 +330,7 @@ class FormCompany
 	 *   @param		string		$htmlname		Name of HTML select field
 	 *   @return	void
 	 */
-	function select_region($selected = '', $htmlname = 'region_id')
+	public function select_region($selected = '', $htmlname = 'region_id')
 	{
         // phpcs:enable
 		global $conf,$langs;
@@ -387,7 +387,7 @@ class FormCompany
 		}
 	}
 
-    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
 	/**
 	 *  Return combo list with people title
 	 *
@@ -396,7 +396,7 @@ class FormCompany
 	 *  @param  string  $morecss        Add more css on SELECT element
 	 *  @return	string					String with HTML select
 	 */
-	function select_civility($selected = '', $htmlname = 'civility_id', $morecss = 'maxwidth100')
+	public function select_civility($selected = '', $htmlname = 'civility_id', $morecss = 'maxwidth100')
 	{
         // phpcs:enable
 		global $conf,$langs,$user;
@@ -445,7 +445,7 @@ class FormCompany
 		return $out;
 	}
 
-    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
 	/**
 	 *    Retourne la liste deroulante des formes juridiques tous pays confondus ou pour un pays donne.
 	 *    Dans le cas d'une liste tous pays confondu, on affiche une rupture sur le pays.
@@ -457,13 +457,13 @@ class FormCompany
 	 *    @deprecated Use print xxx->select_juridicalstatus instead
 	 *    @see select_juridicalstatus()
 	 */
-	function select_forme_juridique($selected = '', $country_codeid = 0, $filter = '')
+	public function select_forme_juridique($selected = '', $country_codeid = 0, $filter = '')
 	{
         // phpcs:enable
 		print $this->select_juridicalstatus($selected, $country_codeid, $filter);
 	}
 
-    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
 	/**
 	 *    Retourne la liste deroulante des formes juridiques tous pays confondus ou pour un pays donne.
 	 *    Dans le cas d'une liste tous pays confondu, on affiche une rupture sur le pays
@@ -474,7 +474,7 @@ class FormCompany
      *    @param	string		$htmlname			HTML name of select
      *    @return	string							String with HTML select
 	 */
-	function select_juridicalstatus($selected = '', $country_codeid = 0, $filter = '', $htmlname = 'forme_juridique_code')
+	public function select_juridicalstatus($selected = '', $country_codeid = 0, $filter = '', $htmlname = 'forme_juridique_code')
 	{
         // phpcs:enable
 		global $conf,$langs,$user;
@@ -579,7 +579,7 @@ class FormCompany
      *  @param	string		$morecss		More CSS on select component
 	 * 	@return int 						The selected third party ID
 	 */
-	function selectCompaniesForNewContact($object, $var_id, $selected = '', $htmlname = 'newcompany', $limitto = '', $forceid = 0, $moreparam = '', $morecss = '')
+	public function selectCompaniesForNewContact($object, $var_id, $selected = '', $htmlname = 'newcompany', $limitto = '', $forceid = 0, $moreparam = '', $morecss = '')
 	{
 		global $conf, $langs;
 
@@ -738,7 +738,7 @@ class FormCompany
      *  @param  string      $morecss        Add more css to select component
      *  @return	void
      */
-	function selectTypeContact($object, $selected, $htmlname = 'type', $source = 'internal', $sortorder = 'position', $showempty = 0, $morecss = '')
+    public function selectTypeContact($object, $selected, $htmlname = 'type', $source = 'internal', $sortorder = 'position', $showempty = 0, $morecss = '')
 	{
 	    global $user, $langs;
 
@@ -762,7 +762,7 @@ class FormCompany
 		}
 	}
 
-    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
 	/**
 	 *    Return a select list with zip codes and their town
 	 *
@@ -775,7 +775,7 @@ class FormCompany
 	 *    @param    string      $morecss                More css
 	 *    @return	string
 	 */
-	function select_ziptown($selected = '', $htmlname = 'zipcode', $fields = '', $fieldsize = 0, $disableautocomplete = 0, $moreattrib = '', $morecss = '')
+	public function select_ziptown($selected = '', $htmlname = 'zipcode', $fields = '', $fieldsize = 0, $disableautocomplete = 0, $moreattrib = '', $morecss = '')
 	{
         // phpcs:enable
 		global $conf;
@@ -795,7 +795,7 @@ class FormCompany
 		return $out;
 	}
 
-    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
     /**
      *  Return HTML string to use as input of professional id into a HTML page (siren, siret, etc...)
      *
@@ -806,7 +806,7 @@ class FormCompany
      *  @param  string  $morecss        More css
      *  @return	string					HTML string with prof id
      */
-    function get_input_id_prof($idprof, $htmlname, $preselected, $country_code, $morecss = 'maxwidth100onsmartphone quatrevingtpercent')
+    public function get_input_id_prof($idprof, $htmlname, $preselected, $country_code, $morecss = 'maxwidth100onsmartphone quatrevingtpercent')
     {
         // phpcs:enable
         global $conf,$langs;
@@ -847,7 +847,7 @@ class FormCompany
         return $out;
     }
 
-    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
     /**
      * Return a HTML select with localtax values for thirdparties
      *
@@ -856,7 +856,7 @@ class FormCompany
      * @param 	string      $htmlname		HTML select name
      * @return	void
      */
-    function select_localtax($local, $selected, $htmlname)
+    public function select_localtax($local, $selected, $htmlname)
     {
         // phpcs:enable
         $tax=get_localtax_by_third($local);
@@ -900,7 +900,7 @@ class FormCompany
      * @param string $morecss More css
      * @return string HTML string
      */
-    function selectProspectCustomerType($selected, $htmlname = 'client', $htmlidname = 'customerprospect', $typeinput = 'form', $morecss = '')
+    public function selectProspectCustomerType($selected, $htmlname = 'client', $htmlidname = 'customerprospect', $typeinput = 'form', $morecss = '')
     {
 
     	global $conf,$langs;
diff --git a/htdocs/core/class/html.formcontract.class.php b/htdocs/core/class/html.formcontract.class.php
index d7cf1cd62d9..195f09663b3 100644
--- a/htdocs/core/class/html.formcontract.class.php
+++ b/htdocs/core/class/html.formcontract.class.php
@@ -49,7 +49,7 @@ class FormContract
     }
 
 
-    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
 	/**
 	 *	Show a combo list with contracts qualified for a third party
 	 *
@@ -60,8 +60,8 @@ class FormContract
 	 *	@param	int		$showempty	Show empty line
 	 *	@return int         		Nbr of project if OK, <0 if KO
 	 */
-	function select_contract($socid = -1, $selected = '', $htmlname = 'contrattid', $maxlength = 16, $showempty = 1)
-	{
+    public function select_contract($socid = -1, $selected = '', $htmlname = 'contrattid', $maxlength = 16, $showempty = 1)
+    {
         // phpcs:enable
 		global $db,$user,$conf,$langs;
 
@@ -164,21 +164,21 @@ class FormContract
 			dol_print_error($db);
 			return -1;
 		}
-	}
+    }
 
-	/**
-	 *	Show a form to select a contract
-	 *
-	 *  @param	int		$page       Page
-	 *	@param	int		$socid      Id third party (-1=all, 0=only contracts not linked to a third party, id=contracts not linked or linked to third party id)
-	 *	@param  int		$selected   Id contract preselected
-	 *	@param  string	$htmlname   Nom de la zone html
-	 *	@param	int		$maxlength	Maximum length of label
-	 *	@param	int		$showempty	Show empty line
-	 *	@return int                 Nbr of project if OK, <0 if KO
-	 */
-	function formSelectContract($page, $socid = -1, $selected = '', $htmlname = 'contrattid', $maxlength = 16, $showempty = 1)
-	{
+    /**
+     *  Show a form to select a contract
+     *
+     *  @param  int     $page       Page
+     *  @param  int     $socid      Id third party (-1=all, 0=only contracts not linked to a third party, id=contracts not linked or linked to third party id)
+     *  @param  int     $selected   Id contract preselected
+     *  @param  string  $htmlname   Nom de la zone html
+     *  @param  int     $maxlength	Maximum length of label
+     *  @param  int     $showempty	Show empty line
+     *  @return int                 Nbr of project if OK, <0 if KO
+     */
+    public function formSelectContract($page, $socid = -1, $selected = '', $htmlname = 'contrattid', $maxlength = 16, $showempty = 1)
+    {
         global $langs;
 
         print "\n";
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index c53a5562997..81a29a0ac04 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -51,14 +51,14 @@ class FormFile
 	 *
 	 *  @param		DoliDB		$db      Database handler
 	 */
-	function __construct($db)
+	public function __construct($db)
 	{
 		$this->db = $db;
 		$this->numoffiles=0;
 	}
 
 
-    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
 	/**
 	 *  Show form to upload a new file.
 	 *
@@ -70,7 +70,7 @@ class FormFile
 	 *  @param  int			$size          	Length of input file area. Deprecated.
 	 *  @param	Object		$object			Object to use (when attachment is done on an element)
 	 *  @param	string		$options		Add an option column
-	 *  @param	integer		$useajax		Use fileupload ajax (0=never, 1=if enabled, 2=always whatever is option).
+     *  @param  integer     $useajax        Use fileupload ajax (0=never, 1=if enabled, 2=always whatever is option).
      *                                      Deprecated 2 should never be used and if 1 is used, option should no be enabled.
 	 *  @param	string		$savingdocmask	Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__'
 	 *  @param	integer		$linkfiles		1=Also add form to link files, 0=Do not show form to link files
@@ -79,7 +79,7 @@ class FormFile
 	 *	@param	string		$sectiondir		If upload must be done inside a particular directory (is sectiondir defined, sectionid must not be)
 	 * 	@return	int							<0 if KO, >0 if OK
 	 */
-	function form_attach_new_file($url, $title = '', $addcancel = 0, $sectionid = 0, $perm = 1, $size = 50, $object = '', $options = '', $useajax = 1, $savingdocmask = '', $linkfiles = 1, $htmlname = 'formuserfile', $accept = '', $sectiondir = '')
+	public function form_attach_new_file($url, $title = '', $addcancel = 0, $sectionid = 0, $perm = 1, $size = 50, $object = '', $options = '', $useajax = 1, $savingdocmask = '', $linkfiles = 1, $htmlname = 'formuserfile', $accept = '', $sectiondir = '')
 	{
         // phpcs:enable
 		global $conf,$langs, $hookmanager;
@@ -238,7 +238,7 @@ class FormFile
 		}
 	}
 
-    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
 	/**
 	 *      Show the box with list of available documents for object
 	 *
@@ -261,7 +261,7 @@ class FormFile
 	 * 		@return		int										<0 if KO, number of shown files if OK
 	 *      @deprecated                                         Use print xxx->showdocuments() instead.
 	 */
-	function show_documents($modulepart, $modulesubdir, $filedir, $urlsource, $genallowed, $delallowed = 0, $modelselected = '', $allowgenifempty = 1, $forcenomultilang = 0, $iconPDF = 0, $notused = 0, $noform = 0, $param = '', $title = '', $buttonlabel = '', $codelang = '')
+	public function show_documents($modulepart, $modulesubdir, $filedir, $urlsource, $genallowed, $delallowed = 0, $modelselected = '', $allowgenifempty = 1, $forcenomultilang = 0, $iconPDF = 0, $notused = 0, $noform = 0, $param = '', $title = '', $buttonlabel = '', $codelang = '')
 	{
         // phpcs:enable
 		$this->numoffiles=0;
@@ -294,7 +294,7 @@ class FormFile
 	 *      @param		int					$hideifempty		Hide section of generated files if there is no file
 	 * 		@return		string              					Output string with HTML array of documents (might be empty string)
 	 */
-	function showdocuments($modulepart, $modulesubdir, $filedir, $urlsource, $genallowed, $delallowed = 0, $modelselected = '', $allowgenifempty = 1, $forcenomultilang = 0, $iconPDF = 0, $notused = 0, $noform = 0, $param = '', $title = '', $buttonlabel = '', $codelang = '', $morepicto = '', $object = null, $hideifempty = 0)
+	public function showdocuments($modulepart, $modulesubdir, $filedir, $urlsource, $genallowed, $delallowed = 0, $modelselected = '', $allowgenifempty = 1, $forcenomultilang = 0, $iconPDF = 0, $notused = 0, $noform = 0, $param = '', $title = '', $buttonlabel = '', $codelang = '', $morepicto = '', $object = null, $hideifempty = 0)
 	{
 		// Deprecation warning
 		if (! empty($iconPDF)) {
@@ -893,7 +893,7 @@ class FormFile
 	 *  @param	string	$filter			Filter filenames on this regex string (Example: '\.pdf$')
 	 *	@return	string              	Output string with HTML link of documents (might be empty string). This also fill the array ->infofiles
 	 */
-	function getDocumentsLink($modulepart, $modulesubdir, $filedir, $filter = '')
+	public function getDocumentsLink($modulepart, $modulesubdir, $filedir, $filter = '')
 	{
 		global $conf, $langs;
 
@@ -996,7 +996,7 @@ class FormFile
 	}
 
 
-    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
 	/**
 	 *  Show list of documents in $filearray (may be they are all in same directory but may not)
 	 *  This also sync database if $upload_dir is defined.
@@ -1028,7 +1028,7 @@ class FormFile
 	 * 	@return	 int						<0 if KO, nb of files shown if OK
 	 *  @see list_of_autoecmfiles
 	 */
-	function list_of_documents($filearray, $object, $modulepart, $param = '', $forcedownload = 0, $relativepath = '', $permonobject = 1, $useinecm = 0, $textifempty = '', $maxlength = 0, $title = '', $url = '', $showrelpart = 0, $permtoeditline = -1, $upload_dir = '', $sortfield = '', $sortorder = 'ASC', $disablemove = 1, $addfilterfields = 0)
+	public function list_of_documents($filearray, $object, $modulepart, $param = '', $forcedownload = 0, $relativepath = '', $permonobject = 1, $useinecm = 0, $textifempty = '', $maxlength = 0, $title = '', $url = '', $showrelpart = 0, $permtoeditline = -1, $upload_dir = '', $sortfield = '', $sortorder = 'ASC', $disablemove = 1, $addfilterfields = 0)
 	{
         // phpcs:enable
 		global $user, $conf, $langs, $hookmanager;
@@ -1397,7 +1397,7 @@ class FormFile
 	}
 
 
-    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
 	/**
 	 *	Show list of documents in a directory
 	 *
@@ -1416,7 +1416,7 @@ class FormFile
 	 *  @return int                 		<0 if KO, nb of files shown if OK
 	 *  @see list_of_documents
 	 */
-	function list_of_autoecmfiles($upload_dir, $filearray, $modulepart, $param, $forcedownload = 0, $relativepath = '', $permtodelete = 1, $useinecm = 0, $textifempty = '', $maxlength = 0, $url = '', $addfilterfields = 0)
+	public function list_of_autoecmfiles($upload_dir, $filearray, $modulepart, $param, $forcedownload = 0, $relativepath = '', $permtodelete = 1, $useinecm = 0, $textifempty = '', $maxlength = 0, $url = '', $addfilterfields = 0)
 	{
         // phpcs:enable
 		global $user, $conf, $langs, $form;
diff --git a/htdocs/core/class/html.formintervention.class.php b/htdocs/core/class/html.formintervention.class.php
index 3d0a84b074c..83405f9725b 100644
--- a/htdocs/core/class/html.formintervention.class.php
+++ b/htdocs/core/class/html.formintervention.class.php
@@ -49,7 +49,7 @@ class FormIntervention
     }
 
 
-    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
 	/**
 	 *	Show a combo list with contracts qualified for a third party
 	 *
@@ -60,7 +60,7 @@ class FormIntervention
 	 *	@param	int		$showempty	Show empty line
 	 *	@return int         		Nbre of project if OK, <0 if KO
 	 */
-	function select_interventions($socid = -1, $selected = '', $htmlname = 'interventionid', $maxlength = 16, $showempty = 1)
+	public function select_interventions($socid = -1, $selected = '', $htmlname = 'interventionid', $maxlength = 16, $showempty = 1)
 	{
         // phpcs:enable
 		global $db,$user,$conf,$langs;
diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index 1159c74dc8d..b643f1dfcb9 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -121,7 +121,7 @@ class FormMail extends Form
 	 *
 	 *  @param	DoliDB	$db      Database handler
 	 */
-	function __construct($db)
+	public function __construct($db)
 	{
 		$this->db = $db;
 
@@ -151,13 +151,13 @@ class FormMail extends Form
 		$this->withfckeditor=-1;	// -1 = Auto
 	}
 
-    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
 	/**
 	 * Clear list of attached files in send mail form (also stored in session)
 	 *
 	 * @return	void
 	 */
-	function clear_attached_files()
+	public function clear_attached_files()
 	{
         // phpcs:enable
 		global $conf,$user;
@@ -174,7 +174,7 @@ class FormMail extends Form
 		unset($_SESSION["listofmimes".$keytoavoidconflict]);
 	}
 
-    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
 	/**
 	 * Add a file into the list of attached files (stored in SECTION array)
 	 *
@@ -183,7 +183,7 @@ class FormMail extends Form
 	 * @param 	string   $type   Mime type (can be dol_mimetype($file))
 	 * @return	void
 	 */
-	function add_attached_files($path, $file = '', $type = '')
+	public function add_attached_files($path, $file = '', $type = '')
 	{
         // phpcs:enable
 		$listofpaths=array();
@@ -208,14 +208,14 @@ class FormMail extends Form
 		}
 	}
 
-    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
 	/**
 	 * Remove a file from the list of attached files (stored in SECTION array)
 	 *
 	 * @param  	string	$keytodelete     Key in file array (0, 1, 2, ...)
 	 * @return	void
 	 */
-	function remove_attached_files($keytodelete)
+	public function remove_attached_files($keytodelete)
 	{
         // phpcs:enable
 		$listofpaths=array();
@@ -238,13 +238,13 @@ class FormMail extends Form
 		}
 	}
 
-    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
 	/**
 	 * Return list of attached files (stored in SECTION array)
 	 *
 	 * @return	array       array('paths'=> ,'names'=>, 'mimes'=> )
 	 */
-	function get_attached_files()
+	public function get_attached_files()
 	{
         // phpcs:enable
 		$listofpaths=array();
@@ -258,7 +258,7 @@ class FormMail extends Form
 		return array('paths'=>$listofpaths, 'names'=>$listofnames, 'mimes'=>$listofmimes);
 	}
 
-    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
 	/**
 	 *	Show the form to input an email
 	 *  this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files
@@ -268,13 +268,13 @@ class FormMail extends Form
 	 *	@param	string	$removefileaction	Name of action when removing file attachments
 	 *	@return	void
 	 */
-	function show_form($addfileaction = 'addfile', $removefileaction = 'removefile')
+	public function show_form($addfileaction = 'addfile', $removefileaction = 'removefile')
 	{
         // phpcs:enable
 		print $this->get_form($addfileaction, $removefileaction);
 	}
 
-    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
 	/**
 	 *	Get the form to input an email
 	 *  this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files
@@ -285,7 +285,7 @@ class FormMail extends Form
 	 *	@param	string	$removefileaction	Name of action when removing file attachments
 	 *	@return string						Form to show
 	 */
-	function get_form($addfileaction = 'addfile', $removefileaction = 'removefile')
+	public function get_form($addfileaction = 'addfile', $removefileaction = 'removefile')
 	{
         // phpcs:enable
 		global $conf, $langs, $user, $hookmanager, $form;
@@ -1130,24 +1130,23 @@ class FormMail extends Form
 	}
 
 	/**
-	 *      Return templates of email with type = $type_template or type = 'all'.
-	 *      This search into table c_email_templates. Used by the get_form function.
+	 *  Return templates of email with type = $type_template or type = 'all'.
+	 *  This search into table c_email_templates. Used by the get_form function.
 	 *
-	 * 		@param	DoliDB		$db				Database handler
-	 * 		@param	string		$type_template	Get message for model/type=$type_template, type='all' also included.
-	 *      @param	string		$user			Get template public or limited to this user
-	 *      @param	Translate	$outputlangs	Output lang object
-	 *      @param	int			$id				Id of template to find, or -1 for first found with position 0, or 0 for first found whatever is position (priority order depends on lang provided or not) or -2 for exact match with label (no answer if not found)
-	 *      @param  int         $active         1=Only active template, 0=Only disabled, -1=All
-	 *      @param	string		$label			Label of template
-	 *      @return ModelMail|integer			One instance of ModelMail or -1 if error
+	 *  @param	DoliDB		$db				Database handler
+	 *  @param	string		$type_template	Get message for model/type=$type_template, type='all' also included.
+	 *  @param	string		$user			Get template public or limited to this user
+	 *  @param	Translate	$outputlangs	Output lang object
+	 *  @param	int			$id				Id of template to find, or -1 for first found with position 0, or 0 for first found whatever is position (priority order depends on lang provided or not) or -2 for exact match with label (no answer if not found)
+	 *  @param  int         $active         1=Only active template, 0=Only disabled, -1=All
+	 *  @param	string		$label			Label of template
+	 *  @return ModelMail|integer			One instance of ModelMail or -1 if error
 	 */
 	public function getEMailTemplate($db, $type_template, $user, $outputlangs, $id = 0, $active = 1, $label = '')
 	{
-		$ret = new ModelMail();
+        $ret = new ModelMail();
 
-		if ($id == -2 && empty($label))
-		{
+		if ($id == -2 && empty($label)) {
 			$this->error = 'LabelIsMandatoryWhenIdIs-2';
 			return -1;
 		}
@@ -1320,7 +1319,7 @@ class FormMail extends Form
 	 * @return	void
 	 * @see getCommonSubstitutionArray
 	 */
-	function setSubstitFromObject($object, $outputlangs)
+	public function setSubstitFromObject($object, $outputlangs)
 	{
 		global $conf, $user;
 
@@ -1377,7 +1376,7 @@ class FormMail extends Form
 	 * @param	Object	$object		Object if applicable
 	 * @return	array               Array of substitution values for emails.
 	 */
-	static function getAvailableSubstitKey($mode = 'formemail', $object = null)
+	public static function getAvailableSubstitKey($mode = 'formemail', $object = null)
 	{
 		global $conf, $langs;
 
diff --git a/htdocs/core/class/html.formmailing.class.php b/htdocs/core/class/html.formmailing.class.php
index 95c2c057b40..caf4bf8a504 100644
--- a/htdocs/core/class/html.formmailing.class.php
+++ b/htdocs/core/class/html.formmailing.class.php
@@ -27,33 +27,33 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/html.form.class.php';
  */
 class FormMailing extends Form
 {
-	/**
-	 * @var string[] Error codes (or messages)
-	 */
-	public $errors = array();
+    /**
+     * @var string[] Error codes (or messages)
+     */
+    public $errors = array();
 
-	/**
-	 * Output a select with destinaries status
-	 *
-	 * @param string   $selectedid     The selected id
-	 * @param string   $htmlname       Name of controm
-	 * @param integer  $show_empty     Show empty option
-	 * @return string HTML select
-	 */
+    /**
+     * Output a select with destinaries status
+     *
+     * @param string   $selectedid     The selected id
+     * @param string   $htmlname       Name of controm
+     * @param integer  $show_empty     Show empty option
+     * @return string HTML select
+     */
     public function selectDestinariesStatus($selectedid = '', $htmlname = 'dest_status', $show_empty = 0)
     {
 
-		global $langs;
-		$langs->load("mails");
+        global $langs;
+        $langs->load("mails");
 
-		require_once DOL_DOCUMENT_ROOT.'/comm/mailing/class/mailing.class.php';
-		$mailing = new Mailing($this->db);
+        require_once DOL_DOCUMENT_ROOT.'/comm/mailing/class/mailing.class.php';
+        $mailing = new Mailing($this->db);
 
-		$options = array();
+        $options = array();
 
-		if ($show_empty) {
-			$options[-2] = '';   // Note -1 is used for error
-		}
+        if ($show_empty) {
+            $options[-2] = '';   // Note -1 is used for error
+        }
 
         $options = $options + $mailing->statut_dest;
 
diff --git a/htdocs/core/class/html.formmargin.class.php b/htdocs/core/class/html.formmargin.class.php
index 5aecb6efc71..f022d2c3791 100644
--- a/htdocs/core/class/html.formmargin.class.php
+++ b/htdocs/core/class/html.formmargin.class.php
@@ -44,7 +44,7 @@ class FormMargin
      *
      *	@param	DoliDB		$db      Database handler
      */
-    function __construct($db)
+    public function __construct($db)
     {
         $this->db = $db;
     }
@@ -59,7 +59,7 @@ class FormMargin
 	 * 	@param 	boolean			$force_price	True of not
 	 * 	@return array							Array with info
 	 */
-	function getMarginInfosArray($object, $force_price = false)
+	public function getMarginInfosArray($object, $force_price = false)
 	{
 		global $conf, $db;
 
@@ -191,7 +191,7 @@ class FormMargin
 	 * 	@param 	boolean			$force_price	Force price
 	 * 	@return	void
 	 */
-	function displayMarginInfos($object, $force_price = false)
+	public function displayMarginInfos($object, $force_price = false)
 	{
 		global $langs, $conf, $user;
 
diff --git a/htdocs/core/class/html.formorder.class.php b/htdocs/core/class/html.formorder.class.php
index 9783d6f50a8..9c1d847f16e 100644
--- a/htdocs/core/class/html.formorder.class.php
+++ b/htdocs/core/class/html.formorder.class.php
@@ -31,13 +31,13 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/html.form.class.php';
 class FormOrder extends Form
 {
 
-	/**
-     *    Return combo list of differents status of a orders
+    /**
+     *  Return combo list of differents status of a orders
      *
-     *    @param	string	$selected   Preselected value
-     *    @param	int		$short		Use short labels
-     *    @param	string	$hmlname	Name of HTML select element
-     *    @return	void
+     *  @param	string	$selected   Preselected value
+     *  @param	int		$short		Use short labels
+     *  @param	string	$hmlname	Name of HTML select element
+     *  @return	void
      */
     public function selectSupplierOrderStatus($selected = '', $short = 0, $hmlname = 'order_status')
     {
diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php
index 97beb2464ad..1bb59077bec 100644
--- a/htdocs/core/class/html.formother.class.php
+++ b/htdocs/core/class/html.formother.class.php
@@ -50,13 +50,13 @@ class FormOther
      *
      *	@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
     /**
      *    Return HTML select list of export models
      *
@@ -67,7 +67,7 @@ class FormOther
      *    @param    int		$fk_user          Utilisateur créant le modèle
      *    @return	void
      */
-    function select_export_model($selected = '', $htmlname = 'exportmodelid', $type = '', $useempty = 0, $fk_user = null)
+    public function select_export_model($selected = '', $htmlname = 'exportmodelid', $type = '', $useempty = 0, $fk_user = null)
     {
         // phpcs:enable
         $sql = "SELECT rowid, label";
@@ -109,7 +109,7 @@ class FormOther
     }
 
 
-    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
     /**
      *    Return list of export models
      *
@@ -119,7 +119,7 @@ class FormOther
      *    @param    int		$useempty          Affiche valeur vide dans liste
      *    @return	void
      */
-    function select_import_model($selected = '', $htmlname = 'importmodelid', $type = '', $useempty = 0)
+    public function select_import_model($selected = '', $htmlname = 'importmodelid', $type = '', $useempty = 0)
     {
         // phpcs:enable
         $sql = "SELECT rowid, label";
@@ -160,7 +160,7 @@ class FormOther
     }
 
 
-    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
     /**
      *    Return list of ecotaxes with label
      *
@@ -168,7 +168,7 @@ class FormOther
      *    @param    string	$htmlname	Name of combo list
      *    @return	integer
      */
-    function select_ecotaxes($selected = '', $htmlname = 'ecotaxe_id')
+    public function select_ecotaxes($selected = '', $htmlname = 'ecotaxe_id')
     {
         // phpcs:enable
         global $langs;
@@ -218,7 +218,7 @@ class FormOther
     }
 
 
-    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
     /**
      *    Return list of revenue stamp for country
      *
@@ -227,7 +227,7 @@ class FormOther
      *    @param    string	$country_code   Country Code
      *    @return	string					HTML select list
      */
-    function select_revenue_stamp($selected = '', $htmlname = 'revenuestamp', $country_code = '')
+    public function select_revenue_stamp($selected = '', $htmlname = 'revenuestamp', $country_code = '')
     {
         // phpcs:enable
     	global $langs;
@@ -277,7 +277,7 @@ class FormOther
     }
 
 
-    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
     /**
      *    Return a HTML select list to select a percent
      *
@@ -290,7 +290,7 @@ class FormOther
      *    @param    int     $showempty      Add also an empty line
      *    @return   string					HTML select string
      */
-    function select_percent($selected = 0, $htmlname = 'percent', $disabled = 0, $increment = 5, $start = 0, $end = 100, $showempty = 0)
+    public function select_percent($selected = 0, $htmlname = 'percent', $disabled = 0, $increment = 5, $start = 0, $end = 100, $showempty = 0)
     {
         // phpcs:enable
         $return = '";
-            }
-            else
-			{
+            } else {
                 print $langs->trans("DictionaryEmpty");
             }
         }
diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php
index 765f7d00d79..9ef1098901c 100644
--- a/htdocs/core/class/html.formprojet.class.php
+++ b/htdocs/core/class/html.formprojet.class.php
@@ -45,12 +45,12 @@ class FormProjets
 	 *
 	 *  @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
 	/**
 	 *	Output a combo list with projects qualified for a third party / user
 	 *
@@ -71,8 +71,8 @@ class FormProjets
 	 *	@param  int     $htmlid         Html id to use instead of htmlname
 	 *	@return string           		Return html content
 	 */
-	function select_projects($socid = -1, $selected = '', $htmlname = 'projectid', $maxlength = 16, $option_only = 0, $show_empty = 1, $discard_closed = 0, $forcefocus = 0, $disabled = 0, $mode = 0, $filterkey = '', $nooutput = 0, $forceaddid = 0, $morecss = '', $htmlid = '')
-	{
+    public function select_projects($socid = -1, $selected = '', $htmlname = 'projectid', $maxlength = 16, $option_only = 0, $show_empty = 1, $discard_closed = 0, $forcefocus = 0, $disabled = 0, $mode = 0, $filterkey = '', $nooutput = 0, $forceaddid = 0, $morecss = '', $htmlid = '')
+    {
         // phpcs:enable
 		global $langs,$conf,$form;
 
@@ -90,13 +90,13 @@ class FormProjets
 				$selected_input_value=$project->ref;
 			}
 			$urloption='socid='.$socid.'&htmlname='.$htmlname.'&discardclosed='.$discard_closed;
-$out.=ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PROJECT_USE_SEARCH_TO_SELECT, 0, array(
-//				'update' => array(
-//					'projectid' => 'id'
-//				)
-			));
+            $out.=ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PROJECT_USE_SEARCH_TO_SELECT, 0, array(
+                //  'update' => array(
+                //      'projectid' => 'id'
+                //  )
+            ));
 
-			$out.='';
+            $out.='';
 		}
 		else
 		{
@@ -119,7 +119,7 @@ $out.=ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projec
 		else return $out;
 	}
 
-    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
 	/**
 	 * Returns an array with projects qualified for a third party
 	 *
@@ -140,8 +140,8 @@ $out.=ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projec
 	 * @param  string  $morecss            More CSS
 	 * @return int         			       Nb of project if OK, <0 if KO
 	 */
-	function select_projects_list($socid = -1, $selected = '', $htmlname = 'projectid', $maxlength = 24, $option_only = 0, $show_empty = 1, $discard_closed = 0, $forcefocus = 0, $disabled = 0, $mode = 0, $filterkey = '', $nooutput = 0, $forceaddid = 0, $htmlid = '', $morecss = 'maxwidth500')
-	{
+    public function select_projects_list($socid = -1, $selected = '', $htmlname = 'projectid', $maxlength = 24, $option_only = 0, $show_empty = 1, $discard_closed = 0, $forcefocus = 0, $disabled = 0, $mode = 0, $filterkey = '', $nooutput = 0, $forceaddid = 0, $htmlid = '', $morecss = 'maxwidth500')
+    {
         // phpcs:enable
 		global $user,$conf,$langs;
 
@@ -303,11 +303,11 @@ $out.=ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projec
 	}
 
 	/**
-	 *	Output a combo list with tasks qualified for a third party
+	 *  Output a combo list with tasks qualified for a third party
 	 *
-	 *	@param	int		$socid      	Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id)
-	 *	@param  int		$selected   	Id task preselected
-	 *	@param  string	$htmlname   	Name of HTML select
+	 *  @param	int		$socid      	Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id)
+	 *  @param  int		$selected   	Id task preselected
+	 *  @param  string	$htmlname   	Name of HTML select
 	 *	@param	int		$maxlength		Maximum length of label
 	 *	@param	int		$option_only	Return only html options lines without the select tag
 	 *	@param	string	$show_empty		Add an empty line ('1' or string to show for empty line)
@@ -320,7 +320,7 @@ $out.=ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projec
 	 *  @param	User	$usertofilter	User object to use for filtering
 	 *	@return int         			Nbr of project if OK, <0 if KO
 	 */
-	function selectTasks($socid = -1, $selected = '', $htmlname = 'taskid', $maxlength = 24, $option_only = 0, $show_empty = '1', $discard_closed = 0, $forcefocus = 0, $disabled = 0, $morecss = 'maxwidth500', $projectsListId = '', $showproject = 'all', $usertofilter = null)
+    public function selectTasks($socid = -1, $selected = '', $htmlname = 'taskid', $maxlength = 24, $option_only = 0, $show_empty = '1', $discard_closed = 0, $forcefocus = 0, $disabled = 0, $morecss = 'maxwidth500', $projectsListId = '', $showproject = 'all', $usertofilter = null)
 	{
 		global $user,$conf,$langs;
 
@@ -477,7 +477,7 @@ $out.=ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projec
 	}
 
 
-    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
 	/**
 	 *    Build a HTML select list of element of same thirdparty to suggest to link them to project
 	 *
@@ -488,7 +488,7 @@ $out.=ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projec
 	 *    @param	string		$projectkey			Equivalent key  to fk_projet for actual table_element
 	 *    @return	int|string						The HTML select list of element or '' if nothing or -1 if KO
 	 */
-	function select_element($table_element, $socid = 0, $morecss = '', $limitonstatus = -2, $projectkey = "fk_projet")
+	public function select_element($table_element, $socid = 0, $morecss = '', $limitonstatus = -2, $projectkey = "fk_projet")
 	{
         // phpcs:enable
 		global $conf, $langs;
@@ -618,7 +618,7 @@ $out.=ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projec
 	 *    @param   string      $morecss            Add more css
 	 *    @return  int|string                      The HTML select list of element or '' if nothing or -1 if KO
 	 */
-	function selectOpportunityStatus($htmlname, $preselected = '-1', $showempty = 1, $useshortlabel = 0, $showallnone = 0, $showpercent = 0, $morecss = '')
+	public function selectOpportunityStatus($htmlname, $preselected = '-1', $showempty = 1, $useshortlabel = 0, $showallnone = 0, $showpercent = 0, $morecss = '')
 	{
 		global $conf, $langs;
 
diff --git a/htdocs/core/class/html.formpropal.class.php b/htdocs/core/class/html.formpropal.class.php
index 1f4fad0829c..e9f78638742 100644
--- a/htdocs/core/class/html.formpropal.class.php
+++ b/htdocs/core/class/html.formpropal.class.php
@@ -27,26 +27,26 @@
  */
 class FormPropal
 {
-	/**
+    /**
      * @var DoliDB Database handler.
      */
     public $db;
-	
-	/**
-	 * @var string Error code (or message)
-	 */
-	public $error='';
+
+    /**
+     * @var string Error code (or message)
+     */
+    public $error='';
 
 
-	/**
-	 * Constructor
-	 *
-	 * @param		DoliDB		$db      Database handler
-	 */
-	public function __construct($db)
-	{
-		$this->db = $db;
-	}
+    /**
+     * Constructor
+     *
+     * @param		DoliDB		$db      Database handler
+     */
+    public function __construct($db)
+    {
+        $this->db = $db;
+    }
 
     /**
      *    Return combo list of differents status of a proposal
@@ -60,14 +60,13 @@ class FormPropal
      *    @param    string  $htmlname       Name of select field
      *    @return	void
      */
-    function selectProposalStatus($selected = '', $short = 0, $excludedraft = 0, $showempty = 1, $mode = 'customer', $htmlname = 'propal_statut')
+    public function selectProposalStatus($selected = '', $short = 0, $excludedraft = 0, $showempty = 1, $mode = 'customer', $htmlname = 'propal_statut')
     {
         global $langs;
 
         $prefix='';
         $listofstatus=array();
-        if ($mode == 'supplier')
-        {
+        if ($mode == 'supplier') {
             $prefix='SupplierProposalStatus';
 
             $langs->load("supplier_proposal");
@@ -78,9 +77,7 @@ class FormPropal
                 3=>array('id'=>3, 'code'=>'PR_NOTSIGNED'),
                 4=>array('id'=>4, 'code'=>'PR_CLOSED')
             );
-        }
-        else
-        {
+        } else {
             $prefix="PropalStatus";
 
             $sql = "SELECT id, code, label, active FROM ".MAIN_DB_PREFIX."c_propalst";
@@ -114,11 +111,11 @@ class FormPropal
         {
             if ($excludedraft)
             {
-				if ($obj['code'] == 'Draft' || $obj['code'] == 'PR_DRAFT')
-				{
-					$i++;
-					continue;
-				}
+                if ($obj['code'] == 'Draft' || $obj['code'] == 'PR_DRAFT')
+                {
+                    $i++;
+                    continue;
+                }
             }
             if ($selected != '' && $selected == $obj['id'])
             {
@@ -134,7 +131,7 @@ class FormPropal
                 print $langs->trans($prefix.$key.($short?'Short':''));
             }
             else
-			{
+            {
                 $conv_to_new_code=array('PR_DRAFT'=>'Draft','PR_OPEN'=>'Validated','PR_CLOSED'=>'Closed','PR_SIGNED'=>'Signed','PR_NOTSIGNED'=>'NotSigned','PR_FAC'=>'Billed');
                 if (! empty($conv_to_new_code[$obj['code']])) $key=$conv_to_new_code[$obj['code']];
 
diff --git a/htdocs/core/class/html.formsocialcontrib.class.php b/htdocs/core/class/html.formsocialcontrib.class.php
index c797fb77dbb..74a511ebdd5 100644
--- a/htdocs/core/class/html.formsocialcontrib.class.php
+++ b/htdocs/core/class/html.formsocialcontrib.class.php
@@ -48,7 +48,7 @@ class FormSocialContrib
 	    $this->db = $db;
 	}
 
-    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
     /**
      *  Return list of social contributions.
      *  Use mysoc->country_id or mysoc->country_code so they must be defined.
@@ -61,7 +61,7 @@ class FormSocialContrib
      *  @param	string	$morecss		Add more CSS on select
      * 	@return	void
      */
-    function select_type_socialcontrib($selected = '', $htmlname = 'actioncode', $useempty = 0, $maxlen = 40, $help = 1, $morecss = 'minwidth300')
+    public function select_type_socialcontrib($selected = '', $htmlname = 'actioncode', $useempty = 0, $maxlen = 40, $help = 1, $morecss = 'minwidth300')
     {
         // phpcs:enable
         global $conf,$db,$langs,$user,$mysoc;
diff --git a/htdocs/core/class/html.formwebsite.class.php b/htdocs/core/class/html.formwebsite.class.php
index 9ab430733e0..3cefeaef99c 100644
--- a/htdocs/core/class/html.formwebsite.class.php
+++ b/htdocs/core/class/html.formwebsite.class.php
@@ -40,7 +40,7 @@ class FormWebsite
      *
      *	@param	DoliDB		$db      Database handler
      */
-    function __construct($db)
+    public function __construct($db)
     {
         $this->db = $db;
     }
@@ -54,9 +54,9 @@ class FormWebsite
      *    @param    int		$useempty          Show empty value or not
      *    @return	string					   Html component
      */
-    function selectWebsite($selected = '', $htmlname = 'exportmodelid', $useempty = 0)
+    public function selectWebsite($selected = '', $htmlname = 'exportmodelid', $useempty = 0)
     {
-    	$out='';
+        $out='';
 
         $sql = "SELECT rowid, ref";
         $sql.= " FROM ".MAIN_DB_PREFIX."website";
@@ -107,16 +107,16 @@ class FormWebsite
      *  @param  string  $moreattrib         More attributes on HTML select tag
      * 	@return	void
      */
-    function selectTypeOfContainer($htmlname, $selected = '', $useempty = 0, $moreattrib = '')
+    public function selectTypeOfContainer($htmlname, $selected = '', $useempty = 0, $moreattrib = '')
     {
-    	global $langs, $conf, $user;
+        global $langs, $conf, $user;
 
-    	$langs->load("admin");
+        $langs->load("admin");
 
-    	$sql = "SELECT rowid, code, label, entity";
-    	$sql.= " FROM ".MAIN_DB_PREFIX.'c_type_container';
-    	$sql.= " WHERE active = 1 AND entity IN (".getEntity('c_type_container').")";
-    	$sql.= " ORDER BY label";
+        $sql = "SELECT rowid, code, label, entity";
+        $sql.= " FROM ".MAIN_DB_PREFIX.'c_type_container';
+        $sql.= " WHERE active = 1 AND entity IN (".getEntity('c_type_container').")";
+        $sql.= " ORDER BY label";
 
     	dol_syslog(get_class($this)."::selectTypeOfContainer", LOG_DEBUG);
     	$result = $this->db->query($sql);
@@ -170,7 +170,7 @@ class FormWebsite
      *  @param  string  $moreattrib         More attributes on HTML select tag
      * 	@return	void
      */
-    function selectSampleOfContainer($htmlname, $selected = '', $useempty = 0, $moreattrib = '')
+    public function selectSampleOfContainer($htmlname, $selected = '', $useempty = 0, $moreattrib = '')
     {
     	global $langs, $conf, $user;
 
diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php
index 1b07d98e7be..99020e287f4 100644
--- a/htdocs/cron/class/cronjob.class.php
+++ b/htdocs/cron/class/cronjob.class.php
@@ -691,7 +691,7 @@ class Cronjob 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)
 	{
 		$error=0;
 
@@ -1109,8 +1109,7 @@ class Cronjob extends CommonObject
 			}
 		}
 
-		if($this->jobtype == 'function')
-		{
+		if ($this->jobtype == 'function') {
 			//load lib
 			$libpath = '/' . strtolower($this->module_name) . '/lib/' . $this->libname;
 			$ret = dol_include_once($libpath);
@@ -1333,7 +1332,7 @@ class Cronjob extends CommonObject
 	    	if ($status == 1) return img_picto($langs->trans('Enabled').$moretext, 'statut'.($processing?'1':'4'), 'class="pictostatus"').' '.$langs->trans('Enabled').$moretext;
 	    	elseif ($status == 0) return img_picto($langs->trans('Disabled').$moretext, 'statut5', 'class="pictostatus"').' '.$langs->trans('Disabled').$moretext;
 	    }
-	    elseif ($mode == 5)
+        elseif ($mode == 5)
         {
             if ($status == 1) return $langs->trans('Enabled').$moretext.' '.img_picto($langs->trans('Enabled').$moretext, 'statut'.($processing?'1':'4'), 'class="pictostatus"');
             elseif ($status == 0) return $langs->trans('Disabled').$moretext.' '.img_picto($langs->trans('Disabled').$moretext, 'statut5', 'class="pictostatus"');
diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php
index 6bae79ba2cf..7ce39a43354 100644
--- a/htdocs/exports/class/export.class.php
+++ b/htdocs/exports/class/export.class.php
@@ -491,13 +491,13 @@ class Export
     }
 
     /**
-     *      Build an input field used to filter the query
-	 *
-	 *      @param		string	$TypeField		Type of Field to filter
-	 *      @return		string					html string of the input field ex : ""
-	 */
+     *  Build an input field used to filter the query
+     *
+     *  @param      string  $TypeField      Type of Field to filter
+     *  @return     string                  html string of the input field ex : ""
+     */
     public function genDocFilter($TypeField)
-	{
+    {
         global $langs;
 
 		$szMsg='';