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

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



Revision: 4193
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4193&view=rev
Author:   einhverfr
Date:     2011-12-11 01:21:05 +0000 (Sun, 11 Dec 2011)
Log Message:
-----------
Merging from branches/1.3

Modified Paths:
--------------
    trunk/Changelog
    trunk/LedgerSMB/Auth/DB.pm
    trunk/LedgerSMB/Database.pm
    trunk/LedgerSMB/Form.pm
    trunk/LedgerSMB/Scripts/login.pm
    trunk/LedgerSMB/Scripts/menu.pm
    trunk/LedgerSMB/Scripts/payment.pm
    trunk/LedgerSMB/Scripts/setup.pm
    trunk/LedgerSMB/Scripts/taxform.pm
    trunk/LedgerSMB/Sysconfig.pm
    trunk/LedgerSMB.pm
    trunk/UI/lib/ui-header.html
    trunk/UI/login.js
    trunk/UI/logout/firefox.js
    trunk/UI/rp-search-payments.html
    trunk/UI/taxform/details_report.html
    trunk/UI/taxform/summary_report.html
    trunk/bin/io.pl
    trunk/bin/is.pl
    trunk/bin/rp.pl
    trunk/dists/rpm/ledgersmb.spec
    trunk/lsmb-request.pl
    trunk/old-handler.pl
    trunk/sql/Pg-database.sql
    trunk/sql/modules/1099_reports.sql
    trunk/templates/demo/sales_quotation.tex

Added Paths:
-----------
    trunk/UI/taxform/1099-INT-base.tex
    trunk/UI/taxform/1099-INT.tex
    trunk/UI/taxform/1099-MISC-base.tex
    trunk/UI/taxform/1099-MISC.tex
    trunk/UI/taxform/summary_report.tex

Property Changed:
----------------
    trunk/
    trunk/LedgerSMB/Scripts/admin.pm
    trunk/LedgerSMB/Scripts/employee.pm
    trunk/LedgerSMB/Scripts/file.pm
    trunk/LedgerSMB/Scripts/login.pm
    trunk/LedgerSMB/Scripts/menu.pm
    trunk/LedgerSMB/Scripts/payment.pm
    trunk/LedgerSMB/Scripts/setup.pm
    trunk/LedgerSMB/Scripts/taxform.pm
    trunk/sql/upgrade/1.2-1.3-manual.sql


Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3:3711-4154
   + /branches/1.3:3711-4192

Modified: trunk/Changelog
===================================================================
--- trunk/Changelog	2011-12-10 18:29:41 UTC (rev 4192)
+++ trunk/Changelog	2011-12-11 01:21:05 UTC (rev 4193)
@@ -9,6 +9,18 @@
 Initial Release:  Monday, Oct 12 2011
 Supported Presently
 
+Changelog for 1.3.9
+* More logging enhancements (Herman V)
+* Translation fixes in tax form reports (Chris T)
+* Added accidently omitted 1099 forms (Chris T)
+* Fixed formatting issue in sales_quotation.tex (Chris T)
+* Better localization handling on logout (Herman V)
+* Better handling of successive logouts (Herman V)
+* Correcting some erroneous errors on db setup (Herman V)
+* Corrected error message in old handler (Herman V)
+* Reduced warnings in logs (Herman V and Chris T)
+* Corrected "Not a CODE reference" in payment processing (Herman V)
+
 Changelog for 1.3.8:
 * Fixed duplicate key error saving taxes (Herman V)
 * Fixed not null violation when inserting bank acct w/o bic (Chris T)
@@ -25,8 +37,9 @@
 * Fixed part account mappings broken after upgrade from 1.2 (Chris T)
 * Fixed quotation number increasing when saving existing quotation (Chris T)
 * Fixed invalid from address on backup routine (Chris T)
-* Fixed error "RROR: lower bound of FOR loop cannot be null" (Chris T)
+* Fixed error "ERROR: lower bound of FOR loop cannot be null" (Chris T)
 * Updated documentation regarding retaining old migrated data (Herman V)
+* Fixed duplicate sessions created on login (Herman V)
 
 Chris T is Chris Travers
 David B is David Bandel

Modified: trunk/LedgerSMB/Auth/DB.pm
===================================================================
--- trunk/LedgerSMB/Auth/DB.pm	2011-12-10 18:29:41 UTC (rev 4192)
+++ trunk/LedgerSMB/Auth/DB.pm	2011-12-11 01:21:05 UTC (rev 4193)
@@ -22,7 +22,7 @@
 use LedgerSMB::Log;
 use strict;
 
-my $logger = Log::Log4perl->get_logger('LedgerSMB');
+my $logger = Log::Log4perl->get_logger('LedgerSMB::Auth');
 
 =item get_credentials
 
@@ -41,6 +41,7 @@
     $auth =~ s/Basic //i; # strip out basic authentication preface
     $auth = MIME::Base64::decode($auth);
     my $return_value = {};
+    #$logger->debug("\$auth=$auth");#be aware of passwords in log!
     ($return_value->{login}, $return_value->{password}) = split(/:/, $auth);
     if (defined $LedgerSMB::Sysconfig::force_username_case){
         if (lc($LedgerSMB::Sysconfig::force_username_case) eq 'lower'){

Modified: trunk/LedgerSMB/Database.pm
===================================================================
--- trunk/LedgerSMB/Database.pm	2011-12-10 18:29:41 UTC (rev 4192)
+++ trunk/LedgerSMB/Database.pm	2011-12-11 01:21:05 UTC (rev 4193)
@@ -264,6 +264,7 @@
     full_version => undef,
           status => undef,
     };
+    $logger->debug("\$self->{dbh}=$self->{dbh}");
     my $creds = LedgerSMB::Auth->get_credentials();
     my $dbh = DBI->connect(
         "dbi:Pg:dbname=$self->{company_name}", 
@@ -276,6 +277,8 @@
                    "$creds->{login}", "$creds->{password}", { AutoCommit => 0 }
             );
            return $retval unless $dbh;
+           $logger->debug("DBI->connect dbh=$dbh");
+           $self->{dbh}=$dbh;#make available to upper levels
            my $sth = $dbh->prepare(
                  "select count(*) = 1 from pg_database where datname = ?"
            );
@@ -292,20 +295,26 @@
            return $retval;
    } else { # Got a db handle... try to find the version and app by a few
             # different means
+       $logger->debug("DBI->connect dbh=$dbh");
+       $self->{dbh}=$dbh;#make it available to upper levels
        my $sth;
        $sth = $dbh->prepare("SELECT SESSION_USER");
        $sth->execute;
        $retval->{username} = $sth->fetchrow_array();
        # Legacy SL and LSMB
        $sth = $dbh->prepare('SELECT version FROM defaults');
-       $sth->execute();
-       if (my ($ref) = $sth->fetchrow_hashref('NAME_lc')){
+       #avoid DBD::Pg::st fetchrow_hashref failed: no statement executing
+       my $rv=$sth->execute();     
+       if(defined($rv))
+       {
+        if (my ($ref) = $sth->fetchrow_hashref('NAME_lc')){
            if ($ref->{version}){
                $retval->{appname} = 'ledgersmb';
                $retval->{version} = 'legacy';
                $retval->{full_version} = $ref->{version};
                return $retval;
            }
+        }
        }
        $dbh->rollback;
        # LedgerSMB 1.2 and above
@@ -337,7 +346,8 @@
        }
        $dbh->rollback;
    }
-   $dbh->disconnect;
+   #$logger->debug("DBI->disconnect dbh=$dbh");
+   #$dbh->disconnect;#leave disconnect to upper level
    return $retval;
 }
 

Modified: trunk/LedgerSMB/Form.pm
===================================================================
--- trunk/LedgerSMB/Form.pm	2011-12-10 18:29:41 UTC (rev 4192)
+++ trunk/LedgerSMB/Form.pm	2011-12-11 01:21:05 UTC (rev 4193)
@@ -135,8 +135,12 @@
     if ( substr( $self->{action}, 0, 1 ) !~ /( |\.)/ ) {
         $self->{action} = lc $self->{action};
         $self->{action} =~ s/( |-|,|\#|\/|\.$)/_/g;
-        $self->{nextsub} = lc $self->{nextsub};
-        $self->{nextsub} =~ s/( |-|,|\#|\/|\.$)/_/g;
+        if (defined $self->{nextsub}){
+            $self->{nextsub} = lc $self->{nextsub};
+            $self->{nextsub} =~ s/( |-|,|\#|\/|\.$)/_/g;
+        } else { 
+            $self->{nextsub} = '';
+        }
     }
 
     $self->{login} = "" unless defined $self->{login};
@@ -198,9 +202,14 @@
     if (!$ENV{GATEWAY_INTERFACE}){
         return 1;
     }
-    $logger->trace("\$self->{session_id}=$self->{session_id}");
     my $sth = $self->{dbh}->prepare('select form_open(?)');
-    $sth->execute($self->{session_id});
+    #HV session_id not always set in LedgerSMB/Auth/DB.pm because of mix old,new code-chain?
+    my $rc=$sth->execute($self->{session_id});#HV ERROR:Invalid session,if count(*) FROM session!=1,multiple login
+    if(! $rc)
+    {
+     $logger->error("select form_open \$self->{form_id}=$self->{form_id} \$self->{session_id}=$self->{session_id} \$rc=$rc,invalid count FROM session?");
+     return undef;
+    }
     my @results = $sth->fetchrow_array();
 
     $self->{form_id} = $results[0];
@@ -1391,6 +1400,8 @@
         $myconfig->{dbconnect}, $myconfig->{dbuser},
         $myconfig->{dbpasswd}, { AutoCommit => 0 }
     ) or $self->dberror;
+    #HV trying to trace DBI->connect statements
+    $logger->debug("DBI->connect dbh=$dbh");
     $dbh->{pg_enable_utf8} = 1;
 
     # set db options


Property changes on: trunk/LedgerSMB/Scripts/admin.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/admin.pm:3901-4154
/branches/1.3/scripts/admin.pl:3711-3903
   + /branches/1.3/LedgerSMB/Scripts/admin.pm:3901-4192
/branches/1.3/scripts/admin.pl:3711-3903


Property changes on: trunk/LedgerSMB/Scripts/employee.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/employee.pm:3712-4154
/branches/1.3/scripts/employee.pl:3842-3843
   + /branches/1.3/LedgerSMB/Scripts/employee.pm:3712-4192
/branches/1.3/scripts/employee.pl:3842-3843


Property changes on: trunk/LedgerSMB/Scripts/file.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/file.pm:3711-4154
/branches/1.3/scripts/file.pl:3711-4138
   + /branches/1.3/LedgerSMB/Scripts/file.pm:3711-4192
/branches/1.3/scripts/file.pl:3711-4138

Modified: trunk/LedgerSMB/Scripts/login.pm
===================================================================
--- trunk/LedgerSMB/Scripts/login.pm	2011-12-10 18:29:41 UTC (rev 4192)
+++ trunk/LedgerSMB/Scripts/login.pm	2011-12-11 01:21:05 UTC (rev 4193)
@@ -34,16 +34,17 @@
 
 sub __default {
    my ($request) = @_;
-    my $locale;
-    $locale = LedgerSMB::Locale->get_handle(${LedgerSMB::Sysconfig::language})
-      or $request->error( __FILE__ . ':' . __LINE__ . 
-         ": Locale not loaded: $!\n" );         
+    #HV _locale from request
+    #my $locale;
+    #$locale = LedgerSMB::Locale->get_handle(${LedgerSMB::Sysconfig::language})
+    #  or $request->error( __FILE__ . ':' . __LINE__ . 
+    #     ": Locale not loaded: $!\n" );         
 
     $request->{stylesheet} = "ledgersmb.css";
     $request->{titlebar} = "LedgerSMB $request->{VERSION}";
      my $template = LedgerSMB::Template->new(
         user =>$request->{_user}, 
-        locale => $locale,
+        locale => $request->{_locale},
         path => 'UI',
         template => 'login',
         format => 'HTML'
@@ -128,7 +129,7 @@
 =cut
 
 sub logout {
-    my ($request) = @_;
+    my ($request) = @_;    
     @{$request->{scripts}} = 
                   qw(UI/logout/iexplore.js 
                      UI/logout/firefox.js
@@ -139,7 +140,7 @@
                    );
     $request->{callback}   = "";
     $request->{endsession} = 1;
-    LedgerSMB::Auth::session_destroy($request);
+    if($request->{dbh}){LedgerSMB::Auth::session_destroy($request);}#if logout on already logged out session
      my $template = LedgerSMB::Template->new(
         user =>$request->{_user}, 
         locale => $request->{_locale},


Property changes on: trunk/LedgerSMB/Scripts/login.pm
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/1.3/scripts/login.pl:3711-4192

Modified: trunk/LedgerSMB/Scripts/menu.pm
===================================================================
--- trunk/LedgerSMB/Scripts/menu.pm	2011-12-10 18:29:41 UTC (rev 4192)
+++ trunk/LedgerSMB/Scripts/menu.pm	2011-12-11 01:21:05 UTC (rev 4193)
@@ -119,6 +119,7 @@
     
     my $menu = LedgerSMB::DBObject::Menu->new({base => $request});
     $menu->generate();
+    #print STDERR localtime()." menu.pl expanding_menu menu=".Data::Dumper::Dumper(\$menu)."\n";
     for my $item (@{$menu->{menu_items}}){
         if ($request->{'open'} =~ /:$item->{id}:/ ){
             $item->{'open'} = 'true';


Property changes on: trunk/LedgerSMB/Scripts/menu.pm
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/1.3/LedgerSMB/Scripts/menu.pm:4155-4192
/branches/1.3/scripts/menu.pl:3711-4192

Modified: trunk/LedgerSMB/Scripts/payment.pm
===================================================================
--- trunk/LedgerSMB/Scripts/payment.pm	2011-12-10 18:29:41 UTC (rev 4192)
+++ trunk/LedgerSMB/Scripts/payment.pm	2011-12-11 01:21:05 UTC (rev 4193)
@@ -649,7 +649,7 @@
 
 sub payment {
  my ($request)    = @_;  
- my $locale       = $request->{_locale};
+ #my $locale       = $request->{_locale};
  my $dbPayment = LedgerSMB::DBObject::Payment->new({'base' => $request});
  my $Settings = LedgerSMB::Setting->new({'base' => $request});
 # Lets get the project data... 
@@ -681,7 +681,7 @@
  }
 # Lets build filter by period
 my $date = LedgerSMB::DBObject::Date->new({base => $request});
-   $date->build_filter_by_period($locale);
+   $date->build_filter_by_period($request->{_locale});
 # Lets set the data in a hash for the template system. :)    
 my $select = {
   stylesheet => $request->{_user}->{stylesheet},
@@ -725,7 +725,7 @@
   action => {
     name => 'action',
     value => 'payment1_5', 
-    text => $locale->text("Continue"),
+    text => $request->{_locale}->text("Continue"),
   }
 };
 
@@ -751,9 +751,11 @@
 
 sub payment1_5 {
 my ($request)    = @_;  
-my $locale       = $request->{_locale};
+#my $locale       = $request->{_locale};#avoid duplicating variables as much as possible?
 my  $dbPayment = LedgerSMB::DBObject::Payment->new({'base' => $request});
+#print STDERR localtime()." payment.pl payment1_5 dbPayment=".Data::Dumper::Dumper(\$dbPayment)."\n";
 my @array_options = $dbPayment->get_entity_credit_account();
+#print STDERR localtime()." payment.pl payment1_5 \$\#array_options=".Data::Dumper::Dumper(..hidden..)."\n";
 if ($#array_options == -1) { 
    &payment($request);   
 } elsif ($#array_options == 0) {
@@ -790,7 +792,7 @@
                        value => $request->{type}},
     action       => {  name => 'action',
                        value => 'payment2', 
-                       text => $locale->text("Continue")}
+                       text =>  $request->{_locale}->text("Continue")}
     };
     my $template;
      $template = LedgerSMB::Template->new(
@@ -802,9 +804,10 @@
      try {$template->render($select); }
      catch CancelFurtherProcessing with {
        my $ex = shift;
+       print STDERR localtime()." payment.pl payment1_5 \$ex=".Data::Dumper::Dumper(\$ex)."\n";
        throw $ex;
      }
-     otherwise { $request->error("$@"); }; # PRINT ERRORS ON THE UI
+     otherwise {print STDERR localtime()." payment.pl payment1_5 ..hidden..".Data::Dumper::Dumper(\$@)."\n"; $request->error("$@"); }; # PRINT ERRORS ON THE UI
  }
 
 }


Property changes on: trunk/LedgerSMB/Scripts/payment.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/payment.pm:4010-4154
/branches/1.3/scripts/payment.pl:3711-4147
   + /branches/1.3/LedgerSMB/Scripts/payment.pm:4010-4192
/branches/1.3/scripts/payment.pl:3711-4192

Modified: trunk/LedgerSMB/Scripts/setup.pm
===================================================================
--- trunk/LedgerSMB/Scripts/setup.pm	2011-12-10 18:29:41 UTC (rev 4192)
+++ trunk/LedgerSMB/Scripts/setup.pm	2011-12-11 01:21:05 UTC (rev 4193)
@@ -48,7 +48,8 @@
 sub login {
     use LedgerSMB::Locale;
     my ($request) = @_;
-    $request->{_locale}->new('en');
+    $logger->trace("\$request=$request \$request->{dbh}=$request->{dbh} request=".Data::Dumper::Dumper(\$request));
+    #$request->{_locale}->new('en'); why not continue to use already set $request->{_locale}
     my $creds = LedgerSMB::Auth::get_credentials();
     if (!$request->{database}){
         $request->error($request->{_locale}->text('No database specified'));
@@ -59,6 +60,7 @@
                 password => $creds->{password}}
     );
     my $version_info = $database->get_info();
+    if(!$request->{dbh}){$request->{dbh}=$database->{dbh};}#allow upper stack to disconnect dbh when leaving
     $request->{login_name} = $version_info->{username};
     if ($version_info->{appname} eq 'sql-ledger'){
          $request->{message} = 
@@ -755,7 +757,8 @@
     $database->load_modules('LOADORDER');
     $database->process_roles('Roles.sql');
     # Credentials set above via environment variables --CT
-    $request->{dbh} = DBI->connect("dbi:Pg:dbname=$request->{database}");
+    #avoid msg commit ineffective with AutoCommit enabled
+    $request->{dbh} = DBI->connect("dbi:Pg:dbname=$request->{database}",{AutoCommit=>0});
     my $dbh = $request->{dbh};
     my $sth = $dbh->prepare(
           'UPDATE defaults SET value = ? WHERE setting_key = ?'
@@ -763,7 +766,7 @@
     $sth->execute($request->{dbversion}, 'version');
     $sth->finish;
     $dbh->commit;
-    $dbh->disconnect;
+    #$dbh->disconnect;#upper stack will disconnect
     my $template = LedgerSMB::Template->new(
             path => 'UI/setup',
             template => 'complete',


Property changes on: trunk/LedgerSMB/Scripts/setup.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/setup.pm:3937-4154
/branches/1.3/scripts/setup.pl:3711-4147
   + /branches/1.3/LedgerSMB/Scripts/setup.pm:3937-4192
/branches/1.3/scripts/setup.pl:3711-4192

Modified: trunk/LedgerSMB/Scripts/taxform.pm
===================================================================
--- trunk/LedgerSMB/Scripts/taxform.pm	2011-12-10 18:29:41 UTC (rev 4192)
+++ trunk/LedgerSMB/Scripts/taxform.pm	2011-12-11 01:21:05 UTC (rev 4193)
@@ -23,11 +23,13 @@
 
 use strict;
 use LedgerSMB;
+use LedgerSMB::Company_Config;
 use LedgerSMB::Template;
 use LedgerSMB::DBObject::TaxForm;
 use LedgerSMB::DBObject::Date;
 use LedgerSMB::Template;
 use LedgerSMB::Form;
+use LedgerSMB::DBObject::Vendor;
 
 =pod
 
@@ -125,6 +127,14 @@
     if (!$request->{format}){
        $request->{format} = 'HTML';
     }
+
+    # Business settings for 1099
+    #
+    my $cc = $LedgerSMB::Company_Config::settings;
+    $request->{company_name}      = $cc->{company_name};
+    $request->{company_address}   = $cc->{company_address};
+    $request->{company_telephone} = $cc->{company_phone};
+    $request->{my_tax_code}       = $cc->{businessnumber};
     # TODO:  Eliminate duplicate code!
     if ($request->{meta_number}) {
       my @call_args = ($request->{'tax_form_id'},
@@ -132,18 +142,37 @@
                        $request->{meta_number});
                        
       my @results = $request->call_procedure(procname => 'tax_form_details_report', args => ..hidden..);
+      my $credit_id;
       for my $r (@results){
           $r->{acc_sum} = $request->format_amount({amount => $r->{acc_sum}});
           $r->{invoice_sum} = 
                $request->format_amount({amount => $r->{invoice_sum}});
+          ($request->{total_sum}) ? $request->{total_sum} + $r->{total_sum}
+                                  : $r->{total_sum};
           $r->{total_sum} = $request->format_amount({amount => $r->{total_sum}});
+          $credit_id = $r->{credit_id};
       }
+      $request->{total_sum} = $request->format_amount(
+                                      {amount => $request->{total_sum}}
+      ) || '0';
+      #XXX Please note, the line below is a kludge because we don't support
+      # generic companies at present on instantiation.  This means I have to 
+      # specify that this is either a customer or vendor.  Right now I am 
+      # specifying as a vendor.  This should have no effect on subsequent code
+      # but if this is somethign we end up depending on, we need to fix it.
+      my $company = LedgerSMB::DBObject::Vendor->new(base => $request);
+      $company->{id} = $credit_id;
+      $company->get_billing_info;
+      delete $company->{id}; 
+      $request->merge($company);
       $request->{results} = ..hidden..;
+      $request->debug({file=>'/tmp/taxformdebug'});
       
       my $template = LedgerSMB::Template->new(
           user => $request->{_user}, 
           locale => $request->{_locale},
           path => 'UI',
+          media => 'screen',
           template => 'taxform/details_report',
           format => $request->{format},
       );
@@ -154,6 +183,14 @@
         my @call_args = ($request->{'tax_form_id'}, $request->{begin_month}.' '.$request->{begin_day}.' '.$request->{begin_year}, $request->{end_month}.' '.$request->{end_day}.' '.$request->{end_year});
         my @results = $request->call_procedure(procname => 'tax_form_summary_report', args => ..hidden..);
         for my $r (@results){
+            my $company = LedgerSMB::DBObject::Vendor->new(base => $request);
+            $company->{id} = $r->{credit_id};
+            $company->get_billing_info;
+            delete $company->{id};
+            for my $k (keys %$company){
+                 $r->{$k} = $company->{$k};
+            }
+ 
             $r->{acc_sum} = $request->format_amount({amount => $r->{acc_sum}});
             $r->{invoice_sum} = 
                  $request->format_amount({amount => $r->{invoice_sum}});
@@ -165,6 +202,7 @@
             user => $request->{_user}, 
             locale => $request->{_locale},
             path => 'UI',
+            media => 'screen',
             template => 'taxform/summary_report',
             format => $request->{format},
         );
@@ -199,7 +237,7 @@
     my ($request) = @_;
     my $taxform = LedgerSMB::DBObject::TaxForm->new({base => $request});
     my $form_info = $taxform->get($request->{tax_form_id});
-    $request->{taxform_name} = $form_info->{description};
+    $request->{taxform_name} = $form_info->{form_name};
     $request->{format} = 'PDF';
     generate_report($request);    
 }


Property changes on: trunk/LedgerSMB/Scripts/taxform.pm
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/1.3/scripts/taxform.pl:3711-4192

Modified: trunk/LedgerSMB/Sysconfig.pm
===================================================================
--- trunk/LedgerSMB/Sysconfig.pm	2011-12-10 18:29:41 UTC (rev 4192)
+++ trunk/LedgerSMB/Sysconfig.pm	2011-12-11 01:21:05 UTC (rev 4193)
@@ -175,7 +175,7 @@
     # layout for non-DEBUG messages
     log4perl.appender.Basic = Log::Log4perl::Appender::Screen
     log4perl.appender.Basic.layout = PatternLayout
-    log4perl.appender.Basic.layout.ConversionPattern = %d - %p - %C -- %m%n
+    log4perl.appender.Basic.layout.ConversionPattern = %d - %p - %M -- %m%n
     log4perl.appender.Basic.Filter = MatchRest
 );
 #some examples of loglevel setting for modules

Modified: trunk/LedgerSMB.pm
===================================================================
--- trunk/LedgerSMB.pm	2011-12-10 18:29:41 UTC (rev 4192)
+++ trunk/LedgerSMB.pm	2011-12-11 01:21:05 UTC (rev 4193)
@@ -263,8 +263,8 @@
          utf8::decode($params{$p});
          utf8::upgrade($params{$p});
      }
+     $logger->debug("params=", Data::Dumper::Dumper(\%params));
     }
-    $logger->debug("params=", Data::Dumper::Dumper(\%params));
     $self->{VERSION} = $VERSION;
     $self->{_request} = $query;
 
@@ -288,6 +288,10 @@
             $cookie{$name} = $value;
         }
     }
+    #HV set _locale already to default here,so routines lower in stack can use it;e.g. login.pl
+    $self->{_locale}=LedgerSMB::Locale->get_handle(${LedgerSMB::Sysconfig::language})
+      or $self->error( __FILE__ . ':' . __LINE__ .": Locale not loaded: $!\n" );
+
     $self->{action} = "" unless defined $self->{action};
     $self->{action} =~ s/\W/_/g;
     $self->{action} = lc $self->{action};
@@ -318,13 +322,14 @@
     if (!$self->{script}) {
         $self->{script} = 'login.pl';
     }
-    $logger->debug("LedgerSMB.pm: \$self->{script} = $self->{script}");
-    $logger->debug("LedgerSMB.pm: \$self->{action} = $self->{action}");
+    $logger->debug("\$self->{script} = $self->{script} \$self->{action} = $self->{action}");
 #    if ($self->{action} eq 'migrate_user'){
 #        return $self;
 #    }
 
     # This is suboptimal.  We need to have a better way for 1.4
+    #HV we should try to have DBI->connect in one place?
+    #HV  why not trying _db_init also in case of login authenticate? quid logout-function?
     if ($self->{script} eq 'login.pl' &&
         ($self->{action} eq 'authenticate'  || $self->{action} eq '__default' 
 		|| !$self->{action})){
@@ -333,18 +338,29 @@
     if ($self->{script} eq 'setup.pl'){
         return $self;
     }
+    my $ccookie;
     if (!$self->{company} && $self->is_run_mode('cgi', 'mod_perl')){
-         my $ccookie = $cookie{${LedgerSMB::Sysconfig::cookie_name}};
+         $ccookie = $cookie{${LedgerSMB::Sysconfig::cookie_name}};
          $ccookie =~ s/.*:([^:]*)$/$1/;
          if($ccookie ne 'Login') { $self->{company} = $ccookie; } 
     }
-    $logger->debug("\$self->{company} = $self->{company}");
+    $logger->debug("\$ccookie=$ccookie cookie.LedgerSMB::Sysconfig::cookie_name=".$cookie{${LedgerSMB::Sysconfig::cookie_name}}." \$self->{company}=$self->{company}");
 
-    if(!$self->{dbh}){$self->_db_init;}
+    if(! $cookie{${LedgerSMB::Sysconfig::cookie_name}} && $self->{action} eq 'logout')
+    {
+     $logger->debug("quitting because of logout and no cookie,avoid _db_init");
+     return $self;
+    }
 
+    #dbh may have been set elsewhere,by DBObject.pm?
+    if(!$self->{dbh})
+    {
+     $self->_db_init;
+    }
+
     LedgerSMB::Company_Config::initialize($self);
 
-
+    #TODO move before _db_init to avoid _db_init with invalid session?
     if ($self->is_run_mode('cgi', 'mod_perl') and !$ENV{LSMB_NOHEAD}) {
        #check for valid session unless this is an inital authentication
        #request -- CT
@@ -353,14 +369,16 @@
             $self->_get_password("Session Expired");
             exit;
        }
-       $logger->debug("LedgerSMB::new: session_check completed OK");
+       $logger->debug("session_check completed OK \$self->{session_id}=$self->{session_id} caller=\$filename=$filename \$line=$line");
     }
     $self->get_user_info;
 
-    my $locale   = LedgerSMB::Locale->get_handle($self->{_user}->{language})
-#    $self->{_locale} = LedgerSMB::Locale->get_handle('en') # temporary
+    $self->{dbh}->do("set DateStyle to '".$date_setting{$self->{_user}->{dateformat}}."'");
+    #my $locale   = LedgerSMB::Locale->get_handle($self->{_user}->{language})
+    # or $self->error(__FILE__.':'.__LINE__.": Locale not loaded: $!\n");
+    #$self->{_locale} = $locale;
+    $self->{_locale}=LedgerSMB::Locale->get_handle($self->{_user}->{language})
      or $self->error(__FILE__.':'.__LINE__.": Locale not loaded: $!\n");
-    $self->{_locale} = $locale;
 
     $self->{stylesheet} = $self->{_user}->{stylesheet};
 
@@ -808,9 +826,13 @@
 sub _db_init {
     my $self     = shift @_;
     my %args     = @_;
-    $logger->debug("start");
+    (my $package,my $filename,my $line)=caller;
+    if($self->{dbh})
+    {
+     $logger->error("dbh already set \$self->{dbh}=$self->{dbh},called from $filename");
+    }
+
     my $creds = LedgerSMB::Auth::get_credentials();
-
   
     $self->{login} = $creds->{login};
     if (!$self->{company}){ 
@@ -822,11 +844,10 @@
     # connection fails since this probably means bad credentials are entered.
     # Just in case, however, I think it is a good idea to include the DBI
     # error string.  CT
-    $logger->debug("before DBI->connect dbh=$self->{dbh}");
     $self->{dbh} = DBI->connect(
         "dbi:Pg:dbname=$dbname", "$creds->{login}", "$creds->{password}", { AutoCommit => 0 }
     ); 
-    $logger->debug("after DBI->connect dbh=$self->{dbh}");
+    $logger->debug("DBI->connect dbh=$self->{dbh}");
      #my $dbh = $self->{dbh};
 
 
@@ -963,7 +984,9 @@
 sub merge {
     (my $package,my $filename,my $line)=caller;
     my ( $self, $src ) = @_;
-    $logger->debug("begin caller \$filename=$filename \$line=$line \$self->{dbh}=$self->{dbh}");
+    $logger->debug("begin caller \$filename=$filename \$line=$line");
+       # Removed dbh from logging string since not used on this api call and
+       # not initialized in test cases -CT
     for my $arg ( $self, $src ) {
         shift;
     }
@@ -1002,7 +1025,7 @@
         }
         $self->{$dst_arg} = $src->{$arg};
     }
-    $logger->debug("end caller \$filename=$filename \$line=$line \$self->{dbh}=$self->{dbh}");
+    $logger->debug("end caller \$filename=$filename \$line=$line");
 }
 
 sub type {

Modified: trunk/UI/lib/ui-header.html
===================================================================
--- trunk/UI/lib/ui-header.html	2011-12-10 18:29:41 UTC (rev 4192)
+++ trunk/UI/lib/ui-header.html	2011-12-11 01:21:05 UTC (rev 4193)
@@ -12,8 +12,9 @@
 	<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
 	<?lsmb IF form.stylesheet ?>
 	<link rel="stylesheet" href="css/<?lsmb form.stylesheet ?>" type="text/css" title="LedgerSMB stylesheet" />
+	<?lsmb ELSIF stylesheet ?>
+	<link rel="stylesheet" href="css/<?lsmb stylesheet ?>" type="text/css" title="LedgerSMB stylesheet" />
 	<?lsmb ELSE ?>
-	<link rel="stylesheet" href="css/<?lsmb stylesheet ?>" type="text/css" title="LedgerSMB stylesheet" />
 	<?lsmb END ?>
 	<?lsmb FOREACH s = include_stylesheet ?>
 	<link rel="stylesheet" href="<?lsmb s ?>" type="text/css" title="LedgerSMB stylesheet" />

Modified: trunk/UI/login.js
===================================================================
--- trunk/UI/login.js	2011-12-10 18:29:41 UTC (rev 4192)
+++ trunk/UI/login.js	2011-12-11 01:21:05 UTC (rev 4193)
@@ -16,6 +16,7 @@
 		return false;
 	}
 	document.location=document.login.action.value+".pl?action=login&company="+document.login.company.value;
+	return false;//otherwise 2 login's in parallell!
 }
 
 function check_auth() {

Modified: trunk/UI/logout/firefox.js
===================================================================
--- trunk/UI/logout/firefox.js	2011-12-10 18:29:41 UTC (rev 4192)
+++ trunk/UI/logout/firefox.js	2011-12-11 01:21:05 UTC (rev 4193)
@@ -5,6 +5,8 @@
         xhre.open("GET",window.location,true,"logout","logout");
         xhre.send("");
         xhre.abort();
+        //be aware, sometimes get-request reaches server despite abort.
+        // LedgerSMB::Auth::DB::get_credentials can have $auth=logout:logout
 }
 }
 catch (e) {

Modified: trunk/UI/rp-search-payments.html
===================================================================
--- trunk/UI/rp-search-payments.html	2011-12-10 18:29:41 UTC (rev 4192)
+++ trunk/UI/rp-search-payments.html	2011-12-11 01:21:05 UTC (rev 4193)
@@ -3,7 +3,7 @@
         <td colspan="3"><?lsmb PROCESS select element_data=form.paymentaccounts ?></td>
       </tr>
       <tr>
-        <th aligh="right"><?lsmb text('Vendor Number') ?></th>
+        <th aligh="right"><?lsmb text(form.meta_number_text) ?></th>
         <td colpan="3"><?lsmb INCLUDE input element_data = {
 		name = "meta_number"
 		size = '35'

Copied: trunk/UI/taxform/1099-INT-base.tex (from rev 4192, branches/1.3/UI/taxform/1099-INT-base.tex)
===================================================================
--- trunk/UI/taxform/1099-INT-base.tex	                        (rev 0)
+++ trunk/UI/taxform/1099-INT-base.tex	2011-12-11 01:21:05 UTC (rev 4193)
@@ -0,0 +1,27 @@
+<?lsmb BLOCK taxform ?>
+\begin{textblock}{4}[0,1](0.5, 1)
+<?lsmb company_name ?>
+<?lsmb company_address ?>
+Tel: <?lsmb company_telephone ?>
+\end{textblock}
+
+\begin{textblock}{2}[0,1](0.5, 2)
+<?lsmb my_tax_code ?>
+\end{textblock}
+
+\begin{textblock}{2}[0,1](2.5, 2)
+<?lsmb taxnumber ?>
+\end{textblock}
+
+\begin{textblock}{4}[0,1](0.5, 2.5)
+<?lsmb pay_to_name ?>\\
+<?lsmb IF line_one; line_one ?> \\ <?lsmb END -?>
+<?lsmb IF line_two; line_two ?> \\ <? END -?>
+<?lsmb IF line_three; line_three ?> \\ <? END -?>
+<?lsmb city ?>, <?lsmb state ?> <?lsmb mail_code ?>
+\end{textblock}
+
+\begin{textblock}{2}[0,1](4.5, 1.5)
+<?lsmb total ?>
+\end{textblock}
+<?lsmb END # Block ?>

Copied: trunk/UI/taxform/1099-INT.tex (from rev 4192, branches/1.3/UI/taxform/1099-INT.tex)
===================================================================
--- trunk/UI/taxform/1099-INT.tex	                        (rev 0)
+++ trunk/UI/taxform/1099-INT.tex	2011-12-11 01:21:05 UTC (rev 4193)
@@ -0,0 +1,15 @@
+\documentclass[usletter]{article}
+\usepackage{textpos}
+<?lsmb INCLUDE "${taxform}-base.tex" #$ ?>
+\begin{document}
+<?lsmb FOR tf in results ?>
+<?lsmb INCLUDE taxform 
+pay_to_name = tf.legal_name
+pay_to_line_one = tf.line_one
+pay_to_line_two = tf.line_two
+pay_to_line_three = tf.line_three
+my_tax_code = business_number
+taxnumber = tf.taxnumber
+total_sum = tf.total_sum
+<?lsmb END # FOR tf  ?>
+\end{document}

Copied: trunk/UI/taxform/1099-MISC-base.tex (from rev 4192, branches/1.3/UI/taxform/1099-MISC-base.tex)
===================================================================
--- trunk/UI/taxform/1099-MISC-base.tex	                        (rev 0)
+++ trunk/UI/taxform/1099-MISC-base.tex	2011-12-11 01:21:05 UTC (rev 4193)
@@ -0,0 +1,43 @@
+\documentclass[usletter]{article}
+\usepackage{textpos}
+\usepackage[top=0.0in, bottom=0in, left=0in, right=0in]{geometry}
+\setlength{\parindent}{0pt}
+\setlength{\TPHorizModule}{1in}
+\setlength{\TPVertModule}{1in}
+<?lsmb BLOCK taxformpart ?>
+\begin{textblock}{4}[0,1](1, 1.5)
+<?lsmb company_name ?>\\
+<?lsmb company_address ?>\\
+Tel: <?lsmb company_telephone ?>
+\end{textblock}
+
+\begin{textblock}{2}[0,1](1, 3.5)
+<?lsmb my_tax_code ?>
+\end{textblock}
+
+\begin{textblock}{2}[0,1](3, 3.5)
+<?lsmb taxnumber ?>
+\end{textblock}
+
+\begin{textblock}{4}[0,1](1, 4)
+<?lsmb legal_name ?>\\
+<?lsmb IF street1 ?><?lsmb street1 ?>\\ <?lsmb END ?>
+<?lsmb IF street2 ?><?lsmb street2 ?>\\ <?lsmb END ?>
+<?lsmb IF street3 ?><?lsmb street3 ?>\\ <?lsmb END ?>
+<?lsmb city ?>, <?lsmb state ?> <?lsmb mail_code ?>
+\end{textblock}
+
+\begin{textblock}{2}[0,1](4.5, 4.5)
+<?lsmb total_sum ?>
+\end{textblock}
+<?lsmb END # Block taxformpart ?>
+<?lsmb BLOCK taxform ?>
+<?lsmb PROCESS taxformpart ?>
+\clearpage
+<?lsmb PROCESS taxformpart ?>
+\clearpage
+<?lsmb PROCESS taxformpart ?>
+\clearpage
+<?lsmb PROCESS taxformpart ?>
+\clearpage
+<?lsmb END #BLOCK taxform ?>

Copied: trunk/UI/taxform/1099-MISC.tex (from rev 4192, branches/1.3/UI/taxform/1099-MISC.tex)
===================================================================
--- trunk/UI/taxform/1099-MISC.tex	                        (rev 0)
+++ trunk/UI/taxform/1099-MISC.tex	2011-12-11 01:21:05 UTC (rev 4193)
@@ -0,0 +1,14 @@
+<?lsmb FILTER latex ?>
+<?lsmb PROCESS "taxform/1099-MISC-base.tex" ?>
+\begin{document}
+<?lsmb FOREACH tf IN results;
+INCLUDE taxform 
+legal_name = tf.legal_name
+street1 = tf.street1
+street2 = tf.street2
+street3 = tf.street3
+taxnumber = tf.taxnumber
+total_sum = tf.total_sum;
+END # FOR tf  ?>
+\end{document}
+<?lsmb END # FILTER latex ?>

Modified: trunk/UI/taxform/details_report.html
===================================================================
--- trunk/UI/taxform/details_report.html	2011-12-10 18:29:41 UTC (rev 4192)
+++ trunk/UI/taxform/details_report.html	2011-12-11 01:21:05 UTC (rev 4193)
@@ -45,7 +45,7 @@
 } ?>
 <?lsmb PROCESS button  element_data = {
     name="action"
-    text="Print"
+    text=text("Print")
     value="print"
     class="submit"
     type="submit"

Modified: trunk/UI/taxform/summary_report.html
===================================================================
--- trunk/UI/taxform/summary_report.html	2011-12-10 18:29:41 UTC (rev 4192)
+++ trunk/UI/taxform/summary_report.html	2011-12-11 01:21:05 UTC (rev 4193)
@@ -41,9 +41,9 @@
     type="hidden"
     value="1"
 } ?>
-<?lsmb PROCESS button element_data {
+<?lsmb PROCESS button element_data = {
     name="action"
-    text="Print"
+    text=text("Print")
     value="print"
     class="submit"
     type="submit"

Copied: trunk/UI/taxform/summary_report.tex (from rev 4192, branches/1.3/UI/taxform/summary_report.tex)
===================================================================
--- trunk/UI/taxform/summary_report.tex	                        (rev 0)
+++ trunk/UI/taxform/summary_report.tex	2011-12-11 01:21:05 UTC (rev 4193)
@@ -0,0 +1 @@
+<?lsmb INCLUDE "taxform/${taxform_name}.tex" ?>

Modified: trunk/bin/io.pl
===================================================================
--- trunk/bin/io.pl	2011-12-10 18:29:41 UTC (rev 4192)
+++ trunk/bin/io.pl	2011-12-11 01:21:05 UTC (rev 4193)
@@ -741,9 +741,11 @@
 
 sub new_item {
 
-    if ( $form->{language_code} && $form->{"description_$form->{rowcount}"} ) {
-        $form->error( $locale->text('Translation not on file!') );
-    }
+    #print STDERR localtime()." HV io.pl new_item \$form->{rowcount}=$form->{rowcount} \$form->{language_code}=$form->{language_code} description=".$form->{"description_$form->{rowcount}"}."\n";
+    #HV commented out,ohterwise unable to bring in new article on Sales Invoice if $printops->{lang} set. What was the meaning of this code?
+    #if ( $form->{language_code} && $form->{"description_$form->{rowcount}"} ) {
+        #$form->error( $locale->text('Translation not on file!') );
+    #}
 
     # change callback
     $form->{old_callback} = $form->escape( $form->{callback}, 1 );

Modified: trunk/bin/is.pl
===================================================================
--- trunk/bin/is.pl	2011-12-10 18:29:41 UTC (rev 4192)
+++ trunk/bin/is.pl	2011-12-11 01:21:05 UTC (rev 4193)
@@ -875,7 +875,7 @@
     my $printops = &print_options;
     my $formname = { name => 'formname',
                      options => [
-                                  {text=> 'Sales Invoice', value => 'invoice'},
+                                  {text=> $locale->text('Sales Invoice'), value => 'invoice'},
                                 ]
                    };
     print_select($form, $formname);
@@ -1057,7 +1057,7 @@
 }
 
 sub update {
-    on_update();
+    on_update();#TODO meaning ?
     $form->{taxes} = {};
     $form->{exchangerate} =
       $form->parse_amount( \%myconfig, $form->{exchangerate} );
@@ -1164,11 +1164,10 @@
 
     }
     else {
-
         IS->retrieve_item( \%myconfig, \%$form );
 
         $rows = scalar @{ $form->{item_list} };
-
+        #TODO if language_code in select id="formname", see $printops &print_options $printops->{lang}, will do unnecessary lookup on new item
         if ( $form->{language_code} && $rows == 0 ) {
             $language_code = $form->{language_code};
             $form->{language_code} = "";

Modified: trunk/bin/rp.pl
===================================================================
--- trunk/bin/rp.pl	2011-12-10 18:29:41 UTC (rev 4192)
+++ trunk/bin/rp.pl	2011-12-11 01:21:05 UTC (rev 4193)
@@ -95,7 +95,6 @@
 # $locale->text('Non-taxable Purchases')
 
 sub report {
-
     my %hiddens;
     my %report = (
         balance_sheet    => { title => 'Balance Sheet' },
@@ -263,6 +262,8 @@
         $subform = 'payments';
 
         $form->{db} = ( $form->{report} =~ /payments$/ ) ? "ap" : "ar";
+        if($form->{db} eq 'ar'){$form->{meta_number_text}='Customer Number';}
+        else {$form->{meta_number_text}='Vendor Number';}
 
         RP->paymentaccounts( \%myconfig, \%$form );
 
@@ -288,7 +289,7 @@
 
     }
 
-    $form->{login} = 'test';
+    #$form->{login} = 'test';TODO meaning?
     $hiddens{$_} = $form->{$_} foreach qw(path login sessionid);
     $form->{yearend_options} = [
          {id => 'all',  label => $locale->text('All') }, 
@@ -1923,7 +1924,9 @@
 
     my %hiddens;
     my @options;
-    my $vc = ($form->{db} eq 'ar') ? 'Customer' : 'Vendor';
+    my $meta_number_text;
+    if($form->{db} eq 'ar'){$meta_number_text='Customer Number';}
+    else {$meta_number_text='Vendor Number';}
     if ( $form->{account} ) {
         ( $form->{paymentaccounts} ) = split /--/, $form->{account};
     }
@@ -2021,7 +2024,7 @@
         };
     $column_header{meta_number} = {
         href => "$href&sort=meta_number",
-        text => $locale->text("[_1] Number", $vc),
+        text => $locale->text($meta_number_text),
         };
     $column_header{employee} = {
         href => "$href&sort=employee",

Modified: trunk/dists/rpm/ledgersmb.spec
===================================================================
--- trunk/dists/rpm/ledgersmb.spec	2011-12-10 18:29:41 UTC (rev 4192)
+++ trunk/dists/rpm/ledgersmb.spec	2011-12-11 01:21:05 UTC (rev 4193)
@@ -7,7 +7,6 @@
 URL: http://www.ledgersmb.org/
 Group: Applications/Productivity
 Source0: %{name}-%{version}.tar.gz
-Source2: Template-Plugin-Latex-3.02.tar.gz
 BuildRoot: %{_tmppath}/%{name}-%{version}-root
 BuildArch: noarch
 Requires: perl >= 5.8, httpd, postgresql >= 8.1, tetex-latex
@@ -21,6 +20,7 @@
 Requires: perl-IO-String perl-Config-Std >= 0.007
 Requires: perl-Math-BigInt-GMP
 Requires: perl-Log-Log4perl perl-DateTime
+Requires: perl-Config-Std
 BuildRequires: perl
 # avoid bogus autodetection of perl modules:
 AutoReqProv: no
@@ -58,6 +58,9 @@
 Visit http://localhost/ledgersmb/admin.pl with password "yada" and create an
 application database and users.
 
+Also note, this does NOT provide the LaTeX template extensions which are 
+technically optional but frequently used.  To use these you will need to install
+texlive packages from yum and Template::Latex from cpan.
 
 %prep
 %setup -q -n ledgersmb

Modified: trunk/lsmb-request.pl
===================================================================
--- trunk/lsmb-request.pl	2011-12-10 18:29:41 UTC (rev 4192)
+++ trunk/lsmb-request.pl	2011-12-11 01:21:05 UTC (rev 4193)
@@ -43,11 +43,11 @@
 # for custom preprocessing logic
 eval { require "custom.pl"; };
 
-$logger->debug("getting request");
+$logger->debug("getting new LedgerSMB");
 
 my $request = new LedgerSMB;
 
-$logger->debug("Got request");
+$logger->debug("Got \$request=$request");
 $logger->trace("\$request=".Data::Dumper::Dumper($request));
 
 $request->{action} = '__default' if (!$request->{action});
@@ -74,7 +74,7 @@
 $logger->debug("calling $script");
 
 &call_script( $script, $request );
-$logger->debug("after calling script=$script action=$request->{action}");
+$logger->debug("after calling script=$script action=$request->{action} \$request->{dbh}=$request->{dbh}");
 
 # Prevent flooding the error logs with undestroyed connection warnings
 $request->{dbh}->disconnect()

Modified: trunk/old-handler.pl
===================================================================
--- trunk/old-handler.pl	2011-12-10 18:29:41 UTC (rev 4192)
+++ trunk/old-handler.pl	2011-12-11 01:21:05 UTC (rev 4193)
@@ -164,7 +164,7 @@
 }
 else {
     $form->error( __FILE__ . ':' . __LINE__ . ': '
-          . $locale->text('action= not defined!') );
+          . $locale->text('action not defined!'));
 }
 
 }

Modified: trunk/sql/Pg-database.sql
===================================================================
--- trunk/sql/Pg-database.sql	2011-12-10 18:29:41 UTC (rev 4192)
+++ trunk/sql/Pg-database.sql	2011-12-11 01:21:05 UTC (rev 4193)
@@ -563,7 +563,8 @@
 
 COMMENT ON TABLE session IS
 $$ This table is used to track sessions on a database level across page 
-requests.  Because of the way LedgerSMB authentication works currently we do 
+requests (discretionary locks,open forms for anti-xsrf measures).
+Because of the way LedgerSMB authentication works currently we do 
 not time out authentication when the session times out.  We do time out 
 highly pessimistic locks used for large batch payment workflows.$$;
 

Modified: trunk/sql/modules/1099_reports.sql
===================================================================
--- trunk/sql/modules/1099_reports.sql	2011-12-10 18:29:41 UTC (rev 4192)
+++ trunk/sql/modules/1099_reports.sql	2011-12-11 01:21:05 UTC (rev 4193)
@@ -9,9 +9,10 @@
 -- This file provides 1099 reporting (MISC and INT).  It does NOT provide 1099-K
 -- and we'd need an abstraction layer for that. --CT
 
-
-
+BEGIN;
+DROP TYPE IF EXISTS tax_form_report_item CASCADE;
 CREATE TYPE tax_form_report_item AS (
+    credit_id integer,
     legal_name text, 
     entity_id integer, 
     entity_class integer, 
@@ -21,7 +22,9 @@
     invoice_sum numeric, 
     total_sum numeric);
 
+DROP TYPE IF EXISTS tax_form_report_detail_item CASCADE;
 CREATE TYPE tax_form_report_detail_item AS (
+    credit_id integer,
     legal_name text, 
     entity_id integer, 
     entity_class integer, 
@@ -40,7 +43,8 @@
 	out_row tax_form_report_item;
 BEGIN
 	FOR out_row IN 
-              SELECT company.legal_name, company.entity_id, 
+              SELECT entity_credit_account.id,
+                     company.legal_name, company.entity_id, 
                      entity_credit_account.entity_class, entity.control_code, 
                      entity_credit_account.meta_number, 
                      sum(CASE WHEN gl.amount = 0 THEN 0
@@ -107,7 +111,7 @@
 		JOIN company ON (entity.id = company.entity_id)
 		JOIN country_tax_form ON (entity_credit_account.taxform_id = country_tax_form.id)
                WHERE country_tax_form.id = in_tax_form_id
-             GROUP BY legal_name, meta_number, company.entity_id, entity_credit_account.entity_class, entity.control_code 
+             GROUP BY legal_name, meta_number, company.entity_id, entity_credit_account.entity_class, entity.control_code, entity_credit_account.id
     LOOP
 		RETURN NEXT out_row;
 	END LOOP;
@@ -125,7 +129,8 @@
 	out_row tax_form_report_detail_item;
 BEGIN
 	FOR out_row IN 
-              SELECT company.legal_name, company.entity_id, 
+              SELECT entity_credit_account.id,
+                     company.legal_name, company.entity_id, 
                      entity_credit_account.entity_class, entity.control_code, 
                      entity_credit_account.meta_number, 
                      sum(CASE WHEN gl.amount = 0 then 0 
@@ -191,7 +196,7 @@
                      group by ac.trans_id
                      ) pmt ON  (pmt.trans_id = gl.id)
 		WHERE country_tax_form.id = in_tax_form_id AND meta_number = in_meta_number
-		GROUP BY legal_name, meta_number, company.entity_id, entity_credit_account.entity_class, entity.control_code, gl.invnumber, gl.duedate, gl.id
+		GROUP BY legal_name, meta_number, company.entity_id, entity_credit_account.entity_class, entity.control_code, gl.invnumber, gl.duedate, gl.id, entity_credit_account.id
 	LOOP
 		RETURN NEXT out_row;
 	END LOOP;
@@ -203,3 +208,4 @@
 $$ This provides a list of invoices and transactions that a report hits.  This 
 is intended to allow an organization to adjust what is reported on the 1099 
 before printing them.$$;
+COMMIT;


Property changes on: trunk/sql/upgrade/1.2-1.3-manual.sql
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/sql/upgrade/1.2-1.3-manual.sql:3712-4154
/branches/1.3/sql/upgrade/1.2-1.3.sql:3711-3851
/trunk/sql/upgrade/1.2-1.3.sql:858-3710
   + /branches/1.3/sql/upgrade/1.2-1.3-manual.sql:3712-4192
/branches/1.3/sql/upgrade/1.2-1.3.sql:3711-3851
/trunk/sql/upgrade/1.2-1.3.sql:858-3710

Modified: trunk/templates/demo/sales_quotation.tex
===================================================================
--- trunk/templates/demo/sales_quotation.tex	2011-12-10 18:29:41 UTC (rev 4192)
+++ trunk/templates/demo/sales_quotation.tex	2011-12-11 01:21:05 UTC (rev 4193)
@@ -40,8 +40,7 @@
 <?lsmb address2 ?>
 
 <?lsmb city ?>
-<?lsmb IF state ?>
-\hspace{-0.1cm}, <?lsmb state ?>
+<?lsmb IF state ?>\hspace{-0.1cm}, <?lsmb state ?>
 <?lsmb END ?>
 <?lsmb zipcode ?>
 

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