Cleanup :
- I made the form id different between the front and the back office - I renamed a few files to use the same convention (create / update)
This commit is contained in:
@@ -52,18 +52,27 @@
|
|||||||
</loops>
|
</loops>
|
||||||
|
|
||||||
<forms>
|
<forms>
|
||||||
|
<!-- Forms for Frontend -->
|
||||||
|
<form name="thelia.front.customer.login" class="Thelia\Form\CustomerLogin"/>
|
||||||
|
<form name="thelia.front.customer.lostpassword" class="Thelia\Form\CustomerLostPasswordForm"/>
|
||||||
|
<form name="thelia.front.customer.create" class="Thelia\Form\CustomerCreateForm"/>
|
||||||
|
<form name="thelia.front.customer.profil.update" class="Thelia\Form\CustomerProfilUpdateForm"/>
|
||||||
|
<form name="thelia.front.customer.password.update" class="Thelia\Form\CustomerPasswordUpdateForm"/>
|
||||||
|
<form name="thelia.front.address.create" class="Thelia\Form\AddressCreateForm"/>
|
||||||
|
<form name="thelia.front.address.update" class="Thelia\Form\AddressUpdateForm"/>
|
||||||
|
<form name="thelia.front.contact" class="Thelia\Form\ContactForm"/>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Forms for Admin -->
|
||||||
<form name="thelia.install.step3" class="Thelia\Form\InstallStep3Form"/>
|
<form name="thelia.install.step3" class="Thelia\Form\InstallStep3Form"/>
|
||||||
|
|
||||||
<form name="thelia.customer.creation" class="Thelia\Form\CustomerCreation"/>
|
|
||||||
<form name="thelia.customer.update" class="Thelia\Form\CustomerUpdateForm"/>
|
|
||||||
<form name="thelia.customer.modification" class="Thelia\Form\CustomerModification"/>
|
|
||||||
<form name="thelia.customer.lostpassword" class="Thelia\Form\CustomerLostPasswordForm"/>
|
|
||||||
|
|
||||||
<form name="thelia.customer.login" class="Thelia\Form\CustomerLogin"/>
|
|
||||||
<form name="thelia.admin.login" class="Thelia\Form\AdminLogin"/>
|
<form name="thelia.admin.login" class="Thelia\Form\AdminLogin"/>
|
||||||
|
|
||||||
<form name="thelia.address.create" class="Thelia\Form\AddressCreateForm" />
|
<form name="thelia.admin.customer.create" class="Thelia\Form\CustomerCreateForm"/>
|
||||||
<form name="thelia.address.update" class="Thelia\Form\AddressUpdateForm" />
|
<form name="thelia.admin.customer.update" class="Thelia\Form\CustomerUpdateForm"/>
|
||||||
|
|
||||||
|
<form name="thelia.admin.address.create" class="Thelia\Form\AddressCreateForm" />
|
||||||
|
<form name="thelia.admin.address.update" class="Thelia\Form\AddressUpdateForm" />
|
||||||
|
|
||||||
<form name="thelia.admin.category.creation" class="Thelia\Form\CategoryCreationForm"/>
|
<form name="thelia.admin.category.creation" class="Thelia\Form\CategoryCreationForm"/>
|
||||||
<form name="thelia.admin.category.modification" class="Thelia\Form\CategoryModificationForm"/>
|
<form name="thelia.admin.category.modification" class="Thelia\Form\CategoryModificationForm"/>
|
||||||
|
|||||||
@@ -22,6 +22,8 @@
|
|||||||
/*************************************************************************************/
|
/*************************************************************************************/
|
||||||
|
|
||||||
namespace Thelia\Form;
|
namespace Thelia\Form;
|
||||||
|
|
||||||
|
use Symfony\Component\Validator\Constraints;
|
||||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||||
use Thelia\Core\Translation\Translator;
|
use Thelia\Core\Translation\Translator;
|
||||||
|
|
||||||
@@ -57,115 +59,122 @@ class AddressCreateForm extends BaseForm
|
|||||||
{
|
{
|
||||||
$this->formBuilder
|
$this->formBuilder
|
||||||
->add("label", "text", array(
|
->add("label", "text", array(
|
||||||
"constraints" => array(
|
"constraints" => array(
|
||||||
new NotBlank()
|
new NotBlank()
|
||||||
),
|
),
|
||||||
"label" => Translator::getInstance()->trans("Address label"),
|
"label" => Translator::getInstance()->trans("Address label"),
|
||||||
"label_attr" => array(
|
"label_attr" => array(
|
||||||
"for" => "label_create"
|
"for" => "address_label"
|
||||||
),
|
)
|
||||||
"required" => true
|
))
|
||||||
))
|
|
||||||
->add("title", "text", array(
|
->add("title", "text", array(
|
||||||
"constraints" => array(
|
"constraints" => array(
|
||||||
new NotBlank()
|
new Constraints\NotBlank()
|
||||||
),
|
),
|
||||||
"label" => Translator::getInstance()->trans("Title"),
|
"label" => Translator::getInstance()->trans("Title"),
|
||||||
"label_attr" => array(
|
"label_attr" => array(
|
||||||
"for" => "title_create"
|
"for" => "title"
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
->add("firstname", "text", array(
|
->add("firstname", "text", array(
|
||||||
"constraints" => array(
|
"constraints" => array(
|
||||||
new NotBlank()
|
new Constraints\NotBlank()
|
||||||
),
|
),
|
||||||
"label" => Translator::getInstance()->trans("Firstname"),
|
"label" => Translator::getInstance()->trans("First Name"),
|
||||||
"label_attr" => array(
|
"label_attr" => array(
|
||||||
"for" => "firstname_create"
|
"for" => "firstname"
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
->add("lastname", "text", array(
|
->add("lastname", "text", array(
|
||||||
"constraints" => array(
|
"constraints" => array(
|
||||||
new NotBlank()
|
new Constraints\NotBlank()
|
||||||
),
|
),
|
||||||
"label" => Translator::getInstance()->trans("Lastname"),
|
"label" => Translator::getInstance()->trans("Last Name"),
|
||||||
"label_attr" => array(
|
"label_attr" => array(
|
||||||
"for" => "lastname_create"
|
"for" => "lastname"
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
->add("address1", "text", array(
|
|
||||||
"constraints" => array(
|
|
||||||
new NotBlank()
|
|
||||||
),
|
|
||||||
"label" => Translator::getInstance()->trans("Street Address"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "address1_create"
|
|
||||||
)
|
|
||||||
))
|
|
||||||
->add("address2", "text", array(
|
|
||||||
"label" => Translator::getInstance()->trans("Additional address"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "address2_create"
|
|
||||||
)
|
|
||||||
))
|
|
||||||
->add("address3", "text", array(
|
|
||||||
"label" => Translator::getInstance()->trans("Additional address"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "address3_create"
|
|
||||||
)
|
|
||||||
))
|
|
||||||
->add("zipcode", "text", array(
|
|
||||||
"constraints" => array(
|
|
||||||
new NotBlank()
|
|
||||||
),
|
|
||||||
"label" => Translator::getInstance()->trans("Zip code"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "zipcode_create"
|
|
||||||
)
|
|
||||||
))
|
|
||||||
->add("city", "text", array(
|
|
||||||
"constraints" => array(
|
|
||||||
new NotBlank()
|
|
||||||
),
|
|
||||||
"label" => Translator::getInstance()->trans("City"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "city_create"
|
|
||||||
)
|
|
||||||
))
|
|
||||||
->add("country", "text", array(
|
|
||||||
"constraints" => array(
|
|
||||||
new NotBlank()
|
|
||||||
),
|
|
||||||
"label" => Translator::getInstance()->trans("Country"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "country_create"
|
|
||||||
)
|
|
||||||
))
|
|
||||||
->add("phone", "text", array(
|
|
||||||
"label" => Translator::getInstance()->trans("Phone"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "phone_create"
|
|
||||||
)
|
|
||||||
))
|
|
||||||
->add("cellphone", "text", array(
|
|
||||||
"label" => Translator::getInstance()->trans("Cellphone"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "cellphone_create"
|
|
||||||
)
|
|
||||||
))
|
|
||||||
->add("company", "text", array(
|
->add("company", "text", array(
|
||||||
"label" => Translator::getInstance()->trans("Company"),
|
"label" => Translator::getInstance()->trans("Company Name"),
|
||||||
"label_attr" => array(
|
"label_attr" => array(
|
||||||
"for" => "company_create"
|
"for" => "company"
|
||||||
)
|
),
|
||||||
))
|
"required" => false
|
||||||
->add("is_default", "integer", array(
|
))
|
||||||
"label" => Translator::getInstance()->trans("Make this address has my primary address"),
|
->add("address1", "text", array(
|
||||||
"label_attr" => array(
|
"constraints" => array(
|
||||||
"for" => "default_address"
|
new Constraints\NotBlank()
|
||||||
)
|
),
|
||||||
))
|
"label" => Translator::getInstance()->trans("Street Address"),
|
||||||
;
|
"label_attr" => array(
|
||||||
|
"for" => "address1"
|
||||||
|
)
|
||||||
|
))
|
||||||
|
->add("address2", "text", array(
|
||||||
|
"label" => Translator::getInstance()->trans("Address Line 2"),
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "address2"
|
||||||
|
),
|
||||||
|
"required" => false
|
||||||
|
))
|
||||||
|
->add("address3", "text", array(
|
||||||
|
"label" => Translator::getInstance()->trans("Address Line 3"),
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "address3"
|
||||||
|
),
|
||||||
|
"required" => false
|
||||||
|
))
|
||||||
|
->add("city", "text", array(
|
||||||
|
"constraints" => array(
|
||||||
|
new Constraints\NotBlank()
|
||||||
|
),
|
||||||
|
"label" => Translator::getInstance()->trans("City"),
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "city"
|
||||||
|
)
|
||||||
|
))
|
||||||
|
->add("zipcode", "text", array(
|
||||||
|
"constraints" => array(
|
||||||
|
new Constraints\NotBlank()
|
||||||
|
),
|
||||||
|
"label" => Translator::getInstance()->trans("Zip code"),
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "zipcode"
|
||||||
|
)
|
||||||
|
))
|
||||||
|
->add("country", "text", array(
|
||||||
|
"constraints" => array(
|
||||||
|
new Constraints\NotBlank()
|
||||||
|
),
|
||||||
|
"label" => Translator::getInstance()->trans("Country"),
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "country"
|
||||||
|
)
|
||||||
|
))
|
||||||
|
// Phone
|
||||||
|
->add("phone", "text", array(
|
||||||
|
"label" => Translator::getInstance()->trans("Phone"),
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "phone"
|
||||||
|
),
|
||||||
|
"required" => false
|
||||||
|
))
|
||||||
|
->add("cellphone", "text", array(
|
||||||
|
"label" => Translator::getInstance()->trans("Cellphone"),
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "cellphone"
|
||||||
|
),
|
||||||
|
"required" => false
|
||||||
|
))
|
||||||
|
// Default address
|
||||||
|
->add("is_default", "checkbox", array(
|
||||||
|
"label" => Translator::getInstance()->trans("Make this address has my primary address"),
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "default_address"
|
||||||
|
),
|
||||||
|
"required" => false
|
||||||
|
))
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -22,8 +22,6 @@
|
|||||||
/*************************************************************************************/
|
/*************************************************************************************/
|
||||||
|
|
||||||
namespace Thelia\Form;
|
namespace Thelia\Form;
|
||||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
|
||||||
use Thelia\Core\Translation\Translator;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class AddressUpdateForm
|
* Class AddressUpdateForm
|
||||||
@@ -32,136 +30,11 @@ use Thelia\Core\Translation\Translator;
|
|||||||
*/
|
*/
|
||||||
class AddressUpdateForm extends AddressCreateForm
|
class AddressUpdateForm extends AddressCreateForm
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
*
|
|
||||||
* in this function you add all the fields you need for your Form.
|
|
||||||
* Form this you have to call add method on $this->formBuilder attribute :
|
|
||||||
*
|
|
||||||
* $this->formBuilder->add("name", "text")
|
|
||||||
* ->add("email", "email", array(
|
|
||||||
* "attr" => array(
|
|
||||||
* "class" => "field"
|
|
||||||
* ),
|
|
||||||
* "label" => "email",
|
|
||||||
* "constraints" => array(
|
|
||||||
* new \Symfony\Component\Validator\Constraints\NotBlank()
|
|
||||||
* )
|
|
||||||
* )
|
|
||||||
* )
|
|
||||||
* ->add('age', 'integer');
|
|
||||||
*
|
|
||||||
* @return null
|
|
||||||
*/
|
|
||||||
protected function buildForm()
|
protected function buildForm()
|
||||||
{
|
{
|
||||||
parent::buildForm();
|
parent::buildForm();
|
||||||
|
|
||||||
$this->formBuilder
|
|
||||||
->add("label", "text", array(
|
|
||||||
"constraints" => array(
|
|
||||||
new NotBlank()
|
|
||||||
),
|
|
||||||
"label" => Translator::getInstance()->trans("Address label *"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "label_update"
|
|
||||||
),
|
|
||||||
"required" => true
|
|
||||||
))
|
|
||||||
->add("title", "text", array(
|
|
||||||
"constraints" => array(
|
|
||||||
new NotBlank()
|
|
||||||
),
|
|
||||||
"label" => Translator::getInstance()->trans("Title"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "title_update"
|
|
||||||
)
|
|
||||||
))
|
|
||||||
->add("firstname", "text", array(
|
|
||||||
"constraints" => array(
|
|
||||||
new NotBlank()
|
|
||||||
),
|
|
||||||
"label" => Translator::getInstance()->trans("Firstname"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "firstname_update"
|
|
||||||
)
|
|
||||||
))
|
|
||||||
->add("lastname", "text", array(
|
|
||||||
"constraints" => array(
|
|
||||||
new NotBlank()
|
|
||||||
),
|
|
||||||
"label" => Translator::getInstance()->trans("Lastname"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "lastname_update"
|
|
||||||
)
|
|
||||||
))
|
|
||||||
->add("address1", "text", array(
|
|
||||||
"constraints" => array(
|
|
||||||
new NotBlank()
|
|
||||||
),
|
|
||||||
"label" => Translator::getInstance()->trans("Street Address"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "address1_update"
|
|
||||||
)
|
|
||||||
))
|
|
||||||
->add("address2", "text", array(
|
|
||||||
"label" => Translator::getInstance()->trans("Additional address"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "address2_update"
|
|
||||||
)
|
|
||||||
))
|
|
||||||
->add("address3", "text", array(
|
|
||||||
"label" => Translator::getInstance()->trans("Additional address"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "address3_update"
|
|
||||||
)
|
|
||||||
))
|
|
||||||
->add("zipcode", "text", array(
|
|
||||||
"constraints" => array(
|
|
||||||
new NotBlank()
|
|
||||||
),
|
|
||||||
"label" => Translator::getInstance()->trans("Zip code"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "zipcode_update"
|
|
||||||
)
|
|
||||||
))
|
|
||||||
->add("city", "text", array(
|
|
||||||
"constraints" => array(
|
|
||||||
new NotBlank()
|
|
||||||
),
|
|
||||||
"label" => Translator::getInstance()->trans("City"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "city_update"
|
|
||||||
)
|
|
||||||
))
|
|
||||||
->add("country", "text", array(
|
|
||||||
"constraints" => array(
|
|
||||||
new NotBlank()
|
|
||||||
),
|
|
||||||
"label" => Translator::getInstance()->trans("Country"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "country_update"
|
|
||||||
)
|
|
||||||
))
|
|
||||||
->add("phone", "text", array(
|
|
||||||
"label" => Translator::getInstance()->trans("Phone"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "phone_update"
|
|
||||||
)
|
|
||||||
))
|
|
||||||
->add("cellphone", "text", array(
|
|
||||||
"label" => Translator::getInstance()->trans("Cellphone"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "cellphone_update"
|
|
||||||
)
|
|
||||||
))
|
|
||||||
->add("company", "text", array(
|
|
||||||
"label" => Translator::getInstance()->trans("Compagny"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "company_update"
|
|
||||||
)
|
|
||||||
))
|
|
||||||
;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -23,51 +23,32 @@
|
|||||||
namespace Thelia\Form;
|
namespace Thelia\Form;
|
||||||
|
|
||||||
use Symfony\Component\Validator\Constraints;
|
use Symfony\Component\Validator\Constraints;
|
||||||
|
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||||
use Symfony\Component\Validator\ExecutionContextInterface;
|
use Symfony\Component\Validator\ExecutionContextInterface;
|
||||||
use Thelia\Model\ConfigQuery;
|
use Thelia\Model\ConfigQuery;
|
||||||
use Thelia\Model\CustomerQuery;
|
use Thelia\Model\CustomerQuery;
|
||||||
use Thelia\Core\Translation\Translator;
|
use Thelia\Core\Translation\Translator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CustomerCreation
|
* Class CustomerCreateForm
|
||||||
* @package Thelia\Form
|
* @package Thelia\Form
|
||||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||||
*/
|
*/
|
||||||
class CustomerCreation extends BaseForm
|
class CustomerCreateForm extends AddressCreateForm
|
||||||
{
|
{
|
||||||
|
|
||||||
protected function buildForm()
|
protected function buildForm()
|
||||||
{
|
{
|
||||||
|
parent::buildForm();
|
||||||
|
|
||||||
$this->formBuilder
|
$this->formBuilder
|
||||||
|
// Remove From Address create form
|
||||||
|
->remove("label")
|
||||||
|
->remove("is_default")
|
||||||
|
|
||||||
|
// Add
|
||||||
->add("auto_login", "integer")
|
->add("auto_login", "integer")
|
||||||
// Personal Informations
|
// Add Email address
|
||||||
->add("title", "text", array(
|
|
||||||
"constraints" => array(
|
|
||||||
new Constraints\NotBlank()
|
|
||||||
),
|
|
||||||
"label" => Translator::getInstance()->trans("Title"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "title"
|
|
||||||
)
|
|
||||||
))
|
|
||||||
->add("firstname", "text", array(
|
|
||||||
"constraints" => array(
|
|
||||||
new Constraints\NotBlank()
|
|
||||||
),
|
|
||||||
"label" => Translator::getInstance()->trans("First Name"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "firstname"
|
|
||||||
)
|
|
||||||
))
|
|
||||||
->add("lastname", "text", array(
|
|
||||||
"constraints" => array(
|
|
||||||
new Constraints\NotBlank()
|
|
||||||
),
|
|
||||||
"label" => Translator::getInstance()->trans("Last Name"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "lastname"
|
|
||||||
)
|
|
||||||
))
|
|
||||||
->add("email", "email", array(
|
->add("email", "email", array(
|
||||||
"constraints" => array(
|
"constraints" => array(
|
||||||
new Constraints\NotBlank(),
|
new Constraints\NotBlank(),
|
||||||
@@ -84,90 +65,7 @@ class CustomerCreation extends BaseForm
|
|||||||
"for" => "email"
|
"for" => "email"
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
/* ->add("email_confirm", "email", array(
|
// Add Login Information
|
||||||
"constraints" => array(
|
|
||||||
new Constraints\Callback(array(
|
|
||||||
"methods" => array(
|
|
||||||
array($this,
|
|
||||||
"verifyEmailField")
|
|
||||||
)
|
|
||||||
))
|
|
||||||
),
|
|
||||||
"label" => "email confirmation"
|
|
||||||
))*/
|
|
||||||
->add("phone", "text", array(
|
|
||||||
"label" => Translator::getInstance()->trans("Phone"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "phone"
|
|
||||||
),
|
|
||||||
"required" => false
|
|
||||||
))
|
|
||||||
->add("cellphone", "text", array(
|
|
||||||
"label" => Translator::getInstance()->trans("Cellphone"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "cellphone"
|
|
||||||
),
|
|
||||||
"required" => false
|
|
||||||
))
|
|
||||||
// Delivery Informations
|
|
||||||
->add("company", "text", array(
|
|
||||||
"label" => Translator::getInstance()->trans("Company Name"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "company"
|
|
||||||
),
|
|
||||||
"required" => false
|
|
||||||
))
|
|
||||||
->add("address1", "text", array(
|
|
||||||
"constraints" => array(
|
|
||||||
new Constraints\NotBlank()
|
|
||||||
),
|
|
||||||
"label" => Translator::getInstance()->trans("Street Address"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "address1"
|
|
||||||
)
|
|
||||||
))
|
|
||||||
->add("address2", "text", array(
|
|
||||||
"label" => Translator::getInstance()->trans("Address Line 2"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "address2"
|
|
||||||
),
|
|
||||||
"required" => false
|
|
||||||
))
|
|
||||||
->add("address3", "text", array(
|
|
||||||
"label" => Translator::getInstance()->trans("Address Line 3"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "address3"
|
|
||||||
),
|
|
||||||
"required" => false
|
|
||||||
))
|
|
||||||
->add("city", "text", array(
|
|
||||||
"constraints" => array(
|
|
||||||
new Constraints\NotBlank()
|
|
||||||
),
|
|
||||||
"label" => Translator::getInstance()->trans("City"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "city"
|
|
||||||
)
|
|
||||||
))
|
|
||||||
->add("zipcode", "text", array(
|
|
||||||
"constraints" => array(
|
|
||||||
new Constraints\NotBlank()
|
|
||||||
),
|
|
||||||
"label" => Translator::getInstance()->trans("Zip code"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "zipcode"
|
|
||||||
)
|
|
||||||
))
|
|
||||||
->add("country", "text", array(
|
|
||||||
"constraints" => array(
|
|
||||||
new Constraints\NotBlank()
|
|
||||||
),
|
|
||||||
"label" => Translator::getInstance()->trans("Country"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "country"
|
|
||||||
)
|
|
||||||
))
|
|
||||||
// Login Information
|
|
||||||
->add("password", "password", array(
|
->add("password", "password", array(
|
||||||
"constraints" => array(
|
"constraints" => array(
|
||||||
new Constraints\NotBlank(),
|
new Constraints\NotBlank(),
|
||||||
@@ -191,6 +89,7 @@ class CustomerCreation extends BaseForm
|
|||||||
"for" => "password_confirmation"
|
"for" => "password_confirmation"
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
|
// Add terms & conditions
|
||||||
->add("agreed", "checkbox", array(
|
->add("agreed", "checkbox", array(
|
||||||
"constraints" => array(
|
"constraints" => array(
|
||||||
new Constraints\True(array("message" => "Please accept the Terms and conditions in order to register."))
|
new Constraints\True(array("message" => "Please accept the Terms and conditions in order to register."))
|
||||||
@@ -206,16 +105,7 @@ class CustomerCreation extends BaseForm
|
|||||||
$data = $context->getRoot()->getData();
|
$data = $context->getRoot()->getData();
|
||||||
|
|
||||||
if ($data["password"] != $data["password_confirm"]) {
|
if ($data["password"] != $data["password_confirm"]) {
|
||||||
$context->addViolation("password confirmation is not the same as password field");
|
$context->addViolation("password confirmation is not the same as password field.");
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function verifyEmailField($value, ExecutionContextInterface $context)
|
|
||||||
{
|
|
||||||
$data = $context->getRoot()->getData();
|
|
||||||
|
|
||||||
if ($data["email"] != $data["email_confirm"]) {
|
|
||||||
$context->addViolation("email confirmation is not the same as email field");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -223,12 +113,12 @@ class CustomerCreation extends BaseForm
|
|||||||
{
|
{
|
||||||
$customer = CustomerQuery::create()->findOneByEmail($value);
|
$customer = CustomerQuery::create()->findOneByEmail($value);
|
||||||
if ($customer) {
|
if ($customer) {
|
||||||
$context->addViolation("This email already exists");
|
$context->addViolation("This email already exists.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName()
|
public function getName()
|
||||||
{
|
{
|
||||||
return "thelia_customer_creation";
|
return "thelia_customer_create";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -22,6 +22,8 @@
|
|||||||
/*************************************************************************************/
|
/*************************************************************************************/
|
||||||
namespace Thelia\Form;
|
namespace Thelia\Form;
|
||||||
|
|
||||||
|
use Symfony\Component\Form\FormInterface;
|
||||||
|
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
||||||
use Symfony\Component\Validator\Constraints;
|
use Symfony\Component\Validator\Constraints;
|
||||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||||
use Symfony\Component\Validator\Constraints\Email;
|
use Symfony\Component\Validator\Constraints\Email;
|
||||||
@@ -56,13 +58,13 @@ class CustomerLogin extends BaseForm
|
|||||||
)
|
)
|
||||||
))
|
))
|
||||||
->add("account", "choice", array(
|
->add("account", "choice", array(
|
||||||
"constraints" => array(
|
/*"constraints" => array(
|
||||||
new Constraints\Callback(array(
|
new Constraints\Callback(array(
|
||||||
"methods" => array(
|
"methods" => array(
|
||||||
array($this, "verifyAccount")
|
array($this, "verifyAccount")
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
),
|
),*/
|
||||||
"choices" => array(
|
"choices" => array(
|
||||||
0 => Translator::getInstance()->trans("No, I am a new customer."),
|
0 => Translator::getInstance()->trans("No, I am a new customer."),
|
||||||
1 => Translator::getInstance()->trans("Yes, I have a password :")
|
1 => Translator::getInstance()->trans("Yes, I have a password :")
|
||||||
@@ -70,12 +72,21 @@ class CustomerLogin extends BaseForm
|
|||||||
"label_attr" => array(
|
"label_attr" => array(
|
||||||
"for" => "account"
|
"for" => "account"
|
||||||
),
|
),
|
||||||
"data" => 0
|
"data" => 0,
|
||||||
|
'validation_groups' => function(FormInterface $form) {
|
||||||
|
$account = $form->getData();
|
||||||
|
if ($account === 1)
|
||||||
|
return 'existing_customer';
|
||||||
|
else
|
||||||
|
return 'Default';
|
||||||
|
}
|
||||||
))
|
))
|
||||||
->add("password", "password", array(
|
->add("password", "password", array(
|
||||||
/*"constraints" => array(
|
"constraints" => array(
|
||||||
new Constraints\NotBlank()
|
new Constraints\NotBlank(array(
|
||||||
),*/
|
'groups' => array('existing_customer'),
|
||||||
|
))
|
||||||
|
),
|
||||||
"label" => Translator::getInstance()->trans("Please enter your password"),
|
"label" => Translator::getInstance()->trans("Please enter your password"),
|
||||||
"label_attr" => array(
|
"label_attr" => array(
|
||||||
"for" => "password"
|
"for" => "password"
|
||||||
@@ -120,6 +131,26 @@ class CustomerLogin extends BaseForm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
||||||
|
{
|
||||||
|
$resolver->setDefaults(array(
|
||||||
|
//'cascade_validation' => true,
|
||||||
|
// 'csrf_protection' => true,
|
||||||
|
//'csrf_field_name' => '_token',
|
||||||
|
'validation_groups' => function(FormInterface $form) {
|
||||||
|
$data = $form->getData();
|
||||||
|
if ($data->getAccount() == 1)
|
||||||
|
return array('Default', 'existing_customer');
|
||||||
|
else
|
||||||
|
return 'Default';
|
||||||
|
}
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
public function getName()
|
public function getName()
|
||||||
{
|
{
|
||||||
return "thelia_customer_login";
|
return "thelia_customer_login";
|
||||||
|
|||||||
@@ -1,164 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*************************************************************************************/
|
|
||||||
/* */
|
|
||||||
/* Thelia */
|
|
||||||
/* */
|
|
||||||
/* Copyright (c) OpenStudio */
|
|
||||||
/* email : info@thelia.net */
|
|
||||||
/* web : http://www.thelia.net */
|
|
||||||
/* */
|
|
||||||
/* This program is free software; you can redistribute it and/or modify */
|
|
||||||
/* it under the terms of the GNU General Public License as published by */
|
|
||||||
/* the Free Software Foundation; either version 3 of the License */
|
|
||||||
/* */
|
|
||||||
/* This program is distributed in the hope that it will be useful, */
|
|
||||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
|
||||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
|
||||||
/* GNU General Public License for more details. */
|
|
||||||
/* */
|
|
||||||
/* You should have received a copy of the GNU General Public License */
|
|
||||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
||||||
/* */
|
|
||||||
/*************************************************************************************/
|
|
||||||
|
|
||||||
namespace Thelia\Form;
|
|
||||||
|
|
||||||
use Symfony\Component\Validator\Constraints;
|
|
||||||
use Thelia\Core\Translation\Translator;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class CustomerModification
|
|
||||||
* @package Thelia\Form
|
|
||||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
|
||||||
*/
|
|
||||||
class CustomerModification extends BaseForm
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* in this function you add all the fields you need for your Form.
|
|
||||||
* Form this you have to call add method on $this->form attribute :
|
|
||||||
*
|
|
||||||
* $this->form->add("name", "text")
|
|
||||||
* ->add("email", "email", array(
|
|
||||||
* "attr" => array(
|
|
||||||
* "class" => "field"
|
|
||||||
* ),
|
|
||||||
* "label" => "email",
|
|
||||||
* "constraints" => array(
|
|
||||||
* new NotBlank()
|
|
||||||
* )
|
|
||||||
* )
|
|
||||||
* )
|
|
||||||
* ->add('age', 'integer');
|
|
||||||
*
|
|
||||||
* @return null
|
|
||||||
*/
|
|
||||||
protected function buildForm()
|
|
||||||
{
|
|
||||||
|
|
||||||
$this->formBuilder
|
|
||||||
->add('update_logged_in_user', 'integer') // In a front office context, update the in-memory logged-in user data
|
|
||||||
->add("company", "text", array(
|
|
||||||
"label" => Translator::getInstance()->trans("Company"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "company"
|
|
||||||
)
|
|
||||||
))
|
|
||||||
->add("firstname", "text", array(
|
|
||||||
"constraints" => array(
|
|
||||||
new Constraints\NotBlank()
|
|
||||||
),
|
|
||||||
"label" => Translator::getInstance()->trans("First Name"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "firstname"
|
|
||||||
)
|
|
||||||
))
|
|
||||||
->add("lastname", "text", array(
|
|
||||||
"constraints" => array(
|
|
||||||
new Constraints\NotBlank()
|
|
||||||
),
|
|
||||||
"label" => Translator::getInstance()->trans("Last Name"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "lastname"
|
|
||||||
)
|
|
||||||
))
|
|
||||||
->add("address1", "text", array(
|
|
||||||
"constraints" => array(
|
|
||||||
new Constraints\NotBlank()
|
|
||||||
),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "address"
|
|
||||||
),
|
|
||||||
"label" => Translator::getInstance()->trans("Street Address")
|
|
||||||
))
|
|
||||||
->add("address2", "text", array(
|
|
||||||
"label" => Translator::getInstance()->trans("Address Line 2"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "address2"
|
|
||||||
)
|
|
||||||
))
|
|
||||||
->add("address3", "text", array(
|
|
||||||
"label" => Translator::getInstance()->trans("Address Line 3"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "address3"
|
|
||||||
)
|
|
||||||
))
|
|
||||||
->add("phone", "text", array(
|
|
||||||
"label" => Translator::getInstance()->trans("Phone"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "phone"
|
|
||||||
)
|
|
||||||
))
|
|
||||||
->add("cellphone", "text", array(
|
|
||||||
"label" => Translator::getInstance()->trans("Cellphone"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "cellphone"
|
|
||||||
)
|
|
||||||
))
|
|
||||||
->add("zipcode", "text", array(
|
|
||||||
"constraints" => array(
|
|
||||||
new Constraints\NotBlank()
|
|
||||||
),
|
|
||||||
"label" => Translator::getInstance()->trans("Zip code"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "zipcode"
|
|
||||||
)
|
|
||||||
))
|
|
||||||
->add("city", "text", array(
|
|
||||||
"constraints" => array(
|
|
||||||
new Constraints\NotBlank()
|
|
||||||
),
|
|
||||||
"label" => Translator::getInstance()->trans("City"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "city"
|
|
||||||
)
|
|
||||||
))
|
|
||||||
->add("country", "text", array(
|
|
||||||
"constraints" => array(
|
|
||||||
new Constraints\NotBlank()
|
|
||||||
),
|
|
||||||
"label" => Translator::getInstance()->trans("Country"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "country"
|
|
||||||
)
|
|
||||||
))
|
|
||||||
->add("title", "text", array(
|
|
||||||
"constraints" => array(
|
|
||||||
new Constraints\NotBlank()
|
|
||||||
),
|
|
||||||
"label" => Translator::getInstance()->trans("Title"),
|
|
||||||
"label_attr" => array(
|
|
||||||
"for" => "title"
|
|
||||||
)
|
|
||||||
))
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string the name of you form. This name must be unique
|
|
||||||
*/
|
|
||||||
public function getName()
|
|
||||||
{
|
|
||||||
return "thelia_customer_modification";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
99
core/lib/Thelia/Form/CustomerPasswordUpdateForm.php
Executable file
99
core/lib/Thelia/Form/CustomerPasswordUpdateForm.php
Executable file
@@ -0,0 +1,99 @@
|
|||||||
|
<?php
|
||||||
|
/*************************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* Thelia */
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) OpenStudio */
|
||||||
|
/* email : info@thelia.net */
|
||||||
|
/* web : http://www.thelia.net */
|
||||||
|
/* */
|
||||||
|
/* This program is free software; you can redistribute it and/or modify */
|
||||||
|
/* it under the terms of the GNU General Public License as published by */
|
||||||
|
/* the Free Software Foundation; either version 3 of the License */
|
||||||
|
/* */
|
||||||
|
/* This program is distributed in the hope that it will be useful, */
|
||||||
|
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||||
|
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||||
|
/* GNU General Public License for more details. */
|
||||||
|
/* */
|
||||||
|
/* You should have received a copy of the GNU General Public License */
|
||||||
|
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
/* */
|
||||||
|
/*************************************************************************************/
|
||||||
|
namespace Thelia\Form;
|
||||||
|
|
||||||
|
use Symfony\Component\Validator\Constraints;
|
||||||
|
use Symfony\Component\Validator\ExecutionContextInterface;
|
||||||
|
use Thelia\Model\ConfigQuery;
|
||||||
|
use Thelia\Model\CustomerQuery;
|
||||||
|
use Thelia\Core\Translation\Translator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class CustomerPasswordUpdateForm
|
||||||
|
* @package Thelia\Form
|
||||||
|
* @author Christophe Laffont <claffont@openstudio.fr>
|
||||||
|
*/
|
||||||
|
class CustomerPasswordUpdateForm extends BaseForm
|
||||||
|
{
|
||||||
|
|
||||||
|
protected function buildForm()
|
||||||
|
{
|
||||||
|
$this->formBuilder
|
||||||
|
|
||||||
|
// Login Information
|
||||||
|
->add("password_old", "password", array(
|
||||||
|
"constraints" => array(
|
||||||
|
new Constraints\NotBlank(),
|
||||||
|
new Constraints\Callback(array("methods" => array(
|
||||||
|
array($this, "verifyCurrentPasswordField")
|
||||||
|
)))
|
||||||
|
),
|
||||||
|
"label" => Translator::getInstance()->trans("Current Password"),
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "password_old"
|
||||||
|
)
|
||||||
|
))
|
||||||
|
->add("password", "password", array(
|
||||||
|
"constraints" => array(
|
||||||
|
new Constraints\NotBlank(),
|
||||||
|
new Constraints\Length(array("min" => ConfigQuery::read("password.length", 4)))
|
||||||
|
),
|
||||||
|
"label" => Translator::getInstance()->trans("New Password"),
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "password"
|
||||||
|
)
|
||||||
|
))
|
||||||
|
->add("password_confirm", "password", array(
|
||||||
|
"constraints" => array(
|
||||||
|
new Constraints\NotBlank(),
|
||||||
|
new Constraints\Length(array("min" => ConfigQuery::read("password.length", 4))),
|
||||||
|
new Constraints\Callback(array("methods" => array(
|
||||||
|
array($this, "verifyPasswordField")
|
||||||
|
)))
|
||||||
|
),
|
||||||
|
"label" => "Password confirmation",
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "password_confirmation"
|
||||||
|
)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function verifyCurrentPasswordField($value, ExecutionContextInterface $context)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function verifyPasswordField($value, ExecutionContextInterface $context)
|
||||||
|
{
|
||||||
|
$data = $context->getRoot()->getData();
|
||||||
|
|
||||||
|
if ($data["password"] != $data["password_confirm"]) {
|
||||||
|
$context->addViolation("password confirmation is not the same as password field.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return "thelia_customer_password_update";
|
||||||
|
}
|
||||||
|
}
|
||||||
71
core/lib/Thelia/Form/CustomerProfilUpdateForm.php
Executable file
71
core/lib/Thelia/Form/CustomerProfilUpdateForm.php
Executable file
@@ -0,0 +1,71 @@
|
|||||||
|
<?php
|
||||||
|
/*************************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* Thelia */
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) OpenStudio */
|
||||||
|
/* email : info@thelia.net */
|
||||||
|
/* web : http://www.thelia.net */
|
||||||
|
/* */
|
||||||
|
/* This program is free software; you can redistribute it and/or modify */
|
||||||
|
/* it under the terms of the GNU General Public License as published by */
|
||||||
|
/* the Free Software Foundation; either version 3 of the License */
|
||||||
|
/* */
|
||||||
|
/* This program is distributed in the hope that it will be useful, */
|
||||||
|
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||||
|
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||||
|
/* GNU General Public License for more details. */
|
||||||
|
/* */
|
||||||
|
/* You should have received a copy of the GNU General Public License */
|
||||||
|
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
/* */
|
||||||
|
/*************************************************************************************/
|
||||||
|
namespace Thelia\Form;
|
||||||
|
|
||||||
|
use Symfony\Component\Validator\Constraints;
|
||||||
|
use Thelia\Model\ConfigQuery;
|
||||||
|
use Thelia\Core\Translation\Translator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class CustomerProfilUpdateForm
|
||||||
|
* @package Thelia\Form
|
||||||
|
* @author Christophe Laffont <claffont@openstudio.fr>
|
||||||
|
*/
|
||||||
|
class CustomerProfilUpdateForm extends CustomerCreateForm
|
||||||
|
{
|
||||||
|
|
||||||
|
protected function buildForm()
|
||||||
|
{
|
||||||
|
parent::buildForm();
|
||||||
|
|
||||||
|
$this->formBuilder
|
||||||
|
->remove("auto_login")
|
||||||
|
// Remove From Personal Informations
|
||||||
|
->remove("phone")
|
||||||
|
->remove("cellphone")
|
||||||
|
// Remove Delivery Informations
|
||||||
|
->remove("company")
|
||||||
|
->remove("address1")
|
||||||
|
->remove("address2")
|
||||||
|
->remove("address3")
|
||||||
|
->remove("city")
|
||||||
|
->remove("zipcode")
|
||||||
|
->remove("country")
|
||||||
|
// Remove Terms & conditions
|
||||||
|
->remove("agreed")
|
||||||
|
|
||||||
|
// Add Newsletter
|
||||||
|
->add("newsletter", "checkbox", array(
|
||||||
|
"label" => "I would like to receive the newsletter our the latest news.",
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "newsletter"
|
||||||
|
),
|
||||||
|
"required" => false
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return "thelia_customer_profil_update";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
/*************************************************************************************/
|
/*************************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* Thelia */
|
/* Thelia */
|
||||||
/* */
|
/* */
|
||||||
/* Copyright (c) OpenStudio */
|
/* Copyright (c) OpenStudio */
|
||||||
/* email : info@thelia.net */
|
/* email : info@thelia.net */
|
||||||
/* web : http://www.thelia.net */
|
/* web : http://www.thelia.net */
|
||||||
/* */
|
/* */
|
||||||
/* This program is free software; you can redistribute it and/or modify */
|
/* This program is free software; you can redistribute it and/or modify */
|
||||||
@@ -17,57 +17,146 @@
|
|||||||
/* GNU General Public License for more details. */
|
/* GNU General Public License for more details. */
|
||||||
/* */
|
/* */
|
||||||
/* You should have received a copy of the GNU General Public License */
|
/* You should have received a copy of the GNU General Public License */
|
||||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
/* */
|
/* */
|
||||||
/*************************************************************************************/
|
/*************************************************************************************/
|
||||||
|
|
||||||
namespace Thelia\Form;
|
namespace Thelia\Form;
|
||||||
|
|
||||||
use Symfony\Component\Validator\Constraints;
|
use Symfony\Component\Validator\Constraints;
|
||||||
use Thelia\Model\ConfigQuery;
|
|
||||||
use Thelia\Core\Translation\Translator;
|
use Thelia\Core\Translation\Translator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CustomerUpdateForm
|
* Class CustomerUpdateForm
|
||||||
* @package Thelia\Form
|
* @package Thelia\Form
|
||||||
* @author Christophe Laffont <claffont@openstudio.fr>
|
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||||
*/
|
*/
|
||||||
class CustomerUpdateForm extends CustomerCreation
|
class CustomerUpdateForm extends BaseForm
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* in this function you add all the fields you need for your Form.
|
||||||
|
* Form this you have to call add method on $this->form attribute :
|
||||||
|
*
|
||||||
|
* $this->form->add("name", "text")
|
||||||
|
* ->add("email", "email", array(
|
||||||
|
* "attr" => array(
|
||||||
|
* "class" => "field"
|
||||||
|
* ),
|
||||||
|
* "label" => "email",
|
||||||
|
* "constraints" => array(
|
||||||
|
* new NotBlank()
|
||||||
|
* )
|
||||||
|
* )
|
||||||
|
* )
|
||||||
|
* ->add('age', 'integer');
|
||||||
|
*
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
protected function buildForm()
|
protected function buildForm()
|
||||||
{
|
{
|
||||||
parent::buildForm();
|
|
||||||
|
|
||||||
|
|
||||||
$this->formBuilder
|
$this->formBuilder
|
||||||
->remove("auto_login")
|
->add('update_logged_in_user', 'integer') // In a front office context, update the in-memory logged-in user data
|
||||||
// Remove From Personal Informations
|
->add("company", "text", array(
|
||||||
->remove("phone")
|
"label" => Translator::getInstance()->trans("Company"),
|
||||||
->remove("cellphone")
|
|
||||||
// Remove Delivery Informations
|
|
||||||
->remove("company")
|
|
||||||
->remove("address1")
|
|
||||||
->remove("address2")
|
|
||||||
->remove("address3")
|
|
||||||
->remove("city")
|
|
||||||
->remove("zipcode")
|
|
||||||
->remove("country")
|
|
||||||
// Remove Login Information
|
|
||||||
->remove("password")
|
|
||||||
->remove("password_confirm")
|
|
||||||
// Remove Terms & conditions
|
|
||||||
->remove("agreed")
|
|
||||||
|
|
||||||
// Add Newsletter
|
|
||||||
->add("newsletter", "checkbox", array(
|
|
||||||
"label" => "I would like to receive the newsletter our the latest news.",
|
|
||||||
"label_attr" => array(
|
"label_attr" => array(
|
||||||
"for" => "newsletter"
|
"for" => "company"
|
||||||
|
)
|
||||||
|
))
|
||||||
|
->add("firstname", "text", array(
|
||||||
|
"constraints" => array(
|
||||||
|
new Constraints\NotBlank()
|
||||||
),
|
),
|
||||||
"required" => false
|
"label" => Translator::getInstance()->trans("First Name"),
|
||||||
));
|
"label_attr" => array(
|
||||||
|
"for" => "firstname"
|
||||||
|
)
|
||||||
|
))
|
||||||
|
->add("lastname", "text", array(
|
||||||
|
"constraints" => array(
|
||||||
|
new Constraints\NotBlank()
|
||||||
|
),
|
||||||
|
"label" => Translator::getInstance()->trans("Last Name"),
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "lastname"
|
||||||
|
)
|
||||||
|
))
|
||||||
|
->add("address1", "text", array(
|
||||||
|
"constraints" => array(
|
||||||
|
new Constraints\NotBlank()
|
||||||
|
),
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "address"
|
||||||
|
),
|
||||||
|
"label" => Translator::getInstance()->trans("Street Address")
|
||||||
|
))
|
||||||
|
->add("address2", "text", array(
|
||||||
|
"label" => Translator::getInstance()->trans("Address Line 2"),
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "address2"
|
||||||
|
)
|
||||||
|
))
|
||||||
|
->add("address3", "text", array(
|
||||||
|
"label" => Translator::getInstance()->trans("Address Line 3"),
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "address3"
|
||||||
|
)
|
||||||
|
))
|
||||||
|
->add("phone", "text", array(
|
||||||
|
"label" => Translator::getInstance()->trans("Phone"),
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "phone"
|
||||||
|
)
|
||||||
|
))
|
||||||
|
->add("cellphone", "text", array(
|
||||||
|
"label" => Translator::getInstance()->trans("Cellphone"),
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "cellphone"
|
||||||
|
)
|
||||||
|
))
|
||||||
|
->add("zipcode", "text", array(
|
||||||
|
"constraints" => array(
|
||||||
|
new Constraints\NotBlank()
|
||||||
|
),
|
||||||
|
"label" => Translator::getInstance()->trans("Zip code"),
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "zipcode"
|
||||||
|
)
|
||||||
|
))
|
||||||
|
->add("city", "text", array(
|
||||||
|
"constraints" => array(
|
||||||
|
new Constraints\NotBlank()
|
||||||
|
),
|
||||||
|
"label" => Translator::getInstance()->trans("City"),
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "city"
|
||||||
|
)
|
||||||
|
))
|
||||||
|
->add("country", "text", array(
|
||||||
|
"constraints" => array(
|
||||||
|
new Constraints\NotBlank()
|
||||||
|
),
|
||||||
|
"label" => Translator::getInstance()->trans("Country"),
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "country"
|
||||||
|
)
|
||||||
|
))
|
||||||
|
->add("title", "text", array(
|
||||||
|
"constraints" => array(
|
||||||
|
new Constraints\NotBlank()
|
||||||
|
),
|
||||||
|
"label" => Translator::getInstance()->trans("Title"),
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "title"
|
||||||
|
)
|
||||||
|
))
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string the name of you form. This name must be unique
|
||||||
|
*/
|
||||||
public function getName()
|
public function getName()
|
||||||
{
|
{
|
||||||
return "thelia_customer_update";
|
return "thelia_customer_update";
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{* Update an Address *}
|
{* Update an Address *}
|
||||||
|
|
||||||
{form name="thelia.address.update"}
|
{form name="thelia.admin.address.update"}
|
||||||
|
|
||||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||||
{capture "edit_address_dialog"}
|
{capture "edit_address_dialog"}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
<div class="form-container">
|
<div class="form-container">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
|
|
||||||
{form name="thelia.customer.modification"}
|
{form name="thelia.admin.customer.modification"}
|
||||||
<form method="POST" action="{url path="/admin/customer/update/{$ID}"}" {form_enctype form=$form} class="clearfix">
|
<form method="POST" action="{url path="/admin/customer/update/{$ID}"}" {form_enctype form=$form} class="clearfix">
|
||||||
|
|
||||||
<div class="row inner-toolbar clearfix">
|
<div class="row inner-toolbar clearfix">
|
||||||
@@ -221,7 +221,7 @@
|
|||||||
<div id="address-update-modal"></div>
|
<div id="address-update-modal"></div>
|
||||||
{* Add an Address *}
|
{* Add an Address *}
|
||||||
|
|
||||||
{form name="thelia.address.create"}
|
{form name="thelia.admin.address.create"}
|
||||||
|
|
||||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||||
{capture "address_creation_dialog"}
|
{capture "address_creation_dialog"}
|
||||||
|
|||||||
@@ -161,7 +161,7 @@
|
|||||||
{* Adding a new Category *}
|
{* Adding a new Category *}
|
||||||
|
|
||||||
|
|
||||||
{form name="thelia.customer.creation"}
|
{form name="thelia.admin.customer.create"}
|
||||||
|
|
||||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||||
{capture "customer_creation_dialog"}
|
{capture "customer_creation_dialog"}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
<h1 id="main-label" class="page-header">{intl l="Update Profil"}</h1>
|
<h1 id="main-label" class="page-header">{intl l="Update Profil"}</h1>
|
||||||
|
|
||||||
{form name="thelia.customer.update"}
|
{form name="thelia.front.customer.profil.update"}
|
||||||
{assign var="isPost" value="{$smarty.post|count}"}
|
{assign var="isPost" value="{$smarty.post|count}"}
|
||||||
<form id="form-register" class="form-horizontal" action="{url path="/account/update"}" method="post" role="form">
|
<form id="form-register" class="form-horizontal" action="{url path="/account/update"}" method="post" role="form">
|
||||||
{form_field form=$form field='success_url'}
|
{form_field form=$form field='success_url'}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<article class="col-main" role="main" aria-labelledby="main-label">
|
<article class="col-main" role="main" aria-labelledby="main-label">
|
||||||
|
|
||||||
<h1 id="main-label" class="page-header">{intl l="Create New Address"}</h1>
|
<h1 id="main-label" class="page-header">{intl l="Create New Address"}</h1>
|
||||||
{form name="thelia.address.update"}
|
{form name="thelia.front.address.update"}
|
||||||
{loop name="customer.update" type="address" customer="current" id="{$address_id}"}
|
{loop name="customer.update" type="address" customer="current" id="{$address_id}"}
|
||||||
<form id="form-address" class="form-horizontal" action="{url path="/address/update/{$address_id}"}" method="post" role="form">
|
<form id="form-address" class="form-horizontal" action="{url path="/address/update/{$address_id}"}" method="post" role="form">
|
||||||
{form_field form=$form field='success_url'}
|
{form_field form=$form field='success_url'}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<article class="col-main" role="main" aria-labelledby="main-label">
|
<article class="col-main" role="main" aria-labelledby="main-label">
|
||||||
|
|
||||||
<h1 id="main-label" class="page-header">{intl l="Create New Address"}</h1>
|
<h1 id="main-label" class="page-header">{intl l="Create New Address"}</h1>
|
||||||
{form name="thelia.address.create"}
|
{form name="thelia.front.address.create"}
|
||||||
<form id="form-address" class="form-horizontal" action="{url path="/address/create"}" method="post" role="form">
|
<form id="form-address" class="form-horizontal" action="{url path="/address/create"}" method="post" role="form">
|
||||||
{form_field form=$form field='success_url'}
|
{form_field form=$form field='success_url'}
|
||||||
<input type="hidden" name="{$name}" value="{url path="/account"}" /> {* the url the user is redirected to on login success *}
|
<input type="hidden" name="{$name}" value="{url path="/account"}" /> {* the url the user is redirected to on login success *}
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ URL: http://www.thelia.net
|
|||||||
<li class="dropdown">
|
<li class="dropdown">
|
||||||
<a href="{url path="/login"}" class="login">{intl l="Log In!"}</a>
|
<a href="{url path="/login"}" class="login">{intl l="Log In!"}</a>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
{form name="thelia.customer.login"}
|
{form name="thelia.front.customer.login"}
|
||||||
<form id="form-login-mini" action="{url path="/login"}" method="post" role="form" {form_enctype form=$form}>
|
<form id="form-login-mini" action="{url path="/login"}" method="post" role="form" {form_enctype form=$form}>
|
||||||
{form_hidden_fields form=$form}
|
{form_hidden_fields form=$form}
|
||||||
{form_field form=$form field="email"}
|
{form_field form=$form field="email"}
|
||||||
|
|||||||
@@ -15,8 +15,8 @@
|
|||||||
<div class="main">
|
<div class="main">
|
||||||
<article class="col-main" role="main" aria-labelledby="main-label">
|
<article class="col-main" role="main" aria-labelledby="main-label">
|
||||||
<h1 id="main-label" class="page-header">{intl l="Login"}</h1>
|
<h1 id="main-label" class="page-header">{intl l="Login"}</h1>
|
||||||
{form name="thelia.customer.login"}
|
{form name="thelia.front.customer.login"}
|
||||||
<form id="form-login" action="{url path="/login"}" method="post" role="form" {form_enctype form=$form}>
|
<form id="form-login" action="{url path="/login"}" method="post" role="form" {form_enctype form=$form} novalidate>
|
||||||
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
|
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
|
||||||
{form_field form=$form field='success_url'}
|
{form_field form=$form field='success_url'}
|
||||||
<input type="hidden" name="{$name}" value="{navigate to="return_to"}"> {* the url the user is redirected to on login success *}
|
<input type="hidden" name="{$name}" value="{navigate to="return_to"}"> {* the url the user is redirected to on login success *}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<div class="main">
|
<div class="main">
|
||||||
<article class="col-main" role="main" aria-labelledby="main-label">
|
<article class="col-main" role="main" aria-labelledby="main-label">
|
||||||
<h1 id="main-label" class="page-header">{intl l="Password Forgotten"}</h1>
|
<h1 id="main-label" class="page-header">{intl l="Password Forgotten"}</h1>
|
||||||
{form name="thelia.customer.lostpassword"}
|
{form name="thelia.front.customer.lostpassword"}
|
||||||
<form id="form-forgotpassword" action="{url path="/password"}" method="post" role="form">
|
<form id="form-forgotpassword" action="{url path="/password"}" method="post" role="form">
|
||||||
|
|
||||||
<p>{intl l="Please enter your email address below."} {intl l="You will receive a link to reset your password."}</p>
|
<p>{intl l="Please enter your email address below."} {intl l="You will receive a link to reset your password."}</p>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<article class="col-main" role="main" aria-labelledby="main-label">
|
<article class="col-main" role="main" aria-labelledby="main-label">
|
||||||
|
|
||||||
<h1 id="main-label" class="page-header">{intl l="Create New Account"}</h1>
|
<h1 id="main-label" class="page-header">{intl l="Create New Account"}</h1>
|
||||||
{form name="thelia.customer.creation"}
|
{form name="thelia.front.customer.create"}
|
||||||
<form id="form-register" class="form-horizontal" action="{url path="/register"}" method="post" role="form">
|
<form id="form-register" class="form-horizontal" action="{url path="/register"}" method="post" role="form">
|
||||||
{form_field form=$form field='success_url'}
|
{form_field form=$form field='success_url'}
|
||||||
<input type="hidden" name="{$name}" value="{url path="/account"}" /> {* the url the user is redirected to on registration success *}
|
<input type="hidden" name="{$name}" value="{url path="/account"}" /> {* the url the user is redirected to on registration success *}
|
||||||
|
|||||||
Reference in New Issue
Block a user