Skip to content

Commit

Permalink
Merge pull request #50 from akagane99/master
Browse files Browse the repository at this point in the history
MailSettingテーブルの定型文だけ別テーブルに切り出し
  • Loading branch information
s-nakajima committed Apr 14, 2016
2 parents 613625b + 293d155 commit c9b256e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
34 changes: 21 additions & 13 deletions Config/Migration/002_mail_setting_records.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,21 @@
* @copyright Copyright 2014, NetCommons Project
*/

App::uses('NetCommonsMigration', 'NetCommons.Config/Migration');
App::uses('MailsMigration', 'Mails.Config/Migration');

/**
* メール設定データのMigration
*
* @package NetCommons\Mails\Config\Migration
*/
class BbsMailSettingRecords extends NetCommonsMigration {
class BbsMailSettingRecords extends MailsMigration {

/**
* プラグインキー
*
* @var string
*/
const PLUGIN_KEY = 'bbses';

/**
* Migration description
Expand All @@ -41,14 +48,21 @@ class BbsMailSettingRecords extends NetCommonsMigration {
*/
public $records = array(
'MailSetting' => array(
//コンテンツ通知
//コンテンツ通知 - 設定
array(
'plugin_key' => self::PLUGIN_KEY,
'block_key' => null,
'is_mail_send' => false,
),
),
'MailSettingFixedPhrase' => array(
//コンテンツ通知 - 定型文
// * 英語
array(
'language_id' => '1',
'plugin_key' => 'bbses',
'plugin_key' => self::PLUGIN_KEY,
'block_key' => null,
'type_key' => 'contents',
'is_mail_send' => false,
'mail_fixed_phrase_subject' => '[{X-SITE_NAME}-{X-PLUGIN_NAME}]{X-SUBJECT}({X-ROOM} {X-BBS_NAME})',
'mail_fixed_phrase_body' => 'You are receiving this email because a message was posted to BBS.
Room\'s name:{X-ROOM}
Expand All @@ -65,10 +79,9 @@ class BbsMailSettingRecords extends NetCommonsMigration {
// * 日本語
array(
'language_id' => '2',
'plugin_key' => 'bbses',
'plugin_key' => self::PLUGIN_KEY,
'block_key' => null,
'type_key' => 'contents',
'is_mail_send' => false,
'mail_fixed_phrase_subject' => '[{X-SITE_NAME}-{X-PLUGIN_NAME}]{X-SUBJECT}({X-ROOM} {X-BBS_NAME})',
'mail_fixed_phrase_body' => '{X-PLUGIN_NAME}に投稿されたのでお知らせします。
ルーム名:{X-ROOM}
Expand Down Expand Up @@ -102,11 +115,6 @@ public function before($direction) {
* @return bool Should process continue
*/
public function after($direction) {
foreach ($this->records as $model => $records) {
if (!$this->updateRecords($model, $records)) {
return false;
}
}
return true;
return parent::updateAndDelete($direction, self::PLUGIN_KEY);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class BbsMailSettingsControllerEditTest extends NetCommonsControllerTestCase {
'plugin.bbses.bbs_frame_setting',
'plugin.bbses.bbs_setting',
'plugin.bbses.bbs',
'plugin.mails.mail_setting_fixed_phrase',
);

/**
Expand Down

0 comments on commit c9b256e

Please sign in to comment.