trimParameters
This commit is contained in:
parent
ab0f842db6
commit
b950043618
@ -78,30 +78,17 @@ class Cchargesociales
|
|||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
|
$this->trimParameters(
|
||||||
if (isset($this->libelle)) {
|
array(
|
||||||
$this->libelle = trim($this->libelle);
|
'libelle',
|
||||||
}
|
'deductible',
|
||||||
if (isset($this->deductible)) {
|
'active',
|
||||||
$this->deductible = trim($this->deductible);
|
'code',
|
||||||
}
|
'fk_pays',
|
||||||
if (isset($this->active)) {
|
'module',
|
||||||
$this->active = trim($this->active);
|
'accountancy_code',
|
||||||
}
|
)
|
||||||
if (isset($this->code)) {
|
);
|
||||||
$this->code = trim($this->code);
|
|
||||||
}
|
|
||||||
if (isset($this->fk_pays)) {
|
|
||||||
$this->fk_pays = trim($this->fk_pays);
|
|
||||||
}
|
|
||||||
if (isset($this->module)) {
|
|
||||||
$this->module = trim($this->module);
|
|
||||||
}
|
|
||||||
if (isset($this->accountancy_code)) {
|
|
||||||
$this->accountancy_code = trim($this->accountancy_code);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
// Put here code to add control on parameters values
|
// Put here code to add control on parameters values
|
||||||
|
|||||||
@ -7324,7 +7324,7 @@ abstract class CommonObject
|
|||||||
$comment = new Comment($this->db);
|
$comment = new Comment($this->db);
|
||||||
$result=$comment->fetchAllFor($this->element, $this->id);
|
$result=$comment->fetchAllFor($this->element, $this->id);
|
||||||
if ($result<0) {
|
if ($result<0) {
|
||||||
$this->errors=array_merge($this->errors,$comment->errors);
|
$this->errors=array_merge($this->errors, $comment->errors);
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
$this->comments = $comment->comments;
|
$this->comments = $comment->comments;
|
||||||
@ -7341,4 +7341,20 @@ abstract class CommonObject
|
|||||||
{
|
{
|
||||||
return count($this->comments);
|
return count($this->comments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trim object parameters
|
||||||
|
* @param string[] $parameters array of parameters to trim
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function trimParameters($parameters)
|
||||||
|
{
|
||||||
|
if (!is_array($parameters)) return;
|
||||||
|
foreach ($parameters as $parameter) {
|
||||||
|
if (isset($this->$parameter)) {
|
||||||
|
$this->$parameter = trim($this->$parameter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user