X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fview%2Fcust_main%2Fpackages%2Fstatus.html;h=2707803efc98d9b58a63c90098f642b4fdc78370;hb=998f029ef805c73e90543b34192e16d38a23c69c;hp=40d6438f315700831ce35c5b992ce3cb25e3b387;hpb=2d5f9e43a60773a9b079e96c330cb9e0e089800a;p=freeside.git diff --git a/httemplate/view/cust_main/packages/status.html b/httemplate/view/cust_main/packages/status.html index 40d6438f3..2707803ef 100644 --- a/httemplate/view/cust_main/packages/status.html +++ b/httemplate/view/cust_main/packages/status.html @@ -3,6 +3,10 @@ %#this should use cust_pkg->status and cust_pkg->statuscolor eventually +% if ( $cust_pkg->order_date ) { + <% pkg_status_row($cust_pkg, 'Ordered', 'order_date', %opt ) %> +% } + % if ( $cust_pkg->get('cancel') ) { #status: cancelled % my $cpr = $cust_pkg->last_cust_pkg_reason('cancel'); @@ -42,6 +46,8 @@ ) %> + <% pkg_status_row_noauto( $cust_pkg, %opt, 'colspan'=>$colspan ) %> + <% pkg_status_row_discount( $cust_pkg, %opt, 'colspan'=>$colspan ) %> % unless ( $cust_pkg->get('setup') ) { @@ -52,8 +58,11 @@ <% pkg_status_row_changed( $cust_pkg, %opt, 'colspan'=>$colspan ) %> <% pkg_status_row_if( $cust_pkg, $last_bill_or_renewed, 'last_bill', %opt, curuser=>$curuser ) %> -% # pkg_status_row($cust_pkg, 'Next bill', 'bill', %opt) +% if ( $part_pkg->option('suspend_bill', 1) ) { + <% pkg_status_row_if( $cust_pkg, 'Next bill', 'bill', %opt, curuser=>$curuser ) %> +% } <% pkg_status_row_if( $cust_pkg, 'Expires', 'expire', %opt, curuser=>$curuser ) %> + <% pkg_status_row_if( $cust_pkg, 'Contract ends', 'contract_end', %opt ) %> > @@ -76,7 +85,9 @@ <% pkg_status_row_colspan( $cust_pkg, 'Not yet billed (one-time charge)', '', 'colspan'=>$colspan, %opt ) %> - <% pkg_status_row_discount( $cust_pkg, %opt, 'colspan'=>$colspan ) %> + <% pkg_status_row_noauto( $cust_pkg, %opt, 'colspan'=>$colspan ) %> + + <% pkg_status_row_discount( $cust_pkg, %opt, 'colspan'=>$colspan ) %> <% pkg_status_row_if( $cust_pkg, @@ -100,6 +111,8 @@ <% pkg_status_row_colspan($cust_pkg, "Not yet billed ($billed_or_prepaid ". myfreq($part_pkg). ')', '', 'colspan'=>$colspan, %opt ) %> + <% pkg_status_row_noauto( $cust_pkg, %opt, 'colspan'=>$colspan ) %> + <% pkg_status_row_discount( $cust_pkg, %opt, 'colspan'=>$colspan ) %> <% pkg_status_row_if($cust_pkg, 'Start billing', 'start_date', %opt) %> @@ -114,6 +127,8 @@ <% pkg_status_row($cust_pkg, 'Billed', 'setup', %opt) %> + <% pkg_status_row_noauto( $cust_pkg, %opt, 'colspan'=>$colspan ) %> + <% pkg_status_row_discount( $cust_pkg, %opt, 'colspan'=>$colspan ) %> % } else { @@ -138,6 +153,8 @@ %> % } + <% pkg_status_row_noauto( $cust_pkg, %opt, 'colspan'=>$colspan ) %> + <% pkg_status_row_discount( $cust_pkg, %opt, 'colspan'=>$colspan ) %> <% pkg_status_row($cust_pkg, 'Setup', 'setup', %opt) %> @@ -157,6 +174,7 @@ <% pkg_status_row_if($cust_pkg, 'Will automatically suspend by', 'autosuspend', %opt) %> <% pkg_status_row_if( $cust_pkg, 'Will suspend on', 'adjourn', %opt, curuser=>$curuser ) %> <% pkg_status_row_if( $cust_pkg, 'Expires', 'expire', %opt, curuser=>$curuser ) %> + <% pkg_status_row_if( $cust_pkg, 'Contract ends', 'contract_end', %opt ) %> % if ( $part_pkg->freq ) { @@ -290,6 +308,23 @@ sub pkg_status_row_changed { $html; } +sub pkg_status_row_noauto { + my( $cust_pkg, %opt ) = @_; + my $part_pkg = $opt{'part_pkg'}; + return '' unless $cust_pkg->no_auto || $part_pkg->no_auto; + + #inefficient, should be passed in + my $cust_main = $cust_pkg->cust_main; + + return '' unless $cust_main->payby =~ /^(CARD|CHEK)$/; + my $what = lc(FS::payby->shortname($cust_main->payby)); + + pkg_status_row_colspan( $cust_pkg, "No automatic $what charge", '', + 'colspan' => $opt{'colspan'}, + #%opt, + ); +} + sub pkg_status_row_discount { my( $cust_pkg, %opt ) = @_; @@ -300,9 +335,16 @@ sub pkg_status_row_discount { my $discount = $cust_pkg_discount->discount; my $label = 'Discount: '. $discount->description; - $label .= ' ('. ( $discount->months - $cust_pkg_discount->months_used ). - ' months remaining)' - if $discount->months; + if ( $discount->months ) { + my $remaining = $discount->months - $cust_pkg_discount->months_used; + $remaining = sprintf('%.2f', $remaining) if $remaining =~ /\./; + $label .= " ($remaining months remaining)" + } + + $label .= ' ('. + 'remove discount)'; $html .= pkg_status_row_colspan( $cust_pkg, $label, '', 'colspan' => $opt{'colspan'},