$m->scomp(@_);
}
+ sub errorpage {
+ use vars qw($m);
+ $m->comp('/elements/errorpage.html', @_);
+ }
+
sub redirect {
my( $location ) = @_;
use vars qw($m);
%if ( $error ) {
% #$cgi->param('error', $error);
% #print $cgi->redirect(popurl(2). "cust_svc.cgi?". $cgi->query_string );
-% eidiot($error);
+% errorpage($error);
%} else {
% my $svcdb = $new->part_svc->svcdb;
% print $cgi->redirect(popurl(3). "view/$svcdb.cgi?$svcnum");
<!-- mason kludge -->
%
-% eidiot($error);
+% errorpage($error);
%} else {
% my $svcnum = $new->svcnum;
% print $cgi->redirect(popurl(3). "view/svc_domain.cgi?$svcnum");
%
%
%$cgi->param('agentnum') =~ /^(\d+)$/
-% or eidiot 'illegal agentnum '. $cgi->param('agentnum');
+% or errorpage('illegal agentnum '. $cgi->param('agentnum'));
%my $agentnum = $1;
%my $agent = qsearchs('agent', { 'agentnum' => $agentnum } );
%
%if ( @rate_prefix ) {
% $countrycode = $rate_prefix[0]->countrycode;
% foreach my $rate_prefix ( @rate_prefix ) {
-% eidiot 'multiple country codes per region not yet supported by web UI'
+% errorpage('multiple country codes per region not yet supported by web UI')
% unless $rate_prefix->countrycode eq $countrycode;
% }
%}
%
%my $agentnum = $cgi->param('agentnum');
-%$agentnum =~ /^(\d+)$/ or eidiot "illegal agentnum $agentnum";
+%$agentnum =~ /^(\d+)$/ or errorpage("illegal agentnum $agentnum");
%$agentnum = $1;
%my $agent = qsearchs('agent', { 'agentnum' => $agentnum } );
%
--- /dev/null
+<% include("/elements/header.html", "Error processing your request") %>
+
+Your request could not be processed because of the following error<% (scalar(@_) > 1) ? 's' : '' %>:
+
+% while (@_) {
+
+<P><FONT SIZE="+1" COLOR="#ff0000"><B><% shift %></B></FONT>
+
+
+%}
+% $m->flush_buffer();
+% $HTML::Mason::Commands::m->abort();
+% #die "shouldn't fall through to here (mason \$m->abort didn't)";
% if ( scalar( @{$opt{'part_referrals'}} ) == 0 ) {
-% eidiot "You have not created any advertising sources. You must create at least one advertising source before adding a customer. Go to ". popurl(2). "browse/part_referral.html and create one or more advertising sources.";
+ <P><FONT SIZE="+1" COLOR="#ff0000">You have not created any advertising sources. You must create at least one advertising source before adding a customer. Go to <A HREF="<% popurl(2) %>browse/part_referral.html">advertising source listing</A> and create one or more advertising sources.</FONT>
% } elsif ( scalar( @{$opt{'part_referrals'}} ) == 1 ) {
<INPUT TYPE="hidden" NAME="<% $opt{'element_name'} || $opt{'field'} || 'refnum' %>" VALUE="<% $opt{'part_referrals'}->[0]->refnum %>">
%my $error = $cust_main->bill(
%# 'time'=>$time
% );
-%#&eidiot($error) if $error;
%
%unless ( $error ) {
% $error = $cust_main->apply_payments_and_credits
% #'realtime' => $conf->exists('realtime-backend'),
% );
%}
-%#&eidiot($error) if $error;
%
%if ( $error ) {
%
<!-- mason kludge -->
%
-% &idiot($error);
+% errorpage($error);
%} else {
% print $cgi->redirect(popurl(2). "view/cust_main.cgi?$custnum");
%}
%die "Unknown svcnum!" unless $cust_svc;
%my $cust_pkg = $cust_svc->cust_pkg;
%if ( $cust_pkg ) {
-% &eidiot( 'This account has already been audited. Cancel the '.
+% errorpage( 'This account has already been audited. Cancel the '.
% qq!<A HREF="${p}view/cust_main.cgi?!. $cust_pkg->custnum.
% '#cust_pkg'. $cust_pkg->pkgnum. '">'.
% 'package</A> instead.');
<!-- mason kludge -->
%
-% &eidiot($error);
+% errorpage($error);
%} else {
% print $cgi->redirect(popurl(2));
%}
% });
%
% my $error = $agent_payment_gateway->delete;
-% eidiot($error) if $error;
+% errorpage($error) if $error;
%
% print $cgi->redirect($p. "browse/agent.cgi");
%my $custnum = $cust_credit->custnum;
%
%my $error = $cust_credit->delete;
-%eidiot($error) if $error;
+%errorpage($error) if $error;
%
%print $cgi->redirect($p. "view/cust_main.cgi?". $custnum);
%
%my $custnum = $cust_pay->custnum;
%
%my $error = $cust_pay->delete;
-%eidiot($error) if $error;
+%errorpage($error) if $error;
%
%print $cgi->redirect($p. "view/cust_main.cgi?". $custnum);
%
%my $custnum = $cust_refund->custnum;
%
%my $error = $cust_refund->delete;
-%eidiot($error) if $error;
+%errorpage($error) if $error;
%
%print $cgi->redirect($p. "view/cust_main.cgi?". $custnum);
%
%my $domain_record = qsearchs('domain_record',{'recnum'=>$recnum});
%
%my $error = $domain_record->delete;
-%eidiot($error) if $error;
+%errorpage($error) if $error;
%
%print $cgi->redirect($p. "view/svc_domain.cgi?". $domain_record->svcnum);
%
%my $part_export = qsearchs('part_export',{'exportnum'=>$exportnum});
%
%my $error = $part_export->delete;
-%eidiot($error) if $error;
+%errorpage($error) if $error;
%
%print $cgi->redirect($p. "browse/part_export.cgi");
%
% }
% open(DUMP,"pg_dump $dbname |");
% } else {
-% eidiot "don't (yet) know how to dump ". driver_name. " databases\n";
+% errorpage("don't (yet) know how to dump ". driver_name. " databases");
% }
%
% http_header('Content-Type' => 'text/plain' );
%
%
%my $classnum = $cgi->param('classnum');
-%$classnum =~ /^(\d+)$/ or eidiot "illegal classnum $classnum";
+%$classnum =~ /^(\d+)$/ or errorpage("illegal classnum $classnum");
%$classnum = $1;
%my $inventory_class = qsearchs('inventory_class', { 'classnum' => $classnum } );
%
<!-- mason kludge -->
%
-% eidiot($error);
+% errorpage($error);
%# $cgi->param('error', $error);
%# print $cgi->redirect( "${p}cust_main-import.cgi
% } else {
<!-- mason kludge -->
%
-% eidiot($error);
+% errorpage($error);
%# $cgi->param('error', $error);
%# print $cgi->redirect( "${p}cust_main-import.cgi
% } else {
<!-- mason kludge -->
%
-% eidiot($error);
+% errorpage($error);
%# $cgi->param('error', $error);
%# print $cgi->redirect( "${p}cust_main-import_charges.cgi
% } else {
<!-- mason kludge -->
%
-% eidiot($error);
+% errorpage($error);
%# $cgi->param('error', $error);
%# print $cgi->redirect( "${p}cust_main-import.cgi
% } else {
%
% my $svc_x = $svc_x[0];
%
-% eidiot("$link_field not found!") unless $svc_x;
+% errorpage("$link_field not found!") unless $svc_x;
%
% $svcnum = $svc_x->svcnum;
%
<!-- mason kludge -->
%
-% idiot($error);
+% errorpage($error);
%}
%
%
die "unknown custnum $custnum" unless $cust_main;
$cgi->param('amount') =~ /^\s*(\d*(\.\d\d)?)\s*$/
- or eidiot "illegal amount ". $cgi->param('amount');
+ or errorpage("illegal amount ". $cgi->param('amount'));
my $amount = $1;
-eidiot "amount <= 0" unless $amount > 0;
+errorpage("amount <= 0") unless $amount > 0;
$cgi->param('year') =~ /^(\d+)$/
- or die "illegal year ". $cgi->param('year');
+ or errorpage("illegal year ". $cgi->param('year'));
my $year = $1;
$cgi->param('month') =~ /^(\d+)$/
- or die "illegal month ". $cgi->param('month');
+ or errorpage("illegal month ". $cgi->param('month'));
my $month = $1;
$cgi->param('payby') =~ /^(CARD|CHEK)$/
- or die "illegal payby ". $cgi->param('payby');
+ or errorpage("illegal payby ". $cgi->param('payby'));
my $payby = $1;
my %payby2fields = (
'CARD' => [ qw( address1 address2 city state zip ) ],
);
$cgi->param('payname') =~ /^([\w \,\.\-\']+)$/
- or eidiot gettext('illegal_name'). " payname: ". $cgi->param('payname');
+ or errorpage(gettext('illegal_name'). " payname: ". $cgi->param('payname'));
my $payname = $1;
$cgi->param('payunique') =~ /^([\w \!\@\#\$\%\&\(\)\-\+\;\:\'\"\,\.\?\/\=]*)$/
- or eidiot gettext('illegal_text'). " payunique: ". $cgi->param('payunique');
+ or errorpage(gettext('illegal_text'). " payunique: ". $cgi->param('payunique'));
my $payunique = $1;
my $payinfo;
$payinfo = $cust_main->payinfo;
} else {
$cgi->param('payinfo1') =~ /^(\d+)$/
- or eidiot "illegal account number ". $cgi->param('payinfo1');
+ or errorpage("illegal account number ". $cgi->param('payinfo1'));
my $payinfo1 = $1;
$cgi->param('payinfo2') =~ /^(\d+)$/
- or eidiot "illegal ABA/routing number ". $cgi->param('payinfo2');
+ or errorpage("illegal ABA/routing number ". $cgi->param('payinfo2'));
my $payinfo2 = $1;
$payinfo = $payinfo1. '@'. $payinfo2;
}
}
$payinfo =~ s/\D//g;
$payinfo =~ /^(\d{13,16})$/
- or eidiot gettext('invalid_card'); # . ": ". $self->payinfo;
+ or errorpage(gettext('invalid_card')); # . ": ". $self->payinfo;
$payinfo = $1;
validate($payinfo)
- or eidiot gettext('invalid_card'); # . ": ". $self->payinfo;
- eidiot gettext('unknown_card_type')
+ or errorpage(gettext('invalid_card')); # . ": ". $self->payinfo;
+ errorpage(gettext('unknown_card_type'))
if cardtype($payinfo) eq "Unknown";
if ( defined $cust_main->dbdef_table->column('paycvv') ) {
if ( length($cgi->param('paycvv') ) ) {
if ( cardtype($payinfo) eq 'American Express card' ) {
$cgi->param('paycvv') =~ /^(\d{4})$/
- or eidiot "CVV2 (CID) for American Express cards is four digits.";
+ or errorpage("CVV2 (CID) for American Express cards is four digits.");
$paycvv = $1;
} else {
$cgi->param('paycvv') =~ /^(\d{3})$/
- or eidiot "CVV2 (CVC2/CID) is three digits.";
+ or errorpage("CVV2 (CVC2/CID) is three digits.");
$paycvv = $1;
}
}
map { $_ => $cgi->param($_) }
@{$payby2fields{$payby}}
);
- eidiot($error) if $error;
+ errotpage($error) if $error;
} else {
'paycvv' => $paycvv,
map { $_ => $cgi->param($_) } @{$payby2fields{$payby}}
);
- eidiot($error) if $error;
+ errorpage($error) if $error;
$cust_main->apply_payments;
$new->set( $_ => $cgi->param($_) ) foreach @{$payby2fields{$payby}};
my $error = $new->replace($cust_main);
- eidiot "payment processed successfully, but error saving info: $error"
+ errorpage("payment processed successfully, but error saving info: $error")
if $error;
$cust_main = $new;
}
%
%foreach my $cust_credit_bill ( $cust_credit->cust_credit_bill ) {
% my $error = $cust_credit_bill->delete;
-% eidiot($error) if $error;
+% errorpage($error) if $error;
%}
%
%print $cgi->redirect($p. "view/cust_main.cgi?". $custnum);
%
%foreach my $cust_bill_pay ( $cust_pay->cust_bill_pay ) {
% my $error = $cust_bill_pay->delete;
-% eidiot($error) if $error;
+% errorpage($error) if $error;
%}
%
%print $cgi->redirect($p. "view/cust_main.cgi?". $custnum);
<!-- mason kludge -->
%
-% &eidiot($error);
+% errorpage($error);
%} else {
% print $cgi->redirect(popurl(2)."view/cust_main.cgi?$custnum");
%}
%my $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum});
%
%my $error = $cust_pkg->unsuspend;
-%&eidiot($error) if $error;
+%errorpage($error) if $error;
%
%print $cgi->redirect(popurl(2). "view/cust_main.cgi?".$cust_pkg->getfield('custnum'));
%
%my $custnum = $cust_pay_void->custnum;
%
%my $error = $cust_pay_void->unvoid;
-%eidiot($error) if $error;
+%errorpage($error) if $error;
%
%print $cgi->redirect($p. "view/cust_main.cgi?". $custnum);
%
<!-- mason kludge -->
-% eidiot($error);
+% errorpage($error);
%# $cgi->param('error', $error);
%# print $cgi->redirect( "${p}cust_main-import.cgi
% } else {
%my $custnum = $cust_pay->custnum;
%
%my $error = $cust_pay->void;
-%eidiot($error) if $error;
+%errorpage($error) if $error;
%
%print $cgi->redirect($p. "view/cust_main.cgi?". $custnum);
%
% if ( $cgi->param('otaker_on') ) {
% die "access denied"
% unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
-% $cgi->param('otaker') =~ /^(\w{1,32})$/ or eidiot "Illegal otaker\n";
+% $cgi->param('otaker') =~ /^(\w{1,32})$/ or errorpage("Illegal otaker");
% $search{otaker} = $1;
% } elsif ( $cgi->param('agentnum_on') ) {
-% $cgi->param('agentnum') =~ /^(\d+)$/ or eidiot "Illegal agentnum\n";
+% $cgi->param('agentnum') =~ /^(\d+)$/ or errorpage("Illegal agentnum");
% $search{agentnum} = $1;
%# } else {
%# die "unknown query...";
<!-- mason kludge -->
%
-% eidiot "No matching customers found!\n";
+% errorpage("No matching customers found!");
%} else {
%
%
% if ( $cgi->param('referral_custnum') ) {
% $cgi->param('referral_custnum') =~ /^(\d+)$/
-% or eidiot "Illegal referral_custnum\n";
+% or errorpage("Illegal referral_custnum");
% my $referral_custnum = $1;
% my $cust_main = qsearchs('cust_main', { custnum => $referral_custnum } );
% print '<FORM METHOD="GET">'.
% print ' <SELECT NAME="referral_depth" SIZE="1" onChange="changed(this)">';
% my $max = 8; #config file
% $cgi->param('referral_depth') =~ /^(\d*)$/
-% or eidiot "Illegal referral_depth";
+% or errorpage("Illegal referral_depth");
% my $referral_depth = $1;
%
% foreach my $depth ( 1 .. $max ) {
%
% my $custnum = $cgi->param('custnum_text');
% $custnum =~ s/\D//g;
-% $custnum =~ /^(\d{1,23})$/ or eidiot "Illegal customer number\n";
+% $custnum =~ /^(\d{1,23})$/ or errorpage("Illegal customer number");
% $custnum = $1;
%
% [ qsearchs('cust_main', { 'custnum' => $custnum } ) ];
%
% my($card)=$cgi->param('card');
% $card =~ s/\D//g;
-% $card =~ /^(\d{13,16})$/ or eidiot "Illegal card number\n";
+% $card =~ /^(\d{13,16})$/ or errorpage("Illegal card number");
% my($payinfo)=$1;
%
% [ qsearch('cust_main',{'payinfo'=>$payinfo, 'payby'=>'CARD'}),
%
%sub referralsearch {
% $cgi->param('referral_custnum') =~ /^(\d+)$/
-% or eidiot "Illegal referral_custnum";
+% or errorpage("Illegal referral_custnum");
% my $cust_main = qsearchs('cust_main', { 'custnum' => $1 } )
-% or eidiot "Customer $1 not found";
+% or errorpage("Customer $1 not found");
% my $depth;
% if ( $cgi->param('referral_depth') ) {
% $cgi->param('referral_depth') =~ /^(\d+)$/
-% or eidiot "Illegal referral_depth";
+% or errorpage("Illegal referral_depth");
% $depth = $1;
% } else {
% $depth = 1;
% }
%
% $cgi->param('last_text') =~ /^([\w \,\.\-\']*)$/
-% or eidiot "Illegal last name";
+% or errorpage("Illegal last name");
% my($last)=$1;
%
% if ( $last_type{'Exact'} || $last_type{'Fuzzy'} ) {
%
% $cgi->param('company_text') =~
% /^([\w \!\@\#\$\%\&\(\)\-\+\;\:\'\"\,\.\?\/\=]*)$/
-% or eidiot "Illegal company";
+% or errorpage("Illegal company");
% my $company = $1;
%
% if ( $company_type{'Exact'} || $company_type{'Fuzzy'} ) {
%
% $cgi->param('address2_text') =~
% /^([\w \!\@\#\$\%\&\(\)\-\+\;\:\'\"\,\.\?\/\=]*)$/
-% or eidiot "Illegal address2";
+% or errorpage("Illegal address2");
% my $address2 = $1;
%
% push @cust_main, qsearch( 'cust_main',
% } elsif ( $phone =~ /^(\d{3,4})$/ ) {
% $phone = $1;
% } else {
-% eidiot gettext('illegal_phone'). ": $phone";
+% errorpage(gettext('illegal_phone'). ": $phone");
% }
%
% my @fields = qw(daytime night fax);
push @extra_sql, "svcpart = $1";
} else {
- eidiot("No search term specified");
+ errorpage("No search term specified");
}
#here is the agent virtualization
unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
my $classnum = $cgi->param('classnum');
-$classnum =~ /^(\d+)$/ or eidiot "illegal classnum $classnum";
+$classnum =~ /^(\d+)$/ or errorpage("illegal classnum $classnum");
$classnum = $1;
my $inventory_class = qsearchs( {
unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
my $agentnum = $cgi->param('agentnum');
-$agentnum =~ /^(\d+)$/ or eidiot "illegal agentnum $agentnum";
+$agentnum =~ /^(\d+)$/ or errorpage("illegal agentnum $agentnum");
$agentnum = $1;
my $agent = qsearchs('agent', { 'agentnum' => $agentnum } );
my $count_query = "SELECT COUNT(*) FROM reg_code WHERE agentnum = $agentnum";
-<%init>
+</%init>
'title' => 'Query Results',
'name' => 'rows',
'query' => 'SELECT '. ( $cgi->param('sql')
- || eidiot('Empty query') ),
+ || errorpage('Empty query') ),
)
%>
<%init>
unless ( $svc_domain ) {
#it would be nice if this looked more like the other "not found"
#errors, but this will do for now.
- eidiot "Domain ". $cgi->param('domain'). " not found at all";
+ errorpage("Domain ". $cgi->param('domain'). " not found at all");
} else {
push @extra_sql, 'domsvc = '. $svc_domain->svcnum;
}
<!-- mason kludge -->
%
-% eidiot "No matching broadband services found!\n";
+% errorpage("No matching broadband services found!");
%} else {
%