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

SF.net SVN: ledger-smb: [1824] trunk/LedgerSMB



Revision: 1824
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1824&view=rev
Author:   tetragon
Date:     2007-10-28 12:13:38 -0700 (Sun, 28 Oct 2007)

Log Message:
-----------
Get purchase order retreival to work

Modified Paths:
--------------
    trunk/LedgerSMB/OE.pm
    trunk/LedgerSMB/PriceMatrix.pm

Modified: trunk/LedgerSMB/OE.pm
===================================================================
--- trunk/LedgerSMB/OE.pm	2007-10-28 18:52:18 UTC (rev 1823)
+++ trunk/LedgerSMB/OE.pm	2007-10-28 19:13:38 UTC (rev 1824)
@@ -762,21 +762,24 @@
 			SELECT o.ordnumber, o.transdate, o.reqdate, o.terms,
                 		o.taxincluded, o.shippingpoint, o.shipvia, 
 				o.notes, o.intnotes, o.curr AS currency, 
-				e.name AS employee, o.employee_id,
-				o.$form->{vc}_id, vc.name AS $form->{vc}, 
+				pe.first_name \|\| ' ' \|\| pe.last_name AS employee,
+				o.person_id AS employee_id,
+				o.entity_id AS $form->{vc}_id, c.legal_name AS $form->{vc}, 
 				o.amount AS invtotal, o.closed, o.reqdate, 
 				o.quonumber, o.department_id, 
 				d.description AS department, o.language_code, 
 				o.ponumber
 			FROM oe o
-			JOIN $form->{vc} vc ON (o.$form->{vc}_id = vc.id)
-			LEFT JOIN employee e ON (o.employee_id = e.id)
+			JOIN company c ON (c.entity_id = o.entity_id)
+			JOIN $form->{vc} vc ON (c.entity_id = vc.entity_id)
+			LEFT JOIN person pe ON (o.person_id = pe.id)
+			LEFT JOIN employee e ON (pe.entity_id = e.entity_id)
 			LEFT JOIN department d ON (o.department_id = d.id)
 			WHERE o.id = ?|;
         $sth = $dbh->prepare($query);
         $sth->execute( $form->{id} ) || $form->dberror($query);
 
-        $ref = $sth->fetchrow_hashref(NAME_lc);
+        $ref = $sth->fetchrow_hashref('NAME_lc');
         $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
         for ( keys %$ref ) { $form->{$_} = $ref->{$_} }
         $sth->finish;
@@ -785,7 +788,7 @@
         $sth   = $dbh->prepare($query);
         $sth->execute( $form->{id} ) || $form->dberror($query);
 
-        $ref = $sth->fetchrow_hashref(NAME_lc);
+        $ref = $sth->fetchrow_hashref('NAME_lc');
         for ( keys %$ref ) { $form->{$_} = $ref->{$_} }
         $sth->finish;
 
@@ -851,7 +854,7 @@
         my $sellprice;
         my $listprice;
 
-        while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+        while ( $ref = $sth->fetchrow_hashref('NAME_lc') ) {
             $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
 
             ($decimalplaces) = ( $ref->{sellprice} =~ /\.(\d+)/ );

Modified: trunk/LedgerSMB/PriceMatrix.pm
===================================================================
--- trunk/LedgerSMB/PriceMatrix.pm	2007-10-28 18:52:18 UTC (rev 1823)
+++ trunk/LedgerSMB/PriceMatrix.pm	2007-10-28 19:13:38 UTC (rev 1824)
@@ -102,7 +102,7 @@
 			SELECT partnumber
 			FROM partsvendor
 			WHERE parts_id = ?
-			AND vendor_id = $entity_id|;
+			AND entity_id = $entity_id|;
         $sth = $dbh->prepare($query) || $form->dberror($query);
     }
 
@@ -122,9 +122,9 @@
     if ( $form->{customer_id} ) {
         $pmh->execute( $ref->{id}, $ref->{id}, $ref->{id}, $ref->{id} );
 
-        while ( $mref = $pmh->fetchrow_hashref(NAME_lc) ) {
+        while ( $mref = $pmh->fetchrow_hashref('NAME_lc') ) {
 
-            $form->db_parse_numeric(sth=>$sth, hashref=>$mref);
+            $form->db_parse_numeric(sth=>$pmh, hashref=>$mref);
             # check date
             if ( $mref->{validfrom} ) {
                 next
@@ -195,8 +195,8 @@
     if ( $form->{vendor_id} ) {
         $pmh->execute( $ref->{id} );
 
-        $mref = $pmh->fetchrow_hashref(NAME_lc);
-        $form->db_parse_numeric(sth=>$sth, hashref=>$mref);
+        $mref = $pmh->fetchrow_hashref('NAME_lc');
+        $form->db_parse_numeric(sth=>$pmh, hashref=>$mref);
 
         if ( $mref->{partnumber} ne "" ) {
             $ref->{partnumber} = $mref->{partnumber};


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