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

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



Revision: 1325
          http://svn.sourceforge.net/ledger-smb/?rev=1325&view=rev
Author:   einhverfr
Date:     2007-06-25 22:25:00 -0700 (Mon, 25 Jun 2007)

Log Message:
-----------
Setting things up so that the LedgerSMB.pm tests run

Modified Paths:
--------------
    trunk/LedgerSMB.pm
    trunk/bin/login.pl
    trunk/login.pl
    trunk/lsmb-request.pl
    trunk/t/11-ledgersmb.t

Modified: trunk/LedgerSMB.pm
===================================================================
--- trunk/LedgerSMB.pm	2007-06-26 05:05:23 UTC (rev 1324)
+++ trunk/LedgerSMB.pm	2007-06-26 05:25:00 UTC (rev 1325)
@@ -164,10 +164,13 @@
         #this is an ugly hack we need to rethink.
         return $self;
     }
+    my $locale   = LedgerSMB::Locale->get_handle($self->{_user}->{countrycode})
+        or $self->error(__FILE__.':'.__LINE__.": Locale not loaded: $!\n");
+    if ( !${LedgerSMB::Sysconfig::GLOBALDBH} ) {
+        $locale->text("No GlobalDBH Configured or Could not Connect");
+    }
 
     $self->{_user} = LedgerSMB::User->fetch_config($self->{login});
-    my $locale   = LedgerSMB::Locale->get_handle($self->{_user}->{countrycode})
-        or $self->error(__FILE__.':'.__LINE__.": Locale not loaded: $!\n");
     $self->{_locale} = $locale;
     $self->{stylesheet} = $self->{_user}->{stylesheet};
     if ( $self->{password} ) {
@@ -242,9 +245,12 @@
 
 sub debug {
     my $self = shift @_;
-    my %args = @_;
-    my $file = $args{file};
-    my $d    = Data::Dumper->new( ..hidden.. );
+    my $args = shift @_;
+    my $file;
+    if (scalar keys %$args){
+        my $file = $args->{'file'};
+    }
+    my $d    = Data::Dumper->new( [$self] );
     $d->Sortkeys(1);
 
     if ($file) {
@@ -650,7 +656,7 @@
     if ( $myconfig->{dboptions} ) {
         $dbh->do( $myconfig->{dboptions} );
     }
-
+    $self->{dbh} = $dbh;
     my $query = "SELECT t.extends, 
 			coalesce (t.table_name, 'custom_' || extends) 
 			|| ':' || f.field_name as field_def

Modified: trunk/bin/login.pl
===================================================================
--- trunk/bin/login.pl	2007-06-26 05:05:23 UTC (rev 1324)
+++ trunk/bin/login.pl	2007-06-26 05:25:00 UTC (rev 1325)
@@ -255,7 +255,7 @@
 
             # upgrade dataset and log in again
             if ( !$LedgerSMB::Sysconfig::db_autoupdate ) {
-                $form->error( $locale->text("Dabase Version too Old") );
+                $form->error( $locale->text("Database Version too Old") );
             }
 
             for (qw(dbname dbhost dbport dbdriver dbuser dbpasswd)) {

Modified: trunk/login.pl
===================================================================
--- trunk/login.pl	2007-06-26 05:05:23 UTC (rev 1324)
+++ trunk/login.pl	2007-06-26 05:25:00 UTC (rev 1325)
@@ -1,91 +1,3 @@
 #!/usr/bin/perl
-#
-######################################################################
-# LedgerSMB Accounting and ERP
 
-# http://www.ledgersmb.org/
-#
-# Copyright (C) 2006
-# This work contains copyrighted information from a number of sources all used
-# with permission.
-#
-# This file contains source code included with or based on SQL-Ledger which
-# is Copyright Dieter Simader and DWS Systems Inc. 2000-2005 and licensed
-# under the GNU General Public License version 2 or, at your option, any later
-# version.  For a full list including contact information of contributors,
-# maintainers, and copyright holders, see the CONTRIBUTORS file.
-#
-# Original Copyright Notice from SQL-Ledger 2.6.17 (before the fork):
-# Copyright (C) 2001
-#
-#  Author: Dieter Simader
-#   Email: ..hidden..
-#     Web: http://www.sql-ledger.org
-#
-#  Contributors:
-#
-#
-#     Web: http://www.ledgersmb.org/
-#
-#  Contributors:
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#######################################################################
-#
-# this script sets up the terminal and runs the scripts
-# in bin/$terminal directory
-# admin.pl is linked to this script
-#
-#######################################################################
-
-use LedgerSMB::Sysconfig;
-require "common.pl";
-
-$| = 1;
-
-if ( $ENV{CONTENT_LENGTH} ) {
-    read( STDIN, $_, $ENV{CONTENT_LENGTH} );
-}
-
-if ( $ENV{QUERY_STRING} ) {
-    $_ = $ENV{QUERY_STRING};
-}
-
-if ( $ARGV[0] ) {
-    $_ = $ARGV[0];
-}
-
-%form = split /[&=]/;
-
-# fix for apache 2.0 bug
-map { $form{$_} =~ s/\\$// } keys %form;
-
-# name of this script
-$0 =~ tr/\\/\//;
-$pos = rindex $0, '/';
-$script = substr( $0, $pos + 1 );
-
-#This needs to be a db query
-#if (-e "${LedgerSMB::Sysconfig::userspath}/nologin" && $script ne 'admin.pl') {
-#	print "Content-Type: text/html\n\n<html><body><strong>";
-#	print "\nLogin disabled!\n";
-#	print "\n</strong></body></html>";
-#	exit;
-#}
-
-$ARGV[0] = $_;
-require "bin/$script";
-
-# end of main
-
+require 'lsmb-request.pl';

Modified: trunk/lsmb-request.pl
===================================================================
--- trunk/lsmb-request.pl	2007-06-26 05:05:23 UTC (rev 1324)
+++ trunk/lsmb-request.pl	2007-06-26 05:25:00 UTC (rev 1325)
@@ -36,14 +36,10 @@
 eval { require "custom.pl"; };
 
 $request = new LedgerSMB;
+$request->{action} = '__default' if (!$request->{action});
 
-$0 =~ m/([^\/\\]*.pl)$/;
-if (!$1){
-	$0 =~ m/([^\/\\]*.pl)[? ]/;
-}
-
+$0 =~ m/([^\/\\]*.pl)\?*.*$/;
 $script = $1;
-
 $locale = LedgerSMB::Locale->get_handle( ${LedgerSMB::Sysconfig::language} )
   or $request->error( __FILE__ . ':' . __LINE__ . ": Locale not loaded: $!\n" );
 

Modified: trunk/t/11-ledgersmb.t
===================================================================
--- trunk/t/11-ledgersmb.t	2007-06-26 05:05:23 UTC (rev 1324)
+++ trunk/t/11-ledgersmb.t	2007-06-26 05:25:00 UTC (rev 1325)
@@ -127,11 +127,11 @@
 my $lsmb = LedgerSMB->new();
 @r = trap{$lsmb->debug()};
 like($trap->stdout, qr|\n\$VAR1 = bless\( {[\n\s]+'action' => '',[\n\s]+'dbversion' => '\d+\.\d+\.\d+',[\n\s]+'path' => 'bin/mozilla',[\n\s]+'version' => '$lsmb->{version}'[\n\s]+}, 'LedgerSMB' \);|,
-	'debug: $lsmb, no file');
+	'debug: $lsmb->debug');
 SKIP: {
 	skip 'Environment for file test not clean' if -f "t/var/lsmb-11.$$";
 	$lsmb->{file} = "t/var/lsmb-11.$$";
-	$lsmb->debug('file' => $lsmb->{file}, $lsmb);
+	$lsmb->debug({'file' => $lsmb->{file}});
 	ok(-f "t/var/lsmb-11.$$", "debug: output file t/var/lsmb-11.$$ created");
 	open(my $FH, '<', "t/var/lsmb-11.$$");
 	my @str = <$FH>;


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