[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[3284] trunk



Revision: 3284
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3284&view=rev
Author:   ehuelsmann
Date:     2011-06-18 22:15:10 +0000 (Sat, 18 Jun 2011)

Log Message:
-----------
Replace scattered 'exit;' calls by exception handling,
allowing callers their own cleanup.  Specifically, close the db connection
in order to reduce the errors reported in the error log.

Modified Paths:
--------------
    trunk/LedgerSMB/DBObject/Payment.pm
    trunk/LedgerSMB/Form.pm
    trunk/LedgerSMB/Template.pm
    trunk/LedgerSMB.pm
    trunk/bin/aa.pl
    trunk/bin/admin.pl
    trunk/bin/am.pl
    trunk/bin/arap.pl
    trunk/bin/arapprn.pl
    trunk/bin/bp.pl
    trunk/bin/cp.pl
    trunk/bin/gl.pl
    trunk/bin/ic.pl
    trunk/bin/io.pl
    trunk/bin/ir.pl
    trunk/bin/is.pl
    trunk/bin/jc.pl
    trunk/bin/oe.pl
    trunk/bin/pe.pl
    trunk/bin/pos.pl
    trunk/bin/pw.pl
    trunk/bin/rp.pl
    trunk/lsmb-request.pl
    trunk/old-handler.pl
    trunk/scripts/drafts.pl
    trunk/scripts/login.pl
    trunk/scripts/recon.pl
    trunk/scripts/vouchers.pl

Added Paths:
-----------
    trunk/LedgerSMB/CancelFurtherProcessing.pm

Added: trunk/LedgerSMB/CancelFurtherProcessing.pm
===================================================================
--- trunk/LedgerSMB/CancelFurtherProcessing.pm	                        (rev 0)
+++ trunk/LedgerSMB/CancelFurtherProcessing.pm	2011-06-18 22:15:10 UTC (rev 3284)
@@ -0,0 +1,5 @@
+package CancelFurtherProcessing;
+
+use base qw(Error);
+
+1;

Modified: trunk/LedgerSMB/DBObject/Payment.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Payment.pm	2011-06-18 21:01:30 UTC (rev 3283)
+++ trunk/LedgerSMB/DBObject/Payment.pm	2011-06-18 22:15:10 UTC (rev 3284)
@@ -536,7 +536,7 @@
     $self->get_metadata();
     if ( !defined $self->{source_start} ){
         $self->error('No source start defined!');
-        exit;
+        $self->finalize_request();
     }
     #$self->error('No source start defined!') unless defined $self->{source_start}; 
 

Modified: trunk/LedgerSMB/Form.pm
===================================================================
--- trunk/LedgerSMB/Form.pm	2011-06-18 21:01:30 UTC (rev 3283)
+++ trunk/LedgerSMB/Form.pm	2011-06-18 22:15:10 UTC (rev 3284)
@@ -222,6 +222,7 @@
     return $results[0];
 }
 
+
 =item open_form()
 
 This sets a $self->{form_id} to be used in later form validation (anti-XSRF 
@@ -439,7 +440,7 @@
         print
           qq|<body><h2 class="error">Error!</h2> <p><b>$self->{msg}</b></body>|;
 
-        exit;
+        $self->finalize_request();
 
     }
     else {
@@ -620,7 +621,7 @@
     if ( $self->{callback} || !$msg ) {
 	print STDERR "Full redirect\n";
         main::redirect();
-	exit;
+	$self->finalize_request();
     }
     else {
 

Modified: trunk/LedgerSMB/Template.pm
===================================================================
--- trunk/LedgerSMB/Template.pm	2011-06-18 21:01:30 UTC (rev 3283)
+++ trunk/LedgerSMB/Template.pm	2011-06-18 22:15:10 UTC (rev 3284)
@@ -129,6 +129,7 @@
 use Carp;
 
 use Error qw(:try);
+use LedgerSMB::CancelFurtherProcessing;
 use LedgerSMB::Sysconfig;
 use LedgerSMB::Mailer;
 use LedgerSMB::Company_Config;
@@ -292,7 +293,7 @@
 		$self->_lpr_output;
 	} elsif (defined $self->{output} or lc $method eq 'screen') {
 		$self->_http_output;
-		exit;
+		throw CancelFurtherProcessing();
 	} elsif (defined $method) {
 		$self->_lpr_output;
 	} else {
@@ -351,7 +352,7 @@
 	
 	unlink($self->{rendered}) or
 		throw Error::Simple 'Unable to delete output file';
-	exit;
+	throw CancelFurtherProcessing();
 }
 
 sub _email_output {

Modified: trunk/LedgerSMB.pm
===================================================================
--- trunk/LedgerSMB.pm	2011-06-18 21:01:30 UTC (rev 3283)
+++ trunk/LedgerSMB.pm	2011-06-18 22:15:10 UTC (rev 3284)
@@ -190,7 +190,9 @@
 use Math::BigFloat;
 use LedgerSMB::Sysconfig;
 use Data::Dumper;
+use Error;
 use LedgerSMB::Auth;
+use LedgerSMB::CancelFurtherProcessing;
 use LedgerSMB::Template;
 use LedgerSMB::Locale;
 use LedgerSMB::User;
@@ -836,6 +838,21 @@
     
 }
 
+=item finalize_request()
+
+This function throws a CancelFurtherProcessing exception to be caught
+by the outermost processing script.  This construct allows the outer
+script and intermediate levels to clean up, if required.
+
+This construct replaces 'exit;' calls randomly scattered
+around the code everywhere.
+
+=cut
+
+sub finalize_request {
+    throw CancelFurtherProcessing();
+}
+
 # To be replaced with a generic interface to an Error class
 sub error {
 

Modified: trunk/bin/aa.pl
===================================================================
--- trunk/bin/aa.pl	2011-06-18 21:01:30 UTC (rev 3283)
+++ trunk/bin/aa.pl	2011-06-18 22:15:10 UTC (rev 3284)
@@ -1202,7 +1202,7 @@
           $locale->text('Data not saved.  Please try again.')
        );
        &update;
-       exit;
+       $form->finalize_request();
     }
     $label =
       ( $form->{vc} eq 'customer' )
@@ -1248,13 +1248,13 @@
     ($name) = split /--/, $form->{ $form->{vc} };
     if ( $form->{"old$form->{vc}"} ne qq|$name--$form->{"$form->{vc}_id"}| ) {
         &update;
-        exit;
+        $form->finalize_request();
     }
 
     if ( !$form->{repost} ) {
         if ( $form->{id} ) {
             &repost;
-            exit;
+            $form->finalize_request();
         }
     }
 

Modified: trunk/bin/admin.pl
===================================================================
--- trunk/bin/admin.pl	2011-06-18 21:01:30 UTC (rev 3283)
+++ trunk/bin/admin.pl	2011-06-18 22:15:10 UTC (rev 3284)
@@ -1003,7 +1003,7 @@
 
         if ( $root->{password} ne ( Digest::MD5::md5_hex $form->{password} ) ) {
             &adminlogin( $locale->text('Access Denied!') );
-            exit;
+            $form->finalize_request();
         }
         else {
             $form->{login} = 'admin';
@@ -1021,7 +1021,7 @@
 
         if ( !Session::session_check( $cookie{${LedgerSMB::Sysconfig::cookie_name}}, $root ) ) {
             &adminlogin( $locale->text('Session expired!') );
-            exit;
+            $form->finalize_request();
         }
     }
 }

Modified: trunk/bin/am.pl
===================================================================
--- trunk/bin/am.pl	2011-06-18 21:01:30 UTC (rev 3283)
+++ trunk/bin/am.pl	2011-06-18 22:15:10 UTC (rev 3284)
@@ -1266,7 +1266,7 @@
 
     if ( ..hidden.. $form->{ALL} } ) {
         &display_form;
-        exit;
+        $form->finalize_request();
     }
 
     unshift @{ $form->{ALL} },

Modified: trunk/bin/arap.pl
===================================================================
--- trunk/bin/arap.pl	2011-06-18 21:01:30 UTC (rev 3283)
+++ trunk/bin/arap.pl	2011-06-18 22:15:10 UTC (rev 3284)
@@ -110,7 +110,7 @@
               )
             {
                 &select_name($name);
-                exit;
+                $form->finalize_request();
             }
 
             if ( $rv == 1 ) {
@@ -343,7 +343,7 @@
                     # check form->{project_list} how many there are
                     $form->{rownumber} = $i;
                     &select_project;
-                    exit;
+                    $form->finalize_request();
                 }
 
                 if ( $rows == 1 ) {

Modified: trunk/bin/arapprn.pl
===================================================================
--- trunk/bin/arapprn.pl	2011-06-18 21:01:30 UTC (rev 3283)
+++ trunk/bin/arapprn.pl	2011-06-18 22:15:10 UTC (rev 3284)
@@ -77,7 +77,7 @@
         if ( $form->{media} eq 'screen' ) {
             if ( $form->{media} eq 'screen' ) {
                 &update;
-                exit;
+                $form->finalize_request();
             }
         }
     }
@@ -98,13 +98,13 @@
         if ( $form->{paidaccounts} > 1 ) {
             if ( $form->{"paid_$form->{paidaccounts}"} ) {
                 &update;
-                exit;
+                $form->finalize_request();
             }
             elsif ( $form->{paidaccounts} > 2 ) {
 
                 # select payment
                 &select_payment;
-                exit;
+                $form->finalize_request();
             }
         }
         else {

Modified: trunk/bin/bp.pl
===================================================================
--- trunk/bin/bp.pl	2011-06-18 21:01:30 UTC (rev 3283)
+++ trunk/bin/bp.pl	2011-06-18 22:15:10 UTC (rev 3284)
@@ -260,7 +260,7 @@
                 print $locale->text('done');
                 $form->redirect( $locale->text('Marked entries printed!') );
             }
-            exit;
+            $form->finalize_request();
         }
     }
 

Modified: trunk/bin/cp.pl
===================================================================
--- trunk/bin/cp.pl	2011-06-18 21:01:30 UTC (rev 3283)
+++ trunk/bin/cp.pl	2011-06-18 22:15:10 UTC (rev 3284)
@@ -1529,7 +1529,7 @@
 
     if ( $form->{currency} ne $form->{oldcurrency} ) {
         &update;
-        exit;
+        $form->finalize_request();
     }
 
     $form->error( $locale->text('Date missing!') ) unless $form->{datepaid};
@@ -1625,7 +1625,7 @@
                 if ( ( $rv = CP->get_openvc( \%myconfig, \%$form ) ) > 1 ) {
                     $form->{redo} = 1;
                     &select_name($name);
-                    exit;
+                    $form->finalize_request();
                 }
 
                 if ( $rv == 1 ) {

Modified: trunk/bin/gl.pl
===================================================================
--- trunk/bin/gl.pl	2011-06-18 21:01:30 UTC (rev 3283)
+++ trunk/bin/gl.pl	2011-06-18 22:15:10 UTC (rev 3284)
@@ -1102,7 +1102,7 @@
 sub post {
     if (!$form->close_form){
         &update;
-        exit;
+        $form->finalize_request();
     };
     $form->isblank( "transdate", $locale->text('Transaction Date missing!') );
 
@@ -1117,7 +1117,7 @@
     if ( !$form->{repost} ) {
         if ( $form->{id} ) {
             &repost;
-            exit;
+            $form->finalize_request();
         }
     }
 

Modified: trunk/bin/ic.pl
===================================================================
--- trunk/bin/ic.pl	2011-06-18 21:01:30 UTC (rev 3283)
+++ trunk/bin/ic.pl	2011-06-18 22:15:10 UTC (rev 3284)
@@ -3188,7 +3188,7 @@
                     $form->{makemodel_rows}--;
                     $form->{customer_rows}--;
                     &select_item;
-                    exit;
+                    $form->finalize_request();
                 }
                 else {
                     $form->{"qty_$i"} = 1;
@@ -3269,7 +3269,7 @@
             ( $form->{vendor} ) = split /--/, $form->{"vendor_$i"};
             if ( ( $j = $form->get_name( \%myconfig, vendor ) ) > 1 ) {
                 &select_name( vendor, $i );
-                exit;
+                $form->finalize_request();
             }
 
             if ( $j == 1 ) {
@@ -3347,7 +3347,7 @@
 
             if ( ( $j = $form->get_name( \%myconfig, customer ) ) > 1 ) {
                 &select_name( customer, $i );
-                exit;
+                $form->finalize_request();
             }
 
             if ( $j == 1 ) {
@@ -3566,7 +3566,7 @@
                 $form->{callback} = $form->unescape( $form->{old_callback} );
 
                 &edit;
-                exit;
+                $form->finalize_request();
             }
 
             # undo number formatting

Modified: trunk/bin/io.pl
===================================================================
--- trunk/bin/io.pl	2011-06-18 21:01:30 UTC (rev 3283)
+++ trunk/bin/io.pl	2011-06-18 22:15:10 UTC (rev 3284)
@@ -814,7 +814,7 @@
     if ( $form->{display_form} ) {
 	
 	&{"$form->{display_form}"};
-        exit;
+        $form->finalize_request();
     }
     
 
@@ -1093,7 +1093,7 @@
     # check if items are valid
     if ( $form->{rowcount} == 1 ) {
         &update;
-        exit;
+        $form->finalize_request();
     }
 
     for $i ( 1 .. $form->{rowcount} - 1 ) {
@@ -1563,7 +1563,7 @@
           $form->update_defaults( \%myconfig, $numberfld );
         if ( $form->{media} eq 'screen' ) {
             &update;
-            exit;
+            $form->finalize_request();
         }
     }
 

Modified: trunk/bin/ir.pl
===================================================================
--- trunk/bin/ir.pl	2011-06-18 21:01:30 UTC (rev 3283)
+++ trunk/bin/ir.pl	2011-06-18 22:15:10 UTC (rev 3284)
@@ -779,7 +779,7 @@
         }
         elsif ( $rows > 1 ) {
             &select_item;
-            exit;
+            $form->finalize_request();
         }
         else {
             map {
@@ -941,7 +941,7 @@
             if ( $rows > 1 ) {
 
                 &select_item;
-                exit;
+                $form->finalize_request();
 
             }
             else {
@@ -1046,7 +1046,7 @@
     # if the vendor changed get new values
     if ( &check_name(vendor) ) {
         &update;
-        exit;
+        $form->finalize_request();
     }
 
     &validate_items;
@@ -1083,7 +1083,7 @@
     if ( !$form->{repost} ) {
         if ( $form->{id} ) {
             &repost;
-            exit;
+            $form->finalize_request();
         }
     }
 

Modified: trunk/bin/is.pl
===================================================================
--- trunk/bin/is.pl	2011-06-18 21:01:30 UTC (rev 3283)
+++ trunk/bin/is.pl	2011-06-18 22:15:10 UTC (rev 3284)
@@ -987,7 +987,7 @@
             if ( $rows > 1 ) {
 
                 &select_item;
-                exit;
+                $form->finalize_request();
 
             }
             else {
@@ -1098,7 +1098,7 @@
     # if oldcustomer ne customer redo form
     if ( &check_name(customer) ) {
         &update;
-        exit;
+        $form->finalize_request();
     }
 
     &validate_items;
@@ -1137,7 +1137,7 @@
     if ( !$form->{repost} ) {
         if ( $form->{id} ) {
             &repost;
-            exit;
+            $form->finalize_request();
         }
     }
 
@@ -1165,7 +1165,7 @@
         if ( $form->{id} ) {
             $form->{print_and_post} = 1;
             &repost;
-            exit;
+            $form->finalize_request();
         }
     }
 

Modified: trunk/bin/jc.pl
===================================================================
--- trunk/bin/jc.pl	2011-06-18 21:01:30 UTC (rev 3283)
+++ trunk/bin/jc.pl	2011-06-18 22:15:10 UTC (rev 3284)
@@ -1161,7 +1161,7 @@
     if ( !$form->{resave} ) {
         if ( $form->{id} ) {
             &resave;
-            exit;
+            $form->finalize_request();
         }
     }
 
@@ -1266,7 +1266,7 @@
         if ( $form->{id} ) {
             $form->{print_and_save} = 1;
             &resave;
-            exit;
+            $form->finalize_request();
         }
     }
 

Modified: trunk/bin/oe.pl
===================================================================
--- trunk/bin/oe.pl	2011-06-18 21:01:30 UTC (rev 3283)
+++ trunk/bin/oe.pl	2011-06-18 22:15:10 UTC (rev 3284)
@@ -898,7 +898,7 @@
         }
 
         &po_orderitems;
-        exit;
+        $form->finalize_request();
     }
 
     $form->{exchangerate} =
@@ -1012,7 +1012,7 @@
             if ( $rows > 1 ) {
 
                 &select_item;
-                exit;
+                $form->finalize_request();
 
             }
             else {
@@ -2130,7 +2130,7 @@
     # if the name changed get new values
     if ( &check_name( $form->{vc} ) ) {
         &update;
-        exit;
+        $form->finalize_request();
     }
 
     # this is for the internal notes section for the [email] Subject
@@ -2172,7 +2172,7 @@
     if ( !$form->{repost} ) {
         if ( $form->{id} ) {
             &repost("Save");
-            exit;
+            $form->finalize_request();
         }
     }
 
@@ -2282,7 +2282,7 @@
     # if the name changed get new values
     if ( &check_name( $form->{vc} ) ) {
         &update;
-        exit;
+        $form->finalize_request();
     }
 
     if (   $form->{type} =~ /_order/
@@ -2299,7 +2299,7 @@
 
         if ( !$exchangerate ) {
             &backorder_exchangerate( $orddate, $buysell );
-            exit;
+            $form->finalize_request();
         }
     }
 
@@ -3590,7 +3590,7 @@
       )
     {
         &select_name( $form->{vc} );
-        exit;
+        $form->finalize_request();
     }
 
     if ( $rv == 1 ) {

Modified: trunk/bin/pe.pl
===================================================================
--- trunk/bin/pe.pl	2011-06-18 21:01:30 UTC (rev 3283)
+++ trunk/bin/pe.pl	2011-06-18 22:15:10 UTC (rev 3284)
@@ -1271,7 +1271,7 @@
     if ( $form->{translation} ) {
         PE->save_translation( \%myconfig, \%$form );
         $form->redirect( $locale->text('Translations saved!') );
-        exit;
+        $form->finalize_request();
     }
 
     if ( $form->{type} eq 'project' ) {
@@ -1293,7 +1293,7 @@
                   )
                 {
                     &select_name;
-                    exit;
+                    $form->finalize_request();
                 }
 
                 if ( $rv == 1 ) {
@@ -1340,7 +1340,7 @@
                   )
                 {
                     &select_name;
-                    exit;
+                    $form->finalize_request();
                 }
 
                 if ( $rv == 1 ) {
@@ -2197,7 +2197,7 @@
         &translation_header;
         &translation_footer;
 
-        exit;
+        $form->finalize_request();
 
     }
 
@@ -2250,7 +2250,7 @@
                   )
                 {
                     &select_name;
-                    exit;
+                    $form->finalize_request();
                 }
 
                 if ( $rv == 1 ) {
@@ -2833,7 +2833,7 @@
       )
     {
         &select_name( $form->{vc} );
-        exit;
+        $form->finalize_request();
     }
 
     if ( $rv == 1 ) {

Modified: trunk/bin/pos.pl
===================================================================
--- trunk/bin/pos.pl	2011-06-18 21:01:30 UTC (rev 3283)
+++ trunk/bin/pos.pl	2011-06-18 22:15:10 UTC (rev 3284)
@@ -701,7 +701,7 @@
     $customer .= "--$form->{customer_id}";
     if ( $customer ne $form->{oldcustomer} ) {
         &update;
-        exit;
+        $form->finalize_request();
     }
 
     &validate_items;
@@ -909,14 +909,14 @@
         || $form->{"paid_$pc"} )
     {
         &update;
-        exit;
+        $form->finalize_request();
     }
     open_drawer();
     sleep 1;
     for $i ( 1 .. $rc - 1 ) {
         if ( $form->{"qty_$i"} != $form->{"oldqty_$i"} ) {
             &update;
-            exit;
+            $form->finalize_request();
         }
     }
 
@@ -924,7 +924,7 @@
         $form->{invnumber} = $form->update_defaults( \%myconfig, "sinumber" );
         if ( $form->{media} eq 'screen' ) {
             &update;
-            exit;
+            $form->finalize_request();
         }
     }
 
@@ -949,7 +949,7 @@
     $customer .= "--$form->{customer_id}";
     if ( $customer ne $form->{oldcustomer} ) {
         &update;
-        exit;
+        $form->finalize_request();
     }
 
     &validate_items;

Modified: trunk/bin/pw.pl
===================================================================
--- trunk/bin/pw.pl	2011-06-18 21:01:30 UTC (rev 3283)
+++ trunk/bin/pw.pl	2011-06-18 22:15:10 UTC (rev 3284)
@@ -59,6 +59,6 @@
     );
     $template->render($form);
     $template->output('http');
-    exit;
+    $form->finalize_request();
 }
 

Modified: trunk/bin/rp.pl
===================================================================
--- trunk/bin/rp.pl	2011-06-18 21:01:30 UTC (rev 3283)
+++ trunk/bin/rp.pl	2011-06-18 22:15:10 UTC (rev 3284)
@@ -1460,7 +1460,7 @@
     $form->redirect(
         $locale->text( 'Statement sent to [_1]', $form->{ $form->{ct} } ) );
 
-    exit;
+    $form->finalize_request();
 }
 
 sub print {

Modified: trunk/lsmb-request.pl
===================================================================
--- trunk/lsmb-request.pl	2011-06-18 21:01:30 UTC (rev 3283)
+++ trunk/lsmb-request.pl	2011-06-18 22:15:10 UTC (rev 3284)
@@ -1,5 +1,5 @@
+=head1 NAME
 #!/usr/bin/perl
-=head1 NAME
 The LedgerSMB Request Handler
 
 =head1 SYNOPSYS
@@ -31,6 +31,7 @@
 use LedgerSMB::Locale;
 use Data::Dumper;
 use LedgerSMB::Log;
+use LedgerSMB::CancelFurtherProcessing;
 use strict;
 
 my $logger = Log::Log4perl->get_logger('');
@@ -68,9 +69,10 @@
 
 
 sub call_script {
-        
-    my $script = shift @_;
-    my $request = shift @_;
+  my $script = shift @_;
+  my $request = shift @_;
+
+  try {        
     $request->{script} = $script;
     eval { require "scripts/$script" } 
       || $request->error($locale->text('Unable to open script') . ": scripts/$script : $!");
@@ -80,5 +82,9 @@
     $script->can($request->{action}) 
       || $request->error($locale->text("Action Not Defined: ") . $request->{action});
     $script->can( $request->{action} )->($request);
+  }
+  catch CancelFurtherProcessing with {
+    my $ex = shift;
+  };
 }
 1;

Modified: trunk/old-handler.pl
===================================================================
--- trunk/old-handler.pl	2011-06-18 21:01:30 UTC (rev 3283)
+++ trunk/old-handler.pl	2011-06-18 22:15:10 UTC (rev 3284)
@@ -56,6 +56,7 @@
 use LedgerSMB::Form;
 use LedgerSMB::Locale;
 use LedgerSMB::Auth;
+use LedgerSMB::CancelFurtherProcessing;
 use Data::Dumper;
 require "common.pl";
 
@@ -126,8 +127,10 @@
 $locale   = LedgerSMB::Locale->get_handle( $myconfig{countrycode} )
   or $form->error( __FILE__ . ':' . __LINE__ . ": Locale not loaded: $!\n" );
 # pull in the main code
-require "bin/$form->{script}";
 
+try {
+  require "bin/$form->{script}";
+
 # customized scripts
 if ( -f "bin/custom/$form->{script}" ) {
     eval { require "bin/custom/$form->{script}"; };
@@ -154,6 +157,12 @@
           . $locale->text('action= not defined!') );
 }
 
+}
+catch CancelFurtherProcessing with {
+  my $ex = shift;
+};
+
+
 1;
 
 $form->{dbh}->disconnect()

Modified: trunk/scripts/drafts.pl
===================================================================
--- trunk/scripts/drafts.pl	2011-06-18 21:01:30 UTC (rev 3283)
+++ trunk/scripts/drafts.pl	2011-06-18 22:15:10 UTC (rev 3284)
@@ -27,7 +27,7 @@
     my ($request) = @_;
     if (!$request->close_form){
         list_drafts($request);
-        exit;
+        $request->finalize_request();
     }
     my $draft= LedgerSMB::DBObject::Draft->new(base => $request);
     for my $row (1 .. $draft->{rowcount}){
@@ -43,7 +43,7 @@
     my ($request) = @_;
     if (!$request->close_form){
         list_drafts($request);
-        exit;
+        $request->finalize_request();
     }
     my $draft= LedgerSMB::DBObject::Draft->new(base => $request);
     for my $row (1 .. $draft->{rowcount}){

Modified: trunk/scripts/login.pl
===================================================================
--- trunk/scripts/login.pl	2011-06-18 21:01:30 UTC (rev 3283)
+++ trunk/scripts/login.pl	2011-06-18 22:15:10 UTC (rev 3284)
@@ -52,14 +52,14 @@
 	    print "Status: 302 Found\n";
 	    print "Location: ".$path.$request->{next}."\n";
 	    print "\n";
-	    exit;	    
+	    $request->finalize_request();	    
     }
     elsif ($request->{dbh} and !$request->{log_out}){
         print "Content-Type: text/html\n";
         print "Set-Cookie: ${LedgerSMB::Sysconfig::cookie_name}=Login; path=$path\n";
 	    print "Status: 200 Success\n\n";
         if ($request->{log_out}){
-            exit;
+            $request->finalize_request();
         }
     }
     else {
@@ -71,7 +71,7 @@
             print "Status: 401 Unauthorized\n\n";
 	    print "Please enter your credentials.\n";
         } 
-        exit; 
+        $request->finalize_request(); 
     }
 }
 

Modified: trunk/scripts/recon.pl
===================================================================
--- trunk/scripts/recon.pl	2011-06-18 21:01:30 UTC (rev 3283)
+++ trunk/scripts/recon.pl	2011-06-18 22:15:10 UTC (rev 3284)
@@ -573,7 +573,7 @@
     my ($request) = @_;
     if (!$request->close_form){
         get_results($request);
-        exit;
+        $request->finalize_request();
     }
     
     # Approve will also display the report in a blurred/opaqued out version,

Modified: trunk/scripts/vouchers.pl
===================================================================
--- trunk/scripts/vouchers.pl	2011-06-18 21:01:30 UTC (rev 3283)
+++ trunk/scripts/vouchers.pl	2011-06-18 22:15:10 UTC (rev 3284)
@@ -446,7 +446,7 @@
     my $batch = LedgerSMB::Batch->new(base => $request);
     if (!$batch->close_form){
        get_batch($request); 
-       exit;
+       $request->finalize_request();
     }
     for my $count (1 .. $batch->{rowcount}){
         my $voucher_id = $batch->{"row_$count"};
@@ -461,7 +461,7 @@
     my $batch = LedgerSMB::Batch->new(base => $request);
     if (!$batch->close_form){
         list_batches($request);
-        exit;
+        $request->finalize_request();
     }
     for my $count (1 .. $batch->{rowcount}){
         next unless $batch->{"batch_" . $batch->{"row_$count"}};
@@ -476,7 +476,7 @@
     my $batch = LedgerSMB::Batch->new(base => $request);
     if (!$batch->close_form){
         list_batches($request);
-        exit;
+        $request->finalize_request();
     }
     for my $count (1 .. $batch->{rowcount}){
         next unless $batch->{"batch_" . $batch->{"row_$count"}};


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.