add missing field to customerCreation field

This commit is contained in:
Manuel Raynaud
2013-07-02 14:35:18 +02:00
parent e15c53625e
commit 33aba6b3d5
4 changed files with 71 additions and 11 deletions

View File

@@ -48,6 +48,7 @@ class Customer implements EventSubscriberInterface
$form->bind($request); $form->bind($request);
if ($form->isValid()) { if ($form->isValid()) {
echo "ok"; exit; echo "ok"; exit;
} else { } else {

View File

@@ -61,12 +61,24 @@ class CustomerCreation extends BaseForm
->add("address3", "text", array( ->add("address3", "text", array(
"label" => "Address Line 3" "label" => "Address Line 3"
)) ))
->add("phone", "text", array(
"label" => "phone"
))
->add("cellphone", "text", array(
"label" => "cellphone"
))
->add("zipcode", "text", array( ->add("zipcode", "text", array(
"constraints" => array( "constraints" => array(
new Constraints\NotBlank() new Constraints\NotBlank()
), ),
"label" => "zipcode" "label" => "zipcode"
)) ))
->add("city", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => "city"
))
->add("country", "text", array( ->add("country", "text", array(
"constraints" => array( "constraints" => array(
new Constraints\NotBlank() new Constraints\NotBlank()
@@ -79,8 +91,8 @@ class CustomerCreation extends BaseForm
new Constraints\Email(), new Constraints\Email(),
new Constraints\Callback(array( new Constraints\Callback(array(
"methods" => array( "methods" => array(
$this, array($this,
"verifyExistingEmail" "verifyExistingEmail")
) )
)) ))
), ),
@@ -90,8 +102,8 @@ class CustomerCreation extends BaseForm
"constraints" => array( "constraints" => array(
new Constraints\Callback(array( new Constraints\Callback(array(
"methods" => array( "methods" => array(
$this, array($this,
"verifyEmailField" "verifyEmailField")
) )
)) ))
), ),

View File

@@ -18,5 +18,30 @@ use Thelia\Model\om\BaseCustomer;
*/ */
class Customer extends 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));
}
} }

View File

@@ -9,7 +9,7 @@
{$message} {$message}
{/form_error} {/form_error}
<label> <span>{intl l="{$label}"} : </span></label><input type="text" name="{$name}" {$attr} > <br /> <label> <span>{intl l="{$label}"} : </span></label><input type="text" name="{$name}" value="{$value}" {$attr} > <br />
{/form_field} {/form_field}
{form_field form=$form.lastname} {form_field form=$form.lastname}
@@ -17,7 +17,7 @@
{$message} {$message}
{/form_error} {/form_error}
<label> <span>{intl l="{$label}"} : </span></label><input type="text" name="{$name}" {$attr} > <br /> <label> <span>{intl l="{$label}"} : </span></label><input type="text" name="{$name}" value="{$value}" {$attr} > <br />
{/form_field} {/form_field}
{form_field form=$form.address1} {form_field form=$form.address1}
@@ -25,7 +25,7 @@
{$message} {$message}
{/form_error} {/form_error}
<label> <span>{intl l="{$label}"} : </span></label><input type="text" name="{$name}" {$attr} > <br /> <label> <span>{intl l="{$label}"} : </span></label><input type="text" name="{$name}" value="{$value}" {$attr} > <br />
{/form_field} {/form_field}
{form_field form=$form.address2} {form_field form=$form.address2}
@@ -33,7 +33,7 @@
{$message} {$message}
{/form_error} {/form_error}
<label> <span>{intl l="{$label}"} : </span></label><input type="text" name="{$name}" {$attr} > <br /> <label> <span>{intl l="{$label}"} : </span></label><input type="text" name="{$name}" value="{$value}" {$attr} > <br />
{/form_field} {/form_field}
{form_field form=$form.address3} {form_field form=$form.address3}
@@ -41,7 +41,7 @@
{$message} {$message}
{/form_error} {/form_error}
<label> <span>{intl l="{$label}"} : </span></label><input type="text" name="{$name}" {$attr} > <br /> <label> <span>{intl l="{$label}"} : </span></label><input type="text" name="{$name}" value="{$value}" {$attr} > <br />
{/form_field} {/form_field}
{form_field form=$form.zipcode} {form_field form=$form.zipcode}
@@ -49,7 +49,15 @@
{$message} {$message}
{/form_error} {/form_error}
<label> <span>{intl l="{$label}"} : </span></label><input type="text" name="{$name}" {$attr} > <br /> <label> <span>{intl l="{$label}"} : </span></label><input type="text" name="{$name}" value="{$value}" {$attr} > <br />
{/form_field}
{form_field form=$form.city}
{form_error form=$form.city}
{$message}
{/form_error}
<label> <span>{intl l="{$label}"} : </span></label><input type="text" name="{$name}" value="{$value}" {$attr} > <br />
{/form_field} {/form_field}
{form_field form=$form.country} {form_field form=$form.country}
@@ -66,11 +74,25 @@
<br /> <br />
{/form_field} {/form_field}
{form_field form=$form.phone}
{form_error form=$form.phone}
{$message}
{/form_error}
<label> <span>{intl l="{$label}"} : </span></label><input type="text" name="{$name}" value="{$value}" {$attr}> <br />
{/form_field}
{form_field form=$form.cellphone}
{form_error form=$form.cellphone}
{$message}
{/form_error}
<label> <span>{intl l="{$label}"} : </span></label><input type="text" name="{$name}" value="{$value}" {$attr}> <br />
{/form_field}
{form_field form=$form.email} {form_field form=$form.email}
{form_error form=$form.email} {form_error form=$form.email}
{#message} {#message}
{/form_error} {/form_error}
<label><span>{intl l="{$label}"}</span></label><input type="email" name="{$name}" {$attr} ><br /> <label><span>{intl l="{$label}"}</span></label><input type="email" name="{$name}" value="{$value}" {$attr} ><br />
{/form_field} {/form_field}
{form_field form=$form.email_confirm} {form_field form=$form.email_confirm}