X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2FClientAPI%2FMasonComponent.pm;h=b6f8aa4c6df4d5434573f1478472f5d7b4a4e19b;hp=20b4e5bdbe1adadc9f4f307ccaf482500ce1ad0f;hb=c110da0da864245e47cae019b8a347367cc6430c;hpb=b5c4237a34aef94976bc343c8d9e138664fc3984 diff --git a/FS/FS/ClientAPI/MasonComponent.pm b/FS/FS/ClientAPI/MasonComponent.pm index 20b4e5bdb..b6f8aa4c6 100644 --- a/FS/FS/ClientAPI/MasonComponent.pm +++ b/FS/FS/ClientAPI/MasonComponent.pm @@ -26,6 +26,8 @@ my %allowed_comps = map { $_=>1 } qw( my %session_comps = map { $_=>1 } qw( /elements/location.html + /elements/tr-amount_fee.html + /elements/select-part_pkg.html /edit/cust_main/first_pkg/select-part_pkg.html ); @@ -36,11 +38,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 } ) @@ -74,11 +99,34 @@ my %session_callbacks = ( my %args = @$argsref; $args{part_pkg} = \@part_pkg; + $args{first_svc} = \@first_svc; + $args{no_comment} = 1; + $args{label_callback} = sub { shift->pkg_comment }; @$argsref = ( %args ); return ''; #no error }, + '/elements/select-part_pkg.html' => sub { + my( $custnum, $argsref ) = @_; + my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ) + or return "unknown custnum $custnum"; + + my $pkgpart = $cust_main->agent->pkgpart_hashref; + + #false laziness w/ edit/cust_main/first_pkg.html + my @first_svc = ( 'svc_acct', 'svc_phone' ); + + my @part_pkg = + grep { $pkgpart->{ $_->pkgpart } + || ( $_->agentnum && $_->agentnum == $cust_main->agentnum ) + } + qsearch( 'part_pkg', { 'disabled' => '' }, '', 'ORDER BY pkg' ); # case? + + push @$argsref, 'part_pkg' => \@part_pkg; + ''; + }, + ); my $outbuf;