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

SF.net SVN: ledger-smb:[3755] branches/1.3



Revision: 3755
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3755&view=rev
Author:   einhverfr
Date:     2011-09-27 10:43:37 +0000 (Tue, 27 Sep 2011)
Log Message:
-----------
Correcting bug 3411616

Modified Paths:
--------------
    branches/1.3/LedgerSMB/AM.pm
    branches/1.3/LedgerSMB/Form.pm
    branches/1.3/bin/am.pl

Modified: branches/1.3/LedgerSMB/AM.pm
===================================================================
--- branches/1.3/LedgerSMB/AM.pm	2011-09-27 05:25:34 UTC (rev 3754)
+++ branches/1.3/LedgerSMB/AM.pm	2011-09-27 10:43:37 UTC (rev 3755)
@@ -1699,7 +1699,7 @@
                       sonumber ponumber sqnumber rfqnumber partnumber 
                       employeenumber customernumber vendornumber projectnumber 
                       yearend curr weightunit businessnumber default_country 
-                      check_prefix password_duration templates)
+                      check_prefix password_duration templates vclimit)
     }
     for (@$defaults)
     {

Modified: branches/1.3/LedgerSMB/Form.pm
===================================================================
--- branches/1.3/LedgerSMB/Form.pm	2011-09-27 05:25:34 UTC (rev 3754)
+++ branches/1.3/LedgerSMB/Form.pm	2011-09-27 10:43:37 UTC (rev 3755)
@@ -1889,7 +1889,11 @@
     $dbh = $self->{dbh};
 
     my $sth;
+    $sth = $dbh->prepare('SELECT value FROM defaults WHERE setting_key = ?');
 
+    $sth->execute('vclimit');
+    ($myconfig->{vclimit}) = $sth->fetchrow_array();
+
     if ($vc eq 'customer'){
         $self->{vc_class} = 1;
     } else {
@@ -1936,6 +1940,38 @@
         $sth->execute($self->{id});
         ($self->{"${vc}_id"}, $self->{$vc}) = $sth->fetchrow_array();
     }
+
+    if ( $count < $myconfig->{vclimit} ) {
+
+        $self->{"${vc}_id"} *= 1;
+
+        $query = qq|SELECT ec.id, e.name
+                      FROM entity e
+                      JOIN entity_credit_account ec ON ec.entity_id = e.id
+                     WHERE 
+                           $where
+                     UNION 
+                    SELECT ec.id, e.name
+                      FROM entity e
+                      JOIN entity_credit_account ec ON ec.entity_id = e.id
+                     WHERE ec.id = ?
+                  ORDER BY name|;
+
+        push( @queryargs, $self->{"${vc}_id"} );
+
+        $sth = $dbh->prepare($query);
+        $sth->execute(@queryargs) || $self->dberror($query);
+
+        @{ $self->{"all_$vc"} } = ();
+
+        while ( $ref = $sth->fetchrow_hashref('NAME_lc') ) {
+            push @{ $self->{"all_$vc"} }, $ref;
+        }
+
+        $sth->finish;
+
+    }
+
     # get self
     if ( !$self->{employee_id} ) {
         ( $self->{employee}, $self->{employee_id} ) = split /--/,

Modified: branches/1.3/bin/am.pl
===================================================================
--- branches/1.3/bin/am.pl	2011-09-27 05:25:34 UTC (rev 3754)
+++ branches/1.3/bin/am.pl	2011-09-27 10:43:37 UTC (rev 3755)
@@ -53,6 +53,7 @@
    { name => 'glnumber', label => $locale->text('GL Reference Number') },
    { name => 'sinumber', 
       label => $locale->text('Sales Invoice/AR Transaction Number'), },
+   { name => 'vclimit', label => $locale->text('Max per dropdown') },
    { name => 'sonumber', label => $locale->text('Sales Order Number') },
    { name => 'vinumber' , 
     label => $locale->text('Vendor Invoice/AP Transaction Number')},

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