Merge with master

This commit is contained in:
touffies
2013-10-02 11:20:48 +02:00
600 changed files with 33563 additions and 13429 deletions

View File

@@ -102,7 +102,7 @@ class AddressCreateForm extends BaseForm
"for" => "address1_create"
)
))
->add("address2", "text", array(
->add("address2", "text", array(
"label" => Translator::getInstance()->trans("Additional address"),
"label_attr" => array(
"for" => "address2_create"

View File

@@ -103,7 +103,7 @@ class AddressUpdateForm extends AddressCreateForm
"for" => "address1_update"
)
))
->add("address2", "text", array(
->add("address2", "text", array(
"label" => Translator::getInstance()->trans("Additional address"),
"label_attr" => array(
"for" => "address2_update"

View File

@@ -51,7 +51,7 @@ class AdminLogin extends BaseForm
)
))
->add("remember_me", "checkbox", array(
'value' => 'yes',
'value' => 'yes',
"label" => Translator::getInstance()->trans("Remember me ?"),
"label_attr" => array(
"for" => "remember_me"

View File

@@ -23,8 +23,6 @@
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
use Thelia\Model\CurrencyQuery;
use Symfony\Component\Validator\ExecutionContextInterface;
use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Core\Translation\Translator;
@@ -59,4 +57,4 @@ class AttributeAvCreationForm extends BaseForm
{
return "thelia_attributeav_creation";
}
}
}

View File

@@ -23,8 +23,6 @@
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
use Thelia\Model\CurrencyQuery;
use Symfony\Component\Validator\ExecutionContextInterface;
use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Core\Translation\Translator;

View File

@@ -23,10 +23,6 @@
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
use Thelia\Model\CurrencyQuery;
use Symfony\Component\Validator\ExecutionContextInterface;
use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Core\Translation\Translator;
use Symfony\Component\Validator\Constraints\GreaterThan;
class AttributeModificationForm extends AttributeCreationForm

View File

@@ -0,0 +1,51 @@
<?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 Thelia\Form\Image\DocumentModification;
/**
* Created by JetBrains PhpStorm.
* Date: 9/18/13
* Time: 3:56 PM
*
* Form allowing to process an document collection
*
* @package Image
* @author Guillaume MOREL <gmorel@openstudio.fr>
*
*/
class CategoryDocumentModification extends DocumentModification
{
/**
* Get form name
* This name must be unique
*
* @return string
*/
public function getName()
{
return 'thelia_category_document_modification';
}
}

View File

@@ -0,0 +1,51 @@
<?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 Thelia\Form\Image\ImageModification;
/**
* Created by JetBrains PhpStorm.
* Date: 9/18/13
* Time: 3:56 PM
*
* Form allowing to process an image collection
*
* @package Image
* @author Guillaume MOREL <gmorel@openstudio.fr>
*
*/
class CategoryImageModification extends ImageModification
{
/**
* Get form name
* This name must be unique
*
* @return string
*/
public function getName()
{
return 'thelia_category_image_modification';
}
}

View File

@@ -27,7 +27,7 @@ use Thelia\Core\Translation\Translator;
class ContentCreationForm extends BaseForm
{
protected function buildForm($change_mode = false)
protected function buildForm()
{
$this->formBuilder
->add("title", "text", array(
@@ -40,9 +40,11 @@ class ContentCreationForm extends BaseForm
)
))
->add("default_folder", "integer", array(
"label" => Translator::getInstance()->trans("Default folder *"),
"constraints" => array(
new NotBlank()
)
),
"label_attr" => array("for" => "default_folder")
))
->add("locale", "text", array(
"constraints" => array(

View File

@@ -0,0 +1,51 @@
<?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 Thelia\Form\Image\DocumentModification;
/**
* Created by JetBrains PhpStorm.
* Date: 9/18/13
* Time: 3:56 PM
*
* Form allowing to process a file
*
* @package File
* @author Guillaume MOREL <gmorel@openstudio.fr>
*
*/
class ContentDocumentModification extends DocumentModification
{
/**
* Get form name
* This name must be unique
*
* @return string
*/
public function getName()
{
return 'thelia_content_document_modification';
}
}

View File

@@ -0,0 +1,51 @@
<?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 Thelia\Form\Image\ImageModification;
/**
* Created by JetBrains PhpStorm.
* Date: 9/18/13
* Time: 3:56 PM
*
* Form allowing to process an image collection
*
* @package Image
* @author Guillaume MOREL <gmorel@openstudio.fr>
*
*/
class ContentImageModification extends ImageModification
{
/**
* Get form name
* This name must be unique
*
* @return string
*/
public function getName()
{
return 'thelia_content_image_modification';
}
}

View File

@@ -0,0 +1,62 @@
<?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\GreaterThan;
use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Core\Translation\Translator;
use Thelia\Form\StandardDescriptionFieldsTrait;
/**
* Class ContentModificationForm
* @package Thelia\Form
* @author manuel raynaud <mraynaud@openstudio.fr>
*/
class ContentModificationForm extends ContentCreationForm
{
use StandardDescriptionFieldsTrait;
protected function buildForm()
{
parent::buildForm();
$this->formBuilder
->add("id", "hidden", array("constraints" => array(new GreaterThan(array('value' => 0)))))
->add("url", "text", array(
"label" => Translator::getInstance()->trans("Rewriten URL *"),
"constraints" => array(new NotBlank()),
"label_attr" => array("for" => "rewritten_url")
))
;
// Add standard description fields, excluding title and locale, which a re defined in parent class
$this->addStandardDescFields(array('title', 'locale'));
}
public function getName()
{
return "thelia_content_modification";
}
}

View File

@@ -38,7 +38,7 @@ class CountryCreationForm extends BaseForm
"label_attr" => array(
"for" => "title"
)
))
))
->add("area", "text", array(
"constraints" => array(
new NotBlank()
@@ -47,7 +47,7 @@ class CountryCreationForm extends BaseForm
"label_attr" => array(
"for" => "area"
)
))
))
->add("isocode", "text", array(
"constraints" => array(
new NotBlank()
@@ -56,7 +56,7 @@ class CountryCreationForm extends BaseForm
"label_attr" => array(
"for" => "isocode"
)
))
))
->add("isoalpha2", "text", array(
"constraints" => array(
new NotBlank()
@@ -65,7 +65,7 @@ class CountryCreationForm extends BaseForm
"label_attr" => array(
"for" => "isoalpha2"
)
))
))
->add("isoalpha3", "text", array(
"constraints" => array(
new NotBlank()
@@ -74,7 +74,7 @@ class CountryCreationForm extends BaseForm
"label_attr" => array(
"for" => "isoalpha3"
)
))
))
;
}

View File

@@ -42,7 +42,7 @@ class CountryModificationForm extends CurrencyCreationForm
"label_attr" => array(
"for" => "title"
)
))
))
->add("short-description", "text", array(
"constraints" => array(
new NotBlank()
@@ -51,7 +51,7 @@ class CountryModificationForm extends CurrencyCreationForm
"label_attr" => array(
"for" => "short-description"
)
))
))
->add("description", "text", array(
"constraints" => array(
new NotBlank()
@@ -60,7 +60,7 @@ class CountryModificationForm extends CurrencyCreationForm
"label_attr" => array(
"for" => "description"
)
))
))
->add("area", "text", array(
"constraints" => array(
new NotBlank()
@@ -69,7 +69,7 @@ class CountryModificationForm extends CurrencyCreationForm
"label_attr" => array(
"for" => "area"
)
))
))
->add("isocode", "text", array(
"constraints" => array(
new NotBlank()
@@ -78,7 +78,7 @@ class CountryModificationForm extends CurrencyCreationForm
"label_attr" => array(
"for" => "isocode"
)
))
))
->add("isoalpha2", "text", array(
"constraints" => array(
new NotBlank()
@@ -87,7 +87,7 @@ class CountryModificationForm extends CurrencyCreationForm
"label_attr" => array(
"for" => "isoalpha2"
)
))
))
->add("isoalpha3", "text", array(
"constraints" => array(
new NotBlank()

View File

@@ -24,7 +24,6 @@
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints\Date;
use Symfony\Component\Validator\Constraints\DateTime;
use Symfony\Component\Validator\Constraints\GreaterThanOrEqual;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\NotEqualTo;
@@ -87,7 +86,7 @@ class CouponCreationForm extends BaseForm
)
)
->add(
'effect',
'type',
'text',
array(
'constraints' => array(

View File

@@ -220,4 +220,4 @@ class CustomerCreation extends BaseForm
{
return "thelia_customer_creation";
}
}
}

View File

@@ -35,8 +35,8 @@ use Thelia\Model\CustomerQuery;
* @package Thelia\Form
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class CustomerLostPasswordForm extends BaseForm {
class CustomerLostPasswordForm extends BaseForm
{
/**
*
* in this function you add all the fields you need for your Form.
@@ -93,4 +93,4 @@ class CustomerLostPasswordForm extends BaseForm {
{
return "thelia_customer_creation";
}
}
}

View File

@@ -23,8 +23,6 @@
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
use Thelia\Model\CurrencyQuery;
use Symfony\Component\Validator\ExecutionContextInterface;
use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Core\Translation\Translator;
@@ -59,4 +57,4 @@ class FeatureAvCreationForm extends BaseForm
{
return "thelia_featureav_creation";
}
}
}

View File

@@ -23,8 +23,6 @@
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
use Thelia\Model\CurrencyQuery;
use Symfony\Component\Validator\ExecutionContextInterface;
use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Core\Translation\Translator;

View File

@@ -23,10 +23,6 @@
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
use Thelia\Model\CurrencyQuery;
use Symfony\Component\Validator\ExecutionContextInterface;
use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Core\Translation\Translator;
use Symfony\Component\Validator\Constraints\GreaterThan;
class FeatureModificationForm extends FeatureCreationForm

View File

@@ -0,0 +1,51 @@
<?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 Thelia\Form\Image\DocumentModification;
/**
* Created by JetBrains PhpStorm.
* Date: 9/18/13
* Time: 3:56 PM
*
* Form allowing to process a file
*
* @package Image
* @author Guillaume MOREL <gmorel@openstudio.fr>
*
*/
class FolderDocumentModification extends DocumentModification
{
/**
* Get form name
* This name must be unique
*
* @return string
*/
public function getName()
{
return 'thelia_folder_document_modification';
}
}

View File

@@ -0,0 +1,51 @@
<?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 Thelia\Form\Image\ImageModification;
/**
* Created by JetBrains PhpStorm.
* Date: 9/18/13
* Time: 3:56 PM
*
* Form allowing to process an image collection
*
* @package Image
* @author Guillaume MOREL <gmorel@openstudio.fr>
*
*/
class FolderImageModification extends ImageModification
{
/**
* Get form name
* This name must be unique
*
* @return string
*/
public function getName()
{
return 'thelia_folder_image_modification';
}
}

View File

@@ -32,7 +32,7 @@ class FolderModificationForm extends FolderCreationForm
protected function buildForm()
{
parent::buildForm(true);
parent::buildForm();
$this->formBuilder
->add("id", "hidden", array("constraints" => array(new GreaterThan(array('value' => 0)))))

View File

@@ -0,0 +1,137 @@
<?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\Image;
use Symfony\Component\Validator\Constraints\Image;
use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Core\Translation\Translator;
use Thelia\Form\BaseForm;
/**
* Created by JetBrains PhpStorm.
* Date: 9/18/13
* Time: 3:56 PM
*
* Form allowing to process a file
* @todo refactor make all document using propel inheritance and factorise image behaviour into one single clean action
*
* @package File
* @author Guillaume MOREL <gmorel@openstudio.fr>
*
*/
abstract class DocumentModification 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(
'file',
'file',
array(
'constraints' => array(),
'label' => Translator::getInstance()->trans('Replace current document by this file'),
'label_attr' => array(
'for' => 'file'
)
)
);
$this->formBuilder
->add(
'title',
'text',
array(
'constraints' => array(
new NotBlank()
),
'label' => Translator::getInstance()->trans('Title'),
'label_attr' => array(
'for' => 'title'
)
)
)
->add(
'description',
'text',
array(
'constraints' => array(),
'label' => Translator::getInstance()->trans('Description'),
'label_attr' => array(
'for' => 'description'
)
)
)
->add(
'chapo',
'text',
array(
'constraints' => array(),
'label' => Translator::getInstance()->trans('Chapo'),
'label_attr' => array(
'for' => 'chapo'
)
)
)
->add(
'postscriptum',
'text',
array(
'constraints' => array(),
'label' => Translator::getInstance()->trans('Post Scriptum'),
'label_attr' => array(
'for' => 'postscriptum'
)
)
)
->add(
'postscriptum',
'text',
array(
'constraints' => array(),
'label' => Translator::getInstance()->trans('Post Scriptum'),
'label_attr' => array(
'for' => 'postscriptum'
)
)
);
}
}

View File

@@ -0,0 +1,145 @@
<?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\Image;
use Symfony\Component\Validator\Constraints\Image;
use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Core\Translation\Translator;
use Thelia\Form\BaseForm;
/**
* Created by JetBrains PhpStorm.
* Date: 9/18/13
* Time: 3:56 PM
*
* Form allowing to process an image
* @todo refactor make all pictures using propel inheritance and factorise image behaviour into one single clean action
*
* @package Image
* @author Guillaume MOREL <gmorel@openstudio.fr>
*
*/
abstract class ImageModification 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(
'file',
'file',
array(
'constraints' => array(
new Image(
array(
// 'minWidth' => 200,
// 'minHeight' => 200
)
)
),
'label' => Translator::getInstance()->trans('Replace current image by this file'),
'label_attr' => array(
'for' => 'file'
)
)
);
$this->formBuilder
->add(
'title',
'text',
array(
'constraints' => array(
new NotBlank()
),
'label' => Translator::getInstance()->trans('Title'),
'label_attr' => array(
'for' => 'title'
)
)
)
->add(
'description',
'text',
array(
'constraints' => array(),
'label' => Translator::getInstance()->trans('Description'),
'label_attr' => array(
'for' => 'description'
)
)
)
->add(
'chapo',
'text',
array(
'constraints' => array(),
'label' => Translator::getInstance()->trans('Chapo'),
'label_attr' => array(
'for' => 'chapo'
)
)
)
->add(
'postscriptum',
'text',
array(
'constraints' => array(),
'label' => Translator::getInstance()->trans('Post Scriptum'),
'label_attr' => array(
'for' => 'postscriptum'
)
)
)
->add(
'postscriptum',
'text',
array(
'constraints' => array(),
'label' => Translator::getInstance()->trans('Post Scriptum'),
'label_attr' => array(
'for' => 'postscriptum'
)
)
);
}
}

View File

@@ -25,8 +25,6 @@ namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Model\AddressQuery;
use Thelia\Model\ConfigQuery;
use Thelia\Core\Translation\Translator;
use Thelia\Model\ModuleQuery;
use Thelia\Module\BaseModule;
@@ -69,7 +67,7 @@ class OrderDelivery extends BaseForm
$address = AddressQuery::create()
->findPk($value);
if(null === $address) {
if (null === $address) {
$context->addViolation("Address ID not found");
}
}
@@ -80,9 +78,9 @@ class OrderDelivery extends BaseForm
->filterByType(BaseModule::DELIVERY_MODULE_TYPE)
->filterByActivate(1)
->filterById($value)
->find();
->findOne();
if(null === $module) {
if (null === $module) {
$context->addViolation("Delivery module ID not found");
}
@@ -98,4 +96,4 @@ class OrderDelivery extends BaseForm
{
return "thelia_order_delivery";
}
}
}

View File

@@ -25,8 +25,6 @@ namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Model\AddressQuery;
use Thelia\Model\ConfigQuery;
use Thelia\Core\Translation\Translator;
use Thelia\Model\ModuleQuery;
use Thelia\Module\BaseModule;
@@ -69,7 +67,7 @@ class OrderPayment extends BaseForm
$address = AddressQuery::create()
->findPk($value);
if(null === $address) {
if (null === $address) {
$context->addViolation("Address ID not found");
}
}
@@ -82,7 +80,7 @@ class OrderPayment extends BaseForm
->filterById($value)
->findOne();
if(null === $module) {
if (null === $module) {
$context->addViolation("Payment module ID not found");
}
@@ -98,4 +96,4 @@ class OrderPayment extends BaseForm
{
return "thelia_order_payment";
}
}
}

View File

@@ -0,0 +1,192 @@
<?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\Callback;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Core\Translation\Translator;
use Thelia\Model\CountryQuery;
use Thelia\Model\CustomerTitleQuery;
use Thelia\Model\OrderAddressQuery;
/**
* Class AddressUpdateForm
* @package Thelia\Form
* @author Etienne Roudeix <eroudeix@openstudio.fr>
*/
class OrderUpdateAddress extends BaseForm
{
protected function buildForm()
{
$this->formBuilder
->add("id", "integer", array(
"constraints" => array(
new NotBlank(),
new Callback(array(
"methods" => array(
array($this, "verifyId")
)
))
),
"required" => true
))
->add("title", "text", array(
"constraints" => array(
new NotBlank(),
new Callback(array(
"methods" => array(
array($this, "verifyTitle")
)
))
),
"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(),
new Callback(array(
"methods" => array(
array($this, "verifyCountry")
)
))
),
"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("company", "text", array(
"label" => Translator::getInstance()->trans("Compagny"),
"label_attr" => array(
"for" => "company_update"
)
))
;
}
/**
* @return string the name of you form. This name must be unique
*/
public function getName()
{
return "thelia_order_address_update";
}
public function verifyId($value, ExecutionContextInterface $context)
{
$address = OrderAddressQuery::create()
->findPk($value);
if (null === $address) {
$context->addViolation("Order address ID not found");
}
}
public function verifyTitle($value, ExecutionContextInterface $context)
{
$address = CustomerTitleQuery::create()
->findPk($value);
if (null === $address) {
$context->addViolation("Title ID not found");
}
}
public function verifyCountry($value, ExecutionContextInterface $context)
{
$address = CountryQuery::create()
->findPk($value);
if (null === $address) {
$context->addViolation("Country ID not found");
}
}
}

View File

@@ -47,25 +47,48 @@ class ProductCreationForm extends BaseForm
"label_attr" => array("for" => "ref")
))
->add("title", "text", array(
"constraints" => array(
new NotBlank()
),
"constraints" => array(new NotBlank()),
"label" => "Product title *",
"label_attr" => array("for" => "title")
))
->add("default_category", "integer", array(
"constraints" => array(new NotBlank()),
"label" => Translator::getInstance()->trans("Default product category."),
"label" => Translator::getInstance()->trans("Default product category *"),
"label_attr" => array("for" => "default_category_field")
))
->add("locale", "text", array(
"constraints" => array(new NotBlank())
))
->add("visible", "integer", array(
"label" => Translator::getInstance()->trans("This product is online."),
"label" => Translator::getInstance()->trans("This product is online"),
"label_attr" => array("for" => "visible_field")
))
;
;
if (! $change_mode) {
$this->formBuilder
->add("price", "number", array(
"constraints" => array(new NotBlank()),
"label" => Translator::getInstance()->trans("Product base price excluding taxes *"),
"label_attr" => array("for" => "price_field")
))
->add("currency", "integer", array(
"constraints" => array(new NotBlank()),
"label" => Translator::getInstance()->trans("Price currency *"),
"label_attr" => array("for" => "currency_field")
))
->add("tax_rule", "integer", array(
"constraints" => array(new NotBlank()),
"label" => Translator::getInstance()->trans("Tax rule for this product *"),
"label_attr" => array("for" => "tax_rule_field")
))
->add("weight", "number", array(
"constraints" => array(new NotBlank()),
"label" => Translator::getInstance()->trans("Weight *"),
"label_attr" => array("for" => "weight_field")
))
;
}
}
public function checkDuplicateRef($value, ExecutionContextInterface $context)

View File

@@ -0,0 +1,90 @@
<?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\GreaterThan;
use Thelia\Core\Translation\Translator;
use Symfony\Component\Validator\Constraints\NotBlank;
class ProductDetailsModificationForm extends BaseForm
{
use StandardDescriptionFieldsTrait;
protected function buildForm()
{
$this->formBuilder
->add("id", "integer", array(
"label" => Translator::getInstance()->trans("Prodcut ID *"),
"label_attr" => array("for" => "product_id_field"),
"constraints" => array(new GreaterThan(array('value' => 0)))
))
->add("price", "number", array(
"constraints" => array(new NotBlank()),
"label" => Translator::getInstance()->trans("Product base price excluding taxes *"),
"label_attr" => array("for" => "price_field")
))
->add("price_with_tax", "number", array(
"label" => Translator::getInstance()->trans("Product base price including taxes *"),
"label_attr" => array("for" => "price_with_tax_field")
))
->add("currency", "integer", array(
"constraints" => array(new NotBlank()),
"label" => Translator::getInstance()->trans("Price currency *"),
"label_attr" => array("for" => "currency_field")
))
->add("tax_rule", "integer", array(
"constraints" => array(new NotBlank()),
"label" => Translator::getInstance()->trans("Tax rule for this product *"),
"label_attr" => array("for" => "tax_rule_field")
))
->add("weight", "number", array(
"constraints" => array(new NotBlank()),
"label" => Translator::getInstance()->trans("Weight *"),
"label_attr" => array("for" => "weight_field")
))
->add("quantity", "number", array(
"constraints" => array(new NotBlank()),
"label" => Translator::getInstance()->trans("Current quantity *"),
"label_attr" => array("for" => "quantity_field")
))
->add("sale_price", "number", array(
"label" => Translator::getInstance()->trans("Sale price *"),
"label_attr" => array("for" => "price_with_tax_field")
))
->add("onsale", "integer", array(
"label" => Translator::getInstance()->trans("This product is on sale"),
"label_attr" => array("for" => "onsale_field")
))
->add("isnew", "integer", array(
"label" => Translator::getInstance()->trans("Advertise this product as new"),
"label_attr" => array("for" => "isnew_field")
))
;
}
public function getName()
{
return "thelia_product_details_modification";
}
}

View File

@@ -0,0 +1,51 @@
<?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 Thelia\Form\Image\DocumentModification;
/**
* Created by JetBrains PhpStorm.
* Date: 9/18/13
* Time: 3:56 PM
*
* Form allowing to process a file
*
* @package File
* @author Guillaume MOREL <gmorel@openstudio.fr>
*
*/
class ProductDocumentModification extends DocumentModification
{
/**
* Get form name
* This name must be unique
*
* @return string
*/
public function getName()
{
return 'thelia_product_document_modification';
}
}

View File

@@ -0,0 +1,51 @@
<?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 Thelia\Form\Image\ImageModification;
/**
* Created by JetBrains PhpStorm.
* Date: 9/18/13
* Time: 3:56 PM
*
* Form allowing to process an image collection
*
* @package Image
* @author Guillaume MOREL <gmorel@openstudio.fr>
*
*/
class ProductImageModification extends ImageModification
{
/**
* Get form name
* This name must be unique
*
* @return string
*/
public function getName()
{
return 'thelia_product_image_modification';
}
}

View File

@@ -61,4 +61,4 @@ class ProductModificationForm extends ProductCreationForm
{
return "thelia_product_modification";
}
}
}

View File

@@ -35,7 +35,6 @@ use Thelia\Model\ConfigQuery;
class ProfileModificationForm extends BaseForm
{
protected function buildForm()
{

View File

@@ -23,8 +23,6 @@
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
use Thelia\Model\CurrencyQuery;
use Symfony\Component\Validator\ExecutionContextInterface;
use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Core\Translation\Translator;

View File

@@ -23,10 +23,6 @@
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
use Thelia\Model\CurrencyQuery;
use Symfony\Component\Validator\ExecutionContextInterface;
use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Core\Translation\Translator;
use Symfony\Component\Validator\Constraints\GreaterThan;
class TemplateModificationForm extends TemplateCreationForm