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

SF.net SVN: ledger-smb:[4303] branches/1.3/bin/aa.pl



Revision: 4303
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4303&view=rev
Author:   tshvr
Date:     2012-02-11 15:33:31 +0000 (Sat, 11 Feb 2012)
Log Message:
-----------
prevent empty or multiple same projectnumber from filling tr-row withe meaningless td-columns

Modified Paths:
--------------
    branches/1.3/bin/aa.pl

Modified: branches/1.3/bin/aa.pl
===================================================================
--- branches/1.3/bin/aa.pl	2012-02-11 15:30:40 UTC (rev 4302)
+++ branches/1.3/bin/aa.pl	2012-02-11 15:33:31 UTC (rev 4303)
@@ -2150,10 +2150,38 @@
     foreach $ref ( @{ $form->{transactions} } ) {
 
         $i++;
+        #print STDERR localtime()." aa.pl sub transactions row=".Data::Dumper::Dumper($ref)."\n";
+        #print STDERR localtime()." aa.pl sub transactions invnumber=$ref->{invnumber} projectnumber=$ref->{projectnumber}\n";
         if ($form->{l_projectnumber} eq 'Y' and ref($ref->{ac_projects}) eq 'ARRAY' and ref($ref->{inv_projects}) eq 'ARRAY'){
-            my @projects; 
-            push @projects, @{$ref->{ac_projects}};
-            push @projects, @{$ref->{inv_projects}};
+            #HV $ref->{projectnumber} in this case is not filled by AA-->transactions
+            my @projects;
+            my %projects_hash;
+            foreach $acprjct(@{$ref->{ac_projects}})
+            {
+             if($acprjct)
+             {
+              if(! exists $projects_hash{$acprjct})
+              {
+               #print STDERR localtime()." aa.pl sub transactions acprjct=$acprjct\n";
+               $projects_hash{$acprjct}=1;
+               push @projects, $acprjct;
+              }
+             }
+            }
+            foreach $invprjct(@{$ref->{inv_projects}})
+            {
+             if($invprjct)
+             {
+              if(! exists $projects_hash{$invprjct})
+              {
+               #print STDERR localtime()." aa.pl sub transactions invprjct=$invprjct\n";
+               $projects_hash{$invprjct}=1;
+               push @projects, $invprjct;
+              }
+             }
+            }
+            #push @projects, @{$ref->{ac_projects}};
+            #push @projects, @{$ref->{inv_projects}};
             $ref->{projectnumber} = join '<br />', @projects;
             $ref->{projectnumber} =~ s/(<br \/>)+/<br \/>/;
         } elsif ($form->{l_projectnumber} eq 'Y') { $form->error($locale->text('Invalid Project Data:'). 

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