Author Topic: Company field not allowing a . (dot)  (Read 1215 times)

Offline Broem

  • Posts: 7
Company field not allowing a . (dot)
« on: September 21, 2016, 08:15:26 AM »
Here in The Netherlands some company's have a . (dot) in the name. Like B.V. (the kind of firm). Now the Bakery shop checks the Company field (when enabled) for a .

I did see a topic about the address preg_match and think it is something similar for the company field, but not sure what preg_match it should be to allow a . (dot) in the field. Found it should be somewhere in the save_form.php file.

Offline freeSbee

  • Moderator
  • ***
  • Posts: 1117
    • BAKERY - Website Baker shop module
Re: Company field not allowing a . (dot)
« Reply #1 on: September 21, 2016, 10:03:26 AM »
Hi Broem

Go to the file save_form.php about lines 93-98:
Code: [Select]
if (strpos($field, 'company') !== false) {
if (!preg_match('#^[\p{Latin}'.$us.'0-9+&\s\-]{0,50}$#u', $value)) {
$error_bg[] = $field;
$errors[]   = htmlspecialchars($value, ENT_QUOTES).' '.$MOD_BAKERY['ERR_INVAL_NAME'];
}
}

… and replace the code above by
Code: [Select]
if (strpos($field, 'company') !== false) {
if (!preg_match('#^[\p{Latin}'.$us.'0-9.+&\s\-]{0,50}$#u', $value)) {
$error_bg[] = $field;
$errors[]   = htmlspecialchars($value, ENT_QUOTES).' '.$MOD_BAKERY['ERR_INVAL_NAME'];
}
}

Regards Christoph

Offline Broem

  • Posts: 7
Re: Company field not allowing a . (dot)
« Reply #2 on: September 21, 2016, 04:22:48 PM »
Thanks, this solved the issue :)

 

postern-length