X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fmisc%2Fbill.cgi;h=6151dce5188c30efdc2bc9a1e1f4cbaad9434be2;hb=2ab068f449eb97a10e18d20e9dab5ab9faa017e7;hp=cc7938308a456ecb6cc31c60871d068fc5c9b477;hpb=3d671921441ba8422650b54435a1959ad1d4c71d;p=freeside.git diff --git a/httemplate/misc/bill.cgi b/httemplate/misc/bill.cgi index cc7938308..6151dce51 100755 --- a/httemplate/misc/bill.cgi +++ b/httemplate/misc/bill.cgi @@ -1,38 +1,38 @@ -<% -# +%if ( $error ) { +% errorpage($error); +%} else { +<% $cgi->redirect(popurl(2). "view/cust_main.cgi?$custnum") %> +%} +<%init> -use strict; -use vars qw( $cgi $query $custnum $cust_main $error ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(popurl eidiot); -use FS::Record qw(qsearchs); -use FS::cust_main; - -$cgi = new CGI; -&cgisuidsetup($cgi); +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Bill customer now'); #untaint custnum -($query) = $cgi->keywords; +my($query) = $cgi->keywords; $query =~ /^(\d*)$/; -$custnum = $1; -$cust_main = qsearchs('cust_main',{'custnum'=>$custnum}); +my $custnum = $1; +my $cust_main = qsearchs('cust_main',{'custnum'=>$custnum}); die "Can't find customer!\n" unless $cust_main; -$error = $cust_main->bill( -# 'time'=>$time - ); -&eidiot($error) if $error; +my $conf = new FS::Conf; + +my $error = $cust_main->bill_and_collect( 'fatal' => 'return', + 'retry' => 'yes', + ); -$error = $cust_main->collect( -# 'invoice-time'=>$time, -# 'batch_card'=> 'yes', - 'batch_card'=> 'no', - 'report_badcard'=> 'yes', - ); -&eidiot($error) if $error; + #'invoice-time'=>$time, + #'batch_card'=> 'yes', + #'batch_card'=> 'no', + #'report_badcard'=> 'yes', + #'retry_card' => 'yes', -print $cgi->redirect(popurl(2). "view/cust_main.cgi?$custnum"); + #this is used only by cust_main::batch_card + #need to pick & create an actual config + #value if we're going to turn this on + #("realtime-backend" doesn't exist, + # "backend-realtime" is for something + # entirely different) + #'realtime' => $conf->exists('realtime-backend'), -%> +