From 33aba6b3d5563635599be31b1cc0ddcf2ce98abf Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Tue, 2 Jul 2013 14:35:18 +0200 Subject: [PATCH] add missing field to customerCreation field --- core/lib/Thelia/Action/Customer.php | 1 + core/lib/Thelia/Form/CustomerCreation.php | 20 ++++++++++--- core/lib/Thelia/Model/Customer.php | 25 ++++++++++++++++ templates/smarty-sample/connexion.html | 36 ++++++++++++++++++----- 4 files changed, 71 insertions(+), 11 deletions(-) diff --git a/core/lib/Thelia/Action/Customer.php b/core/lib/Thelia/Action/Customer.php index bc1a3567c..ca0ce3652 100755 --- a/core/lib/Thelia/Action/Customer.php +++ b/core/lib/Thelia/Action/Customer.php @@ -48,6 +48,7 @@ class Customer implements EventSubscriberInterface $form->bind($request); if ($form->isValid()) { + echo "ok"; exit; } else { diff --git a/core/lib/Thelia/Form/CustomerCreation.php b/core/lib/Thelia/Form/CustomerCreation.php index f03c99cc8..4edd5628e 100644 --- a/core/lib/Thelia/Form/CustomerCreation.php +++ b/core/lib/Thelia/Form/CustomerCreation.php @@ -61,12 +61,24 @@ class CustomerCreation extends BaseForm ->add("address3", "text", array( "label" => "Address Line 3" )) + ->add("phone", "text", array( + "label" => "phone" + )) + ->add("cellphone", "text", array( + "label" => "cellphone" + )) ->add("zipcode", "text", array( "constraints" => array( new Constraints\NotBlank() ), "label" => "zipcode" )) + ->add("city", "text", array( + "constraints" => array( + new Constraints\NotBlank() + ), + "label" => "city" + )) ->add("country", "text", array( "constraints" => array( new Constraints\NotBlank() @@ -79,8 +91,8 @@ class CustomerCreation extends BaseForm new Constraints\Email(), new Constraints\Callback(array( "methods" => array( - $this, - "verifyExistingEmail" + array($this, + "verifyExistingEmail") ) )) ), @@ -90,8 +102,8 @@ class CustomerCreation extends BaseForm "constraints" => array( new Constraints\Callback(array( "methods" => array( - $this, - "verifyEmailField" + array($this, + "verifyEmailField") ) )) ), diff --git a/core/lib/Thelia/Model/Customer.php b/core/lib/Thelia/Model/Customer.php index 9e9018620..885d867b0 100755 --- a/core/lib/Thelia/Model/Customer.php +++ b/core/lib/Thelia/Model/Customer.php @@ -18,5 +18,30 @@ use Thelia\Model\om\BaseCustomer; */ class Customer extends BaseCustomer { + public function create($titleId, $firstname, $lastname, $address1, $address2, $address3, $phone, $cellphone, $zipcode, $countryId, $email, $plainPassword, $reseller = 0, $sponsor = null, $discount = 0 ) + { + $this + ->setFirstname($firstname) + ->setLastname($lastname) + ->setAddress1($address1) + ->setAddress2($address2) + ->setAddress3($address3) + ->setPhone($phone) + ->setCellphone($cellphone) + ->setZipcode($zipcode) + ->setCountryId($countryId) + ->setEmail($email) + ->setPassword($plainPassword) + ->setReseller($reseller) + ->setSponsor($sponsor) + ->setDiscount($discount) + ; + } + + public function setPassword($password) + { + $this->setAlgo("PASSWORD_BCRYPT"); + return parent::setPassword(password_hash($password, PASSWORD_BCRYPT)); + } } diff --git a/templates/smarty-sample/connexion.html b/templates/smarty-sample/connexion.html index b3137152a..45ad06a3d 100644 --- a/templates/smarty-sample/connexion.html +++ b/templates/smarty-sample/connexion.html @@ -9,7 +9,7 @@ {$message} {/form_error} -
+
{/form_field} {form_field form=$form.lastname} @@ -17,7 +17,7 @@ {$message} {/form_error} -
+
{/form_field} {form_field form=$form.address1} @@ -25,7 +25,7 @@ {$message} {/form_error} -
+
{/form_field} {form_field form=$form.address2} @@ -33,7 +33,7 @@ {$message} {/form_error} -
+
{/form_field} {form_field form=$form.address3} @@ -41,7 +41,7 @@ {$message} {/form_error} -
+
{/form_field} {form_field form=$form.zipcode} @@ -49,7 +49,15 @@ {$message} {/form_error} -
+
+ {/form_field} + + {form_field form=$form.city} + {form_error form=$form.city} + {$message} + {/form_error} + +
{/form_field} {form_field form=$form.country} @@ -66,11 +74,25 @@
{/form_field} + {form_field form=$form.phone} + {form_error form=$form.phone} + {$message} + {/form_error} +
+ {/form_field} + + {form_field form=$form.cellphone} + {form_error form=$form.cellphone} + {$message} + {/form_error} +
+ {/form_field} + {form_field form=$form.email} {form_error form=$form.email} {#message} {/form_error} -
+
{/form_field} {form_field form=$form.email_confirm}