diff --git a/core/lib/Thelia/Action/Currency.php b/core/lib/Thelia/Action/Currency.php
index 58257c012..5ed2fb875 100644
--- a/core/lib/Thelia/Action/Currency.php
+++ b/core/lib/Thelia/Action/Currency.php
@@ -60,6 +60,7 @@ class Currency extends BaseAction implements EventSubscriberInterface
->save()
;
+
$event->setCurrency($currency);
}
diff --git a/core/lib/Thelia/Controller/Admin/CurrencyController.php b/core/lib/Thelia/Controller/Admin/CurrencyController.php
index 654a92bcf..2fae3315b 100644
--- a/core/lib/Thelia/Controller/Admin/CurrencyController.php
+++ b/core/lib/Thelia/Controller/Admin/CurrencyController.php
@@ -125,10 +125,6 @@ class CurrencyController extends BaseAdminController
catch (\Exception $ex) {
// Any other error
$error_msg = sprintf("Sorry, an error occured: %s", $ex->getMessage());
-
- var_dump($ex);
-
- exit;
}
if ($error_msg !== false) {
diff --git a/core/lib/Thelia/Form/CurrencyCreationForm.php b/core/lib/Thelia/Form/CurrencyCreationForm.php
index 6150947b8..a4d858ed6 100644
--- a/core/lib/Thelia/Form/CurrencyCreationForm.php
+++ b/core/lib/Thelia/Form/CurrencyCreationForm.php
@@ -31,20 +31,20 @@ class CurrencyCreationForm extends BaseForm
{
protected function buildForm($change_mode = false)
{
- $name_constraints = array(new Constraints\NotBlank());
+ $code_constraints = array(new Constraints\NotBlank());
if (!$change_mode) {
- $name_constraints[] = new Constraints\Callback(array(
- "methods" => array(array($this, "checkDuplicateName"))
+ $code_constraints[] = new Constraints\Callback(array(
+ "methods" => array(array($this, "checkDuplicateCode"))
));
}
$this->formBuilder
- ->add("name" , "text" , array("constraints" => $name_constraints))
+ ->add("name" , "text" , array("constraints" => array(new NotBlank())))
->add("locale" , "text" , array("constraints" => array(new NotBlank())))
->add("symbol" , "text" , array("constraints" => array(new NotBlank())))
->add("rate" , "text" , array("constraints" => array(new NotBlank())))
- ->add("code" , "text" , array("constraints" => array(new NotBlank())))
+ ->add("code" , "text" , array("constraints" => $code_constraints))
;
}
@@ -53,12 +53,12 @@ class CurrencyCreationForm extends BaseForm
return "thelia_currency_creation";
}
- public function checkDuplicateName($value, ExecutionContextInterface $context)
+ public function checkDuplicateCode($value, ExecutionContextInterface $context)
{
- $currency = CurrencyQuery::create()->findOneByName($value);
+ $currency = CurrencyQuery::create()->findOneByCode($value);
if ($currency) {
- $context->addViolation(sprintf("A currency with name \"%s\" already exists.", $value));
+ $context->addViolation(sprintf("A currency with code \"%s\" already exists.", $value));
}
}
diff --git a/install/insert.sql b/install/insert.sql
index 761704362..5bf2538a1 100755
--- a/install/insert.sql
+++ b/install/insert.sql
@@ -39,12 +39,12 @@ VALUES
INSERT INTO `currency_i18n` (`id` ,`locale` ,`name`)
VALUES
-(1, 'fr_FR', 'euro'),
-(1, 'en_UK', 'euro'),
-(2, 'fr_FR', 'dollar'),
-(2, 'en_UK', 'dollar'),
-(3, 'fr_FR', 'livre'),
-(3, 'en_UK', 'pound');
+(1, 'fr_FR', 'Euro'),
+(1, 'en_UK', 'Euro'),
+(2, 'fr_FR', 'Dollar Américain'),
+(2, 'en_UK', 'United States Dollar'),
+(3, 'fr_FR', 'Livre anglaise'),
+(3, 'en_UK', 'UK Pound');
INSERT INTO `country` (`id`, `area_id`, `isocode`, `isoalpha2`, `isoalpha3`, `created_at`, `updated_at`) VALUES
diff --git a/templates/admin/default/assets/css/admin.less b/templates/admin/default/assets/css/admin.less
index 9a01cfb67..0bc9fc274 100755
--- a/templates/admin/default/assets/css/admin.less
+++ b/templates/admin/default/assets/css/admin.less
@@ -658,6 +658,7 @@ label {
font-weight: normal;
}
+
.form-horizontal input + .help-block,
.form-horizontal select + .help-block,
.form-horizontal textarea + .help-block,
@@ -665,9 +666,10 @@ label {
.form-horizontal .input-prepend + .help-block,
.form-horizontal .input-append + .help-block
.help-block, .form-horizontal .help-block {
- margin-top: 0px;
+ margin-top: 5px;
}
+
// Fix for append-fields shorter than others
// see http://stackoverflow.com/questions/13306670/bootstrap-prepended-and-appended-input-how-to-max-input-field-width
.input-append.input-block-level,
diff --git a/templates/admin/default/currency-edit.html b/templates/admin/default/currency-edit.html
index a6c6b5500..86b6fbf25 100644
--- a/templates/admin/default/currency-edit.html
+++ b/templates/admin/default/currency-edit.html
@@ -108,7 +108,7 @@
{/form_field}
- Price in Euro * rate = Price in this currency
+ Price in Euro x rate = Price in this currency