+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, emt("No automatic $what charge"), '');
+}
+
+sub pkg_status_row_discount {
+ my( $cust_pkg, %opt ) = @_;
+
+ my $html;
+
+ foreach my $cust_pkg_discount (@{ $cust_pkg->{_cust_pkg_discount_active} }) {
+
+ my $discount = $cust_pkg_discount->discount;
+
+ my $label = '<B>'.emt('Discount').'</B>: '. $discount->description;
+ if ( $discount->months ) {
+ my $remaining = $discount->months - $cust_pkg_discount->months_used;
+ $remaining = sprintf('%.2f', $remaining) if $remaining =~ /\./;
+ $label .= emt("([_1] months remaining)",$remaining);
+ }
+
+ $label .= ' <FONT SIZE="-1">('.
+ '<A HREF="../misc/delete-cust_pkg_discount.html?'.
+ $cust_pkg_discount->pkgdiscountnum.
+ '">'.emt('remove discount').'</A>)</FONT>';
+
+ $html .= pkg_status_row_colspan( $cust_pkg, $label, '', %opt );
+
+ }
+
+ $html;
+}
+
+sub pkg_reason_row {
+ my ($cust_pkg, $cpr, %opt) = @_;
+ return '' if $cust_pkg->main_pkgnum;
+
+ my $reasontext = '';
+ $reasontext = $cpr->reasontext . ' by ' . $cpr->otaker if $cpr;
+ pkg_status_row_colspan( $cust_pkg, $reasontext, '',
+ 'align'=>'right', 'size'=>'-2', %opt
+ );
+}
+