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

SF.net SVN: ledger-smb:[3837] branches/1.3/LedgerSMB/JC.pm



Revision: 3837
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3837&view=rev
Author:   einhverfr
Date:     2011-10-11 23:52:25 +0000 (Tue, 11 Oct 2011)
Log Message:
-----------
Correcting timecards, needs more testing

Modified Paths:
--------------
    branches/1.3/LedgerSMB/JC.pm

Property Changed:
----------------
    branches/1.3/LedgerSMB/JC.pm

Modified: branches/1.3/LedgerSMB/JC.pm
===================================================================
--- branches/1.3/LedgerSMB/JC.pm	2011-10-11 23:36:58 UTC (rev 3836)
+++ branches/1.3/LedgerSMB/JC.pm	2011-10-11 23:52:25 UTC (rev 3837)
@@ -67,7 +67,8 @@
 			       pr.production, pr.completed, 
 			       pr.parts_id AS project
 			  FROM jcitems j
-			  JOIN employee e ON (e.id = j.employee_id)
+                          JOIN person ps ON (j.person_id = p.id)
+			  JOIN entity e ON (e.id = ps.employee_id)
 			  JOIN parts p ON (p.id = j.parts_id)
 			  JOIN project pr ON (pr.id = j.project_id)
 			 WHERE j.id = ?|;
@@ -419,7 +420,7 @@
     if ( $form->{employee} ) {
         ( $null, $var ) = split /--/, $form->{employee};
         $var = $dbh->quote($var);
-        $where .= " AND j.employee_id = $var";
+        $where .= " AND j.person_id = (select id from person where entity_id = $var)";
     }
     if ( $form->{open} || $form->{closed} ) {
         unless ( $form->{open} && $form->{closed} ) {
@@ -481,10 +482,13 @@
 		       to_char(j.checkedin, 'D') AS weekday,
 		       p.partnumber,
 		       pr.projectnumber, pr.description AS projectdescription,
-		       e.employeenumber, e.name AS employee,
+		       ee.employeenumber, e.name AS employee,
 		       to_char(j.checkedin, 'WW') AS workweek, pr.parts_id,
 		       j.sellprice
 		  FROM jcitems j
+                  JOIN person pn ON pn.id = j.person_id
+                  JOIN entity e ON pn.entity_id = e.id
+                  JOIN entity_employee ee ON ee.entity_id = e.id
 		  JOIN parts p ON (p.id = j.parts_id)
 		  JOIN project pr ON (pr.id = j.project_id)
 		  JOIN employee e ON (e.entity_id = j.employee_id)
@@ -554,7 +558,9 @@
         my $uid = localtime;
         $uid .= "$$";
 
-        $query = qq|INSERT INTO jcitems (description) VALUES ('$uid')|;
+        $query = qq|INSERT INTO jcitems (description, person_id) 
+                    SELECT '$uid', id
+                      FROM person WHERE entity_id = person__get_my_entity_id()|;
         $dbh->do($query) || $form->dberror($query);
 
         $query = qq|SELECT id FROM jcitems WHERE description = '$uid'|;
@@ -596,7 +602,9 @@
 		       serialnumber = ?,
 		       checkedin = ?::timestamp,
 		       checkedout = ?::timestamp,
-		       person_id = ?,
+		       person_id = (SELECT id FROM person 
+                                     WHERE entity_id 
+                                           = person__get_my_entity_id()),
 		       notes = ?
 		 WHERE id = ?|;
     $sth = $dbh->prepare($query);


Property changes on: branches/1.3/LedgerSMB/JC.pm
___________________________________________________________________
Added: svn:mergeinfo
   + /trunk/LedgerSMB/JC.pm:3711-3836

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