From 9b1b659e0f5def5c3e47218e2485010a3281b0f5 Mon Sep 17 00:00:00 2001
From: Robert Anderson <randerson@lbsd.net>
Date: Tue, 9 Jun 2009 11:26:02 +0000
Subject: [PATCH] Changed PeriodKey to string value

---
 database/core.tsql                               | 2 +-
 smradius/modules/config/mod_config_sql_topups.pm | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/database/core.tsql b/database/core.tsql
index 4ee37604..e69c7d8c 100644
--- a/database/core.tsql
+++ b/database/core.tsql
@@ -142,7 +142,7 @@ CREATE TABLE @PREFIX@topups_summary (
 
 	TopupID			@SERIAL_REF_TYPE@ NOT NULL,
 
-	PeriodKey		DATETIME, 
+	PeriodKey		VARCHAR(255) NOT NULL, 
 
 	Balance			@INT_UNSIGNED@,
 
diff --git a/smradius/modules/config/mod_config_sql_topups.pm b/smradius/modules/config/mod_config_sql_topups.pm
index fa487a20..31cafeb5 100644
--- a/smradius/modules/config/mod_config_sql_topups.pm
+++ b/smradius/modules/config/mod_config_sql_topups.pm
@@ -394,7 +394,7 @@ sub cleanup
 							VALUES
 								(?,?,?)
 							',
-							$topup->{'ID'},$thisMonth,$trafficRemaining
+							$topup->{'ID'},$thisMonth->year."-".$thisMonth->month,$trafficRemaining
 						);
 						if (!$sth) {
 							$server->log(LOG_ERR,"[MOD_CONFIG_SQL_TOPUPS] Cleanup => Failed to update topup summary: ".
@@ -432,7 +432,7 @@ sub cleanup
 							VALUES
 								(?,?,?)
 							',
-							$topup->{'ID'},$thisMonth,$uptimeRemaining
+							$topup->{'ID'},$thisMonth->year."-".$thisMonth->month,$uptimeRemaining
 						);
 						if (!$sth) {
 							$server->log(LOG_ERR,"[MOD_CONFIG_SQL_TOPUPS] Cleanup => Failed to update topups: ".
-- 
GitLab