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

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



Revision: 5039
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=5039&view=rev
Author:   einhverfr
Date:     2012-07-25 08:31:25 +0000 (Wed, 25 Jul 2012)
Log Message:
-----------
Correcting purchase order generation logic

Modified Paths:
--------------
    branches/1.3/Changelog
    branches/1.3/LedgerSMB/OE.pm

Modified: branches/1.3/Changelog
===================================================================
--- branches/1.3/Changelog	2012-07-25 07:43:11 UTC (rev 5038)
+++ branches/1.3/Changelog	2012-07-25 08:31:25 UTC (rev 5039)
@@ -14,6 +14,7 @@
 * If pos.conf.pl is not found, now returns an intelligible error (Chris T)
 * Adding action/id div to top of many screens (Chris T, h/t Erik H)
 * File->get_for_template now gets most recent parts image (Chris T)
+* Fixed error on generate purchase orders (Chris T, 3544857, h/t Nigel T)
 
 Changelog for 1.3.20
 * Fixes for es_AR translation, duplicate keys removed (Andres B)

Modified: branches/1.3/LedgerSMB/OE.pm
===================================================================
--- branches/1.3/LedgerSMB/OE.pm	2012-07-25 07:43:11 UTC (rev 5038)
+++ branches/1.3/LedgerSMB/OE.pm	2012-07-25 08:31:25 UTC (rev 5039)
@@ -2314,9 +2314,10 @@
 
         $query = qq|
 			SELECT pv.partnumber, pv.leadtime, pv.lastcost, pv.curr,
-				v.id as vendor_id, v.name
+				eca.id as vendor_id, e.name
 			FROM partsvendor pv
-			JOIN vendor v ON (v.id = pv.credit_id)
+			JOIN entity_credit_account eca ON (eca.id = pv.credit_id)
+                        JOIN entity e ON e.id = eca.entity_id
 			WHERE pv.parts_id = ?|;
         $sth = $dbh->prepare($query) || $form->dberror($query);
 
@@ -2385,7 +2386,7 @@
 
         $query = qq|
 			SELECT v.curr, v.taxincluded, t.rate, c.accno
-			FROM vendor v
+			FROM entity_credit_account v
 			LEFT JOIN vendortax vt ON (v.id = vt.vendor_id)
 			LEFT JOIN tax t ON (t.chart_id = vt.chart_id)
 			LEFT JOIN chart c ON (c.id = t.chart_id)
@@ -2408,9 +2409,11 @@
 
         # TODO:  Make this function insert as much as possible
         $query = qq|
-			INSERT INTO oe (ordnumber)
-			VALUES ('$uid')|;
-        $dbh->do($query) || $form->dberror($query);
+			INSERT INTO oe (ordnumber, entity_credit_account, 
+                                       oe_class_id)
+			VALUES (?, ?, 2)|;
+        $sth = $dbh->prepare($query);
+        $sth->execute($uid, $vendor_id) || $form->dberror($query);
 
         $query = qq|SELECT id FROM oe WHERE ordnumber = '$uid'|;
         $sth   = $dbh->prepare($query);
@@ -2500,7 +2503,7 @@
 			UPDATE oe SET
 				ordnumber = ?,
 				transdate = current_date,
-				entity_id = ?
+				entity_id = ?,
 				amount = ?,
 				netamount = ?,
 				taxincluded = ?,

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