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

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



Revision: 5109
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=5109&view=rev
Author:   einhverfr
Date:     2012-08-16 11:54:16 +0000 (Thu, 16 Aug 2012)
Log Message:
-----------
Making the code ready for Plack and fixing some misc errors
This largely means moving the old code controller scripts into a namespace, cleaning out old code namespaces, and then fixing other 1.4-specific bugs as they were found

Modified Paths:
--------------
    trunk/LedgerSMB/AA.pm
    trunk/LedgerSMB/Form.pm
    trunk/LedgerSMB/Report/Unapproved/Batch_Overview.pm
    trunk/bin/aa.pl
    trunk/bin/am.pl
    trunk/bin/ap.pl
    trunk/bin/ar.pl
    trunk/bin/arap.pl
    trunk/bin/arapprn.pl
    trunk/bin/bp.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/pw.pl
    trunk/bin/rp.pl
    trunk/old-handler.pl

Modified: trunk/LedgerSMB/AA.pm
===================================================================
--- trunk/LedgerSMB/AA.pm	2012-08-08 10:00:24 UTC (rev 5108)
+++ trunk/LedgerSMB/AA.pm	2012-08-16 11:54:16 UTC (rev 5109)
@@ -1057,10 +1057,6 @@
         }
 
         $sth->finish;
-        $query = "select description from department where id = ?";
-        $sth = $dbh->prepare($query);
-        $sth->execute($form->{department_id});
-        ($form->{department}) = $sth->fetchrow_array;
         $form->{rowcount} = $i if ( $i && !$form->{type} );
     }
 

Modified: trunk/LedgerSMB/Form.pm
===================================================================
--- trunk/LedgerSMB/Form.pm	2012-08-08 10:00:24 UTC (rev 5108)
+++ trunk/LedgerSMB/Form.pm	2012-08-16 11:54:16 UTC (rev 5109)
@@ -103,19 +103,17 @@
         die "Error: Request entity too large\n";
     }
 
-    read( STDIN, $_, $ENV{CONTENT_LENGTH} ) unless $ENV{CONTENT_LENGTH} == 0;
-
-    if ($argstr) {
+    if ($ENV{CONTENT_LENGTH}!= 0){
+        read( STDIN, $_, $ENV{CONTENT_LENGTH} );
+    }elsif ($argstr) {
         $_ = $argstr;
     }
     elsif ( $ENV{QUERY_STRING} ) {
         $_ = $ENV{QUERY_STRING};
     }
-
     elsif ( $ARGV[0] ) {
         $_ = $ARGV[0];
     }
-
     my $self = {};
     my $orig = {};
     %$orig = split /[&=]/ unless !defined $_;

Modified: trunk/LedgerSMB/Report/Unapproved/Batch_Overview.pm
===================================================================
--- trunk/LedgerSMB/Report/Unapproved/Batch_Overview.pm	2012-08-08 10:00:24 UTC (rev 5108)
+++ trunk/LedgerSMB/Report/Unapproved/Batch_Overview.pm	2012-08-16 11:54:16 UTC (rev 5109)
@@ -158,6 +158,10 @@
     return [];
 }
 
+sub text {
+    return LedgerSMB::Report::text(@_);
+}
+
 =back
 
 =head2 Criteria Properties

Modified: trunk/bin/aa.pl
===================================================================
--- trunk/bin/aa.pl	2012-08-08 10:00:24 UTC (rev 5108)
+++ trunk/bin/aa.pl	2012-08-16 11:54:16 UTC (rev 5109)
@@ -44,6 +44,7 @@
 #
 #======================================================================
 
+package lsmb_legacy;
 use LedgerSMB::Tax;
 
 # any custom scripts for this one

Modified: trunk/bin/am.pl
===================================================================
--- trunk/bin/am.pl	2012-08-08 10:00:24 UTC (rev 5108)
+++ trunk/bin/am.pl	2012-08-16 11:54:16 UTC (rev 5109)
@@ -32,6 +32,7 @@
 #
 #======================================================================
 
+package lsmb_legacy;
 use LedgerSMB::AM;
 use LedgerSMB::Form;
 use LedgerSMB::User;

Modified: trunk/bin/ap.pl
===================================================================
--- trunk/bin/ap.pl	2012-08-08 10:00:24 UTC (rev 5108)
+++ trunk/bin/ap.pl	2012-08-16 11:54:16 UTC (rev 5109)
@@ -45,6 +45,7 @@
 #
 #======================================================================
 
+package lsmb_legacy;
 use LedgerSMB::PE;
 use LedgerSMB::IR;
 

Modified: trunk/bin/ar.pl
===================================================================
--- trunk/bin/ar.pl	2012-08-08 10:00:24 UTC (rev 5108)
+++ trunk/bin/ar.pl	2012-08-16 11:54:16 UTC (rev 5109)
@@ -40,6 +40,7 @@
 #
 #======================================================================
 
+package lsmb_legacy;
 use LedgerSMB::PE;
 use LedgerSMB::IS;
 

Modified: trunk/bin/arap.pl
===================================================================
--- trunk/bin/arap.pl	2012-08-08 10:00:24 UTC (rev 5108)
+++ trunk/bin/arap.pl	2012-08-16 11:54:16 UTC (rev 5109)
@@ -38,6 +38,7 @@
 # common routines for gl, ar, ap, is, ir, oe
 #
 
+package lsmb_legacy;
 use LedgerSMB::AA;
 
 # any custom scripts for this one

Modified: trunk/bin/arapprn.pl
===================================================================
--- trunk/bin/arapprn.pl	2012-08-08 10:00:24 UTC (rev 5108)
+++ trunk/bin/arapprn.pl	2012-08-16 11:54:16 UTC (rev 5109)
@@ -39,6 +39,7 @@
 # printing routines for ar, ap
 #
 
+package lsmb_legacy;
 use Error qw(:try);
 use LedgerSMB::Template;
 use LedgerSMB::Company_Config;

Modified: trunk/bin/bp.pl
===================================================================
--- trunk/bin/bp.pl	2012-08-08 10:00:24 UTC (rev 5108)
+++ trunk/bin/bp.pl	2012-08-16 11:54:16 UTC (rev 5109)
@@ -38,6 +38,7 @@
 #
 #======================================================================
 
+package lsmb_legacy;
 use LedgerSMB::BP;
 use LedgerSMB::Template;
 

Modified: trunk/bin/gl.pl
===================================================================
--- trunk/bin/gl.pl	2012-08-08 10:00:24 UTC (rev 5108)
+++ trunk/bin/gl.pl	2012-08-16 11:54:16 UTC (rev 5109)
@@ -45,6 +45,7 @@
 #
 #======================================================================
 
+package lsmb_legacy;
 use LedgerSMB::GL;
 use LedgerSMB::PE;
 use LedgerSMB::Template;

Modified: trunk/bin/ic.pl
===================================================================
--- trunk/bin/ic.pl	2012-08-08 10:00:24 UTC (rev 5108)
+++ trunk/bin/ic.pl	2012-08-16 11:54:16 UTC (rev 5109)
@@ -40,6 +40,7 @@
 #
 #======================================================================
 
+package lsmb_legacy;
 use LedgerSMB::IC;
 use LedgerSMB::Tax;
 

Modified: trunk/bin/io.pl
===================================================================
--- trunk/bin/io.pl	2012-08-08 10:00:24 UTC (rev 5108)
+++ trunk/bin/io.pl	2012-08-16 11:54:16 UTC (rev 5109)
@@ -38,6 +38,7 @@
 #
 #######################################################################
 
+package lsmb_legacy;
 use Error qw(:try);
 use LedgerSMB::Tax;
 use LedgerSMB::Template;

Modified: trunk/bin/ir.pl
===================================================================
--- trunk/bin/ir.pl	2012-08-08 10:00:24 UTC (rev 5108)
+++ trunk/bin/ir.pl	2012-08-16 11:54:16 UTC (rev 5109)
@@ -38,6 +38,7 @@
 #
 #======================================================================
 
+package lsmb_legacy;
 use LedgerSMB::IR;
 use LedgerSMB::PE;
 use LedgerSMB::Tax;

Modified: trunk/bin/is.pl
===================================================================
--- trunk/bin/is.pl	2012-08-08 10:00:24 UTC (rev 5108)
+++ trunk/bin/is.pl	2012-08-16 11:54:16 UTC (rev 5109)
@@ -43,6 +43,7 @@
 #
 #======================================================================
 
+package lsmb_legacy;
 use LedgerSMB::IS;
 use LedgerSMB::PE;
 use LedgerSMB::Tax;

Modified: trunk/bin/jc.pl
===================================================================
--- trunk/bin/jc.pl	2012-08-08 10:00:24 UTC (rev 5108)
+++ trunk/bin/jc.pl	2012-08-16 11:54:16 UTC (rev 5109)
@@ -39,6 +39,7 @@
 #
 #======================================================================
 
+package lsmb_legacy;
 use Error qw(:try);
 
 use LedgerSMB::Template;

Modified: trunk/bin/oe.pl
===================================================================
--- trunk/bin/oe.pl	2012-08-08 10:00:24 UTC (rev 5108)
+++ trunk/bin/oe.pl	2012-08-16 11:54:16 UTC (rev 5109)
@@ -39,6 +39,7 @@
 #
 #======================================================================
 
+package lsmb_legacy;
 use LedgerSMB::OE;
 use LedgerSMB::IR;
 use LedgerSMB::IS;

Modified: trunk/bin/pe.pl
===================================================================
--- trunk/bin/pe.pl	2012-08-08 10:00:24 UTC (rev 5108)
+++ trunk/bin/pe.pl	2012-08-16 11:54:16 UTC (rev 5109)
@@ -17,6 +17,7 @@
 #
 #======================================================================
 
+package lsmb_legacy;
 use LedgerSMB::PE;
 use LedgerSMB::AA;
 use LedgerSMB::OE;

Modified: trunk/bin/pw.pl
===================================================================
--- trunk/bin/pw.pl	2012-08-08 10:00:24 UTC (rev 5108)
+++ trunk/bin/pw.pl	2012-08-16 11:54:16 UTC (rev 5109)
@@ -34,6 +34,7 @@
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #======================================================================
 
+package lsmb_legacy;
 use CGI::Simple;
 
 1;

Modified: trunk/bin/rp.pl
===================================================================
--- trunk/bin/rp.pl	2012-08-08 10:00:24 UTC (rev 5108)
+++ trunk/bin/rp.pl	2012-08-16 11:54:16 UTC (rev 5109)
@@ -41,6 +41,7 @@
 #
 #======================================================================
 
+package lsmb_legacy;
 use Error qw(:try);
 
 require "bin/arap.pl";

Modified: trunk/old-handler.pl
===================================================================
--- trunk/old-handler.pl	2012-08-08 10:00:24 UTC (rev 5108)
+++ trunk/old-handler.pl	2012-08-16 11:54:16 UTC (rev 5109)
@@ -46,7 +46,24 @@
 #
 #######################################################################
 
-use LedgerSMB::Sysconfig;
+# Clearing all namespaces for persistant code use
+for my $nsp (qw(lsmb_legacy Form GL AA IS IR OE RP JC PE IC AM BP CP PE User)) {    
+   for my $k (keys %{"${nsp}::"}){
+        next if $k =~ /[A-Z]+/;
+        next if $k eq 'try' or $k eq 'catch';
+        next if *{"${nsp}::{$k}"}{CODE};
+        if (*{"${nsp}::{$k}"}{ARRAY}) {
+            @{"${nsp}::{$k}"} = () unless /^(?:INC|ISA|EXPORT|EXPORT_OK|ARGV|_|\W)$/;
+        }
+        if (*{"${nsp}::{$k}"}{HASH}) {
+            %{"${nsp}::{$k}"} = ();
+        }
+        if (*{"${nsp}::{$k}"}{SCALAR}){
+           ${"${nsp}::{$k}"} = undef;
+        }
+    }   
+}
+package lsmb_legacy;
 use Digest::MD5;
 use Try::Tiny;
 use LedgerSMB::App_State;
@@ -61,17 +78,20 @@
 use LedgerSMB::Auth;
 use LedgerSMB::Session;
 use LedgerSMB::App_State;
-use Data::Dumper;
-use LedgerSMB::App_State;
 
 our $logger=Log::Log4perl->get_logger('old-handler-chain');#make logger available to other old programs
 
+#sleep 10000;
+
+use Data::Dumper;
 require "common.pl";
 
 # for custom preprocessing logic
 eval { require "custom.pl"; };
 
 $form = new Form;
+use Data::Dumper;
+use LedgerSMB::Sysconfig;
 
 # name of this script
 $0 =~ tr/\\/\//;
@@ -141,8 +161,8 @@
 
 $LedgerSMB::App_State::Locale = $locale;
 # pull in the main code
-$logger->trace("trying script=bin/$form->{script} action=$form->{action}");#trace flow
 try {
+#eval {
   require "bin/$form->{script}";
 
   # customized scripts
@@ -173,15 +193,16 @@
     $form->error( __FILE__ . ':' . __LINE__ . ': '
           . $locale->text('action not defined!'));
   }
-
-}
-catch {
+#  1;
+#} ||
+ }catch  {
   # We have an exception here because otherwise we always get an exception
   # when output terminates.  A mere 'die' will no longer trigger an automatic
   # error, but die 'foo' will map to $form->error('foo')
   # -- CT
   $form->error($_)  unless $_ eq 'Died'; 
-};
+} 
+;
 
 $logger->trace("leaving after script=bin/$form->{script} action=$form->{action}");#trace flow
 

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