From 1203e278e2ec38fcf1468da2e4f10862004bebeb Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 5 Jun 2008 19:24:33 +0000 Subject: [PATCH] voxlinesystems CDRs and quantity bs --- FS/FS/cdr.pm | 6 +++--- FS/FS/cust_main.pm | 9 ++++++--- httemplate/edit/process/quick-charge.cgi | 6 ++++++ httemplate/edit/quick-charge.html | 27 ++++++++++++++++++++++++--- httemplate/search/cdr.html | 14 +++++++++++++- 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 787a2ef00..1f2fe886b 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 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 2dcbe5169..d51015054 100644 --- a/httemplate/edit/quick-charge.html +++ b/httemplate/edit/quick-charge.html @@ -78,18 +78,32 @@ function validate_quick_charge () { - + + + +% if ( $conf->exists('invoice-unitprice') ) { + + + + +% } + <% include('/elements/tr-select-pkg_class.html', 'curr_value' => $cgi->param('classnum') ) %> + <% include('/elements/tr-select-taxclass.html', 'curr_value' => $cgi->param('taxclass') ) %> - + + + @@ -114,7 +128,7 @@ function validate_quick_charge () {
Amount:Amount: $
Quantity: + +
Description:
Optional additional description:

-param('error') ? '' :' DISABLED' %>> +param('error') ? '' :' DISABLED' %>> @@ -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 8bd4dba02..6f3986083 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(). + # "View $_ CDRs"; + #} keys(%what); my @links = map { - qq(). + qq(). "View $_ CDRs"; } keys(%what); -- 2.11.0