X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FClientAPI%2FMasonComponent.pm;h=8a31185bd2e80f60baca502b150027c53223f57f;hb=6da8d320d8792e6b70ec5cf1a40088f87f4762e5;hp=88baf0764264e9ec59c629f4ab42b60f07827c69;hpb=beb9681db0ee4c0912c82849267a82dd434784b3;p=freeside.git diff --git a/FS/FS/ClientAPI/MasonComponent.pm b/FS/FS/ClientAPI/MasonComponent.pm index 88baf0764..8a31185bd 100644 --- a/FS/FS/ClientAPI/MasonComponent.pm +++ b/FS/FS/ClientAPI/MasonComponent.pm @@ -26,6 +26,7 @@ my %allowed_comps = map { $_=>1 } qw( my %session_comps = map { $_=>1 } qw( /elements/location.html + /elements/tr-amount_fee.html /edit/cust_main/first_pkg/select-part_pkg.html ); @@ -36,11 +37,34 @@ my %session_callbacks = ( my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ) or return "unknown custnum $custnum"; my %args = @$argsref; - $args{object} = $cust_main; + $args{object} = $cust_main->bill_location; @$argsref = ( %args ); return ''; #no error }, + '/elements/tr-amount_fee.html' => sub { + my( $custnum, $argsref ) = @_; + + my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ) + or return "unknown custnum $custnum"; + + my $conf = new FS::Conf; + + my %args = @$argsref; + %args = ( + %args, + 'process-pkgpart' => + scalar($conf->config('selfservice_process-pkgpart', $cust_main->agentnum)), + 'process-display' => scalar($conf->config('selfservice_process-display')), + 'process-skip_first' => $conf->exists('selfservice_process-skip_first'), + 'num_payments' => scalar($cust_main->cust_pay), + 'surcharge_percentage' => scalar($conf->config('credit-card-surcharge-percentage')), + ); + @$argsref = ( %args ); + + return ''; #no error + }, + '/edit/cust_main/first_pkg/select-part_pkg.html' => sub { my( $custnum, $argsref ) = @_; my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ) @@ -59,8 +83,23 @@ my %session_callbacks = ( } qsearch( 'part_pkg', { 'disabled' => '' }, '', 'ORDER BY pkg' ); # case? + my $conf = new FS::Conf; + if ( $conf->exists('pkg-addon_classnum') ) { + + my %classnum = map { ( $_->addon_classnum => 1 ) } + grep { $_->freq !~ /^0/ } + map { $_->part_pkg } + $cust_main->ncancelled_pkgs; + + unless ( $classnum{''} || ! keys %classnum ) { + @part_pkg = grep $classnum{ $_->classnum }, @part_pkg; + } + } + my %args = @$argsref; $args{part_pkg} = \@part_pkg; + $args{first_svc} = \@first_svc; + $args{no_comment} = 1; @$argsref = ( %args ); return ''; #no error @@ -96,6 +135,7 @@ sub mason_comp { my $conf = new FS::Conf; $FS::Mason::Request::FSURL = $conf->config('selfservice_server-base_url'); + $FS::Mason::Request::FSURL .= '/' unless $FS::Mason::Request::FSURL =~ /\/$/; $FS::Mason::Request::QUERY_STRING = $packet->{'query_string'} || ''; $outbuf = '';