[freeside-commits]
freeside/httemplate/view/cust_main packages.html, 1.2, 1.3
Ivan,,,
ivan at wavetail.420.am
Wed Sep 21 05:47:51 PDT 2005
Update of /home/cvs/cvsroot/freeside/httemplate/view/cust_main
In directory wavetail:/tmp/cvs-serv13129/httemplate/view/cust_main
Modified Files:
packages.html
Log Message:
add prepaid support which sets RADIUS Expiration attribute, update customer view package UI
Index: packages.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/view/cust_main/packages.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- packages.html 29 Dec 2004 12:00:07 -0000 1.2
+++ packages.html 21 Sep 2005 12:47:49 -0000 1.3
@@ -5,6 +5,10 @@
my $packages = get_packages($cust_main, $conf);
%>
+<STYLE TYPE="text/css">
+.package .provision { font-weight: bold }
+</STYLE>
+
<A NAME="cust_pkg"><FONT SIZE="+2">Packages</FONT></A>
<%= include('order_pkg.html', $cust_main ) %>
@@ -71,12 +75,10 @@
( <%=pkg_dates_link($pkg)%> | <%=pkg_customize_link($pkg,$cust_main->custnum)%> )
<% } %>
</TD>
-<%
- #foreach (qw(setup last_bill next_bill susp expire cancel)) {
- # print qq! <TD ROWSPAN=$rowspan>! . pkg_datestr($pkg,$_,$conf) . qq!</TD>\n!;
- #}
- print "<TD ROWSPAN=$rowspan>". &itable('');
+ <TD ROWSPAN=<%=$rowspan%>>
+ <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="100%">
+<%
sub myfreq {
my $part_pkg = shift;
my $freq = $part_pkg->freq_pretty;
@@ -84,92 +86,190 @@
$freq;
}
- if ( $pkg->{cancel} ) { #status: cancelled
+ #this should use cust_pkg->status and cust_pkg->statuscolor eventually
- print '<TR><TD><FONT COLOR="#ff0000"><B>Cancelled </B></FONT></TD>'.
- '<TD>'. pkg_datestr($pkg,'cancel',$conf). '</TD></TR>';
- unless ( $pkg->{setup} ) {
- print '<TR><TD COLSPAN=2>Never billed</TD></TR>';
- } else {
- print "<TR><TD>Setup </TD><TD>".
- pkg_datestr($pkg, 'setup',$conf). '</TD></TR>';
- print "<TR><TD>Last bill </TD><TD>".
- pkg_datestr($pkg, 'last_bill',$conf). '</TD></TR>'
- if $pkg->{'last_bill'};
- print "<TR><TD>Suspended </TD><TD>".
- pkg_datestr($pkg, 'susp',$conf). '</TD></TR>'
- if $pkg->{'susp'};
- }
+ my $colspan = $conf->exists('cust_pkg-display_times') ? 8 : 4;
+ my $width = $conf->exists('cust_pkg-display_times') ? '38%' : '56%';
+ #false laziness w/edit/REAL_cust_pkg.cgi
+ my( $billed_or_prepaid, $last_bill_or_renewed, $next_bill_or_prepaid_until );
+ unless ( $pkg->{'part_pkg'}->is_prepaid ) {
+ $billed_or_prepaid = 'billed';
+ $last_bill_or_renewed = 'Last bill';
+ $next_bill_or_prepaid_until = 'Next bill';
} else {
+ $billed_or_prepaid = 'prepaid';
+ $last_bill_or_renewed = 'Renewed';
+ $next_bill_or_prepaid_until = 'Prepaid until';
+ }
- if ( $pkg->{susp} ) { #status: suspended
- print '<TR><TD><FONT COLOR="#FF9900"><B>Suspended</B> </FONT></TD>'.
- '<TD>'. pkg_datestr($pkg,'susp',$conf). '</TD></TR>';
- unless ( $pkg->{setup} ) {
- print '<TR><TD COLSPAN=2>Never billed</TD></TR>';
- } else {
- print "<TR><TD>Setup </TD><TD>".
- pkg_datestr($pkg, 'setup',$conf). '</TD></TR>';
- }
- print "<TR><TD>Last bill </TD><TD>".
- pkg_datestr($pkg, 'last_bill',$conf). '</TD></TR>'
- if $pkg->{'last_bill'};
- # next bill ??
- print "<TR><TD>Expires </TD><TD>".
- pkg_datestr($pkg, 'expire',$conf). '</TD></TR>'
- if $pkg->{'expire'};
- print '<TR><TD COLSPAN=2>( '. pkg_unsuspend_link($pkg).
- ' | '. pkg_cancel_link($pkg). ' )</TD></TR>';
+%>
- } else { #status: active
+<% if ( $pkg->{cancel} ) { %> <!-- #status: cancelled -->
- unless ( $pkg->{setup} ) { #not setup
+ <TR>
+ <TD WIDTH="<%=$width%>" ALIGN="right"><FONT COLOR="#ff0000"><B>Cancelled </B></FONT></TD>
+ <%= pkg_datestr($pkg,'cancel',$conf) %>
+ </TR>
- print '<TR><TD COLSPAN=2>Not yet billed (';
- unless ( $pkg->{freq} ) {
- print 'one-time charge)</TD></TR>';
- print '<TR><TD COLSPAN=2>( '. pkg_cancel_link($pkg).
- ' )</TD</TR>';
- } else {
- print 'billed '. myfreq($pkg->{part_pkg}). ')</TD></TR>';
- }
+ <% unless ( $pkg->{setup} ) { %>
- } else { #setup
+ <TR>
+ <TD COLSPAN=<%=$colspan%>>Never billed</TD>
+ </TR>
- unless ( $pkg->{freq} ) {
- print "<TR><TD COLSPAN=2>One-time charge</TD></TR>".
- '<TR><TD>Billed </TD><TD>'.
- pkg_datestr($pkg,'setup',$conf). '</TD></TR>';
- } else {
- print '<TR><TD COLSPAN=2><FONT COLOR="#00CC00"><B>Active</B></FONT>'.
- ', billed '. myfreq($pkg->{part_pkg}). '</TD></TR>'.
- '<TR><TD>Setup </TD><TD>'.
- pkg_datestr($pkg, 'setup',$conf). '</TD></TR>';
- }
+ <% } else { %>
- }
+ <TR>
+ <TD WIDTH="<%=$width%>" ALIGN="right">Setup </TD>
+ <%= pkg_datestr($pkg, 'setup',$conf) %>
+ </TR>
- print "<TR><TD>Last bill </TD><TD>".
- pkg_datestr($pkg, 'last_bill',$conf). '</TD></TR>'
- if $pkg->{'last_bill'};
- print "<TR><TD>Next bill </TD><TD>".
- pkg_datestr($pkg, 'next_bill',$conf). '</TD></TR>'
- if $pkg->{'next_bill'};
- print "<TR><TD>Expires </TD><TD>".
- pkg_datestr($pkg, 'expire',$conf). '</TD></TR>'
- if $pkg->{'expire'};
- if ( $pkg->{freq} ) {
- print '<TR><TD COLSPAN=2>( '. pkg_suspend_link($pkg).
- ' | '. pkg_cancel_link($pkg). ' )</TD></TR>';
- }
+ <% if ( $pkg->{'last_bill'} ) { %>
+ <TR>
+ <TD WIDTH="<%=$width%>" ALIGN="right"><%= $last_bill_or_renewed %> </TD>
+ <%= pkg_datestr($pkg, 'last_bill',$conf) %>
+ </TR>
+ <% } %>
- }
+ <% if ( $pkg->{'susp'} ) { %>
+ <TR>
+ <TD WIDTH="<%=$width%>" ALIGN="right">Suspended </TD>
+ <%= pkg_datestr($pkg, 'susp',$conf) %>
+ </TR>
+ <% } %>
- }
+ <% } %>
- print "</TABLE></TD>\n";
+<% } else { %>
+
+ <% if ( $pkg->{susp} ) { %> <!-- #status: suspended -->
+
+ <TR>
+ <TD WIDTH="<%=$width%>" ALIGN="right"><FONT COLOR="#FF9900"><B>Suspended</B> </FONT></TD>
+ <%= pkg_datestr($pkg,'susp',$conf) %>
+ </TR>
+ <% unless ( $pkg->{setup} ) { %>
+
+ <TR>
+ <TD COLSPAN=<%=$colspan%>>Never billed</TD>
+ </TR>
+
+ <% } else { %>
+
+ <TR>
+ <TD WIDTH="<%=$width%>" ALIGN="right">Setup </TD>
+ <%= pkg_datestr($pkg, 'setup',$conf) %>
+ </TR>
+
+ <% } %>
+
+ <% if ( $pkg->{'last_bill'} ) { %>
+ <TR>
+ <TD WIDTH="<%=$width%>" ALIGN="right"><%= $last_bill_or_renewed %> </TD>
+ <%= pkg_datestr($pkg, 'last_bill',$conf) %>
+ </TR>
+ <% } %>
+
+ <!-- # next bill ?? -->
+
+ <% if ( $pkg->{'expire'} ) { %>
+ <TR>
+ <TD WIDTH="<%=$width%>" ALIGN="right">Expires </TD>
+ <%= pkg_datestr($pkg, 'expire',$conf) %>
+ </TR>
+ <% } %>
+
+ <TR>
+ <TD COLSPAN=<%=$colspan%>>( <%= pkg_unsuspend_link($pkg) %> | <%= pkg_cancel_link($pkg) %> )</TD>
+ </TR>
+
+ <% } else { %> <!-- #status: active -->
+
+ <% unless ( $pkg->{setup} ) { %> <!-- #not setup -->
+
+ <% unless ( $pkg->{'freq'} ) { %>
+
+ <TR>
+ <TD COLSPAN=<%=$colspan%>>Not yet billed (one-time charge)</TD>
+ </TR>
+
+ <TR>
+ <TD COLSPAN=<%=$colspan%>>( <%= pkg_cancel_link($pkg) %> )</TD>
+ </TR>
+
+ <% } else { %>
+
+ <TR>
+ <TD COLSPAN=<%=$colspan%>>Not yet billed (<%= $billed_or_prepaid %> <%= myfreq($pkg->{part_pkg}) %>)</TD>
+ </TR>
+
+ <% } %>
+
+ <% } else { %> <!-- #setup -->
+
+ <% unless ( $pkg->{freq} ) { %>
+
+ <TR>
+ <TD COLSPAN=<%=$colspan%>>One-time charge</TD>
+ </TR>
+
+ <TR>
+ <TD WIDTH="<%=$width%>" ALIGN="right">Billed </TD>
+ <%= pkg_datestr($pkg,'setup',$conf) %>
+ </TR>
+
+ <% } else { %>
+
+ <TR>
+ <TD COLSPAN=<%=$colspan%>><FONT COLOR="#00CC00"><B>Active</B></FONT>, <%= $billed_or_prepaid %> <%= myfreq($pkg->{part_pkg}) %></TD>
+ </TR>
+
+ <TR>
+ <TD WIDTH="<%=$width%>" ALIGN="right">Setup </TD>
+ <%= pkg_datestr($pkg, 'setup',$conf) %>
+ </TR>
+
+ <% } %>
+
+ <% } %>
+
+ <% if ( $pkg->{'last_bill'} ) { %>
+ <TR>
+ <TD WIDTH="<%=$width%>" ALIGN="right"><%= $last_bill_or_renewed %> </TD>
+ <%= pkg_datestr($pkg, 'last_bill',$conf) %>
+ </TR>
+ <% } %>
+
+ <% if ( $pkg->{'next_bill'} ) { %>
+ <TR>
+ <TD WIDTH="<%=$width%>" ALIGN="right"><%= $next_bill_or_prepaid_until %> </TD>
+ <%= pkg_datestr($pkg, 'next_bill',$conf) %>
+ </TR>
+ <% } %>
+
+ <% if ( $pkg->{'expire'} ) { %>
+ <TR>
+ <TD WIDTH="<%=$width%>" ALIGN="right">Expires </TD>
+ <%= pkg_datestr($pkg, 'expire',$conf) %>
+ </TR>
+ <% } %>
+
+ <% if ( $pkg->{freq} ) { %>
+ <TR>
+ <TD COLSPAN=<%=$colspan%>>( <%= pkg_suspend_link($pkg) %> | <%= pkg_cancel_link($pkg) %> )</TD>
+ </TR>
+ <% } %>
+
+ <% } %>
+
+<% } %>
+
+</TABLE>
+</TD>
+
+<%
if ($rowspan == 0) { print qq!</TR>\n!; next; }
my $cnt = 0;
@@ -342,9 +442,15 @@
sub pkg_datestr {
my($pkg, $field, $conf) = @_ or return '';
return ' ' unless $pkg->{$field};
- my $format = $conf->exists('pkg_showtimes')
- ? '<B>%D</B> <FONT SIZE=-3>%l:%M:%S%P %z</FONT>'
- : '<B>%b %o, %Y</B>';
+ my $format = '<TD align="left"><B>%b</B></TD>'.
+ '<TD align="right"><B> %o,</B></TD>'.
+ '<TD align="right"><B> %Y</B></TD>';
+ #$format .= ' <FONT SIZE=-3>%l:%M:%S%P %z</FONT>'
+ $format .= '<TD ALIGN="right"><B> %l</TD>'.
+ '<TD ALIGN="center"><B>:</B></TD>'.
+ '<TD ALIGN="left"><B>%M</B></TD>'.
+ '<TD ALIGN="left"><B> %P</B></TD>'
+ if $conf->exists('cust_pkg-display_times');
( my $strip = time2str($format, $pkg->{$field}) ) =~ s/ (\d)/$1/g;
$strip;
}
More information about the freeside-commits
mailing list