From 7dac113f3848afa8b9b0a4ad9ec9bc156e752c1f Mon Sep 17 00:00:00 2001 From: chicpro Date: Wed, 24 Jul 2013 10:34:34 +0900 Subject: [PATCH] =?UTF-8?q?=EA=B2=8C=EC=8B=9C=EA=B8=80=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=EC=8B=9C=20=ED=8F=AC=EC=9D=B8=ED=8A=B8=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=20=EC=BD=94=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- adm/point_list.php | 2 +- adm/point_list_delete.php | 2 +- lib/common.lib.php | 24 +++++++++++++++++++----- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/adm/point_list.php b/adm/point_list.php index e29aaa1c7..5f93b2bd4 100644 --- a/adm/point_list.php +++ b/adm/point_list.php @@ -168,7 +168,7 @@ function point_clear() - + diff --git a/adm/point_list_delete.php b/adm/point_list_delete.php index 21cba5212..bf672a333 100644 --- a/adm/point_list_delete.php +++ b/adm/point_list_delete.php @@ -33,7 +33,7 @@ for ($i=0; $i<$count; $i++) delete_use_point($mb_id, $po_point); } } else { - if($row['po_expired'] == 0 && $row['po_use_point'] > 0) { + if($row['po_expired'] != 1 && $row['po_use_point'] > 0) { insert_use_point($row['mb_id'], $row['po_use_point'], $row['po_id']); } } diff --git a/lib/common.lib.php b/lib/common.lib.php index 12d0b4ce3..7e113912c 100644 --- a/lib/common.lib.php +++ b/lib/common.lib.php @@ -1027,18 +1027,32 @@ function delete_point($mb_id, $rel_table, $rel_id, $rel_action) $result = false; if ($rel_table || $rel_id || $rel_action) { + // 포인트정보 + $sql = " select po_id, mb_id, po_use_point, po_expired + from {$g4['point_table']} + where mb_id = '$mb_id' + and po_rel_table = '$rel_table' + and po_rel_id = '$rel_id' + and po_rel_action = '$rel_action' "; + $row = sql_fetch($sql); + $result = sql_query(" delete from {$g4['point_table']} - where mb_id = '$mb_id' - and po_rel_table = '$rel_table' - and po_rel_id = '$rel_id' - and po_rel_action = '$rel_action' ", false); + where mb_id = '$mb_id' + and po_rel_table = '$rel_table' + and po_rel_id = '$rel_id' + and po_rel_action = '$rel_action' ", false); // 포인트 내역의 합을 구하고 $sum_point = get_point_sum($mb_id); // 포인트 UPDATE $sql = " update {$g4['member_table']} set mb_point = '$sum_point' where mb_id = '$mb_id' "; - $result = sql_query($sql); + $result = sql_query($sql, false); + + // 포인트 사용 값이 있으면 다른 포인트 내역으로 이동시킴 + if($result && $row['po_expired'] != 1 && $row['po_use_point'] > 0) { + insert_use_point($row['mb_id'], $row['po_use_point'], $row['po_id']); + } } return $result;