From bf69a13f5be71829b607674f78b4b41d8f9e3d59 Mon Sep 17 00:00:00 2001
From: Robert Anderson <randerson@lbsd.net>
Date: Wed, 7 Oct 2009 13:40:57 +0000
Subject: [PATCH] Missing break in switch Fixed incorrect relational operator
 in topups query

---
 .../include/ajax/functions/AdminUserLogs.php  |  2 +-
 .../include/ajax/functions/WiSPUserLogs.php   |  2 +-
 webgui/include/ajax/functions/WiSPUsers.php   | 27 +++++++++++++++++++
 3 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/webgui/include/ajax/functions/AdminUserLogs.php b/webgui/include/ajax/functions/AdminUserLogs.php
index 16b2f0fc..54ef3feb 100644
--- a/webgui/include/ajax/functions/AdminUserLogs.php
+++ b/webgui/include/ajax/functions/AdminUserLogs.php
@@ -92,7 +92,7 @@ function getAdminUserLogsSummary($params) {
 			topups
 		WHERE
 			topups.UserID = ?
-			AND topups.ValidFrom = ?
+			AND topups.ValidFrom <= ?
 			AND topups.ValidTo >= ?
 			AND topups.Depleted = 0
 		ORDER BY
diff --git a/webgui/include/ajax/functions/WiSPUserLogs.php b/webgui/include/ajax/functions/WiSPUserLogs.php
index 1e21b91c..d9822eee 100644
--- a/webgui/include/ajax/functions/WiSPUserLogs.php
+++ b/webgui/include/ajax/functions/WiSPUserLogs.php
@@ -92,7 +92,7 @@ function getWiSPUserLogsSummary($params) {
 			topups
 		WHERE
 			topups.UserID = ?
-			AND topups.ValidFrom = ?
+			AND topups.ValidFrom <= ?
 			AND topups.ValidTo >= ?
 			AND topups.Depleted = 0
 		ORDER BY
diff --git a/webgui/include/ajax/functions/WiSPUsers.php b/webgui/include/ajax/functions/WiSPUsers.php
index 07372733..cac8ea8a 100644
--- a/webgui/include/ajax/functions/WiSPUsers.php
+++ b/webgui/include/ajax/functions/WiSPUsers.php
@@ -373,22 +373,31 @@ function createWiSPUser($params) {
 							switch ($attr['Modifier']) {
 								case "Seconds":
 									$attrValue = $attr['Value'] / 60;
+									break;
 								case "Minutes":
 									$attrValue = $attr['Value'];
+									break;
 								case "Hours":
 									$attrValue = $attr['Value'] * 60;
+									break;
 								case "Days":
 									$attrValue = $attr['Value'] * 1440;
+									break;
 								case "Weeks":
 									$attrValue = $attr['Value'] * 10080;
+									break;
 								case "Months":
 									$attrValue = $attr['Value'] * 44640; 
+									break;
 								case "MBytes":
 									$attrValue = $attr['Value'];
+									break;
 								case "GBytes":
 									$attrValue = $attr['Value'] * 1000;
+									break;
 								case "TBytes":
 									$attrValue = $attr['Value'] * 1000000;
+									break;
 							}
 						}
 					}
@@ -499,22 +508,31 @@ function createWiSPUser($params) {
 									switch ($attr['Modifier']) {
 										case "Seconds":
 											$attrValue = $attr['Value'] / 60;
+											break;
 										case "Minutes":
 											$attrValue = $attr['Value'];
+											break;
 										case "Hours":
 											$attrValue = $attr['Value'] * 60;
+											break;
 										case "Days":
 											$attrValue = $attr['Value'] * 1440;
+											break;
 										case "Weeks":
 											$attrValue = $attr['Value'] * 10080;
+											break;
 										case "Months":
 											$attrValue = $attr['Value'] * 44640; 
+											break;
 										case "MBytes":
 											$attrValue = $attr['Value'];
+											break;
 										case "GBytes":
 											$attrValue = $attr['Value'] * 1000;
+											break;
 										case "TBytes":
 											$attrValue = $attr['Value'] * 1000000;
+											break;
 									}
 								}
 							}
@@ -699,22 +717,31 @@ function updateWiSPUser($params) {
 						switch ($attr['Modifier']) {
 							case "Seconds":
 								$attrValue = $attr['Value'] / 60;
+								break;
 							case "Minutes":
 								$attrValue = $attr['Value'];
+								break;
 							case "Hours":
 								$attrValue = $attr['Value'] * 60;
+								break;
 							case "Days":
 								$attrValue = $attr['Value'] * 1440;
+								break;
 							case "Weeks":
 								$attrValue = $attr['Value'] * 10080;
+								break;
 							case "Months":
 								$attrValue = $attr['Value'] * 44640; 
+								break;
 							case "MBytes":
 								$attrValue = $attr['Value'];
+								break;
 							case "GBytes":
 								$attrValue = $attr['Value'] * 1000;
+								break;
 							case "TBytes":
 								$attrValue = $attr['Value'] * 1000000;
+								break;
 						}
 					}
 				}
-- 
GitLab