X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=httemplate%2Fview%2Fcust_bill.cgi;h=2ff3ca8834983ef3270e117aee868f08c4c77370;hb=1d4c8f82596a7f3695ba2203e301e497dec9194c;hp=4ee4efbf4fe3bdaf67862551b2fbafe9b9c0ab7e;hpb=2c5aa117162ef4dfce93da42ea3391dcdece4bb9;p=freeside.git
diff --git a/httemplate/view/cust_bill.cgi b/httemplate/view/cust_bill.cgi
index 4ee4efbf4..2ff3ca883 100755
--- a/httemplate/view/cust_bill.cgi
+++ b/httemplate/view/cust_bill.cgi
@@ -2,26 +2,20 @@
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 && $curuser->access_right('Void invoices') ) {
+ <& /elements/popup_link.html,
+ 'label' => emt('Void this invoice'),
+ 'actionlabel' => emt('Void this invoice'),
+ 'action' => $p.'misc/void-cust_bill.html?invnum='.$invnum,
+ &>
-
% }
% if ( $cust_bill->owed > 0
@@ -174,8 +168,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;
@@ -186,6 +179,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);