<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[FrontAccounting forum — Problem Importing Item Purchase Price]]></title>
		<link>https://frontaccounting.com/punbb/viewtopic.php?id=8309</link>
		<atom:link href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=8309&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Problem Importing Item Purchase Price.]]></description>
		<lastBuildDate>Mon, 05 Aug 2019 05:46:20 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Problem Importing Item Purchase Price]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=35623#p35623</link>
			<description><![CDATA[<p>Check if your input data had any extraneous characters that caused a mess up in escaping (or double escaping?). The escape was to prevent SQL injection.</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Mon, 05 Aug 2019 05:46:20 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=35623#p35623</guid>
		</item>
		<item>
			<title><![CDATA[Re: Problem Importing Item Purchase Price]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=35602#p35602</link>
			<description><![CDATA[<p>OK - I don&#039;t know if I should be altering files, nor do I know if this change is a good idea, but in the import_items.php file, at the &quot;function get_supplier_id&quot; portion, I changed this line:</p><div class="codebox"><pre><code>$sql = &quot;SELECT supplier_id FROM &quot;.TB_PREF.&quot;suppliers where supp_name = &quot;.db_escape($supplier);</code></pre></div><p>to this:</p><div class="codebox"><pre><code>$sql = &quot;SELECT supplier_id FROM &quot;.TB_PREF.&quot;suppliers where supp_name = $supplier&quot;;</code></pre></div><p>&nbsp; And my test file seemed to have imported correctly. Please let me know if this is allowed (for me to change it) and if it is acceptable as far as code is concerned.</p><p>&nbsp; Thank you,</p><p>Paul</p>]]></description>
			<author><![CDATA[null@example.com (paul)]]></author>
			<pubDate>Fri, 02 Aug 2019 14:48:12 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=35602#p35602</guid>
		</item>
		<item>
			<title><![CDATA[Re: Problem Importing Item Purchase Price]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=35601#p35601</link>
			<description><![CDATA[<p>OK - Maybe this can help. This is my test import file contents:</p><div class="codebox"><pre><code>type,stock_id,dummy,supplier_description,supplier,suppliers_uom,conversion_factor,dummy1,USD,price
BUY,12345,,,MainVendor,Ea,576,,USD,75</code></pre></div><p>It looks like the import extension is requesting the supplier name and also adding &quot;&amp;#039;&quot; (without the quotation marks) around the supplier&#039;s name:</p><div class="codebox"><pre><code>...
SELECT * FROM 2_stock_master where stock_id = &#039;12345&#039;
SELECT supplier_id FROM 2_suppliers where supp_name = &#039;&quot;&amp;#039;&quot;MainVendor&quot;&amp;#039;&quot;&#039;
SELECT material_cost FROM 2_stock_master WHERE stock_id = &#039;12345&#039;
...</code></pre></div><p>&nbsp; (again, without the quotation marks) The request gets the stock_id correctly. I also tried adding quotation marks around the supplier name in my file, but did not help. Anyway to change this issue?</p><p>&nbsp; Thank you...</p>]]></description>
			<author><![CDATA[null@example.com (paul)]]></author>
			<pubDate>Fri, 02 Aug 2019 12:50:18 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=35601#p35601</guid>
		</item>
		<item>
			<title><![CDATA[Re: Problem Importing Item Purchase Price]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=35591#p35591</link>
			<description><![CDATA[<p>Yes - That&#039;s the part I am looking at.</p><p>&nbsp; I attempted to make sure I had exact name. I even added a supplier manually to FA so I could export that data to compare. I saved the export, changed a price and tried to import the otherwise same file, but it could not find supplier.</p>]]></description>
			<author><![CDATA[null@example.com (paul)]]></author>
			<pubDate>Thu, 01 Aug 2019 18:20:59 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=35591#p35591</guid>
		</item>
		<item>
			<title><![CDATA[Re: Problem Importing Item Purchase Price]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=35588#p35588</link>
			<description><![CDATA[<p>Lines 43 to 49 of <strong>import_items.php</strong>:<br /></p><div class="codebox"><pre><code>function get_supplier_id($supplier) {
    $sql = &quot;SELECT supplier_id FROM &quot;.TB_PREF.&quot;suppliers where supp_name = &quot;.db_escape($supplier);
    $result = db_query($sql, &quot;Can not look up supplier&quot;);
    $row = db_fetch_row($result);
    if (!$row[0]) return 0;
    return $row[0];
}</code></pre></div><p>If an existing supplier name is available in the target table, then it will return the supplier_id, otherwise it returns a 0. Make sure that the Supplier Name is exactly the same as the one in FA when an import occurs.</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Thu, 01 Aug 2019 18:07:30 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=35588#p35588</guid>
		</item>
		<item>
			<title><![CDATA[Re: Problem Importing Item Purchase Price]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=35584#p35584</link>
			<description><![CDATA[<p>Yes - yes. I downloaded those same files. I am looking through import_items.php and am looking at the get_supplier function to try to make sure it&#039;s looking at the correct database, table, field, etc. the function returns a 0. I even exported the current data to make sure I understand what I need to input.</p>]]></description>
			<author><![CDATA[null@example.com (paul)]]></author>
			<pubDate>Thu, 01 Aug 2019 17:55:25 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=35584#p35584</guid>
		</item>
		<item>
			<title><![CDATA[Re: Problem Importing Item Purchase Price]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=35581#p35581</link>
			<description><![CDATA[<p>Are you referring to the <strong><a href="https://github.com/apmuthu/FA24extensions/tree/master/Extensions/import_items">Inventory Items CSV Import</a></strong> module?</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Thu, 01 Aug 2019 17:45:21 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=35581#p35581</guid>
		</item>
		<item>
			<title><![CDATA[Problem Importing Item Purchase Price]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=35563#p35563</link>
			<description><![CDATA[<p>I am using FA v.2.4.7 and the extension to import item data into my setup. So far, I have been able to build and import the items, themselves, and their prices. I am having problems importing purchase data or maybe I misunderstand what it is suppose to do, but I get an error anyways.</p><p>&nbsp; When I import BUY purchasing data, the Standard Unit Cost is updated and is correctly calculated using the imported files unit_conversion information along with the price in the file. The Purchasing Pricing tab does not show the predefined supplier nor did the import operation update existing data (after I manually enter the supplier and outdated pricing (for this test)). </p><p>&nbsp; After I click on Import, I get two green banners toward the top of the page:</p><p>Supplier MainVendor not found</p><p>and</p><p>1. Purchasing Data items added or updated.</p><p>&nbsp; I have even exported the same data, saved and modified this file&#039;s pricing and tried to import, but I get same results. If I understand the import code, the supplier field is looking in the &quot;supp_name&quot; column of FA database&#039;s suppliers table.</p><p>&nbsp; What am I doing wrong, please?!</p><p>&nbsp; Thank you,</p><p>Paul</p>]]></description>
			<author><![CDATA[null@example.com (paul)]]></author>
			<pubDate>Wed, 31 Jul 2019 16:34:22 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=35563#p35563</guid>
		</item>
	</channel>
</rss>
