[-] FO : replace ucfirst by ucwords for the customer firstname #PSCFV-10396

This commit is contained in:
Damien Metzger
2013-09-16 11:40:29 +02:00
parent 08efa4e313
commit e68c124218
3 changed files with 9 additions and 1 deletions

View File

@@ -1260,6 +1260,13 @@ class ToolsCore
return Tools::strtoupper(Tools::substr($str, 0, 1)).Tools::substr($str, 1);
}
public static function ucwords($str)
{
if (function_exists('mb_convert_case'))
return mb_convert_case($str, MB_CASE_TITLE);
return ucwords(strtolower($str));
}
public static function orderbyPrice(&$array, $order_way)
{
foreach ($array as &$row)

View File

@@ -425,6 +425,7 @@ class AuthControllerCore extends FrontController
if (Tools::isSubmit('newsletter'))
$this->processCustomerNewsletter($customer);
$customer->firstname = Tools::ucwords($customer->firstname);
$customer->birthday = (empty($_POST['years']) ? '' : (int)$_POST['years'].'-'.(int)$_POST['months'].'-'.(int)$_POST['days']);
if (!Validate::isBirthDate($customer->birthday))
$this->errors[] = Tools::displayError('Invalid date of birth.');

View File

@@ -79,7 +79,7 @@ class IdentityControllerCore extends FrontController
if (!count($this->errors))
{
$this->customer->id_default_group = (int)$prev_id_default_group;
$this->customer->firstname = Tools::ucfirst(Tools::strtolower($this->customer->firstname));
$this->customer->firstname = Tools::ucwords($this->customer->firstname);
if (!isset($_POST['newsletter']))
$this->customer->newsletter = 0;