no more exit() in templates
authorivan <ivan>
Sat, 9 Feb 2002 18:24:02 +0000 (18:24 +0000)
committerivan <ivan>
Sat, 9 Feb 2002 18:24:02 +0000 (18:24 +0000)
FS/FS/CGI.pm
htetc/global.asa
htetc/handler.pl
httemplate/edit/process/agent_type.cgi
httemplate/edit/process/cust_main_county-expand.cgi
httemplate/edit/process/cust_main_county.cgi
httemplate/edit/process/cust_pay.cgi
httemplate/edit/process/part_pkg.cgi
httemplate/search/cust_main.cgi
httemplate/search/cust_pkg.cgi
httemplate/search/svc_domain.cgi

index d1c56a2..35d2e28 100644 (file)
@@ -10,7 +10,7 @@ use FS::UID;
 
 @ISA = qw(Exporter);
 @EXPORT_OK = qw(header menubar idiot eidiot popurl table itable ntable
-                small_custview);
+                small_custview myexit);
 
 =head1 NAME
 
@@ -132,6 +132,18 @@ Sends an HTML error message, then exits.
 sub eidiot {
   warn "eidiot depriciated";
   idiot(@_);
+  &myexit();
+}
+
+=item myexit
+
+You probably shouldn't use this; but if you must:
+
+If running under mod_perl, calles Apache::exit, otherwise, calls exit.
+
+=cut
+
+sub myexit {
   if (exists $ENV{MOD_PERL}) {
     $main::Response->End()
       if defined $main::Response
index cf6b0f6..daf1c39 100644 (file)
@@ -13,7 +13,7 @@ use FS::UID qw(cgisuidsetup dbh getotaker datasrc);
 use FS::Record qw(qsearch qsearchs fields dbdef);
 use FS::Conf;
 use FS::CGI qw(header menubar popurl table itable ntable idiot eidiot
-               small_custview);
+               small_custview myexit);
 
 use FS::agent;
 use FS::agent_type;
index 5be19c4..29e759a 100644 (file)
@@ -68,7 +68,7 @@ sub handler
       use FS::Record qw(qsearch qsearchs fields dbdef);
       use FS::Conf;
       use FS::CGI qw(header menubar popurl table itable ntable idiot eidiot
-                     small_custview);
+                     small_custviewm myexit);
 
       use FS::agent;
       use FS::agent_type;
index 2d11597..4e98cf1 100755 (executable)
@@ -1,4 +1,4 @@
-<!-- $Id: agent_type.cgi,v 1.3 2002-01-30 14:18:08 ivan Exp $ -->
+<!-- $Id: agent_type.cgi,v 1.4 2002-02-09 18:24:01 ivan Exp $ -->
 <%
 
 my $typenum = $cgi->param('typenum');
@@ -21,35 +21,35 @@ if ( $typenum ) {
 if ( $error ) {
   $cgi->param('error', $error);
   print $cgi->redirect(popurl(2). "agent_type.cgi?". $cgi->query_string );
-  exit;
-}
+} else {
+
+  foreach my $part_pkg (qsearch('part_pkg',{})) {
+    my($pkgpart)=$part_pkg->getfield('pkgpart');
 
-foreach my $part_pkg (qsearch('part_pkg',{})) {
-  my($pkgpart)=$part_pkg->getfield('pkgpart');
-
-  my($type_pkgs)=qsearchs('type_pkgs',{
-      'typenum' => $typenum,
-      'pkgpart' => $pkgpart,
-  });
-  if ( $type_pkgs && ! $cgi->param("pkgpart$pkgpart") ) {
-    my($d_type_pkgs)=$type_pkgs; #need to save $type_pkgs for below.
-    $error=$d_type_pkgs->delete;
-    die $error if $error;
-
-  } elsif ( $cgi->param("pkgpart$pkgpart")
-            && ! $type_pkgs
-  ) {
-    #ok to clobber it now (but bad form nonetheless?)
-    $type_pkgs=new FS::type_pkgs ({
-      'typenum' => $typenum,
-      'pkgpart' => $pkgpart,
+    my($type_pkgs)=qsearchs('type_pkgs',{
+        'typenum' => $typenum,
+        'pkgpart' => $pkgpart,
     });
-    $error= $type_pkgs->insert;
-    die $error if $error;
+    if ( $type_pkgs && ! $cgi->param("pkgpart$pkgpart") ) {
+      my($d_type_pkgs)=$type_pkgs; #need to save $type_pkgs for below.
+      $error=$d_type_pkgs->delete;
+      die $error if $error;
+
+    } elsif ( $cgi->param("pkgpart$pkgpart")
+              && ! $type_pkgs
+    ) {
+      #ok to clobber it now (but bad form nonetheless?)
+      $type_pkgs=new FS::type_pkgs ({
+        'typenum' => $typenum,
+        'pkgpart' => $pkgpart,
+      });
+      $error= $type_pkgs->insert;
+      die $error if $error;
+    }
+
   }
 
+  print $cgi->redirect(popurl(3). "browse/agent_type.cgi");
 }
 
-print $cgi->redirect(popurl(3). "browse/agent_type.cgi");
-
 %>
index b16fab4..3427790 100755 (executable)
@@ -1,4 +1,4 @@
-<!-- $Id: cust_main_county-expand.cgi,v 1.4 2002-01-30 14:18:09 ivan Exp $ -->
+<!-- $Id: cust_main_county-expand.cgi,v 1.5 2002-02-09 18:24:01 ivan Exp $ -->
 <%
 
 $cgi->param('taxnum') =~ /^(\d+)$/ or die "Illegal taxnum!";
@@ -19,7 +19,7 @@ if ( $cgi->param('delim') eq 'n' ) {
   unless ( /^\s*([\w\- ]+)\s*$/ ) {
     $cgi->param('error', "Illegal item in expansion");
     print $cgi->redirect(popurl(2). "cust_main_county-expand.cgi?". $cgi->query_string );
-    exit;
+    myexit();
   }
   $1;
 } @expansion;
index 0f0246b..e9d1308 100755 (executable)
@@ -1,4 +1,4 @@
-<!-- $Id: cust_main_county.cgi,v 1.3 2002-01-30 14:18:09 ivan Exp $ -->
+<!-- $Id: cust_main_county.cgi,v 1.4 2002-02-09 18:24:01 ivan Exp $ -->
 <%
 
 foreach ( $cgi->param ) {
@@ -14,7 +14,7 @@ foreach ( $cgi->param ) {
   if ( $error ) {
     $cgi->param('error', $error);
     print $cgi->redirect(popurl(2). "cust_main_county.cgi?". $cgi->query_string );
-    exit;
+    myexit();
   }
 }
 
index c75e532..953ff3e 100755 (executable)
@@ -1,4 +1,4 @@
-<!-- $Id: cust_pay.cgi,v 1.6 2002-01-30 14:18:09 ivan Exp $ -->
+<!-- $Id: cust_pay.cgi,v 1.7 2002-02-09 18:24:01 ivan Exp $ -->
 <%
 
 $cgi->param('linknum') =~ /^(\d+)$/
@@ -22,7 +22,6 @@ my $error = $new->insert;
 if ($error) {
   $cgi->param('error', $error);
   print $cgi->redirect(popurl(2). 'cust_pay.cgi?'. $cgi->query_string );
-  exit;
 } elsif ( $link eq 'invnum' ) {
   print $cgi->redirect(popurl(3). "view/cust_bill.cgi?$linknum");
 } elsif ( $link eq 'custnum' ) {
index 2ba1cbe..5240d8c 100755 (executable)
@@ -1,4 +1,4 @@
-<!-- $Id: part_pkg.cgi,v 1.7 2002-01-30 14:18:09 ivan Exp $ -->
+<!-- $Id: part_pkg.cgi,v 1.8 2002-02-09 18:24:01 ivan Exp $ -->
 <%
 
 my $dbh = dbh;
@@ -34,7 +34,7 @@ foreach my $part_svc ( qsearch('part_svc', {} ) ) {
   unless ( $quantity =~ /^(\d+)$/ ) {
     $cgi->param('error', "Illegal quantity" );
     print $cgi->redirect(popurl(2). "part_pkg.cgi?". $cgi->query_string );
-    exit;
+    myexit();
   }
 }
 
@@ -58,7 +58,7 @@ if ( $error ) {
   $dbh->rollback;
   $cgi->param('error', $error );
   print $cgi->redirect(popurl(2). "part_pkg.cgi?". $cgi->query_string );
-  exit;
+  myexit();
 }
 
 foreach $part_svc (qsearch('part_svc',{})) {
index f21dd7e..89e325d 100755 (executable)
@@ -150,7 +150,7 @@ if ( scalar(@cust_main) == 1 && ! $cgi->param('referral_custnum') ) {
   } else {
     print $cgi->redirect(popurl(2). "view/cust_main.cgi?". $cust_main[0]->custnum);
   }
-  exit;
+  #exit;
 } elsif ( scalar(@cust_main) == 0 ) {
   eidiot "No matching customers found!\n";
 } else { 
index 9705bd6..b2199e9 100755 (executable)
@@ -1,4 +1,4 @@
-<!-- $Id: cust_pkg.cgi,v 1.13 2002-01-30 14:18:09 ivan Exp $ -->
+<!-- $Id: cust_pkg.cgi,v 1.14 2002-02-09 18:24:02 ivan Exp $ -->
 <%
 
 my $conf = new FS::Conf;
@@ -76,7 +76,7 @@ my @cust_pkg = qsearch('cust_pkg',{}, '', "$unconf ORDER BY pkgnum $limit" );
 if ( scalar(@cust_pkg) == 1 ) {
   my($pkgnum)=$cust_pkg[0]->pkgnum;
   print $cgi->redirect(popurl(2). "view/cust_pkg.cgi?$pkgnum");
-  exit;
+  #exit;
 } elsif ( scalar(@cust_pkg) == 0 ) { #error
   eidiot("No packages found");
 } else {
index 4ec5eb0..c274750 100755 (executable)
@@ -1,4 +1,4 @@
-<!-- $Id: svc_domain.cgi,v 1.6 2002-01-30 14:18:09 ivan Exp $ -->
+<!-- $Id: svc_domain.cgi,v 1.7 2002-02-09 18:24:02 ivan Exp $ -->
 <%
 
 my $conf = new FS::Conf;
@@ -34,7 +34,7 @@ if ( $query eq 'svcnum' ) {
 
 if ( scalar(@svc_domain) == 1 ) {
   print $cgi->redirect(popurl(2). "view/svc_domain.cgi?". $svc_domain[0]->svcnum);
-  exit;
+  #exit;
 } elsif ( scalar(@svc_domain) == 0 ) {
   eidiot "No matching domains found!\n";
 } else {