Commit b9cde9cc authored by Antonio.Suerte's avatar Antonio.Suerte

Withdrawal Transaction Delete and Revert Button

parent 0b5c6f3c
......@@ -146,6 +146,16 @@ include_once('template/base_head.php');
<td><textarea id="note" name="note" rows="5" class="w100p"><?php $this -> echoNote(); ?></textarea></td>
</tr>
</table>
<table class="table col bdr default odd w60p fontXS m_auto mb20">
<colgroup>
<col class="w40p">
<col class="w60p">
</colgroup>
<tr>
<th>Delete transaction</th>
<td><input type="button" id="btnDelete" value="DELETE" class="btn bg-red font12 hi22 px80"></td>
</tr>
</table>
<p class="calign mb10"><input type="button" id="btnSave" value="Save" class="btn bg-grad px100 hi30"></p>
<p class="calign"><a href="" class="btn bg-default">Return to List</a></p>
<div class="article-bottom">
......
......@@ -130,6 +130,19 @@ $(function() {
setDefault();
});
var deleteTransaction = (lang == "en" ? "Delete the transaction?"
: "取引を削除しますか?");
/**
* 取引削除
*/
$('#btnDelete').click(function(){
if(confirm(deleteTransaction)){
$('#type').val('delete');
$('#acForm').submit();
}
});
/**
* 検索
*/
......
......@@ -3543,6 +3543,32 @@
t_deposit_deleted AS t_deposit_deleted
WHERE
type != 1
UNION ALL
/* 出金 */
SELECT
create_time AS transaction_time,
transaction_number AS transaction_number,
'2' AS transaction_type,
'' AS withdraw_account_name,
user_account AS withdraw_account_number,
'' AS deposit_account_name,
'' AS deposit_account_number,
debit_amount AS withdraw_amount,
fee AS withdraw_fee,
'' AS deposit_amount,
'' AS deposit_fee,
'' AS rate,
0 AS deposit_currency,
debit_currency AS withdraw_currency,
debit_currency AS debit_currency,
0 AS debit_amount,
TYPE AS TYPE,
0 AS STATUS,
0 AS process_status,
date_deleted AS create_time,
u_id AS u_id
FROM
t_withdraw_deleted
UNION ALL
SELECT /* 口座振替 */
create_time AS transaction_time
......@@ -13750,6 +13776,22 @@ WHERE
WHERE
t_id = '__ELEMENT01__'
</DELETE_TRANSFER_TRANSACTION>
<COPY_WITHDRAW_TRANSACTION>
INSERT INTO t_withdraw_deleted
SELECT
*, CONVERT_TZ(NOW(),@@session.time_zone,'+09:00'), '__ELEMENT02__'
FROM
t_withdraw
WHERE
w_id= '__ELEMENT01__'
</COPY_WITHDRAW_TRANSACTION>
<DELETE_WITHDRAW_TRANSACTION>
DELETE
FROM
t_withdraw
WHERE
w_id = '__ELEMENT01__'
</DELETE_WITHDRAW_TRANSACTION>
<SELECT_DELETED_TRANSACTION>
SELECT
*
......
......@@ -203,7 +203,18 @@ class DeletedTransactionModelClass extends ModelClassEx {
$deposit = NO_STRING;
$withdraw = $this -> getAmountString($this -> getColumnData($row, COLUMN_DEBIT_AMOUNT), $withdrawCur) . '(' . $debitCur . DELIMIT_SPACE . $debitAmount . ')';
} else if($row[COLUMN_TRANSACTION_TYPE] == VAL_INT_2
}else if($row[COLUMN_TRANSACTION_TYPE] == VAL_INT_2
&& $this -> getColumnData($row, COLUMN_TYPE) == VAL_INT_11) { // 通常出金
$tType = VAL_STR_DORMANCY;
$depositCur = NO_STRING;
$withdrawCur = $this -> getColumnData($row, COLUMN_DEBIT_CURRENCY);
$debitCur = $this -> getColumnData($row, COLUMN_WITHDRAW_CURRENCY);
$debitAmount = $this -> getAmountString($this -> getColumnData($row, COLUMN_WITHDRAW_AMOUNT), $debitCur);
$deposit = NO_STRING;
$withdraw = NO_STRING;
}else if($row[COLUMN_TRANSACTION_TYPE] == VAL_INT_2
&& $this -> getColumnData($row, COLUMN_TYPE) == VAR_WITHDRAW_TYPE_CARD) { // 通常出金
$tType = VAL_STR_WITHDRAW_CARD;
......@@ -597,95 +608,46 @@ class DeletedTransactionModelClass extends ModelClassEx {
}
function revertTransaction(){
$transactionType = $this -> revertType;
$columnName = array();
if($transactionType == VAL_INT_1){
$transaction = NO_STRING;
switch($this -> revertType){
case VAL_INT_1:
$transaction = 'deposit';
$columnName[] = COLUMN_D_ID;
$columnName[] = COLUMN_TRANSACTION_NUMBER;
$columnName[] = COLUMN_USER_ACCOUNT;
$columnName[] = COLUMN_AMOUNT;
$columnName[] = COLUMN_CURRENCY;
$columnName[] = COLUMN_METHOD;
$columnName[] = 'isSendMail';
$columnName[] = COLUMN_DEPOSIT_DATE;
$columnName[] = COLUMN_DEPOSIT_BANK;
$columnName[] = COLUMN_FEE;
$columnName[] = COLUMN_MESSAGE;
$columnName[] = COLUMN_COMMENT;
$columnName[] = COLUMN_CREATE_TIME;
$columnName[] = COLUMN_UPDATE_TIME;
$columnName[] = COLUMN_PROCESS_USER;
$columnName[] = COLUMN_OLD_FILENAME;
$columnName[] = COLUMN_NEW_FILENAME;
$columnName[] = COLUMN_TYPE;
$columnName[] = COLUMN_ERR_FLG;
$columnName[] = 'flat3_transaction_id';
$columnName[] = 'msecond';
} else if($transactionType == VAL_INT_3){
break;
case VAL_INT_2:
$transaction = 'withdraw';
break;
case VAL_INT_3:
$transaction = 'transfer';
$columnName[] = COLUMN_T_ID;
$columnName[] = COLUMN_TRANSACTION_NUMBER;
$columnName[] = COLUMN_TRANSACTION_ID;
$columnName[] = COLUMN_USER_ACCOUNT;
$columnName[] = COLUMN_FROM_CURRENCY;
$columnName[] = COLUMN_FROM_ACCOUNT;
$columnName[] = COLUMN_FROM_FEE;
$columnName[] = COLUMN_TRANSFER_TO_CURRENCY;
$columnName[] = COLUMN_TO_ACCOUNT;
$columnName[] = COLUMN_TO_FEE;
$columnName[] = COLUMN_CURRENCY;
$columnName[] = COLUMN_AMOUNT;
$columnName[] = COLUMN_DEBIT_CURRENCY;
$columnName[] = COLUMN_DEBIT_AMOUNT;
$columnName[] = COLUMN_TRANSFER_CURRENCY;
$columnName[] = COLUMN_TRANSFER_AMOUNT;
$columnName[] = COLUMN_RATE;
$columnName[] = 'transfer_type';
$columnName[] = COLUMN_PROCESS_TYPE;
$columnName[] = COLUMN_PROCESS_STATUS;
$columnName[] = COLUMN_ADMIN_ID;
$columnName[] = COLUMN_MESSAGE;
$columnName[] = COLUMN_CREATE_TIME;
$columnName[] = COLUMN_OLD_FILENAME;
$columnName[] = COLUMN_NEW_FILENAME;
$columnName[] = COLUMN_ERR_FLG;
$columnName[] = 'msecond';
$columnName[] = COLUMN_NOTE;
} else if($transactionType == VAL_INT_5){
break;
case VAL_INT_5:
$transaction = 'request';
$columnName[] = COLUMN_R_ID;
$columnName[] = COLUMN_TRANSACTION_NUMBER;
$columnName[] = COLUMN_FROM_ACCOUNT;
$columnName[] = COLUMN_TO_ACCOUNT;
$columnName[] = COLUMN_CURRENCY;
$columnName[] = COLUMN_AMOUNT;
$columnName[] = COLUMN_MESSAGE;
$columnName[] = COLUMN_SEND_MESSAGE;
$columnName[] = COLUMN_COMMENT;
$columnName[] = COLUMN_STATUS;
$columnName[] = COLUMN_DEBIT_CURRENCY;
$columnName[] = COLUMN_DEBIT_AMOUNT;
$columnName[] = COLUMN_RATE;
$columnName[] = COLUMN_FROM_FEE;
$columnName[] = COLUMN_TO_FEE;
$columnName[] = COLUMN_CREATE_TIME;
$columnName[] = COLUMN_UPDATE_TIME;
$columnName[] = 'hidden_flg';
$columnName[] = 'msecond';
}
$columnNames = implode(', ', $columnName);
$tableName = 't_'.$transaction;
$tableNameDeleted = 't_'.$transaction.'_deleted';
$res = $this -> accessSelect('SELECT_DELETED_TRANSACTION', array($this -> transactionNumber,$tableNameDeleted));
break;
}
$tableName = "t_{$transaction}";
$tableNameDeleted = "t_{$transaction}_deleted";
$res = $this -> accessSelect('SELECT_DELETED_TRANSACTION', [$this -> transactionNumber, $tableNameDeleted]);
$transData = $this -> getRowData($res);
$transData = array_keys($transData);
$columnNames = [];
foreach($transData as $fieldName){
if($fieldName == "date_deleted" || $fieldName == "u_id")
continue;
$columnNames[] = $fieldName;
}
$columnNames = implode(', ', $columnNames);
if(count($res)== NO_COUNT){
//$this -> popUpSessionMessage(ERROR, 'E_ERROR_NO_PAGE_ACCESS', array());
}else{
$this -> accessModify('COPY_DELETED_TRANSACTION', array($this -> transactionNumber,$tableNameDeleted,$tableName, $columnNames));
$this -> accessModify('DELETE_DELETED_TRANSACTION', array($this -> transactionNumber,$tableNameDeleted));
$this -> popUpSessionMessage(INFO, 'I_COMPLETE_PROCESS', array());
$this -> accessModify('COPY_DELETED_TRANSACTION', [$this -> transactionNumber, $tableNameDeleted, $tableName, $columnNames]);
$this -> accessModify('DELETE_DELETED_TRANSACTION', [$this -> transactionNumber, $tableNameDeleted]);
$this -> popUpSessionMessage(INFO, 'I_COMPLETE_PROCESS', []);
}
}
......@@ -696,7 +658,7 @@ class DeletedTransactionModelClass extends ModelClassEx {
$type = $this -> getType();
if($type == TYPE_DELETE){
$message = 'Reverted transaction number [' . $this -> transactionNumber . ']';
$message = "Reverted transaction number [{$this -> transactionNumber}]";
}
$rtn[] = $this -> getAdminUserData(PARAM_UID);
......
......@@ -65,6 +65,10 @@ class LogicWithdraw extends WithdrawModelClass {
} else if($this -> getType() == TYPE_SEARCH) { // 検索
$this -> lists();
} else if($this -> getType() == TYPE_DELETE) {
$this -> insertActivity();
$this -> deleteTransaction();
$this -> lists();
} else { // その他
$this -> lists();
}
......@@ -129,6 +133,18 @@ class LogicWithdraw extends WithdrawModelClass {
$this -> popUpSessionMessage(INFO, 'I_COMPLATE_REGIST', array());
}
/*-------------------------------------------------------------------------
* @function_name: 取引削除
* @parameter : なし
* @return : なし
-------------------------------------------------------------------------*/
public function deleteTransaction() {
$this -> accessModify('COPY_WITHDRAW_TRANSACTION', $this -> getDetailData());
$this -> accessModify('DELETE_WITHDRAW_TRANSACTION', $this -> getDetailData());
$this -> popUpSessionMessage(INFO, 'I_COMPLATE_DELETE', array());
}
/*-------------------------------------------------------------------------
* @function_name: エクスポート用のファイルを作成する
* @parameter : なし
......
......@@ -275,6 +275,14 @@ class WithdrawModelClass extends ModelClassEx {
}
}
if($this -> getType() == TYPE_DELETE) {
if(!$this -> checkAdminUserAccess('WDTL', array('','2'))){
$this -> popUpSessionMessage(ERROR, 'E_ERROR_NO_FUNCTION_ACCESS', array());
header('Location: /'.$redirect.'menu');
exit();
}
}
if($this -> getType() == TYPE_INPUT) { // 口座番号入力の場合
$userAccount = $this -> searchUserAccountCommon($this -> userAccount);
......@@ -886,6 +894,15 @@ class WithdrawModelClass extends ModelClassEx {
return $this -> drawCurrency;
}
/*-------------------------------------------------------------------------
* @function_name: 基本的な取引詳細
* @parameter : なし
* @return : 配列
-------------------------------------------------------------------------*/
public function getDetailData(){
return [$this -> wId, $this -> getAdminUserData(PARAM_UID)];
}
/*-------------------------------------------------------------------------
* @function_name: 引き出し通貨の取得
* @parameter : なし
......@@ -2046,7 +2063,6 @@ class WithdrawModelClass extends ModelClassEx {
$oldOrderNumber = $this -> getColumnData($row[0], COLUMN_ORDER_NUMBER);
$oldNote = $this -> getColumnData($row[0], COLUMN_NOTE);
if($type == TYPE_SAVE){
if($oldStatus != $newStatus){
$details[] = ' status from ['.$this -> dispWithdrawStatusCommon($oldStatus).'] to ['.$this -> dispWithdrawStatusCommon($newStatus).']';
......@@ -2065,6 +2081,8 @@ class WithdrawModelClass extends ModelClassEx {
}else{
$message = 'Saved without any changes';
}
}else if($type == TYPE_DELETE){
$message = 'Deleted transaction ['.$tNumber.']';
}
$rtn = array();
......
......@@ -146,6 +146,16 @@ include_once('template/base_head.php');
<td><textarea id="note" name="note" rows="5" class="w100p"><?php $this -> echoNote(); ?></textarea></td>
</tr>
</table>
<table class="table col bdr default odd w60p fontXS m_auto mb20">
<colgroup>
<col class="w40p">
<col class="w60p">
</colgroup>
<tr>
<th>取引を削除する</th>
<td><input type="button" id="btnDelete" value="削除する" class="btn bg-red font12 hi22 px80"></td>
</tr>
</table>
<p class="calign mb10"><input type="button" id="btnSave" value="保存する" class="btn bg-grad px100 hi30"></p>
<p class="calign"><a href="" class="btn bg-default">リストへ戻る</a></p>
<div class="article-bottom">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment