Fixed minor bug in Currencies
This commit is contained in:
@@ -60,6 +60,7 @@ class Currency extends BaseAction implements EventSubscriberInterface
|
||||
->save()
|
||||
;
|
||||
|
||||
|
||||
$event->setCurrency($currency);
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
<input type="text" required="required" name="{$name}" value="{$value|htmlspecialchars}" title="{intl l='Rate from Euro'}" placeholder="{intl l='Rate'}" class="input-mini">
|
||||
</span>
|
||||
{/form_field}
|
||||
<span class="label-help-block">Price in Euro * rate = Price in this currency</span>
|
||||
<span class="help-block">Price in Euro x rate = Price in this currency</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user