Skip to content

Commit

Permalink
feat(register): reduce user error on extra fields
Browse files Browse the repository at this point in the history
Reduce user error on extra field input by trimming the input fields.

This partially fixes #13
  • Loading branch information
tssge committed May 21, 2019
1 parent 40f14ce commit 92cf18e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions ficoraepp.php
Expand Up @@ -492,15 +492,15 @@ protected function gatherExtraInformation($strategy)

return (object) [
'registrantType' => (int) ($this->params['additionalfields']['registrant_type'] ?? 0),
'idNumber' => $this->params['additionalfields']['idNumber'] ?? null,
'registerNumber' => $this->params['additionalfields']['registerNumber'] ?? null,
'birthdate' => $this->params['additionalfields']['birthdate'] ?? null,
'idNumber' => trim(@$this->params['additionalfields']['idNumber']),
'registerNumber' => trim(@$this->params['additionalfields']['registerNumber']),
'birthdate' => trim(@$this->params['additionalfields']['birthdate']),
];
case 1:
return (object) [
'registrantType' => $this->params['companyname'] ? 1 : 0,
'idNumber' => $this->params['customfields' . $this->params['ficora_personid_field']] ?? null,
'registerNumber' => $this->params['customfields' . $this->params['ficora_companyid_field']] ?? null,
'idNumber' => trim(@$this->params['customfields' . $this->params['ficora_personid_field']]),
'registerNumber' => trim(@$this->params['customfields' . $this->params['ficora_companyid_field']]),
'birthdate' => '1990-01-01',
];
default:
Expand Down
2 changes: 1 addition & 1 deletion hooks.php
Expand Up @@ -35,7 +35,7 @@
case '5':
case '6':
case '7':
if(!$vars['domainfield'][$key]['registerNumber']) {
if(!trim($vars['domainfield'][$key]['registerNumber'])) {
$errors[] = 'VAT/Register number is a required field for corporate bodies';
}
break;
Expand Down

0 comments on commit 92cf18e

Please sign in to comment.