Skip to content

Commit

Permalink
Merge branch 'dev-anno' into dev-5
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuring committed Oct 20, 2023
2 parents bb08295 + 3189ed6 commit 83a2ad1
Show file tree
Hide file tree
Showing 20 changed files with 185 additions and 90 deletions.
10 changes: 7 additions & 3 deletions plugins/bc-mail/src/Controller/Admin/MailConfigsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,24 @@

namespace BcMail\Controller\Admin;

use BaserCore\Utility\BcUtil;
use BcMail\Service\MailConfigsServiceInterface;
use Psr\Http\Message\ResponseInterface;
use BaserCore\Annotation\UnitTest;
use BaserCore\Annotation\NoTodo;
use BaserCore\Annotation\Checked;

/**
* メールフォーム設定コントローラー
*
*/
class MailConfigsController extends MailAdminAppController
{

/**
* [ADMIN] メールフォーム設定
*
* @return void
* @return void|ResponseInterface
* @checked
* @noTodo
*/
public function index(MailConfigsServiceInterface $service)
{
Expand Down
4 changes: 4 additions & 0 deletions plugins/bc-mail/src/Controller/Admin/MailFieldsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public function initialize(): void
* beforeFilter
*
* @return void
* @checked
* @noTodo
*/
public function beforeFilter(EventInterface $event)
{
Expand All @@ -73,6 +75,8 @@ public function beforeFilter(EventInterface $event)

/**
* プラグインの環境をチェックする
* @checked
* @noTodo
*/
protected function _checkEnv()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public function initialize(): void
* beforeFilter
*
* @return void
* @checked
* @noTodo
*/
public function beforeFilter(EventInterface $event)
{
Expand Down Expand Up @@ -152,6 +154,10 @@ public function delete(

/**
* メールフォームに添付したファイルを開く
* @param MailMessagesServiceInterface $service
* @return void
* @checked
* @noTodo
*/
public function attachment(MailMessagesServiceInterface $service)
{
Expand Down Expand Up @@ -179,6 +185,8 @@ public function attachment(MailMessagesServiceInterface $service)
*
* @param int $mailContentId
* @return void
* @checked
* @noTodo
*/
public function download_csv(MailMessagesAdminServiceInterface $service, int $mailContentId)
{
Expand Down
8 changes: 8 additions & 0 deletions plugins/bc-mail/src/Controller/Api/MailMessagesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
class MailMessagesController extends BcApiController
{

/**
* Before Filter
*
* @param EventInterface $event
* @return \Cake\Http\Response|void
* @checked
* @noTodo
*/
public function beforeFilter(EventInterface $event)
{
$this->Security->setConfig('validatePost', false);
Expand Down
14 changes: 13 additions & 1 deletion plugins/bc-mail/src/Controller/MailController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use BaserCore\Annotation\UnitTest;
use BaserCore\Annotation\NoTodo;
use BaserCore\Annotation\Checked;
use Psr\Http\Message\ResponseInterface;

/**
* お問い合わせメールフォーム用コントローラー
Expand Down Expand Up @@ -68,6 +69,7 @@ public function initialize(): void
* beforeFilter.
*
* @return void
* @checked
*/
public function beforeFilter(EventInterface $event)
{
Expand All @@ -80,6 +82,7 @@ public function beforeFilter(EventInterface $event)
$mailMessagesService = $this->getService(MailMessagesServiceInterface::class);
$mailMessagesService->MailMessages->setup($this->request->getParam('entityId'), $this->getRequest()->getData());

// TODO ucmitz 未確認
return;
$this->dbDatas['mailContent'] = $this->MailMessage->mailContent;
$this->dbDatas['mailFields'] = $this->MailMessage->mailFields;
Expand Down Expand Up @@ -115,6 +118,7 @@ public function beforeFilter(EventInterface $event)
* beforeRender
*
* @return void
* @checked
*/
public function beforeRender(EventInterface $event): void
{
Expand Down Expand Up @@ -320,7 +324,11 @@ public function submit(
/**
* [PUBIC] メール送信完了
*
* @return void
* @param MailFrontServiceInterface $service
* @param MailContentsServiceInterface $mailContentsService
* @return void|ResponseInterface
* @checked
* @noTodo
*/
public function thanks(MailFrontServiceInterface $service, MailContentsServiceInterface $mailContentsService)
{
Expand All @@ -342,7 +350,11 @@ public function thanks(MailFrontServiceInterface $service, MailContentsServiceIn
/**
* 認証用のキャプチャ画像を表示する
*
* @param BcCaptchaServiceInterface $service
* @param string $token
* @return void
* @checked
* @noTodo
*/
public function captcha(BcCaptchaServiceInterface $service, string $token)
{
Expand Down
2 changes: 2 additions & 0 deletions plugins/bc-mail/src/Model/Entity/MailContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ class MailContent extends Entity
* メッセージ件数を取得する
*
* @return int
* @checked
* @noTodo
*/
public function getNumberOfMessages()
{
Expand Down
7 changes: 6 additions & 1 deletion plugins/bc-mail/src/Model/Table/MailContentsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ public function initialize(array $config): void
*
* @param Validator $validator
* @return Validator
* @checked
* @noTodo
*/
public function validationDefault(Validator $validator): Validator
{
Expand Down Expand Up @@ -176,6 +178,8 @@ public function validationDefault(Validator $validator): Validator
*
* @param array $check チェック対象文字列
* @return boolean
* @checked
* @noTodo
*/
public function checkSslUrl($value)
{
Expand Down Expand Up @@ -256,9 +260,10 @@ public function createSearchIndex($data)
* @param int $newAuthorId 新しいユーザーID
* @param int $newSiteId 新しいサイトID
* @return mixed mailContent|false
* @checked
*/
public function copy(
int $id,
?int $id,
int $newParentId,
string $newTitle,
int $newAuthorId,
Expand Down
22 changes: 17 additions & 5 deletions plugins/bc-mail/src/Model/Table/MailFieldsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace BcMail\Model\Table;

use BcMail\Model\Entity\MailField;
use Cake\Datasource\EntityInterface;
use Cake\Validation\Validator;
use BaserCore\Annotation\UnitTest;
Expand Down Expand Up @@ -49,9 +50,10 @@ public function initialize(array $config): void
/**
* MailField constructor.
*
* @param bool $id
* @param null $table
* @param null $ds
* @param Validator $validator
* @return Validator
* @checked
* @noTodo
*/
public function validationDefault(Validator $validator): Validator
{
Expand Down Expand Up @@ -142,6 +144,8 @@ public function validationDefault(Validator $validator): Validator
*
* @param string $field
* @return array source
* @checked
* @noTodo
*/
public function getControlSource($field = null)
{
Expand Down Expand Up @@ -188,6 +192,8 @@ public function getControlSource($field = null)
* @param string $value
* @param array $context
* @return boolean
* @checked
* @noTodo
*/
public function duplicateMailField(string $value, array $context)
{
Expand All @@ -210,6 +216,8 @@ public function duplicateMailField(string $value, array $context)
*
* @param string $value
* @return boolean
* @checked
* @noTodo
*/
public function halfTextMailField(string $value)
{
Expand All @@ -223,6 +231,8 @@ public function halfTextMailField(string $value)
* @param string $value
* @param array $context
* @return bool
* @checked
* @noTodo
*/
public function sourceMailField(string $value, array $context)
{
Expand All @@ -240,13 +250,13 @@ public function sourceMailField(string $value, array $context)
* フィールドデータをコピーする
*
* @param int $id
* @param array $data
* @param MailField $data
* @param array $options
* @return EntityInterface|false
* @checked
* @noTodo
*/
public function copy($id, $data = null, $options = [])
public function copy(?int $id, MailField $data = null, array $options = [])
{
$options = array_merge([
'sortUpdateOff' => false,
Expand Down Expand Up @@ -303,6 +313,8 @@ public function copy($id, $data = null, $options = [])
* | の対応は後方互換として残しておく
* @param string $source 選択リストソース
* @return string 整形後選択リストソース
* @checked
* @noTodo
*/
public function formatSource($source)
{
Expand Down
14 changes: 11 additions & 3 deletions plugins/bc-mail/src/Model/Table/MailMessagesTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ public function setMailFields(int $mailContentId)
*
* @param Validator $validator
* @return Validator
* @checked
* @noTodo
*/
public function validationDefault(Validator $validator): Validator
{
Expand Down Expand Up @@ -187,6 +189,9 @@ public function setupUpload(int $mailContentId)
* After Marshal
*
* @param Event $event
* @return void
* @checked
* @noTodo
*/
public function afterMarshal(Event $event)
{
Expand Down Expand Up @@ -490,6 +495,8 @@ public function convertToDb(ResultSetInterface $mailFields, EntityInterface $mai
*
* @param array $dbDatas
* @return array $dbDatas
* @checked
* @noTodo
* @TODO ヘルパー化すべきかも
*/
public function convertDatasToMail($data, $options)
Expand Down Expand Up @@ -540,11 +547,12 @@ public function createFullTableName($mailContentId)
/**
* 受信メッセージの内容を表示状態に変換する
*
* @param int $id
* @param $messages
* @param array $messages
* @return array
* @checked
* @noTodo
*/
public function convertMessageToCsv($messages)
public function convertMessageToCsv(array $messages)
{
// フィールド名とデータの変換に必要なヘルパーを読み込む
$maildataHelper = new MaildataHelper(new View());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class MailMessageValidation extends Validation
* 文字列日付チェック
*
* @return bool
* @checked
* @unitTest
* @noTodo
*/
Expand Down
24 changes: 0 additions & 24 deletions plugins/bc-mail/src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,6 @@
*/
class Plugin extends BcPlugin
{
/**
* プラグインをインストールする
*
* @param array $options
* - `plugin` : プラグイン名
* - `connection` : コネクション名
*/
public function install($options = []) : bool
{
// ここに必要なインストール処理を記述
return parent::install($options);
}

/**
* プラグインをアンインストールする
* - `plugin` : プラグイン名
* - `connection` : コネクション名
* - `target` : ロールバック対象バージョン
*/
public function uninstall($options = []): bool
{
// ここに必要なアンインストール処理を記述
return parent::uninstall();
}

/**
* services
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,15 @@ public function getViewVarsForView(int $mailContentId, int $mailMessageId)
* @param ServerRequest $request
* @return array
* @unitTest
* @checked
* @noTodo
*/
public function getViewVarsForDownloadCsv(int $mailContentId, ServerRequest $request)
{
$this->setup($mailContentId);
return [
'encoding' => $request->getQuery('encoding') ?? 'utf-8',
'messages' => $this->MailMessages->convertMessageToCsv($this->getIndex()->all()),
'messages' => $this->MailMessages->convertMessageToCsv($this->getIndex()->all()->toArray()),
'contentName' => $request->getAttribute('currentContent')->name,
];
}
Expand Down
4 changes: 4 additions & 0 deletions plugins/bc-mail/src/Service/Front/MailFrontService.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ public function getViewVarsForConfirm(EntityInterface $mailContent, EntityInterf
* @param array $postData
* @return EntityInterface
* @unitTest
* @checked
* @noTodo
*/
public function confirm(EntityInterface $mailContent, array $postData): EntityInterface
{
Expand Down Expand Up @@ -304,6 +306,8 @@ public function getUserMail(ResultSetInterface $mailFields, EntityInterface $mai
* @param EntityInterface $mailMessage
* @return array
* @unitTest
* @checked
* @noTodo
*/
public function getAttachments(ResultSetInterface $mailFields, EntityInterface $mailMessage): array
{
Expand Down
2 changes: 2 additions & 0 deletions plugins/bc-mail/src/Service/MailContentsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,8 @@ public function copy($postData)
* @param int|null $siteId
* @return \Cake\Datasource\ResultSetInterface
* @unitTest
* @checked
* @noTodo
*/
public function getPublishedAll(int $siteId = null)
{
Expand Down
Loading

0 comments on commit 83a2ad1

Please sign in to comment.