diff options
| author | Ivan Kohler <ivan@freeside.biz> | 2015-06-13 15:18:37 -0700 |
|---|---|---|
| committer | Ivan Kohler <ivan@freeside.biz> | 2015-06-13 15:18:37 -0700 |
| commit | 7beec7068e00be5ae1b2599fdf2b494bc19e31d0 (patch) | |
| tree | 055e1d25694ccfdac3a2d5aca79441cf7a3d89b5 /fs_selfservice/FS-SelfService/cgi | |
| parent | 9e8d2a5bafb21c42f54cdd9b3703e2f88a36e0a8 (diff) | |
| parent | eb6536b41456955fc425dba2e156a996e8fe2837 (diff) | |
Merge branch 'FREESIDE_3_BRANCH' of git.freeside.biz:/home/git/freeside into FREESIDE_3_BRANCH
Diffstat (limited to 'fs_selfservice/FS-SelfService/cgi')
7 files changed, 100 insertions, 25 deletions
diff --git a/fs_selfservice/FS-SelfService/cgi/invoices.html b/fs_selfservice/FS-SelfService/cgi/invoices.html index 752805123..ffc44ec85 100644 --- a/fs_selfservice/FS-SelfService/cgi/invoices.html +++ b/fs_selfservice/FS-SelfService/cgi/invoices.html @@ -3,24 +3,34 @@ <%= if ( @invoices ) { - $OUT .= '<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 BGCOLOR="#eeeeee">'. - '<TR><TH BGCOLOR="#ff6666" COLSPAN=4>All Invoices</TH></TR>'; - my $col1 = "ffffff"; - my $col2 = "dddddd"; + my $th = q!<TH STYLE="background: #ff9999; text-align: left; padding: .1em .5em;">!; + my $thr = q!<TH STYLE="background: #ff9999; text-align: right; padding: .1em .5em;">!; + $OUT .= '<TABLE STYLE="border: 0;" CELLSPACING="0">'. + '<TR>'.$th.'Invoice #</TH>'.$th.'Date</TH>'.$thr.'Charges</TH>' + .$th.'Date Paid</TH>'.$thr.'Owed</TH></TR>'; + my $col1 = "#ffffff"; + my $col2 = "#dddddd"; my $col = $col1; foreach my $invoice ( @invoices ) { - my $td = qq!<TD BGCOLOR="#$col">!; + my $td = qq!<TD STYLE="background: $col; padding: .1em .5em;">!; + my $tdr = qq!<TD STYLE="background: $col; padding: .1em .5em; text-align: right;">!; my $a=qq!<A HREF="${url}view_invoice;invnum=!. $invoice->{'invnum'}. '">'; $OUT .= - "<TR>$td${a}Invoice #". $invoice->{'invnum'}. "</A></TD>$td </TD>". - "$td$a". $invoice->{'date'}. "</A></TD>$td</TD>". + "<TR>". + $td . $a . $invoice->{'invnum'}. "</A></TD>" . + $td . $a . $invoice->{'date'} . "</A></TD>" . + $tdr . $a . $money_char . $invoice->{'charged'} . "</A></TD>" . + $td . $a . $invoice->{'lastpay'} . "</A></TD>" . + $tdr . $a . $money_char . $invoice->{'owed'} . "</A></TD>" . '</TR>'; $col = $col eq $col1 ? $col2 : $col1; } + my $tht = '<TH COLSPAN="4" STYLE="background: #ff9999; padding: .1em .5em; text-align: right;">'; + $OUT .= '<TR>'.$tht.'BALANCE DUE</TH>'.$tht.$money_char.$balance.'</TH></TR>'; $OUT .= '</TABLE><BR>'; } else { - $OUT .= 'You have no invoices.<BR><BR>'; + $OUT .= '<P>You have no invoices.</P>'; } %> diff --git a/fs_selfservice/FS-SelfService/cgi/myaccount.html b/fs_selfservice/FS-SelfService/cgi/myaccount.html index 66e2c692e..309021a87 100644 --- a/fs_selfservice/FS-SelfService/cgi/myaccount.html +++ b/fs_selfservice/FS-SelfService/cgi/myaccount.html @@ -28,28 +28,34 @@ Hello <%= $name %>!<BR><BR> } %> <%= if ( @open_invoices ) { - $OUT .= '<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 BGCOLOR="#eeeeee">'. - '<TR><TH BGCOLOR="#ff6666" COLSPAN=5>Open Invoices</TH></TR>'; - my $link = qq!<A HREF="<%= $url %>myaccount!; - my $col1 = $stripe1_bgcolor || '#ffffff'; - my $col2 = $stripe2_bgcolor || '#dddddd'; + my $th = q!<TH STYLE="background: #ff9999; text-align: left; padding: .1em .5em;">!; + my $thr = q!<TH STYLE="background: #ff9999; text-align: right; padding: .1em .5em;">!; + $OUT .= '<TABLE STYLE="border: 0;" CELLSPACING="0">'. + '<TR><TH BGCOLOR="#ff6666" COLSPAN="4">Open Invoices</TH></TR>'. + '<TR>'.$th.'Invoice #</TH>'.$th.'Date</TH>'.$thr.'Charges</TH>' + .$thr.'Owed</TH></TR>'; + my $col1 = "#ffffff"; + my $col2 = "#dddddd"; my $col = $col1; foreach my $invoice ( @open_invoices ) { - my $td = qq!<TD BGCOLOR="$col">!; + my $td = qq!<TD STYLE="background: $col; padding: .1em .5em;">!; + my $tdr = qq!<TD STYLE="background: $col; padding: .1em .5em; text-align: right;">!; my $a=qq!<A HREF="${url}view_invoice;invnum=!. $invoice->{'invnum'}. '">'; $OUT .= - "<TR>$td${a}Invoice #". $invoice->{'invnum'}. "</A></TD>$td</TD>". - "$td$a". $invoice->{'date'}. "</A></TD>$td</TD>". - qq!<TD BGCOLOR="$col" ALIGN="right">$a\$!. $invoice->{'owed'}. - '</A></TD>'. + "<TR>". + $td . $a . $invoice->{'invnum'}. "</A></TD>" . + $td . $a . $invoice->{'date'} . "</A></TD>" . + $tdr . $a . $money_char . $invoice->{'charged'} . "</A></TD>" . + $tdr . $a . $money_char . $invoice->{'owed'} . "</A></TD>" . '</TR>'; $col = $col eq $col1 ? $col2 : $col1; } $OUT .= '</TABLE><BR>'; } else { - $OUT .= 'You have no outstanding invoices.<BR><BR>'; + $OUT .= '<P>You have no outstanding invoices.</P>'; } + %> <%= diff --git a/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html b/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html index 4802178d0..999c62da0 100644 --- a/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html +++ b/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html @@ -28,7 +28,7 @@ my %payby_mode; # $payby_mode{FOO} is true if FOO is thirdparty, false if it's B::OP, # nonexistent if it's not supported -if ( $balance > 0 ) { #XXXFIXME "enable selfservice prepay features" flag or something, eventually per-pkg or something really fancy +if ( ($balance || 0) > 0 ) { #XXXFIXME "enable selfservice prepay features" flag or something, eventually per-pkg or something really fancy if ( exists( $payby_mode{CARD} ) ) { push @menu, { title => 'Recharge my account with a credit card', diff --git a/fs_selfservice/FS-SelfService/cgi/provision_list.html b/fs_selfservice/FS-SelfService/cgi/provision_list.html index b558337de..086c79e57 100644 --- a/fs_selfservice/FS-SelfService/cgi/provision_list.html +++ b/fs_selfservice/FS-SelfService/cgi/provision_list.html @@ -96,7 +96,7 @@ foreach my $pkg ( '('. $part_svc->{'num_avail'}. ' available)'. '</TD></TR>' #self-service only supports these services so far - if grep { $part_svc->{'svcdb'} eq $_ } qw( svc_acct svc_external ); + if grep { $part_svc->{'svcdb'} eq $_ } qw( svc_acct svc_external svc_forward ); $col = $col eq $col1 ? $col2 : $col1; } diff --git a/fs_selfservice/FS-SelfService/cgi/provision_svc_forward.html b/fs_selfservice/FS-SelfService/cgi/provision_svc_forward.html new file mode 100644 index 000000000..470066323 --- /dev/null +++ b/fs_selfservice/FS-SelfService/cgi/provision_svc_forward.html @@ -0,0 +1,29 @@ +<%= include('header', 'Setup forward') %> + +<FORM name="OneTrueForm" action="<%= $selfurl %>" METHOD="POST"> +<INPUT TYPE="hidden" NAME="action" VALUE="process_svc_forward"> + +<%= '<P><B>' . $error . '</B></P>' if $error %> + +<%= +my $out = mason_comp( + 'session_id' => $session_id, + 'comp' => '/edit/elements/svc_forward.html', + 'args' => [ + 'svcnum' => $svcnum, + 'pkgnum' => $pkgnum, + 'svcpart' => $svcpart, + 'srcsvc' => $srcsvc, + 'dstsvc' => $dstsvc, + 'src' => $src, + 'dst' => $dst, + 'email' => \%forward_emails, + ] +); +$out->{'output'} || $out->{'error'}; +%> + +<INPUT TYPE="submit" VALUE="Setup"> +</FORM> + +<%= include('footer') %> diff --git a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi index d039cfd4d..1b728e2f9 100755 --- a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi +++ b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi @@ -15,7 +15,7 @@ use FS::SelfService qw( access_info login_info login customer_info edit_info invoice payment_info process_payment realtime_collect process_prepay list_pkgs order_pkg signup_info order_recharge - part_svc_info provision_acct provision_external provision_phone + part_svc_info provision_acct provision_external provision_phone provision_forward unprovision_svc change_pkg suspend_pkg domainselector list_svcs list_svc_usage list_cdr_usage list_support_usage myaccount_passwd list_invoices create_ticket get_ticket did_report @@ -70,6 +70,7 @@ my @actions = ( qw( process_svc_acct process_svc_phone process_svc_external + process_svc_forward delete_svc view_usage view_usage_details @@ -847,7 +848,7 @@ sub provision_svc { my $result = part_svc_info( 'session_id' => $session_id, - map { $_ => $cgi->param($_) } qw( pkgnum svcpart svcnum ), + map { $_ => ($cgi->param($_) || '') } qw( pkgnum svcpart svcnum ), ); die $result->{'error'} if exists $result->{'error'} && $result->{'error'}; @@ -933,6 +934,33 @@ sub process_svc_external { ); } +sub process_svc_forward { + + my $result = provision_forward ( + 'session_id' => $session_id, + map { $_ => $cgi->param($_) || '' } qw( + pkgnum svcpart srcsvc src dstsvc dst ) + ); + + if ( exists $result->{'error'} && $result->{'error'} ) { + #warn "$result $result->{'error'}"; + $action = 'provision_svc_forward'; + return { + $cgi->Vars, + %{ part_svc_info( 'session_id' => $session_id, + map { $_ => $cgi->param($_) } qw( svcnum pkgnum svcpart ) + ) + }, + 'error' => $result->{'error'}, + }; + } else { + #just go to setup services page, results will be visible there + $action = 'provision'; + return provision(); + } + +} + sub delete_svc { unprovision_svc( 'session_id' => $session_id, @@ -1143,7 +1171,7 @@ package FS::SelfService::_selfservicecgi; use HTML::Entities; use FS::SelfService qw( - regionselector popselector domainselector location_form didselector + regionselector popselector domainselector location_form didselector mason_comp ); #false laziness w/agent.cgi diff --git a/fs_selfservice/FS-SelfService/cgi/view_usage_details.html b/fs_selfservice/FS-SelfService/cgi/view_usage_details.html index 0388c2fad..27afe12a7 100644 --- a/fs_selfservice/FS-SelfService/cgi/view_usage_details.html +++ b/fs_selfservice/FS-SelfService/cgi/view_usage_details.html @@ -47,7 +47,9 @@ $OUT .= '</TD><TD ALIGN="right">'; $OUT .= Date::Format::time2str('%T%P %a %b %o %Y', $usage->{'acctstarttime'}); $OUT .= '</TD><TD ALIGN="right">'; - my $duration = $usage->{'acctstoptime'} - $usage->{'acctstarttime'}; + my $duration = ( $usage->{'acctstoptime'} && $usage->{'acctstarttime'} ) + ? ( $usage->{'acctstoptime'} - $usage->{'acctstarttime'} ) + : 0; $total += $duration; my $h = int($duration/3600); my $m = sprintf("%02d", int(($duration % 3600) / 60)); |
