X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fview%2Fcust_bill.cgi;h=2ff3ca8834983ef3270e117aee868f08c4c77370;hb=1d4c8f82596a7f3695ba2203e301e497dec9194c;hp=27376d5054f660059846ad2de6580147086d9295;hpb=8d953e7c2f94dc007d94da74650d27c5a74cc792;p=freeside.git diff --git a/httemplate/view/cust_bill.cgi b/httemplate/view/cust_bill.cgi index 27376d505..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 @@ -111,10 +105,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 +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; @@ -190,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);