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

SF.net SVN: ledger-smb:[3203] trunk/LedgerSMB/JC.pm



Revision: 3203
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3203&view=rev
Author:   ehuelsmann
Date:     2011-06-08 20:17:25 +0000 (Wed, 08 Jun 2011)

Log Message:
-----------
Fix bugs 3305912 and 3305913: Menu items 'Add timecard' and
'Reports -> Timecards' not working.

 * LedgerSMB/JC.pm
   (jcparts): Skip price matrix calculations,
      when there's no customer or vendor supplied
   (jcitems): Fix inline query joining on non-existing column name

Modified Paths:
--------------
    trunk/LedgerSMB/JC.pm

Modified: trunk/LedgerSMB/JC.pm
===================================================================
--- trunk/LedgerSMB/JC.pm	2011-06-08 20:09:16 UTC (rev 3202)
+++ trunk/LedgerSMB/JC.pm	2011-06-08 20:17:25 UTC (rev 3203)
@@ -301,15 +301,21 @@
     my $sth = $dbh->prepare($query);
     $sth->execute || $form->dberror($query);
 
-    my $pmh = PriceMatrix::price_matrix_query( $dbh, $form );
-    IS::exchangerate_defaults( $dbh, $form );
+    if (defined $form->{vendor_id} or defined $form->{customer_id} ) {
+        my $pmh = PriceMatrix::price_matrix_query( $dbh, $form );
+        IS::exchangerate_defaults( $dbh, $form );
 
-    while ( my $ref = $sth->fetchrow_hashref(NAME_lc) ) {
-        $ref->{description} = $ref->{translation}
-          if $ref->{translation};
-        PriceMatrix::price_matrix( $pmh, $ref, $form->{transdate}, 4, $form,
-            $myconfig );
-        push @{ $form->{all_parts} }, $ref;
+        while ( my $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+            $ref->{description} = $ref->{translation}
+              if $ref->{translation};
+            PriceMatrix::price_matrix( $pmh, $ref, $form->{transdate}, 4, $form,
+                $myconfig );
+            push @{ $form->{all_parts} }, $ref;
+        }
+    } else {
+        while ( my $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+            push @{ $form->{all_parts} }, $ref;
+        }
     }
     $sth->finish;
 
@@ -481,7 +487,7 @@
 		  FROM jcitems j
 		  JOIN parts p ON (p.id = j.parts_id)
 		  JOIN project pr ON (pr.id = j.project_id)
-		  JOIN employee e ON (e.id = j.employee_id)
+		  JOIN employee e ON (e.entity_id = j.employee_id)
 		 WHERE $where
 		ORDER BY employee, employeenumber, $sortorder|;
 


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