X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fview%2Fcust_bill.cgi;h=e6191be124b910ca5def7d9fe7008852dd4f3a1e;hb=145c780dead46283f7c9664766a7000f6fcaf3b9;hp=4822ab718391f6a0f2f96014bf71d4c2986eb0b4;hpb=1d6a32338660e3d7202faa7e4ce14736b4569a48;p=freeside.git diff --git a/httemplate/view/cust_bill.cgi b/httemplate/view/cust_bill.cgi index 4822ab718..e6191be12 100755 --- a/httemplate/view/cust_bill.cgi +++ b/httemplate/view/cust_bill.cgi @@ -2,30 +2,41 @@ 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 -% && scalar( grep $payby{$_}, qw(BILL CASH WEST MCRD) ) +% && scalar( grep $payby{$_}, qw(BILL CASH WEST MCRD MCHK) ) % && $curuser->access_right(['Post payment', 'Post check payment', 'Post cash payment']) % && ! $conf->exists('pkg-balances') % ) @@ -54,6 +65,11 @@ <% mt('manual credit card') |h %> % } +% if ( $payby{'MCHK'} && $curuser->access_right(['Post payment']) ) { + <% $s++ ? ' | ' : '' %> + <% mt('manual electronic check') |h %> +% } + <% mt('payment against this invoice') |h %>

% } @@ -135,10 +151,10 @@ function change_invoice_mode(obj) { <% $br ? '

' : '' %> -% if ( $conf->exists('invoice_html') ) { +% if ( $conf->exists('invoice_html') && ! $cgi->param('plaintext') ) { <% join('', $cust_bill->print_html(\%opt) ) %> % } else { -
<% join('', $cust_bill->print_text(\%opt) ) %>
+
<% join('', $cust_bill->print_text(\%opt) ) |h %>
% } <& /elements/footer.html &> @@ -185,6 +201,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);