Skip to content

Commit

Permalink
[fix] refs EC-CUBE#113 対応漏れ
Browse files Browse the repository at this point in the history
SC_Helper_DB::registerBasisData() での更新時に、キャッシュデータファイルを生成する。
  • Loading branch information
seasoftjapan committed May 7, 2020
1 parent 482a629 commit 9f99d54
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 65 deletions.
4 changes: 2 additions & 2 deletions data/Smarty/templates/admin/basis/point.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<form name="point_form" id="point_form" method="post" action="">
<input type="hidden" name="<!--{$smarty.const.TRANSACTION_ID_NAME}-->" value="<!--{$transactionid}-->" />
<input type="hidden" name="mode" value="<!--{$tpl_mode}-->" />
<input type="hidden" name="mode" value="" />
<div id="basis" class="contents-main">
<table>
<tr>
Expand All @@ -51,7 +51,7 @@

<div class="btn-area">
<ul>
<li><a class="btn-action" href="javascript:;" onclick="eccube.fnFormModeSubmit('point_form', '<!--{$tpl_mode}-->', '', ''); return false;"><span class="btn-next">この内容で登録する</span></a></li>
<li><a class="btn-action" href="javascript:;" onclick="eccube.fnFormModeSubmit('point_form', 'update', '', ''); return false;"><span class="btn-next">この内容で登録する</span></a></li>
</ul>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions data/Smarty/templates/admin/basis/tradelaw.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<form name="form1" id="form1" method="post" action="">
<input type="hidden" name="<!--{$smarty.const.TRANSACTION_ID_NAME}-->" value="<!--{$transactionid}-->" />
<input type="hidden" name="mode" value="<!--{$tpl_mode}-->" />
<input type="hidden" name="mode" value="" />
<div id="basis" class="contents-main">
<table class="form">
<tr>
Expand Down Expand Up @@ -197,7 +197,7 @@

<div class="btn-area">
<ul>
<li><a class="btn-action" href="javascript:;" onclick="eccube.fnFormModeSubmit('form1', '<!--{$tpl_mode}-->', '', ''); return false;"><span class="btn-next">この内容で登録する</span></a></li>
<li><a class="btn-action" href="javascript:;" onclick="eccube.fnFormModeSubmit('form1', 'update', '', ''); return false;"><span class="btn-next">この内容で登録する</span></a></li>
</ul>
</div>
</div>
Expand Down
3 changes: 3 additions & 0 deletions data/class/helper/SC_Helper_DB.php
Original file line number Diff line number Diff line change
Expand Up @@ -1687,6 +1687,9 @@ public static function registerBasisData($arrData)
$objQuery->insert('dtb_baseinfo', $arrData);
GC_Utils_Ex::gfPrintLog('dtb_baseinfo に INSERT を実行しました。');
}

// キャッシュデータファイルを生成する
SC_Helper_DB_Ex::sfCreateBasisDataCache();
}

/**
Expand Down
2 changes: 0 additions & 2 deletions data/class/pages/admin/basis/LC_Page_Admin_Basis.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ public function action()
$arrData = $objFormParam->getDbArray();
SC_Helper_DB_Ex::registerBasisData($arrData);

// キャッシュファイル更新
$objDb->sfCreateBasisDataCache();
$this->tpl_onload .= "window.alert('SHOPマスターの登録が完了しました。');";
// breakはつけない
default:
Expand Down
38 changes: 6 additions & 32 deletions data/class/pages/admin/basis/LC_Page_Admin_Basis_Point.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,7 @@ public function action()
// POST値の取得
$objFormParam->setParam($_POST);

if ($objDb->sfGetBasisExists()) {
$this->tpl_mode = 'update';
} else {
$this->tpl_mode = 'insert';
}
$this->tpl_mode = 'update'; // 旧バージョンテンプレート互換

if (!empty($_POST)) {
// 入力値の変換
Expand All @@ -87,16 +83,15 @@ public function action()
if (count($this->arrErr) == 0) {
switch ($this->getMode()) {
case 'update':
$this->lfUpdateData($objFormParam->getHashArray()); // 既存編集
break;
case 'insert':
$this->lfInsertData($objFormParam->getHashArray()); // 新規作成
SC_Helper_DB_Ex::registerBasisData($objFormParam->getHashArray());

// 再表示
$this->tpl_onload = "window.alert('ポイント設定が完了しました。');";

break;
default:
break;
}
// 再表示
$this->tpl_onload = "window.alert('ポイント設定が完了しました。');";
}
} else {
$arrRet = $objDb->sfGetBasisData();
Expand All @@ -115,25 +110,4 @@ public function lfInitParam(&$objFormParam)
$objFormParam->addParam('ポイント付与率', 'point_rate', PERCENTAGE_LEN, 'n', array('EXIST_CHECK', 'MAX_LENGTH_CHECK', 'NUM_CHECK'));
$objFormParam->addParam('会員登録時付与ポイント', 'welcome_point', INT_LEN, 'n', array('EXIST_CHECK', 'MAX_LENGTH_CHECK', 'NUM_CHECK'));
}

public function lfUpdateData($post)
{
// 入力データを渡す。
$sqlval = $post;
$sqlval['update_date'] = 'CURRENT_TIMESTAMP';
$objQuery = SC_Query_Ex::getSingletonInstance();
// UPDATEの実行
$objQuery->update('dtb_baseinfo', $sqlval);
}

public function lfInsertData($post)
{
// 入力データを渡す。
$sqlval = $post;
$sqlval['id'] = 1;
$sqlval['update_date'] = 'CURRENT_TIMESTAMP';
$objQuery = SC_Query_Ex::getSingletonInstance();
// INSERTの実行
$objQuery->insert('dtb_baseinfo', $sqlval);
}
}
33 changes: 6 additions & 27 deletions data/class/pages/admin/basis/LC_Page_Admin_Basis_Tradelaw.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,7 @@ public function action()
$this->lfInitParam($objFormParam);
$objFormParam->setParam($_POST);

if ($objDb->sfGetBasisExists()) {
$this->tpl_mode = 'update';
} else {
$this->tpl_mode = 'insert';
}
$this->tpl_mode = 'update'; // 旧バージョンテンプレート互換

if (!empty($_POST)) {
// 入力値の変換
Expand All @@ -88,16 +84,15 @@ public function action()
if (count($this->arrErr) == 0) {
switch ($this->getMode()) {
case 'update':
$this->lfUpdateData($objFormParam->getHashArray()); // 既存編集
break;
case 'insert':
$this->lfInsertData($objFormParam->getHashArray()); // 新規作成
SC_Helper_DB_Ex::registerBasisData($objFormParam->getHashArray());

// 再表示
$this->tpl_onload = "window.alert('特定商取引法の登録が完了しました。');";

break;
default:
break;
}
// 再表示
$this->tpl_onload = "window.alert('特定商取引法の登録が完了しました。');";
}
} else {
$arrRet = $objDb->sfGetBasisData();
Expand Down Expand Up @@ -136,22 +131,6 @@ public function lfInitParam(&$objFormParam)
$objFormParam->addParam('返品・交換について', 'law_term06', MLTEXT_LEN, 'KVa', array('EXIST_CHECK', 'MAX_LENGTH_CHECK'));
}

public function lfUpdateData($sqlval)
{
$sqlval['update_date'] = 'CURRENT_TIMESTAMP';
$objQuery = SC_Query_Ex::getSingletonInstance();
// UPDATEの実行
$objQuery->update('dtb_baseinfo', $sqlval);
}

public function lfInsertData($sqlval)
{
$sqlval['update_date'] = 'CURRENT_TIMESTAMP';
$objQuery = SC_Query_Ex::getSingletonInstance();
// INSERTの実行
$objQuery->insert('dtb_baseinfo', $sqlval);
}

/* 入力内容のチェック */

/**
Expand Down

0 comments on commit 9f99d54

Please sign in to comment.