X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FClientAPI%2FMyAccount.pm;h=e5078f960118eca8123a78d2e610a3162d65150f;hb=7ad62cea1758b8f2e4f0e0d4d8bab36a864b5938;hp=d4c0d3723959fdb76c8e4c402595cab2a791d25f;hpb=6bf2bd02e49b8e1beb8a334e842f56d62e89bd11;p=freeside.git diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm index d4c0d3723..e5078f960 100644 --- a/FS/FS/ClientAPI/MyAccount.pm +++ b/FS/FS/ClientAPI/MyAccount.pm @@ -993,10 +993,14 @@ sub validate_payment { $payinfo = $p->{'payinfo'}; + my $onfile = 0; + #more intelligent matching will be needed here if you change #card_masking_method and don't remove existing paymasks - $payinfo = $cust_main->payinfo - if $cust_main->paymask eq $payinfo; + if ( $cust_main->paymask eq $payinfo ) { + $payinfo = $cust_main->payinfo; + $onfile = 1; + } $payinfo =~ s/\D//g; $payinfo =~ /^(\d{13,16}|\d{8,9})$/ @@ -1018,7 +1022,7 @@ sub validate_payment { or return { 'error' => "CVV2 (CVC2/CID) is three digits." }; $paycvv = $1; } - } elsif ( $conf->exists('selfservice-require_cvv') ) { #and you weren't using a card on file? + } elsif ( !$onfile && $conf->exists('selfservice-require_cvv') ) { return { 'error' => 'CVV2 is required' }; } @@ -1816,6 +1820,7 @@ sub list_svcs { 'inbound' => ( $_ eq 'inbound' ? 1 : 0 ), 'begin' => ($cust_pkg->last_bill || 0), 'nonzero' => 1, + 'disable_charged_party' => 1, ); $hash{$_} = $sum_cdr->hashref; } @@ -2099,7 +2104,12 @@ sub _list_cdr_usage { # we have to return the results all at once... my($svc_phone, $begin, $end, %opt) = @_; map [ $_->downstream_csv(%opt, 'keeparray' => 1) ], - $svc_phone->get_cdrs( 'begin'=>$begin, 'end'=>$end, %opt ); + $svc_phone->get_cdrs( + 'begin'=>$begin, + 'end'=>$end, + 'disable_charged_party' => 1, + %opt + ); } sub list_cdr_usage { @@ -2111,6 +2121,7 @@ sub list_cdr_usage { sub _usage_details { my($callback, $p, %opt) = @_; + my $conf = FS::Conf->new; my($context, $session, $custnum) = _custoragent_session_custnum($p); return { 'error' => $session } if $context eq 'error'; @@ -2129,7 +2140,6 @@ sub _usage_details { my %callback_opt; my $header = []; if ( $svcdb eq 'svc_phone' ) { - my $conf = FS::Conf->new; my $format = ''; if ( $p->{inbound} ) { $format = $cust_pkg->part_pkg->option('selfservice_inbound_format') @@ -2163,6 +2173,14 @@ sub _usage_details { %callback_opt ); + if ( $conf->exists('selfservice-hide_cdr_price') ) { + # ugly kludge, I know + my ($delete_col) = grep { $header->[$_] eq 'Price' } (0..scalar(@$header)); + if (defined $delete_col) { + delete($_->[$delete_col]) foreach ($header, @usage); + } + } + #kinda false laziness with FS::cust_main::bill, but perhaps #we should really change this bit to DateTime and DateTime::Duration # @@ -2842,6 +2860,13 @@ sub myaccount_passwd { my $error = ''; my $conf = new FS::Conf; + + return { 'error' => 'Incorrect current password.' } + if ( exists($p->{'old_password'}) + || $conf->exists('selfservice-password_change_oldpass') + ) + && ! $svc_acct->check_password($p->{'old_password'}); + $error = 'Password too short.' if length($p->{'new_password'}) < ($conf->config('passwordmin') || 6); $error = 'Password too long.'