summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2008-06-05 19:24:33 +0000
committerivan <ivan>2008-06-05 19:24:33 +0000
commit1203e278e2ec38fcf1468da2e4f10862004bebeb (patch)
tree0a9c3155181c6443f5e6faacfa4911e944435697
parent3b54099d7b5532a411bb477006d78844c0597745 (diff)
voxlinesystems CDRs and quantity bs
-rw-r--r--FS/FS/cdr.pm6
-rw-r--r--FS/FS/cust_main.pm9
-rw-r--r--httemplate/edit/process/quick-charge.cgi6
-rw-r--r--httemplate/edit/quick-charge.html27
-rw-r--r--httemplate/search/cdr.html14
-rw-r--r--httemplate/view/svc_phone.cgi6
6 files changed, 57 insertions, 11 deletions
diff --git a/FS/FS/cdr.pm b/FS/FS/cdr.pm
index adde898..5b1a4b4 100644
--- a/FS/FS/cdr.pm
+++ b/FS/FS/cdr.pm
@@ -422,7 +422,7 @@ my %export_formats = (
],
'voxlinesystems' => [
sub { time2str('%D', shift->calldate_unix ) }, #DATE
- sub { time2str('%T', shift->calldate_unix ) }, #TIME
+ sub { time2str('%r', shift->calldate_unix ) }, #TIME
'userfield', #USER
'dst', #NUMBER_DIALED
sub { sprintf('%.2fm', shift->billsec / 60 ) }, #DURATION
@@ -729,9 +729,9 @@ my %import_formats = (
'enddate', #End (also a timestamp!)
sub { my($cdr, $field) = @_; }, #End date
sub { my($cdr, $field) = @_; }, #End time
- 'accountcode', #Calling customer XXX map to agent_custid??
+ 'accountcode', #Calling customer... map to agent_custid??
sub { my($cdr, $field) = @_; }, #Calling type
- sub { shift->src('30000'); }, #XXX FAKE XXX 'src', #Calling number
+ 'src',
'userfield', #Calling name #?
sub { my($cdr, $field) = @_; }, #Called type
'dst', #Called number
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index 787a2ef..1f2fe88 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -4675,9 +4675,10 @@ the error, otherwise returns false.
sub charge {
my $self = shift;
- my ( $amount, $pkg, $comment, $taxclass, $additional, $classnum );
+ my ( $amount, $quantity, $pkg, $comment, $taxclass, $additional, $classnum );
if ( ref( $_[0] ) ) {
$amount = $_[0]->{amount};
+ $quantity = exists($_[0]->{quantity}) ? $_[0]->{quantity} : 1;
$pkg = exists($_[0]->{pkg}) ? $_[0]->{pkg} : 'One-time charge';
$comment = exists($_[0]->{comment}) ? $_[0]->{comment}
: '$'. sprintf("%.2f",$amount);
@@ -4686,6 +4687,7 @@ sub charge {
$additional = $_[0]->{additional};
}else{
$amount = shift;
+ $quantity = 1;
$pkg = @_ ? shift : 'One-time charge';
$comment = @_ ? shift : '$'. sprintf("%.2f",$amount);
$taxclass = @_ ? shift : '';
@@ -4738,8 +4740,9 @@ sub charge {
}
my $cust_pkg = new FS::cust_pkg ( {
- 'custnum' => $self->custnum,
- 'pkgpart' => $pkgpart,
+ 'custnum' => $self->custnum,
+ 'pkgpart' => $pkgpart,
+ 'quantity' => $quantity,
} );
$error = $cust_pkg->insert;
diff --git a/httemplate/edit/process/quick-charge.cgi b/httemplate/edit/process/quick-charge.cgi
index 22f9685..4c4927f 100644
--- a/httemplate/edit/process/quick-charge.cgi
+++ b/httemplate/edit/process/quick-charge.cgi
@@ -30,6 +30,11 @@ $param->{"amount"} =~ /^\s*(\d+(\.\d{1,2})?)\s*$/
or $error .= "Illegal amount " . $param->{"amount"} . " ";
my $amount = $1;
+my $quantity = 1;
+if ( $cgi->param('quantity') =~ /^\s*(\d+)\s*$/ ) {
+ $quantity = $1;
+}
+
if ( $param->{'taxclass'} eq '(select)' ) {
$error .= "Must select a tax class. ";
}
@@ -40,6 +45,7 @@ unless ( $error ) {
$error ||= $cust_main->charge( {
'amount' => $amount,
+ 'quantity' => $quantity,
'pkg' => scalar($cgi->param('pkg')),
'taxclass' => scalar($cgi->param('taxclass')),
'classnum' => scalar($cgi->param('classnum')),
diff --git a/httemplate/edit/quick-charge.html b/httemplate/edit/quick-charge.html
index 2dcbe51..d510150 100644
--- a/httemplate/edit/quick-charge.html
+++ b/httemplate/edit/quick-charge.html
@@ -78,18 +78,32 @@ function validate_quick_charge () {
<TABLE ID="QuickChargeTable" BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 STYLE="background-color: #cccccc">
<TR>
- <TD ALIGN="right">Amount:</TD>
+ <TD ALIGN="right">Amount: </TD>
<TD>
$<INPUT TYPE="text" NAME="amount" SIZE=6 VALUE="<% $amount %>" onChange="enable_quick_charge()" onKeyPress="enable_quick_charge_amount()">
</TD>
+</TR>
+
+% if ( $conf->exists('invoice-unitprice') ) {
+ <TR>
+ <TD ALIGN="right">Quantity: </TD>
+ <TD>
+ <INPUT TYPE="text" NAME="quantity" SIZE=4 VALUE="<% $quantity %>">
+ </TD>
+ </TR>
+% }
+
<% include('/elements/tr-select-pkg_class.html', 'curr_value' => $cgi->param('classnum') ) %>
+
<% include('/elements/tr-select-taxclass.html', 'curr_value' => $cgi->param('taxclass') ) %>
-</TR>
+
+<TR>
<TD>Description:</TD>
<TD>
<INPUT TYPE="text" NAME="pkg" SIZE="60" MAXLENGTH="65" VALUE="<% $pkg %>" onChange="enable_quick_charge()" onKeyPress="enable_quick_charge_desc()">
</TD>
</TR>
+
<TR>
<TD></TD>
<TD><FONT SIZE="-1">Optional additional description: </FONT></TD>
@@ -114,7 +128,7 @@ function validate_quick_charge () {
</TABLE>
<BR>
-<INPUT TYPE="submit" NAME="submit" VALUE="Add one-time charge" <% $cgi->param('error') ? '' :' DISABLED' %>>
+<INPUT TYPE="submit" ID="submit" NAME="submit" VALUE="Add one-time charge" <% $cgi->param('error') ? '' :' DISABLED' %>>
</FORM>
@@ -167,6 +181,8 @@ function validate_quick_charge () {
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('One-time charge');
+my $conf = new FS::Conf;
+
$cgi->param('custnum') =~ /^(\d+)$/ or die 'illegal custnum';
my $custnum = $1;
@@ -175,6 +191,11 @@ if ( $cgi->param('amount') =~ /^\s*\$?\s*(\d+(\.\d{1,2})?)\s*$/ ) {
$amount = $1;
}
+my $quantity = 1;
+if ( $cgi->param('quantity') =~ /^\s*(\d+)\s*$/ ) {
+ $quantity = $1;
+}
+
$cgi->param('pkg') =~ /^([\w \!\@\#\$\%\&\(\)\-\+\;\:\'\"\,\.\?\/\=\[\]]*)$/
or die 'illegal description';
my $pkg = $1;
diff --git a/httemplate/search/cdr.html b/httemplate/search/cdr.html
index 8079b5b..4bac8c1 100644
--- a/httemplate/search/cdr.html
+++ b/httemplate/search/cdr.html
@@ -61,7 +61,7 @@ push @search, FS::UI::Web::parse_lt_gt($cgi, 'duration');
push @search, FS::UI::Web::parse_lt_gt($cgi, 'billsec');
###
-# src/dest
+# src/dest/charged_party
###
my @qsearch = @search;
@@ -78,6 +78,18 @@ if ( $cgi->param('dst') =~ /^\s*([\d\-\+ ]+)\s*$/ ) {
push @search, "dst = '$dst'";
}
+if ( $cgi->param('charged_party') =~ /^\s*([\d\-\+\ ]+)\s*$/ ) {
+ ( my $charged_party = $1 ) =~ s/\D//g;
+ #$hashref->{'charged_party'} = $charged_party;
+ #push @search, "charged_party = '$charged_party'";
+ #XXX countrycode
+ push @search, " ( charged_party = '$charged_party'
+ OR charged_party = '1$charged_party' ) ";
+ push @qsearch, " ( charged_party = '$charged_party'
+ OR charged_party = '1$charged_party' ) ";
+}
+
+
###
# finish it up
###
diff --git a/httemplate/view/svc_phone.cgi b/httemplate/view/svc_phone.cgi
index 8bd4dba..6f39860 100644
--- a/httemplate/view/svc_phone.cgi
+++ b/httemplate/view/svc_phone.cgi
@@ -24,8 +24,12 @@ my $html_foot = sub {
my $number = $svc_phone->phonenum;
+ #my @links = map {
+ # qq(<A HREF="${p}search/cdr.html?src=$number;freesidestatus=$what{$_}">).
+ # "View $_ CDRs</A>";
+ #} keys(%what);
my @links = map {
- qq(<A HREF="${p}search/cdr.html?src=$number;freesidestatus=$what{$_}">).
+ qq(<A HREF="${p}search/cdr.html?charged_party=$number;freesidestatus=$what{$_}">).
"View $_ CDRs</A>";
} keys(%what);