summaryrefslogtreecommitdiff
path: root/fs_selfservice
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2012-07-08 22:45:58 -0700
committerIvan Kohler <ivan@freeside.biz>2012-07-08 22:45:58 -0700
commita6fe07e49e3fc12169e801b1ed6874c3a5bd8500 (patch)
treeb87a7e6f37da5c8e13eb4d4653cfc8ce9239d8f0 /fs_selfservice
parente27244386c346f459d1569db26344407a0372a05 (diff)
parent005424d0c899aa899f43f583a6c74deb13ea4be1 (diff)
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Conflicts: httemplate/misc/process/cancel_pkg.html
Diffstat (limited to 'fs_selfservice')
-rw-r--r--fs_selfservice/FS-SelfService/SelfService.pm18
-rw-r--r--fs_selfservice/FS-SelfService/SelfService/XMLRPC.pm20
-rw-r--r--fs_selfservice/FS-SelfService/cgi/myaccount.html18
-rw-r--r--fs_selfservice/FS-SelfService/cgi/provision_list.html1
-rw-r--r--fs_selfservice/FS-SelfService/cgi/small_custview.html69
-rw-r--r--fs_selfservice/FS-SelfService/cgi/ticket_summary.html26
-rw-r--r--fs_selfservice/php/freeside.class.new.php71
7 files changed, 180 insertions, 43 deletions
diff --git a/fs_selfservice/FS-SelfService/SelfService.pm b/fs_selfservice/FS-SelfService/SelfService.pm
index 0686c3d0f..c22e4269e 100644
--- a/fs_selfservice/FS-SelfService/SelfService.pm
+++ b/fs_selfservice/FS-SelfService/SelfService.pm
@@ -26,11 +26,13 @@ $socket .= '.'.$tag if defined $tag && length($tag);
'chfn' => 'passwd/passwd',
'chsh' => 'passwd/passwd',
'login_info' => 'MyAccount/login_info',
+ 'login_banner_image' => 'MyAccount/login_banner_image',
'login' => 'MyAccount/login',
'logout' => 'MyAccount/logout',
'switch_acct' => 'MyAccount/switch_acct',
'customer_info' => 'MyAccount/customer_info',
'customer_info_short' => 'MyAccount/customer_info_short',
+ 'billing_history' => 'MyAccount/billing_history',
'edit_info' => 'MyAccount/edit_info', #add to ss cgi!
'invoice' => 'MyAccount/invoice',
'invoice_pdf' => 'MyAccount/invoice_pdf',
@@ -103,22 +105,6 @@ $socket .= '.'.$tag if defined $tag && length($tag);
'call_time' => 'PrepaidPhone/call_time',
'call_time_nanpa' => 'PrepaidPhone/call_time_nanpa',
'phonenum_balance' => 'PrepaidPhone/phonenum_balance',
- #izoom
- #'bulk_processrow' => 'Bulk/processrow',
- #conflicts w/Agent one# 'check_username' => 'Bulk/check_username',
- #sg
- 'ping' => 'SGNG/ping',
- 'decompify_pkgs' => 'SGNG/decompify_pkgs',
- 'previous_payment_info' => 'SGNG/previous_payment_info',
- 'previous_payment_info_renew_info'
- => 'SGNG/previous_payment_info_renew_info',
- 'previous_process_payment' => 'SGNG/previous_process_payment',
- 'previous_process_payment_order_pkg'
- => 'SGNG/previous_process_payment_order_pkg',
- 'previous_process_payment_change_pkg'
- => 'SGNG/previous_process_payment_change_pkg',
- 'previous_process_payment_order_renew'
- => 'SGNG/previous_process_payment_order_renew',
);
@EXPORT_OK = (
keys(%autoload),
diff --git a/fs_selfservice/FS-SelfService/SelfService/XMLRPC.pm b/fs_selfservice/FS-SelfService/SelfService/XMLRPC.pm
index 59c8756f8..14f8a0c44 100644
--- a/fs_selfservice/FS-SelfService/SelfService/XMLRPC.pm
+++ b/fs_selfservice/FS-SelfService/SelfService/XMLRPC.pm
@@ -33,17 +33,21 @@ $DEBUG = 0;
$FS::SelfService::DEBUG = $DEBUG;
#false laziness w/FS::ClientAPI_XMLRPC.pm
+our %typefix_skin_info = (
+ 'logo' => 'base64',
+ 'title_left_image' => 'base64',
+ 'title_right_image' => 'base64',
+ 'menu_top_image' => 'base64',
+ 'menu_body_image' => 'base64',
+ 'menu_bottom_image' => 'base64',
+);
our %typefix = (
'invoice_pdf' => { 'invoice_pdf' => 'base64', },
'legacy_invoice_pdf' => { 'invoice_pdf' => 'base64', },
- 'skin_info' => { 'logo' => 'base64',
- 'title_left_image' => 'base64',
- 'title_right_image' => 'base64',
- 'menu_top_image' => 'base64',
- 'menu_body_image' => 'base64',
- 'menu_bottom_image' => 'base64',
- },
- 'invoice_logo' => { 'logo' => 'base64', },
+ 'skin_info' => \%typefix_skin_info,
+ 'login_info' => \%typefix_skin_info,
+ 'invoice_logo' => { 'logo' => 'base64', },
+ 'login_banner_image' => { 'image' => 'base64', },
);
sub AUTOLOAD {
diff --git a/fs_selfservice/FS-SelfService/cgi/myaccount.html b/fs_selfservice/FS-SelfService/cgi/myaccount.html
index f82b706b1..9ab262261 100644
--- a/fs_selfservice/FS-SelfService/cgi/myaccount.html
+++ b/fs_selfservice/FS-SelfService/cgi/myaccount.html
@@ -2,7 +2,9 @@
<%= include('header', 'My Account') %>
Hello <%= $name %>!<BR><BR>
-<%= $small_custview %>
+
+<%= include('small_custview') %>
+
<BR>
<%= unless ( $access_pkgnum ) {
$OUT .= qq!Balance: <B>\$$balance</B><BR><BR>!;
@@ -34,17 +36,17 @@ Hello <%= $name %>!<BR><BR>
$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 = "ffffff";
- my $col2 = "dddddd";
+ my $col1 = $stripe1_bgcolor || '#ffffff';
+ my $col2 = $stripe2_bgcolor || '#dddddd';
my $col = $col1;
foreach my $invoice ( @open_invoices ) {
- my $td = qq!<TD BGCOLOR="#$col">!;
+ my $td = qq!<TD BGCOLOR="$col">!;
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'}.
+ qq!<TD BGCOLOR="$col" ALIGN="right">$a\$!. $invoice->{'owed'}.
'</A></TD>'.
'</TR>';
$col = $col eq $col1 ? $col2 : $col1;
@@ -61,12 +63,12 @@ Hello <%= $name %>!<BR><BR>
'<TR><TH BGCOLOR="#ff6666" COLSPAN="3">Support Time Remaining</TH>'.
'</TR><TR><TH>Package</TH><TH></TH>'.
'<TH>Time Remaining</TH></TR>';
- my $col1 = "ffffff";
- my $col2 = "dddddd";
+ my $col1 = $stripe1_bgcolor || '#ffffff';
+ my $col2 = $stripe2_bgcolor || '#dddddd';
my $col = $col1;
foreach my $support ( @support_services ) {
- my $td = qq!<TD BGCOLOR="#$col">!;
+ my $td = qq!<TD BGCOLOR="$col">!;
my $a = qq!<A HREF="${url}view_support_details;svcnum=!.
$support->{'svcnum'}. '">';
$OUT .=
diff --git a/fs_selfservice/FS-SelfService/cgi/provision_list.html b/fs_selfservice/FS-SelfService/cgi/provision_list.html
index 22054e644..2a3a8e909 100644
--- a/fs_selfservice/FS-SelfService/cgi/provision_list.html
+++ b/fs_selfservice/FS-SelfService/cgi/provision_list.html
@@ -10,7 +10,6 @@ foreach my $pkg (
} @cust_pkg
) {
my $susp = $pkg->{'susp'} || '';
- warn $pkg->{'pkg'}. ' '.$susp."\n";
my @pkg_actions = ( [ 'customer_change_pkg' => 'change' ] );
push @pkg_actions, [ 'process_suspend_pkg' => 'suspend' ]
if $self_suspend_reason and !$susp;
diff --git a/fs_selfservice/FS-SelfService/cgi/small_custview.html b/fs_selfservice/FS-SelfService/cgi/small_custview.html
new file mode 100644
index 000000000..8d6e07368
--- /dev/null
+++ b/fs_selfservice/FS-SelfService/cgi/small_custview.html
@@ -0,0 +1,69 @@
+<DIV ID="fs_small_custview">
+
+Customer #<B><%= $custnum %></B>
+ - <B><FONT COLOR="#<%= $statuscolor %>"><%= ucfirst($status)%></FONT></B>
+
+<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 BGCOLOR="<%= $box_bgcolor ||= '#c0c0c0' %>">
+ <TR>
+ <TD VALIGN="top">
+ <%= $has_ship_address
+ ? '<I><FONT SIZE="-1">Billing Address</FONT></I><BR>'
+ : ''
+ %>
+ <%= $first %> <%= $last %><BR>
+ <%= $company ? $company.'<BR>' : '' %>
+ <%= $address1 %><BR>
+ <%= $address2 ? $address2.'<BR>' : '' %>
+ <%= $city %>, <%= $state %> <%= $zip %><BR>
+ <%= $country && $country ne ($countrydefault||'US')
+ ? $country.'<BR>'
+ : ''
+ %>
+ <%= if ( $daytime && $night ) {
+ $OUT .= "<BR>Day Phone $daytime<BR>Night Phone $night";
+ } elsif ( $daytime || $night ) {
+ $OUT .= '<BR>'. ($daytime || $night);
+ }
+ '';
+ %>
+ <%= $fax ? "<BR>Fax $fax" : '' %>
+
+ </TD>
+
+<%= if ( $has_ship_address ) {
+
+ $OUT .= '<TD>&nbsp;</TD>'.
+ '<TD VALIGN="top">'.
+ '<I><FONT SIZE="-1">Service Address</FONT></I><BR>'.
+ "$ship_first $ship_last<BR>";
+ $OUT .= "$ship_company<BR>" if $ship_company;
+ $OUT .= "$ship_address1<BR>";
+ $OUT .= "$ship_address2<BR>" if $ship_address2;
+ $OUT .= "$ship_city, $ship_state $ship_zip<BR>";
+ $OUT .= "$ship_country<BR>"
+ if $ship_country && $ship_country ne ($countrydefault||'US');
+
+
+ if ( $ship_daytime && $ship_night ) {
+ $OUT .= "<BR>Day Phone $ship_daytime<BR>Night Phone $ship_night";
+ } elsif ( $ship_daytime || $ship_night ) {
+ $OUT .= '<BR'. ($ship_daytime || $ship_night);
+ }
+
+ $OUT .= "<BR>Fax $ship_fax" if $ship_fax;
+
+ $OUT .= '</TD>';
+}
+'';
+%>
+
+</TR></TABLE>
+
+<%= unless ( $access_pkgnum ) {
+ $OUT .= '<BR>Balance: <B>$'. $balance. '</B><BR>';
+ }
+ '';
+%>
+
+</DIV>
+
diff --git a/fs_selfservice/FS-SelfService/cgi/ticket_summary.html b/fs_selfservice/FS-SelfService/cgi/ticket_summary.html
index c840ca9d6..4333c4e92 100644
--- a/fs_selfservice/FS-SelfService/cgi/ticket_summary.html
+++ b/fs_selfservice/FS-SelfService/cgi/ticket_summary.html
@@ -1,10 +1,10 @@
<SCRIPT TYPE="text/javascript" SRC="overlibmws.js"></SCRIPT>
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 BGCOLOR="#eeeeee">
-<TR><TH BGCOLOR="#ff6666" COLSPAN=15>Open Tickets</TH></TR>
+<TR><TH BGCOLOR="#ff6666" COLSPAN=16>Open Tickets</TH></TR>
<TR>
<%=
-my $col1 = "ffffff";
-my $col2 = "dddddd";
+my $col1 = $stripe1_bgcolor || "#ffffff";
+my $col2 = $stripe2_bgcolor || "#dddddd";
my $col = $col1;
my $can_set_priority =
@@ -26,12 +26,15 @@ my @titles = ('#', qw(Subject Queue Status Created Due));
push @titles, 'Estimated<BR>Hours';
push @titles, 'Priority';
-$OUT .= join("\n", map { "<TH VALIGN=\"top\">$_</TH><TH>&nbsp;</TH>" } @titles)
+$box_bgcolor ||= '#c0c0c0';
+my $th = qq(<TH BGCOLOR="$box_bgcolor");
+
+$OUT .= join("\n", map { "$th VALIGN=\"top\">$_</TH>$th>&nbsp;</TH>" } @titles)
. '</TR>';
foreach my $ticket ( @tickets ) {
my $id = $ticket->{'id'};
- my $td = qq!<TD BGCOLOR="#$col">!;
+ my $td = qq!<TD BGCOLOR="$col">!;
my $space = $td.'&nbsp;</TD>';
my $link = qq!<A HREF="${url}tktview;ticket_id=$id">!;
$OUT .= '<TR>' .
@@ -41,31 +44,34 @@ $td. $ticket->{'queue'} . '</TD>'. $space .
$td. $ticket->{'status'} . '</TD>'. $space .
$td. $date_formatter->($ticket->{'created'}) . '</TD>'. $space .
$td. $date_formatter->($ticket->{'due'}) . '</TD>'. $space .
-qq!<TD BGCOLOR="#$col" ALIGN="right">!.
+qq!<TD BGCOLOR="$col" ALIGN="right">!.
($ticket->{'timeestimated'} ?
sprintf('%.1f', $ticket->{'timeestimated'} / 60.0) # .1f?
: ''
) . '</TD>'. $space .
-qq!<TD BGCOLOR="#$col" ALIGN="right">!;
+qq!<TD BGCOLOR="$col" ALIGN="right">!;
if ( $can_set_priority ) {
$OUT .= '<INPUT TYPE="hidden" NAME="ticket'.$id.'" VALUE="1">' .
'<INPUT TYPE="text" SIZE=4 NAME="priority'.$id.'"' .
'VALUE="'.$ticket->{'_selfservice_priority'}.'"></TD>';
if ( exists($ticket_error{$id}) ) {
# display error message compactly
- $OUT .= '<TD><FONT COLOR="#ff0000" onmouseover="'.
+ $OUT .= $td. '<FONT COLOR="#ff0000" onmouseover="'.
"return overlib('".$ticket_error{$id}."', AUTOSTATUS, WRAP);" .
'" onmouseout="nd();">*</FONT></TD>';
+ } else {
+ $OUT .= $td.'</TD>';
}
}
else {
- $OUT .= ($ticket->{'content'} || $ticket->{'priority'}) . '</TD>';
+ $OUT .= ($ticket->{'content'} || $ticket->{'priority'}) . '</TD>'.
+ $td.'</TD>';
}
$OUT .= '</TR>';
$col = $col eq $col1 ? $col2 : $col1;
} #foreach my $ticket
if ( $can_set_priority ) {
- $OUT .= '<TR><TD COLSPAN=15 ALIGN="right">
+ $OUT .= '<TR><TD COLSPAN=16 ALIGN="right">
<INPUT TYPE="submit" VALUE="Save changes"></TD></TR></FORM>';
}
%>
diff --git a/fs_selfservice/php/freeside.class.new.php b/fs_selfservice/php/freeside.class.new.php
new file mode 100644
index 000000000..b9d125eb6
--- /dev/null
+++ b/fs_selfservice/php/freeside.class.new.php
@@ -0,0 +1,71 @@
+<?php
+
+#pre-php 5.4 compatible version?
+function flatten($hash) {
+ if ( !is_array($hash) ) return $hash;
+ $flat = array();
+
+ array_walk($hash, function($value, $key, &$to) {
+ array_push($to, $key, $value);
+ }, $flat);
+
+ if ( PHP_VERSION_ID >= 50400 ) {
+
+ #php 5.4+ (deb 7+)
+ foreach ($hash as $key => $value) {
+ $flat[] = $key;
+ $flat[] = $value;
+ }
+
+ }
+
+ return($flat);
+}
+
+#php 5.4+?
+#function flatten($hash) {
+# if ( !is_array($hash) ) return $hash;
+#
+# $flat = array();
+#
+# foreach ($hash as $key => $value) {
+# $flat[] = $key;
+# $flat[] = $value;
+# }
+#
+# return($flat);
+#}
+
+class FreesideSelfService {
+
+ //Change this to match the location of your selfservice xmlrpc.cgi or daemon
+ #var $URL = 'https://localhost/selfservice/xmlrpc.cgi';
+ var $URL = 'http://localhost/selfservice/xmlrpc.cgi';
+
+ function FreesideSelfService() {
+ $this;
+ }
+
+ public function __call($name, $arguments) {
+
+ error_log("[FreesideSelfService] $name called, sending to ". $this->URL);
+
+ $request = xmlrpc_encode_request("FS.ClientAPI_XMLRPC.$name", flatten($arguments[0]));
+ $context = stream_context_create( array( 'http' => array(
+ 'method' => "POST",
+ 'header' => "Content-Type: text/xml",
+ 'content' => $request
+ )));
+ $file = file_get_contents($this->URL, false, $context);
+ $response = xmlrpc_decode($file);
+ if (xmlrpc_is_fault($response)) {
+ trigger_error("[FreesideSelfService] XML-RPC communication error: $response[faultString] ($response[faultCode])");
+ } else {
+ //error_log("[FreesideSelfService] $response");
+ return $response;
+ }
+ }
+
+}
+
+?>