From 4926ac1e24f8f04e5ed7d7a7bf10284390c500dc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Apr 2021 15:25:06 +0200 Subject: [PATCH] Fix make protected method not visible --- htdocs/api/class/api.class.php | 4 +++- htdocs/comm/action/class/api_agendaevents.class.php | 4 ++-- htdocs/compta/bank/class/api_bankaccounts.class.php | 4 ++-- htdocs/modulebuilder/template/class/api_mymodule.class.php | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index 6cb40825ee7..c760903aca4 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -72,6 +72,7 @@ class DolibarrApi //$this->r->setSupportedFormats('jsonFormat'); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Check and convert a string depending on its type/name. * @@ -82,8 +83,9 @@ class DolibarrApi * @param stdClass $object Object * @return string Value cleaned */ - protected function checkValForAPI($field, $value, $object) + protected function _checkValForAPI($field, $value, $object) { + // phpcs:enable // TODO Use type detected in $object->fields if (in_array($field, array('note', 'note_private', 'note_public', 'desc', 'description'))) { return checkVal($value, 'restricthtml'); diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index 68da91d6ce2..c2961db7bbb 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -217,7 +217,7 @@ class AgendaEvents extends DolibarrApi $result = $this->_validate($request_data); foreach ($request_data as $field => $value) { - $this->actioncomm->$field = $this->checkValForAPI($field, $value, $this->actioncomm); + $this->actioncomm->$field = $this->_checkValForAPI($field, $value, $this->actioncomm); } /*if (isset($request_data["lines"])) { $lines = array(); @@ -270,7 +270,7 @@ class AgendaEvents extends DolibarrApi continue; } - $this->actioncomm->$field = $this->checkValForAPI($field, $value, $this->actioncomm); + $this->actioncomm->$field = $this->_checkValForAPI($field, $value, $this->actioncomm); } if ($this->actioncomm->update(DolibarrApiAccess::$user, 1) > 0) { diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index 4afeac70124..762bcc506da 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -157,7 +157,7 @@ class BankAccounts extends DolibarrApi $account = new Account($this->db); foreach ($request_data as $field => $value) { - $account->$field = $this->checkValForAPI($field, $value, $account); + $account->$field = $this->_checkValForAPI($field, $value, $account); } // Date of the initial balance (required to create an account). $account->date_solde = time(); @@ -332,7 +332,7 @@ class BankAccounts extends DolibarrApi if ($field == 'id') { continue; } - $account->$field = $this->checkValForAPI($field, $value, $account); + $account->$field = $this->_checkValForAPI($field, $value, $account); } if ($account->update(DolibarrApiAccess::$user) > 0) { diff --git a/htdocs/modulebuilder/template/class/api_mymodule.class.php b/htdocs/modulebuilder/template/class/api_mymodule.class.php index e4b5fcca219..769c1529aff 100644 --- a/htdocs/modulebuilder/template/class/api_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/api_mymodule.class.php @@ -213,7 +213,7 @@ class MyModuleApi extends DolibarrApi $result = $this->_validate($request_data); foreach ($request_data as $field => $value) { - $this->myobject->$field = $this->checkValForAPI($field, $value, $this->myobject); + $this->myobject->$field = $this->_checkValForAPI($field, $value, $this->myobject); } // Clean data @@ -255,7 +255,7 @@ class MyModuleApi extends DolibarrApi if ($field == 'id') { continue; } - $this->myobject->$field = $this->checkValForAPI($field, $value, $this->myobject); + $this->myobject->$field = $this->_checkValForAPI($field, $value, $this->myobject); } // Clean data