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

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



Revision: 3756
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3756&view=rev
Author:   einhverfr
Date:     2011-09-27 10:46:46 +0000 (Tue, 27 Sep 2011)
Log Message:
-----------
Merging from branches/1.3

Modified Paths:
--------------
    trunk/LedgerSMB/AM.pm
    trunk/LedgerSMB/Form.pm
    trunk/bin/aa.pl
    trunk/bin/am.pl

Property Changed:
----------------
    trunk/


Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3:3711-3752
   + /branches/1.3:3711-3755

Modified: trunk/LedgerSMB/AM.pm
===================================================================
--- trunk/LedgerSMB/AM.pm	2011-09-27 10:43:37 UTC (rev 3755)
+++ trunk/LedgerSMB/AM.pm	2011-09-27 10:46:46 UTC (rev 3756)
@@ -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: trunk/LedgerSMB/Form.pm
===================================================================
--- trunk/LedgerSMB/Form.pm	2011-09-27 10:43:37 UTC (rev 3755)
+++ trunk/LedgerSMB/Form.pm	2011-09-27 10:46:46 UTC (rev 3756)
@@ -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: trunk/bin/aa.pl
===================================================================
--- trunk/bin/aa.pl	2011-09-27 10:43:37 UTC (rev 3755)
+++ trunk/bin/aa.pl	2011-09-27 10:46:46 UTC (rev 3756)
@@ -1666,9 +1666,11 @@
       . $locale->text('PO Number');
     push @a, qq|<input name="l_transdate" class=checkbox type=checkbox value=Y checked> |
       . $locale->text('Invoice Date');
-    push @a,
+    if (!$form->{outstanding}){
+        push @a,
 qq|<input name="l_projectnumber" class=checkbox type=checkbox value=Y checked> |
       . $locale->text('Project Numbers');
+    }
     push @a, $l_name;
     push @a, $l_employee if $l_employee;
     push @a, $l_manager if $l_employee;

Modified: trunk/bin/am.pl
===================================================================
--- trunk/bin/am.pl	2011-09-27 10:43:37 UTC (rev 3755)
+++ trunk/bin/am.pl	2011-09-27 10:46:46 UTC (rev 3756)
@@ -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.