Skip to content

Commit

Permalink
修正 EC-CUBE#4398
Browse files Browse the repository at this point in the history
  • Loading branch information
oywc410 committed Jan 15, 2020
1 parent 4c1bb0e commit 721dd12
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
5 changes: 3 additions & 2 deletions src/Eccube/Form/Type/Admin/MailType.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,15 @@ public function buildForm(FormBuilderInterface $builder, array $options)

if (!$Mail->getId()) {
$qb = $this->entityManager->createQueryBuilder();

$qb->select('count(m)')
->from('Eccube\\Entity\\MailTemplate', 'm')
->where('m.file_name = :file_name')
->setParameter('file_name', $Mail['file_name']);
->setParameter('file_name', sprintf('Mail/%s.twig', $Mail['file_name']));

$count = $qb->getQuery()->getSingleScalarResult();
if ($count > 0) {
$form['file_name']->addError(new FormError(trans('admin.content.page_file_name_exists')));
$form['file_name']->addError(new FormError(trans('admin.setting.shop.mail_file_name_exists')));
}
}
});
Expand Down
1 change: 1 addition & 0 deletions src/Eccube/Resource/locale/messages.en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1149,6 +1149,7 @@ admin.setting.shop.mail.mail_html: HTML
admin.setting.shop.mail.preview: Preview
admin.setting.shop.mail.file_name: This is the name of a twig template file which has the mail contents.
admin.setting.shop.mail_list: All Mail Templates
admin.setting.shop.mail_file_name_exists: Data with the same file name already exists. Please enter a different one.

#------------------------------------------------------------------------------------
# Settings : Store Settings : CSV Outputs
Expand Down
1 change: 1 addition & 0 deletions src/Eccube/Resource/locale/messages.ja.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1149,6 +1149,7 @@ admin.setting.shop.mail.mail_html: HTML
admin.setting.shop.mail.preview: プレビュー
admin.setting.shop.mail.file_name: ファイル名
admin.setting.shop.mail_list: 一覧を見る
admin.setting.shop.mail_file_name_exists: 同じファイル名のデータが存在しています。別のファイル名を入力してください。

#------------------------------------------------------------------------------------
# 設定:店舗設定:CSV出力項目設定
Expand Down
4 changes: 2 additions & 2 deletions src/Eccube/Resource/template/admin/Setting/Shop/mail.twig
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ file that was distributed with this source code.
#}
{% extends '@admin/default_frame.twig' %}

{% set menus = ['setting', 'shop', 'shop_delivery'] %}
{% set menus = ['setting', 'shop', 'shop_mail'] %}

{% block title %}{{ 'admin.setting.shop.delivery_list'|trans }}{% endblock %}
{% block title %}{{ 'admin.setting.shop.mail_setting'|trans }}{% endblock %}
{% block sub_title %}{{ 'admin.setting.shop'|trans }}{% endblock %}

{% block javascript %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ public function testEditFail()
['mail' => $form]
);

$redirectUrl = $this->generateUrl('admin_setting_shop_mail_edit', ['id' => $mid]);
$this->assertTrue($this->client->getResponse()->isRedirect($redirectUrl));
//$redirectUrl = $this->generateUrl('admin_setting_shop_mail_edit', ['id' => $mid]);
//$this->assertTrue($this->client->getResponse()->isRedirect($redirectUrl));

$this->expected = 404;
$this->actual = $this->client->getResponse()->getStatusCode();
Expand All @@ -152,11 +152,11 @@ public function testCreateFail()
];
$this->client->request(
'POST',
$this->generateUrl('admin_setting_shop_mail_edit'),
$this->generateUrl('admin_setting_shop_mail_new'),
['mail' => $form]
);

$redirectUrl = $this->generateUrl('admin_setting_shop_mail_edit');
$redirectUrl = $this->generateUrl('admin_setting_shop_mail_new');
$this->assertTrue($this->client->getResponse()->isRedirect($redirectUrl));
}

Expand Down

0 comments on commit 721dd12

Please sign in to comment.