X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fview%2Fcust_bill.cgi;h=f1bcf4d52b9ec56f46791ad8ea4fe9fd28083892;hb=ad3bcb39580173f0ac1b6357cb49515d48af7ddf;hp=27376d5054f660059846ad2de6580147086d9295;hpb=d03ab0df1ccbd3bdf54b3a85391879906d499097;p=freeside.git
diff --git a/httemplate/view/cust_bill.cgi b/httemplate/view/cust_bill.cgi
index 27376d505..f1bcf4d52 100755
--- a/httemplate/view/cust_bill.cgi
+++ b/httemplate/view/cust_bill.cgi
@@ -2,26 +2,37 @@
emt("View this customer (#[_1])",$display_custnum) => "${p}view/cust_main.cgi?$custnum",
) &>
-% if ( $conf->exists('deleteinvoices')
-% && $curuser->access_right('Delete invoices' )
-% )
-% {
-
-
-
- <% mt('Delete this invoice') |h %>
-
+
+% if ( !$cust_bill->closed ) { # otherwise allow no changes
+% my $can_delete = $conf->exists('deleteinvoices')
+% && $curuser->access_right('Delete invoices');
+% my $can_void = $curuser->access_right('Void invoices');
+% if ( $can_void ) {
+ <& /elements/popup_link.html,
+ 'label' => emt('Void this invoice'),
+ 'actionlabel' => emt('Void this invoice'),
+ 'action' => $p.'misc/void-cust_bill.html?invnum='.$invnum,
+ &>
+% }
+% if ( $can_void and $can_delete ) {
+ |
+% }
+% if ( $can_delete ) {
+ \
+ <% emt('Delete this invoice') |h %>
+% }
+% if ( $can_void or $can_delete ) {
+
+% }
% }
% if ( $cust_bill->owed > 0
@@ -111,10 +122,6 @@
( <% mt('View invoice events') |h %> )
% }
-% if ( $cust_bill->num_cust_bill_event ) { $br++;
-( <% mt('View deprecated, old-style invoice events') |h %> )
-% }
-
% my @modes = grep {! $_->disabled}
% $cust_bill->cust_main->agent->invoice_modes;
% if ( @modes ) {
@@ -178,8 +185,7 @@ my %opt = (
$opt{'barcode_img'} = 1 if $conf->exists('invoice-barcode');
my @payby = grep /\w/, $conf->config('payby');
-#@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP ))
-@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH COMP ))
+@payby = (qw( CARD DCRD CHEK DCHK BILL CASH ))
unless @payby;
my %payby = map { $_=>1 } @payby;
@@ -190,6 +196,13 @@ my $cust_bill = qsearchs({
'hashref' => { 'invnum' => $invnum },
'extra_sql' => ' AND '. $curuser->agentnums_sql,
});
+# if we're asked for a voided invnum, redirect appropriately
+if (!$cust_bill and FS::cust_bill_void->row_exists("invnum = $invnum") ) {
+ $m->clear_buffer;
+ my $url = $p.'view/cust_bill_void.html?'.$cgi->query_string;
+ $m->print( $cgi->redirect($url) );
+ $m->abort;
+}
die "Invoice #$invnum not found!" unless $cust_bill;
$cust_bill->set('mode' => $mode);