Merge branch 'master' of https://github.com/thelia/thelia into coupon

# By Manuel Raynaud (8) and franck (2)
# Via franck
* 'master' of https://github.com/thelia/thelia:
  en_EN -> en_UK, the "en_EN" locale does not exists.
  Smarty inheritance in admin template.
  fix typo in phpdoc
  complete test for foramt_number smarty function
  test foramt_date without datetime object
  create foramt_number smarty function
  remove sqlmap file
  add some phpdoc
  complete test for format_date smarty function
  create new smarty function for displaying date in expected format

Conflicts:
	reset_install.sh
This commit is contained in:
gmorel
2013-09-04 12:01:12 +02:00
56 changed files with 3243 additions and 1526 deletions

View File

@@ -47,109 +47,92 @@ class CouponCreationForm extends BaseForm
{
$this->formBuilder
->add(
"code",
"text",
'code',
'text',
array(
"constraints" => array(
'constraints' => array(
new NotBlank()
)
)
)
->add(
"type",
"text",
'title',
'text',
array(
"constraints" => array(
'constraints' => array(
new NotBlank()
)
)
)
->add(
"title",
"text",
'shortDescription',
'text',
array(
"constraints" => array(
'invalid_message' => 'test',
'constraints' => array(
new NotBlank()
)
)
)
->add(
"shortDescription",
"text",
'description',
'textarea',
array(
"constraints" => array(
'invalid_message' => 'test',
'constraints' => array(
new NotBlank()
)
)
)
->add(
"description",
"text",
'effect',
'text',
array(
"constraints" => array(
'invalid_message' => 'test',
'constraints' => array(
new NotBlank()
)
)
)
->add(
"amount",
"text",
'amount',
'money',
array()
)
->add(
'isEnabled',
'checkbox',
array()
)
->add(
'expirationDate',
'text',
array(
"constraints" => array(
'constraints' => array(
new NotBlank()
)
)
)
->add(
"isEnabled",
"text",
array(
"constraints" => array(
new NotBlank()
)
)
'isCumulative',
'checkbox',
array()
)
->add(
"expirationDate",
"text",
array(
"constraints" => array(
new NotBlank()
)
)
'isRemovingPostage',
'checkbox',
array()
)
->add(
"isCumulative",
"text",
array(
"constraints" => array(
new NotBlank()
)
)
'isAvailableOnSpecialOffers',
'checkbox',
array()
)
->add(
"isRemovingPostage",
"text",
'maxUsage',
'text',
array(
"constraints" => array(
new NotBlank()
)
)
)
->add(
"maxUsage",
"text",
array(
"constraints" => array(
new NotBlank()
)
)
)
->add(
"isAvailableOnSpecialOffers",
"text",
array(
"constraints" => array(
'constraints' => array(
new NotBlank()
)
)
@@ -163,6 +146,6 @@ class CouponCreationForm extends BaseForm
*/
public function getName()
{
return "thelia_coupon_creation";
return 'thelia_coupon_creation';
}
}

View File

@@ -0,0 +1,65 @@
<?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\CurrencyQuery;
use Symfony\Component\Validator\ExecutionContextInterface;
use Symfony\Component\Validator\Constraints\NotBlank;
class CurrencyCreationForm extends BaseForm
{
protected function buildForm($change_mode = false)
{
$name_constraints = array(new Constraints\NotBlank());
if (!$change_mode) {
$name_constraints[] = new Constraints\Callback(array(
"methods" => array(array($this, "checkDuplicateName"))
));
}
$this->formBuilder
->add("name" , "text" , array("constraints" => array($name_constraints)))
->add("locale" , "text" , array())
->add("symbol" , "text" , array("constraints" => array(new NotBlank())))
->add("rate" , "text" , array("constraints" => array(new NotBlank())))
->add("code" , "text" , array("constraints" => array(new NotBlank())))
;
}
public function getName()
{
return "thelia_currency_creation";
}
public function checkDuplicateName($value, ExecutionContextInterface $context)
{
$currency = CurrencyQuery::create()->findOneByName($value);
if ($currency) {
$context->addViolation(sprintf("A currency with name \"%s\" already exists.", $value));
}
}
}

View File

@@ -0,0 +1,45 @@
<?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\NotBlank;
use Thelia\Model\LangQuery;
use Propel\Runtime\ActiveQuery\Criteria;
use Symfony\Component\Validator\Constraints\GreaterThan;
class CurrencyModificationForm extends CurrencyCreationForm
{
protected function buildForm()
{
parent::buildForm(true);
$this->formBuilder
->add("id" , "hidden", array("constraints" => array(new GreaterThan(array('value' => 0)))))
;
}
public function getName()
{
return "thelia_currency_modification";
}
}