From: jeff Date: Mon, 8 Oct 2007 19:14:28 +0000 (+0000) Subject: Remove remaining calls to idiot/eidiot. Should fix 1479 X-Git-Tag: TRIXBOX_2_6~288 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=718f65eee1c797ea90a315b5f03fae75c80a5112 Remove remaining calls to idiot/eidiot. Should fix 1479 --- diff --git a/htetc/handler.pl b/htetc/handler.pl index 1479145c0..8bf0d59d8 100644 --- a/htetc/handler.pl +++ b/htetc/handler.pl @@ -281,6 +281,11 @@ sub handler $m->scomp(@_); } + sub errorpage { + use vars qw($m); + $m->comp('/elements/errorpage.html', @_); + } + sub redirect { my( $location ) = @_; use vars qw($m); diff --git a/httemplate/edit/process/cust_svc.cgi b/httemplate/edit/process/cust_svc.cgi index 3a07d1e7a..e9d5f6238 100644 --- a/httemplate/edit/process/cust_svc.cgi +++ b/httemplate/edit/process/cust_svc.cgi @@ -21,7 +21,7 @@ %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"); diff --git a/httemplate/edit/process/domain_record.cgi b/httemplate/edit/process/domain_record.cgi index 87bdf6835..daf35ad6d 100755 --- a/httemplate/edit/process/domain_record.cgi +++ b/httemplate/edit/process/domain_record.cgi @@ -26,7 +26,7 @@ % -% eidiot($error); +% errorpage($error); %} else { % my $svcnum = $new->svcnum; % print $cgi->redirect(popurl(3). "view/svc_domain.cgi?$svcnum"); diff --git a/httemplate/edit/process/reg_code.cgi b/httemplate/edit/process/reg_code.cgi index 4fdea60fc..d93bb55a2 100644 --- a/httemplate/edit/process/reg_code.cgi +++ b/httemplate/edit/process/reg_code.cgi @@ -1,7 +1,7 @@ % % %$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 } ); % diff --git a/httemplate/edit/rate_region.cgi b/httemplate/edit/rate_region.cgi index 12cb180de..bd3dcbd46 100644 --- a/httemplate/edit/rate_region.cgi +++ b/httemplate/edit/rate_region.cgi @@ -27,7 +27,7 @@ %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; % } %} diff --git a/httemplate/edit/reg_code.cgi b/httemplate/edit/reg_code.cgi index 06bef4879..f5f0f7b66 100644 --- a/httemplate/edit/reg_code.cgi +++ b/httemplate/edit/reg_code.cgi @@ -1,6 +1,6 @@ % %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 } ); % diff --git a/httemplate/elements/errorpage.html b/httemplate/elements/errorpage.html new file mode 100644 index 000000000..d28055efb --- /dev/null +++ b/httemplate/elements/errorpage.html @@ -0,0 +1,13 @@ +<% include("/elements/header.html", "Error processing your request") %> + +Your request could not be processed because of the following error<% (scalar(@_) > 1) ? 's' : '' %>: + +% while (@_) { + +

<% shift %> + + +%} +% $m->flush_buffer(); +% $HTML::Mason::Commands::m->abort(); +% #die "shouldn't fall through to here (mason \$m->abort didn't)"; diff --git a/httemplate/elements/tr-select-part_referral.html b/httemplate/elements/tr-select-part_referral.html index cd26c254d..62795e9b2 100644 --- a/httemplate/elements/tr-select-part_referral.html +++ b/httemplate/elements/tr-select-part_referral.html @@ -1,5 +1,5 @@ % 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."; +

You have not created any advertising sources. You must create at least one advertising source before adding a customer. Go to advertising source listing and create one or more advertising sources. % } elsif ( scalar( @{$opt{'part_referrals'}} ) == 1 ) { diff --git a/httemplate/misc/bill.cgi b/httemplate/misc/bill.cgi index 1bf1eb11e..24dfd6bbd 100755 --- a/httemplate/misc/bill.cgi +++ b/httemplate/misc/bill.cgi @@ -11,7 +11,6 @@ %my $error = $cust_main->bill( %# 'time'=>$time % ); -%#&eidiot($error) if $error; % %unless ( $error ) { % $error = $cust_main->apply_payments_and_credits @@ -33,14 +32,13 @@ % #'realtime' => $conf->exists('realtime-backend'), % ); %} -%#&eidiot($error) if $error; % %if ( $error ) { % % -% &idiot($error); +% errorpage($error); %} else { % print $cgi->redirect(popurl(2). "view/cust_main.cgi?$custnum"); %} diff --git a/httemplate/misc/cancel-unaudited.cgi b/httemplate/misc/cancel-unaudited.cgi index 6f070a444..da60dc47b 100755 --- a/httemplate/misc/cancel-unaudited.cgi +++ b/httemplate/misc/cancel-unaudited.cgi @@ -14,7 +14,7 @@ %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!'. % 'package instead.'); @@ -27,7 +27,7 @@ % -% &eidiot($error); +% errorpage($error); %} else { % print $cgi->redirect(popurl(2)); %} diff --git a/httemplate/misc/delete-agent_payment_gateway.cgi b/httemplate/misc/delete-agent_payment_gateway.cgi index fb0f1e4b8..20a202e0e 100644 --- a/httemplate/misc/delete-agent_payment_gateway.cgi +++ b/httemplate/misc/delete-agent_payment_gateway.cgi @@ -10,6 +10,6 @@ % }); % % my $error = $agent_payment_gateway->delete; -% eidiot($error) if $error; +% errorpage($error) if $error; % % print $cgi->redirect($p. "browse/agent.cgi"); diff --git a/httemplate/misc/delete-cust_credit.cgi b/httemplate/misc/delete-cust_credit.cgi index e4756a922..78df24989 100755 --- a/httemplate/misc/delete-cust_credit.cgi +++ b/httemplate/misc/delete-cust_credit.cgi @@ -9,7 +9,7 @@ %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); % diff --git a/httemplate/misc/delete-cust_pay.cgi b/httemplate/misc/delete-cust_pay.cgi index 1fda82e2a..a0fa414d5 100755 --- a/httemplate/misc/delete-cust_pay.cgi +++ b/httemplate/misc/delete-cust_pay.cgi @@ -9,7 +9,7 @@ %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); % diff --git a/httemplate/misc/delete-cust_refund.cgi b/httemplate/misc/delete-cust_refund.cgi index 3e44560d0..f3ac589aa 100755 --- a/httemplate/misc/delete-cust_refund.cgi +++ b/httemplate/misc/delete-cust_refund.cgi @@ -9,7 +9,7 @@ %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); % diff --git a/httemplate/misc/delete-domain_record.cgi b/httemplate/misc/delete-domain_record.cgi index cccce357e..83e75ce20 100755 --- a/httemplate/misc/delete-domain_record.cgi +++ b/httemplate/misc/delete-domain_record.cgi @@ -8,7 +8,7 @@ %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); % diff --git a/httemplate/misc/delete-part_export.cgi b/httemplate/misc/delete-part_export.cgi index 16389a90c..5f2ebb99c 100755 --- a/httemplate/misc/delete-part_export.cgi +++ b/httemplate/misc/delete-part_export.cgi @@ -8,7 +8,7 @@ %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"); % diff --git a/httemplate/misc/dump.cgi b/httemplate/misc/dump.cgi index e8f4b6f38..486b66568 100644 --- a/httemplate/misc/dump.cgi +++ b/httemplate/misc/dump.cgi @@ -7,7 +7,7 @@ % } % 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' ); diff --git a/httemplate/misc/inventory_item-import.html b/httemplate/misc/inventory_item-import.html index 87c6af34c..363623806 100644 --- a/httemplate/misc/inventory_item-import.html +++ b/httemplate/misc/inventory_item-import.html @@ -1,7 +1,7 @@ % % %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 } ); % diff --git a/httemplate/misc/process/cdr-import.html b/httemplate/misc/process/cdr-import.html index 68edaa21c..93137c3d0 100644 --- a/httemplate/misc/process/cdr-import.html +++ b/httemplate/misc/process/cdr-import.html @@ -14,7 +14,7 @@ % -% eidiot($error); +% errorpage($error); %# $cgi->param('error', $error); %# print $cgi->redirect( "${p}cust_main-import.cgi % } else { diff --git a/httemplate/misc/process/cust_main-import.cgi b/httemplate/misc/process/cust_main-import.cgi index a5ede99a1..c8d1b6cd1 100644 --- a/httemplate/misc/process/cust_main-import.cgi +++ b/httemplate/misc/process/cust_main-import.cgi @@ -21,7 +21,7 @@ % -% eidiot($error); +% errorpage($error); %# $cgi->param('error', $error); %# print $cgi->redirect( "${p}cust_main-import.cgi % } else { diff --git a/httemplate/misc/process/cust_main-import_charges.cgi b/httemplate/misc/process/cust_main-import_charges.cgi index e0ede576b..1a29bf600 100644 --- a/httemplate/misc/process/cust_main-import_charges.cgi +++ b/httemplate/misc/process/cust_main-import_charges.cgi @@ -16,7 +16,7 @@ % -% eidiot($error); +% errorpage($error); %# $cgi->param('error', $error); %# print $cgi->redirect( "${p}cust_main-import_charges.cgi % } else { diff --git a/httemplate/misc/process/inventory_item-import.html b/httemplate/misc/process/inventory_item-import.html index f6159dc99..51337529f 100644 --- a/httemplate/misc/process/inventory_item-import.html +++ b/httemplate/misc/process/inventory_item-import.html @@ -14,7 +14,7 @@ % -% eidiot($error); +% errorpage($error); %# $cgi->param('error', $error); %# print $cgi->redirect( "${p}cust_main-import.cgi % } else { diff --git a/httemplate/misc/process/link.cgi b/httemplate/misc/process/link.cgi index 7c71371ee..66f4ee11d 100755 --- a/httemplate/misc/process/link.cgi +++ b/httemplate/misc/process/link.cgi @@ -39,7 +39,7 @@ % % 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; % @@ -69,7 +69,7 @@ % -% idiot($error); +% errorpage($error); %} % % diff --git a/httemplate/misc/process/payment.cgi b/httemplate/misc/process/payment.cgi index 29157d8f0..6377b13e8 100644 --- a/httemplate/misc/process/payment.cgi +++ b/httemplate/misc/process/payment.cgi @@ -18,20 +18,20 @@ my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ); 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 ) ], @@ -42,11 +42,11 @@ my %type = ( 'CARD' => 'credit card', ); $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; @@ -57,10 +57,10 @@ if ( $payby eq 'CHEK' ) { $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; } @@ -73,22 +73,22 @@ if ( $payby eq 'CHEK' ) { } $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; } } @@ -110,7 +110,7 @@ if ( $cgi->param('batch') ) { map { $_ => $cgi->param($_) } @{$payby2fields{$payby}} ); - eidiot($error) if $error; + errotpage($error) if $error; } else { @@ -124,7 +124,7 @@ if ( $cgi->param('batch') ) { 'paycvv' => $paycvv, map { $_ => $cgi->param($_) } @{$payby2fields{$payby}} ); - eidiot($error) if $error; + errorpage($error) if $error; $cust_main->apply_payments; @@ -156,7 +156,7 @@ if ( $cgi->param('save') ) { $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; } diff --git a/httemplate/misc/unapply-cust_credit.cgi b/httemplate/misc/unapply-cust_credit.cgi index 56a3ff854..f8fa63268 100755 --- a/httemplate/misc/unapply-cust_credit.cgi +++ b/httemplate/misc/unapply-cust_credit.cgi @@ -10,7 +10,7 @@ % %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); diff --git a/httemplate/misc/unapply-cust_pay.cgi b/httemplate/misc/unapply-cust_pay.cgi index b28f61b0f..6bd6c07ee 100755 --- a/httemplate/misc/unapply-cust_pay.cgi +++ b/httemplate/misc/unapply-cust_pay.cgi @@ -10,7 +10,7 @@ % %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); diff --git a/httemplate/misc/unprovision.cgi b/httemplate/misc/unprovision.cgi index e42feda8a..b5e510695 100755 --- a/httemplate/misc/unprovision.cgi +++ b/httemplate/misc/unprovision.cgi @@ -22,7 +22,7 @@ % -% &eidiot($error); +% errorpage($error); %} else { % print $cgi->redirect(popurl(2)."view/cust_main.cgi?$custnum"); %} diff --git a/httemplate/misc/unsusp_pkg.cgi b/httemplate/misc/unsusp_pkg.cgi index 79c07a72a..80188c668 100755 --- a/httemplate/misc/unsusp_pkg.cgi +++ b/httemplate/misc/unsusp_pkg.cgi @@ -8,7 +8,7 @@ %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')); % diff --git a/httemplate/misc/unvoid-cust_pay_void.cgi b/httemplate/misc/unvoid-cust_pay_void.cgi index 75c3edc06..625431a57 100755 --- a/httemplate/misc/unvoid-cust_pay_void.cgi +++ b/httemplate/misc/unvoid-cust_pay_void.cgi @@ -9,7 +9,7 @@ %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); % diff --git a/httemplate/misc/upload-batch.cgi b/httemplate/misc/upload-batch.cgi index 69d3ca6b1..5a15008b0 100644 --- a/httemplate/misc/upload-batch.cgi +++ b/httemplate/misc/upload-batch.cgi @@ -2,7 +2,7 @@ -% eidiot($error); +% errorpage($error); %# $cgi->param('error', $error); %# print $cgi->redirect( "${p}cust_main-import.cgi % } else { diff --git a/httemplate/misc/void-cust_pay.cgi b/httemplate/misc/void-cust_pay.cgi index b55d22c41..972a1a5bd 100755 --- a/httemplate/misc/void-cust_pay.cgi +++ b/httemplate/misc/void-cust_pay.cgi @@ -9,7 +9,7 @@ %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); % diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index 56bb9ca41..b0f657fbb 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -87,10 +87,10 @@ % 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..."; @@ -232,7 +232,7 @@ % -% eidiot "No matching customers found!\n"; +% errorpage("No matching customers found!"); %} else { % @@ -268,7 +268,7 @@ % % 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 '

'. @@ -288,7 +288,7 @@ % print '