[Asterisk-cvs] astcc astcc-admin.cgi,1.8,1.9

markster at lists.digium.com markster at lists.digium.com
Sun Sep 26 14:00:09 CDT 2004


Update of /usr/cvsroot/astcc
In directory mongoose.digium.com:/tmp/cvs-serv26845

Modified Files:
	astcc-admin.cgi 
Log Message:
Allow card state to be reset (bug #2465)


Index: astcc-admin.cgi
===================================================================
RCS file: /usr/cvsroot/astcc/astcc-admin.cgi,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- astcc-admin.cgi	18 Sep 2004 13:59:16 -0000	1.8
+++ astcc-admin.cgi	26 Sep 2004 18:02:48 -0000	1.9
@@ -267,12 +267,20 @@
 		$cardinfo = &getcard(param('refillnum'));
 		$number = $cardinfo->{number};
 		$newfacevalue = $cardinfo->{facevalue} + (param('refillpennies') * 100);
-		if ($dbh->do("UPDATE cards SET facevalue= $newfacevalue WHERE number= $cardinfo->{number}")) { 
+		if ($dbh->do("UPDATE cards SET facevalue=" . $dbh->quote($newfacevalue) . " WHERE number=" . $dbh->quote($cardinfo->{number}))) { 
 			$status = "Refilled card " . param('refillnum') . "'.";
 		} else {
  			$status = "Unable to Refill card". param('refillnum') . "'.";
 		}
-	} 
+	} elsif (param('action') eq "Reset...") {
+		$number = param('resetnum');
+		$newstatus = 0;
+		if ($dbh->do("UPDATE cards SET inuse=" . $dbh->quote($newstatus) . " WHERE number=" . $dbh->quote($number))) { 
+			$status = "Reset card " . param('resetnum') . "'.";
+		} else {
+ 			$status = "Unable to Reset card ". param('resetnum') . "'.";
+		}
+	}
 	$total = &count_cards();
 	$used = &count_cards("WHERE firstuse > 0");
 	$status = "<i>$status</i><br>" . "<font color=#777777>$total cards outstanding, $used of which have been used</font>";
@@ -291,6 +299,9 @@
 	$body .= "<tr><td>Delete card&nbsp;&nbsp;" . hidden(-name => "mode", -value => "Cards") .
 		textfield(-name => "number", -size => 20)  . "&nbsp;&nbsp;&nbsp;&nbsp;" .
 		submit(-name => "action", -value => "Drop...") . "</td></tr>";	
+	$body .= "<tr><td>Reset in use info on card&nbsp;&nbsp;" . hidden(-name => "mode", -value => "Cards") .
+		textfield(-name => "resetnum", -size => 20)  . "&nbsp;&nbsp;&nbsp;&nbsp;" .
+		submit(-name => "action", -value => "Reset...") . "</td></tr>";	
 	$body .= "<tr><td>List Cards&nbsp;&nbsp;" . hidden(-name => "mode", -value => "Cards") .
 		submit(-name => "action", -value => "List_Cards...") . "</td></tr>";
 	$body .= "</table>";




More information about the svn-commits mailing list