self-service small_custview obeys selfservice-box_color and selfservice-text_color...
authorIvan Kohler <ivan@freeside.biz>
Mon, 30 Apr 2012 03:38:20 +0000 (20:38 -0700)
committerIvan Kohler <ivan@freeside.biz>
Mon, 30 Apr 2012 03:38:20 +0000 (20:38 -0700)
FS/FS/ClientAPI/MyAccount.pm
FS/FS/Conf.pm
FS/FS/UI/Web/small_custview.pm
fs_selfservice/FS-SelfService/cgi/myaccount.html
fs_selfservice/FS-SelfService/cgi/small_custview.html [new file with mode: 0644]
fs_selfservice/FS-SelfService/cgi/ticket_summary.html

index 08e3f7e..46ea66a 100644 (file)
@@ -115,7 +115,7 @@ sub skin_info {
       ( map { $_ => scalar( $conf->config($_, $agentnum) ) }
         qw( company_name date_format ) ),
       ( map { $_ => scalar( $conf->config("selfservice-$_", $agentnum ) ) }
-        qw( body_bgcolor box_bgcolor
+        qw( body_bgcolor box_bgcolor stripe1_bgcolor stripe2_bgcolor
             text_color link_color vlink_color hlink_color alink_color
             font title_color title_align title_size menu_bgcolor menu_fontsize
           )
@@ -418,15 +418,21 @@ sub customer_info {
       $return{open_invoices} = \@open;
     }
 
+    $return{countrydefault} = scalar($conf->config('countrydefault'));
+
     $return{small_custview} =
       small_custview( $cust_main,
-                      scalar($conf->config('countrydefault')),
+                      $return{countrydefault},
                       ( $session->{'pkgnum'} ? 1 : 0 ), #nobalance
                     );
 
     $return{name} = $cust_main->first. ' '. $cust_main->get('last');
     $return{ship_name} = $cust_main->ship_first. ' '. $cust_main->get('ship_last');
 
+    $return{has_ship_address} = $cust_main->has_ship_address;
+    $return{status} = $cust_main->status;
+    $return{statuscolor} = $cust_main->statuscolor;
+
     for (@cust_main_editable_fields) {
       $return{$_} = $cust_main->get($_);
     }
@@ -509,9 +515,11 @@ sub customer_info_short {
     my $cust_main = qsearchs('cust_main', $search )
       or return { 'error' => "unknown custnum $custnum" };
 
+    $return{countrydefault} = scalar($conf->config('countrydefault'));
+
     $return{small_custview} =
       small_custview( $cust_main,
-                      scalar($conf->config('countrydefault')),
+                      $return{countrydefault},
                       1, ##nobalance
                     );
 
index 82e5ea8..39ca9c9 100644 (file)
@@ -4026,6 +4026,23 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'selfservice-stripe1_bgcolor',
+    'section'     => 'self-service',
+    'description' => 'HTML color for self-service interface lists (primary stripe), for example, #FFFFFF',
+    'type'        => 'text',
+    'per_agent'   => 1,
+  },
+
+  {
+    'key'         => 'selfservice-stripe2_bgcolor',
+    'section'     => 'self-service',
+    'description' => 'HTML color for self-service interface lists (alternate stripe), for example, #DDDDDD',
+    'type'        => 'text',
+    'per_agent'   => 1,
+  },
+
+
+  {
     'key'         => 'selfservice-text_color',
     'section'     => 'self-service',
     'description' => 'HTML text color for the self-service interface, for example, #000000',
index 36dd30c..53a3b5e 100644 (file)
@@ -29,7 +29,7 @@ sub small_custview {
                   : qsearchs('cust_main', { 'custnum' => $arg } )
     or die "unknown custnum $arg";
 
-  my $html;
+  my $html = '<DIV ID="fs_small_custview">';
   
   $html = qq!View <A HREF="$url?! . $cust_main->custnum . '">'
     if $url;
@@ -129,6 +129,8 @@ sub small_custview {
 
   # last payment might be good here too?
 
+  $html .= '</DIV>';
+
   $html;
 }
 
index d27f688..5370f7c 100644 (file)
@@ -2,7 +2,9 @@
 <%= include('header', 'My Account') %>
 
 Hello <%= $name %>!<BR><BR>
-<%= $small_custview %>
+
+<%= include('small_custview') %>
+
 <BR>
 <%= if ( $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/small_custview.html b/fs_selfservice/FS-SelfService/cgi/small_custview.html
new file mode 100644 (file)
index 0000000..8d6e073
--- /dev/null
@@ -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>
+
index c840ca9..4333c4e 100644 (file)
@@ -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>';
 }
 %>