X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fview%2Fcust_main%2Fpackages.html;h=ece1b62bbef1f5947868b2e280a26d385e1e674f;hp=068a8276f4f027f79255d37f033e0d5729eec863;hb=0186436eb38e70da0a015e49dab67cec5f1a3467;hpb=6c6b3fe527d046ec3ca83ba1fa67ee414f702bca diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 068a8276f..ece1b62bb 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -5,6 +5,10 @@ my $packages = get_packages($cust_main, $conf); %> + + Packages <%= include('order_pkg.html', $cust_main ) %> @@ -71,12 +75,10 @@ foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) { ( <%=pkg_dates_link($pkg)%> | <%=pkg_customize_link($pkg,$cust_main->custnum)%> ) <% } %> -<% - #foreach (qw(setup last_bill next_bill susp expire cancel)) { - # print qq! ! . pkg_datestr($pkg,$_,$conf) . qq!\n!; - #} - print "". &itable(''); + > + +<% sub myfreq { my $part_pkg = shift; my $freq = $part_pkg->freq_pretty; @@ -84,92 +86,190 @@ foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) { $freq; } - if ( $pkg->{cancel} ) { #status: cancelled - - print ''. - ''; - unless ( $pkg->{setup} ) { - print ''; - } else { - print "'; - print "' - if $pkg->{'last_bill'}; - print "' - if $pkg->{'susp'}; - } + #this should use cust_pkg->status and cust_pkg->statuscolor eventually + + 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 ''. - ''; - unless ( $pkg->{setup} ) { - print ''; - } else { - print "'; - } - print "' - if $pkg->{'last_bill'}; - # next bill ?? - print "' - if $pkg->{'expire'}; - print ''; - - } else { #status: active - - unless ( $pkg->{setup} ) { #not setup - - print ''; - print ''; - } - - } else { #setup - - unless ( $pkg->{freq} ) { - print "". - ''; - } else { - print ''. - ''; - } - - } - - print "' - if $pkg->{'last_bill'}; - print "' - if $pkg->{'next_bill'}; - print "' - if $pkg->{'expire'}; - if ( $pkg->{freq} ) { - print ''; - } +%> - } +<% if ( $pkg->{cancel} ) { %> - } + + + <%= pkg_datestr($pkg,'cancel',$conf) %> + + + <% unless ( $pkg->{setup} ) { %> + + + + + + <% } else { %> + + + + <%= pkg_datestr($pkg, 'setup',$conf) %> + + + <% if ( $pkg->{'last_bill'} ) { %> + + + <%= pkg_datestr($pkg, 'last_bill',$conf) %> + + <% } %> + + <% if ( $pkg->{'susp'} ) { %> + + + <%= pkg_datestr($pkg, 'susp',$conf) %> + + <% } %> + + <% } %> + +<% } else { %> + + <% if ( $pkg->{susp} ) { %> + + + + <%= pkg_datestr($pkg,'susp',$conf) %> + + + <% unless ( $pkg->{setup} ) { %> + + + + + + <% } else { %> + + + + <%= pkg_datestr($pkg, 'setup',$conf) %> + + + <% } %> + + <% if ( $pkg->{'last_bill'} ) { %> + + + <%= pkg_datestr($pkg, 'last_bill',$conf) %> + + <% } %> + + + + <% if ( $pkg->{'expire'} ) { %> + + + <%= pkg_datestr($pkg, 'expire',$conf) %> + + <% } %> - print "
Cancelled '. pkg_datestr($pkg,'cancel',$conf). '
Never billed
Setup ". - pkg_datestr($pkg, 'setup',$conf). '
Last bill ". - pkg_datestr($pkg, 'last_bill',$conf). '
Suspended ". - pkg_datestr($pkg, 'susp',$conf). '
Suspended '. pkg_datestr($pkg,'susp',$conf). '
Never billed
Setup ". - pkg_datestr($pkg, 'setup',$conf). '
Last bill ". - pkg_datestr($pkg, 'last_bill',$conf). '
Expires ". - pkg_datestr($pkg, 'expire',$conf). '
( '. pkg_unsuspend_link($pkg). - ' | '. pkg_cancel_link($pkg). ' )
Not yet billed ('; - unless ( $pkg->{freq} ) { - print 'one-time charge)
( '. pkg_cancel_link($pkg). - ' )'; - } else { - print 'billed '. myfreq($pkg->{part_pkg}). ')
One-time charge
Billed '. - pkg_datestr($pkg,'setup',$conf). '
Active'. - ', billed '. myfreq($pkg->{part_pkg}). '
Setup '. - pkg_datestr($pkg, 'setup',$conf). '
Last bill ". - pkg_datestr($pkg, 'last_bill',$conf). '
Next bill ". - pkg_datestr($pkg, 'next_bill',$conf). '
Expires ". - pkg_datestr($pkg, 'expire',$conf). '
( '. pkg_suspend_link($pkg). - ' | '. pkg_cancel_link($pkg). ' )
Cancelled 
>Never billed
Setup 
<%= $last_bill_or_renewed %> 
Suspended 
Suspended 
>Never billed
Setup 
<%= $last_bill_or_renewed %> 
Expires 
\n"; + + >( <%= pkg_unsuspend_link($pkg) %> | <%= pkg_cancel_link($pkg) %> ) + + <% } else { %> + + <% unless ( $pkg->{setup} ) { %> + + <% unless ( $pkg->{'freq'} ) { %> + + + >Not yet billed (one-time charge) + + + + >( <%= pkg_cancel_link($pkg) %> ) + + + <% } else { %> + + + >Not yet billed (<%= $billed_or_prepaid %> <%= myfreq($pkg->{part_pkg}) %>) + + + <% } %> + + <% } else { %> + + <% unless ( $pkg->{freq} ) { %> + + + >One-time charge + + + + Billed  + <%= pkg_datestr($pkg,'setup',$conf) %> + + + <% } else { %> + + + >Active, <%= $billed_or_prepaid %> <%= myfreq($pkg->{part_pkg}) %> + + + + Setup  + <%= pkg_datestr($pkg, 'setup',$conf) %> + + + <% } %> + + <% } %> + + <% if ( $pkg->{'last_bill'} ) { %> + + <%= $last_bill_or_renewed %>  + <%= pkg_datestr($pkg, 'last_bill',$conf) %> + + <% } %> + + <% if ( $pkg->{'next_bill'} ) { %> + + <%= $next_bill_or_prepaid_until %>  + <%= pkg_datestr($pkg, 'next_bill',$conf) %> + + <% } %> + + <% if ( $pkg->{'expire'} ) { %> + + Expires  + <%= pkg_datestr($pkg, 'expire',$conf) %> + + <% } %> + + <% if ( $pkg->{freq} ) { %> + + >( <%= pkg_suspend_link($pkg) %> | <%= pkg_cancel_link($pkg) %> ) + + <% } %> + + <% } %> + +<% } %> + + + + +<% if ($rowspan == 0) { print qq!\n!; next; } my $cnt = 0; @@ -342,9 +442,15 @@ sub pkgsort_pkgnum_cancel { sub pkg_datestr { my($pkg, $field, $conf) = @_ or return ''; return ' ' unless $pkg->{$field}; - my $format = $conf->exists('pkg_showtimes') - ? '%D %l:%M:%S%P %z' - : '%b %o, %Y'; + my $format = '%b'. + ' %o,'. + ' %Y'; + #$format .= ' %l:%M:%S%P %z' + $format .= ' %l'. + ':'. + '%M'. + ' %P' + if $conf->exists('cust_pkg-display_times'); ( my $strip = time2str($format, $pkg->{$field}) ) =~ s/ (\d)/$1/g; $strip; }