[Asterisk-cvs] astcc astcc-admin.cgi,1.12,1.13
markster at lists.digium.com
markster at lists.digium.com
Tue Mar 1 00:40:53 CST 2005
Update of /usr/cvsroot/astcc
In directory mongoose.digium.com:/tmp/cvs-serv29348
Modified Files:
astcc-admin.cgi
Log Message:
Add maintenance fee support (bug #3299)
Index: astcc-admin.cgi
===================================================================
RCS file: /usr/cvsroot/astcc/astcc-admin.cgi,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- astcc-admin.cgi 19 Dec 2004 22:36:50 -0000 1.12
+++ astcc-admin.cgi 1 Mar 2005 06:38:22 -0000 1.13
@@ -86,8 +86,8 @@
$config{'dbpass'}, 'admin');
connect_db();
return -1 unless $dbh;
- return -1 unless $dbh->do("CREATE TABLE brands (name CHAR(40) PRIMARY KEY, language CHAR(10), publishednum CHAR(40), did char(40), markup INTEGER, inc INTEGER)");
- return -1 unless $dbh->do("CREATE TABLE cards (number CHAR(20) PRIMARY KEY, language CHAR(10), facevalue INTEGER, used INTEGER NOT NULL, inc INTEGER NOT NULL, markup INTEGER NOT NULL, creation TIMESTAMP, firstuse TIMESTAMP, expiration TIMESTAMP, inuse INTEGER)");
+ return -1 unless $dbh->do("CREATE TABLE brands (name CHAR(40) PRIMARY KEY, language CHAR(10), publishednum CHAR(40), did char(40), markup INTEGER, inc INTEGER, fee INTEGER, days INTEGER)");
+ return -1 unless $dbh->do("CREATE TABLE cards (number CHAR(20) PRIMARY KEY, language CHAR(10), facevalue INTEGER, used INTEGER NOT NULL, inc INTEGER NOT NULL, markup INTEGER NOT NULL, creation TIMESTAMP, firstuse TIMESTAMP, expiration TIMESTAMP, inuse INTEGER, brand CHAR(40), nextfee INTEGER)");
return -1 unless $dbh->do("CREATE TABLE trunks (name CHAR(40) PRIMARY KEY, tech CHAR(10), path CHAR(40) NOT NULL)");
return -1 unless $dbh->do("CREATE TABLE routes (pattern CHAR(40) PRIMARY KEY, comment CHAR(80), trunks CHAR(80), connectcost INTEGER NOT NULL, includedseconds INTEGER NOT NULL, cost INTEGER NOT NULL)");
return -1 unless $dbh->do("CREATE TABLE cdrs (cardnum CHAR(40), callerid char(80), callednum CHAR(80), trunk CHAR(40), disposition CHAR(20), billseconds INTEGER, billcost INTEGER)");
@@ -240,10 +240,10 @@
}
sub addcard() {
- my ($number, $language, $seconds, $inc, $markup) = @_;
- my $tmp = "INSERT INTO cards (number,language,inc,facevalue,markup,used) VALUES (" .
+ my ($number, $language, $seconds, $inc, $markup, $brand, $nextfee) = @_;
+ my $tmp = "INSERT INTO cards (number,language,inc,facevalue,markup,used,brand,nextfee) VALUES (" .
$dbh->quote($number) . ", " . $dbh->quote($language) . ", " . $dbh->quote($inc) . ", " . $dbh->quote($seconds) .
- ", " . $dbh->quote($markup) . ",0)";
+ ", " . $dbh->quote($markup) . ",0,". $dbh->quote($brand) ."," . $dbh->quote($nextfee) .")";
$dbh->do($tmp) || print "$tmp failed";
}
@@ -263,7 +263,7 @@
print EMAIL "You have added $count $brand cards in the amount of $pennies cents. \n\n";
}
if ($row = $sth->fetchrow_hashref) {
- ($language, $inc, $markup) = ($row->{language}, $row->{inc}, $row->{markup});
+ ($language, $inc, $markup, $nextfee) = ($row->{language}, $row->{inc}, $row->{markup}, $row->{days});
}
$sth->finish;
# add cards -- face value is in 1/100 of a penny
@@ -273,7 +273,7 @@
} else {
$number = &findunique;
}
- &addcard($number, $language, $pennies * 100, $inc, $markup);
+ &addcard($number, $language, $pennies * 100, $inc, $markup, $brand, $nextfee);
if ($config{'email'} eq "YES") {
print EMAIL "$number \n";
}
@@ -477,7 +477,7 @@
@cardlist = &list_cards();
$body .= "<table>";
$body .= "<tr bgcolor=ffffff><tdcolspan=4><i>" . $status . "</i></td></tr>\n";
- $body .= "<tr bgcolor=ccccff><td>Card Number</td><td>Amount Used</td><td>Face Value</td><td>Markup</td><td>Creation</td><td>First Use</td><td>Expiration</td><td>In Use</td></tr>\n";
+ $body .= "<tr bgcolor=ccccff><td>Card Number</td><td>Brand</td><td>Amount Used</td><td>Face Value</td><td>Markup</td><td>Creation</td><td>First Use</td><td>Expiration</td><td>In Use</td></tr>\n";
foreach (@cardlist) {
$cardnum = $_;
$cardinfo = &getcard($cardnum);
@@ -489,7 +489,7 @@
$color = "#ffffcc";
}
- $body .= "<tr bgcolor=$color><td>$cardnum</td><td>$cardinfo->{used}</td><td>$cardinfo->{facevalue}</td><td>$cardinfo->{markup}</td><td>$cardinfo->{creation}</td><td>$cardinfo->{firstuse}</td><td>$cardinfo->{expiration}</td><td>$cardinfo->{inuse}";
+ $body .= "<tr bgcolor=$color><td>$cardnum</td><td>$cardinfo->{brand}</td><td>$cardinfo->{used}</td><td>$cardinfo->{facevalue}</td><td>$cardinfo->{markup}</td><td>$cardinfo->{creation}</td><td>$cardinfo->{firstuse}</td><td>$cardinfo->{expiration}</td><td>$cardinfo->{inuse}";
$body .= "</td></tr>\n";
}
}
@@ -527,11 +527,14 @@
} elsif (param("action$x") eq "Save...") {
if ($dbh->do("UPDATE brands SET name=" . $dbh->quote(param("newname$x")) .
" WHERE name=" . $dbh->quote(param("item$x")))) {
- $tmp = "REPLACE INTO brands (name,language,inc,publishednum,did,markup) VALUES (" .
+ $tmp = "REPLACE INTO brands (name,language,inc,publishednum,did,markup,days,fee) VALUES (" .
$dbh->quote(param("newname$x")) . ", " . $dbh->quote(param("newlang$x")) .
", " . $dbh->quote(param("newinc$x")) .
", " . $dbh->quote(param("newpub$x")) . ", " . $dbh->quote(param("newdid$x")) .
- ", " . $dbh->quote(param("newmarkup$x")) . ")";
+ ", " . $dbh->quote(param("newmarkup$x")) .
+ ", " . $dbh->quote(param("newdays$x")) .
+ ", " . $dbh->quote(param("newfees$x")) .
+ ")";
if ($dbh->do($tmp)) {
$status = "Brand '" . param("newname$x") . "' has been updated";
} else {
@@ -541,11 +544,14 @@
$status = "Name is already in use!";
}
} elsif (param("action$x") eq "Create...") {
- $tmp = "INSERT INTO brands (name,language,inc,publishednum,did,markup) VALUES (" .
+ $tmp = "INSERT INTO brands (name,language,inc,publishednum,did,markup,days,fee) VALUES (" .
$dbh->quote(param("newname$x")) . ", " . $dbh->quote(param("newlang$x")) .
", " . $dbh->quote(param("newinc$x")) .
", " . $dbh->quote(param("newpub$x")) . ", " . $dbh->quote(param("newdid$x")) .
- ", " . $dbh->quote(param("newmarkup$x")) . ")";
+ ", " . $dbh->quote(param("newmarkup$x")) .
+ ", " . $dbh->quote(param("newdays$x")) .
+ ", " . $dbh->quote(param("newfees$x")) .
+ ")";
if ($dbh->do($tmp)) {
$status = "Brand '" . param("newname$x") . "' has been created";
} else {
@@ -564,7 +570,7 @@
$sth->execute || return "Something is wrong with the brands database\n";
$body = "<table>" .
"<tr bgcolor=ffffff><tdcolspan=7>" . start_form . "<i>$status</i></td></tr>\n" .
- "<tr bgcolor=ccccff><td>" . hidden(-name => 'mode', -value => 'Brands') . "Brand Name</td><td>Language</td><td>Published Number</td><td>DID</td><td>Inc</td><td colspan=2>Markup (in 1/100 of 1%)</td></tr>\n";
+ "<tr bgcolor=ccccff><td>" . hidden(-name => 'mode', -value => 'Brands') . "Brand Name</td><td>Language</td><td>Published Number</td><td>DID</td><td>Inc</td><td>Service Fee (cents)</td><td>Service Fee Days</td><td colspan=2>Markup (in 1/100 of 1%)</td></tr>\n";
while($row = $sth->fetchrow_hashref) {
$count++;
if (!($count % 2)) {
@@ -582,6 +588,8 @@
textfield(-name => "newpub$count", -size => 15, -default => $row->{publishednum}) . "</td><td>" .
textfield(-name => "newdid$count", -size => 10, -default => $row->{did}) .
"</td><td>" . popup_menu(-name => "newinc$count", -values => \@incs, -default => $row->{inc}) . "</td><td>" .
+ textfield(-name => "newfees$count", -size => 2, -default => $row->{fee}) . "</td><td>" .
+ textfield(-name => "newdays$count", -size => 2, -default => $row->{days}) . "</td><td>" .
textfield(-name => "newmarkup$count", -size => 5, -default => $row->{markup}) . "</td>";
$body .= "<td bgcolor=white>" . submit(-name => "action$count", -value => 'Save...') .
submit(-name => "action$count", -value => 'Cancel...');
@@ -590,7 +598,7 @@
$body .= "<tr bgcolor=$color><td>" . hidden(-name => "item$count", -value => $row->{name}) .
"$row->{name}</td>" .
"<td>$row->{language}</td><td>$row->{publishednum}</td>" .
- "<td>$row->{did}</td><td>$row->{inc}</td><td>$row->{markup}</td>" .
+ "<td>$row->{did}</td><td>$row->{inc}</td><td>$row->{fee}</td><td>$row->{days}</td><td>$row->{markup}</td>" .
"<td bgcolor=white>";
if (!$editing) {
$body .= submit(-name => "action$count", -value => 'Edit...') .
@@ -611,6 +619,8 @@
textfield(-name => "newpub$count", -size => 15) . "</td><td>" .
textfield(-name => "newdid$count", -size => 10) .
"</td><td>" . popup_menu(-name => "newinc$count", -values => \@incs) . "</td><td>" .
+ textfield(-name => "newfees$count", -size => 2) . "</td><td>" .
+ textfield(-name => "newdays$count", -size => 2) . "</td><td>" .
textfield(-name => "newmarkup$count", -size => 5) . "</td>";
$body .= "<td bgcolor=white>" . submit(-name => "action$count", -value => 'Create...') .
submit(-name => "action$count", -value => 'Cancel...');
@@ -912,6 +922,9 @@
$config{emailadd} = param('emailadd');
$config{mailprog} = param('mailprog');
$config{friendsdb} = param('friendsdb');
+ $config{maintverbose} = param('maintverbose');
+ $config{maintcdr} = param('maintcdr');
+ $config{maintname} = param('maintname');
&save_config();
$activity = "Configuration saved...";
if ($action eq "Create Database") {
@@ -937,6 +950,9 @@
$body .= "<tr><td>Admin Email</td><td>" . textfield(-name => 'emailadd', -default => $config{emailadd}) . "</td></tr>";
$body .= "<tr><td>Email Program</td><td>" . textfield(-name => 'mailprog', -default => $config{mailprog}) . "</td></tr>";
$body .= "<tr><td>Enable Iax/Sip Friends DB (YES/NO) </td><td>" . textfield(-name => 'friendsdb', -default => $config{friendsdb}) . "</td></tr>";
+ $body .= "<tr><td>Verbose account maintainence (YES/NO) </td><td>" . textfield(-name => 'maintverbose', -default => $config{maintverbose}) . "</td></tr>";
+ $body .= "<tr><td>Modify CDR to show maintainence fee (YES/NO) </td><td>" . textfield(-name => 'maintcdr', -default => $config{maintcdr}) . "</td></tr>";
+ $body .= "<tr><td>CDR Text for maintainence fee</td><td>" . textfield(-name => 'maintname', -default => $config{maintname}) . "</td></tr>";
$body .= "<tr><td align=left> " . submit(-name => 'action', -value => 'Save') . "</td><td align=right>" . submit( -name => 'action', -value => 'Create Database') . " </td></tr>";
$body .= "</table>";
return $body;
More information about the svn-commits
mailing list