X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fmisc%2Fbill.cgi;h=3c3c48c54e6983b55ab028860c8042fe684d723b;hb=96f1d947b394cb96690f5fde2f91f3efcd21dc21;hp=d09fc45dc181a2b6ff81a62cd2300ad0d7582d82;hpb=51984ac3d3da3006809c6866fdecd4ad83610731;p=freeside.git diff --git a/httemplate/misc/bill.cgi b/httemplate/misc/bill.cgi index d09fc45dc..3c3c48c54 100755 --- a/httemplate/misc/bill.cgi +++ b/httemplate/misc/bill.cgi @@ -1,62 +1,45 @@ -<% -# -# $Id: bill.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ -# -# s/FS:Search/FS::Record/ and cgisuidsetup($cgi) ivan@sisd.com 98-mar-13 -# -# Changes to allow page to work at a relative position in server -# bmccane@maxbaud.net 98-apr-3 -# -# $Log: bill.cgi,v $ -# Revision 1.1 2001-07-30 07:36:04 ivan -# templates!!! -# -# Revision 1.5 1999/08/12 04:32:21 ivan -# hidecancelledcustomers -# -# Revision 1.4 1999/01/19 05:14:02 ivan -# for mod_perl: no more top-level my() variables; use vars instead -# also the last s/create/new/; -# -# Revision 1.3 1998/12/23 03:01:13 ivan -# $cgi->keywords instead of $cgi->query_string -# -# Revision 1.2 1998/12/17 09:12:41 ivan -# s/CGI::(Request|Base)/CGI.pm/; -# +%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( +my $conf = new FS::Conf; + +my $error = $cust_main->bill( # 'time'=>$time ); -&eidiot($error) if $error; -$error = $cust_main->collect( -# 'invoice-time'=>$time, -# 'batch_card'=> 'yes', - 'batch_card'=> 'no', - 'report_badcard'=> 'yes', - ); -&eidiot($error) if $error; +unless ( $error ) { + $error = $cust_main->apply_payments_and_credits + || $cust_main->collect( + #'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"); + 'retry' => 'yes', + + #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'), + ); +} -%> +