diff options
| author | ivan <ivan> | 2008-06-05 19:24:37 +0000 | 
|---|---|---|
| committer | ivan <ivan> | 2008-06-05 19:24:37 +0000 | 
| commit | 7a3347315a12b7afb394a855eccf996faf0c6589 (patch) | |
| tree | 0144898e68e4406ace817a67a5f12f2f389f977c | |
| parent | aa7b85d7154526990979d9df17ea1e237386365a (diff) | |
voxlinesystems CDRs and quantity bs
| -rw-r--r-- | FS/FS/cdr.pm | 6 | ||||
| -rw-r--r-- | FS/FS/cust_main.pm | 9 | ||||
| -rw-r--r-- | httemplate/edit/process/quick-charge.cgi | 6 | ||||
| -rw-r--r-- | httemplate/edit/quick-charge.html | 27 | ||||
| -rw-r--r-- | httemplate/search/cdr.html | 14 | ||||
| -rw-r--r-- | httemplate/view/svc_phone.cgi | 6 | 
6 files changed, 57 insertions, 11 deletions
| diff --git a/FS/FS/cdr.pm b/FS/FS/cdr.pm index adde898e4..5b1a4b421 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 51aefa9b0..259f650ce 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -4132,9 +4132,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); @@ -4143,6 +4144,7 @@ sub charge {      $additional = $_[0]->{additional};    }else{      $amount     = shift; +    $quantity   = 1;      $pkg        = @_ ? shift : 'One-time charge';      $comment    = @_ ? shift : '$'. sprintf("%.2f",$amount);      $taxclass   = @_ ? shift : ''; @@ -4195,8 +4197,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 22f96852f..4c4927f4d 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 95ec70c54..eaa9288f3 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', '') %> +  <% include('/elements/tr-select-taxclass.html') %> -</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 8079b5b98..4bac8c1f9 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 5dcf35916..65442d9af 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); | 
