From e5d0743151cce813d22c44775c2b56e2ab29db3e Mon Sep 17 00:00:00 2001
From: Robert Anderson <randerson@lbsd.net>
Date: Mon, 7 Jun 2010 14:22:41 +0000
Subject: [PATCH] Allow the topup_summary and topup to be deleted if there is a
 summary linked to the topup

---
 webgui/include/ajax/functions/AdminUserTopups.php | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/webgui/include/ajax/functions/AdminUserTopups.php b/webgui/include/ajax/functions/AdminUserTopups.php
index 56c68795..d4d453be 100644
--- a/webgui/include/ajax/functions/AdminUserTopups.php
+++ b/webgui/include/ajax/functions/AdminUserTopups.php
@@ -46,7 +46,15 @@ function updateAdminUserTopup($params) {
 # Delete user topup
 function removeAdminUserTopup($params) {
 
-	# Perform query
+	# Delete topup summary
+	$res = DBDo("DELETE FROM @TP@topups_summary WHERE TopupID = ?",array($params[0]));
+
+	# Return result
+	if ($res !== TRUE) {
+		return $res;
+	}
+
+	# Delete topup
 	$res = DBDo("DELETE FROM @TP@topups WHERE ID = ?",array($params[0]));
 
 	# Return result
-- 
GitLab