<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[FrontAccounting forum — Problem Importing Item Purchase Price]]></title>
	<link rel="self" href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=8309&amp;type=atom" />
	<updated>2019-08-05T05:46:20Z</updated>
	<generator>PunBB</generator>
	<id>https://frontaccounting.com/punbb/viewtopic.php?id=8309</id>
		<entry>
			<title type="html"><![CDATA[Re: Problem Importing Item Purchase Price]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=35623#p35623" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2019-08-05T05:46:20Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=35623#p35623</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Problem Importing Item Purchase Price]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=35602#p35602" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[paul]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=44798</uri>
			</author>
			<updated>2019-08-02T14:48:12Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=35602#p35602</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Problem Importing Item Purchase Price]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=35601#p35601" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[paul]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=44798</uri>
			</author>
			<updated>2019-08-02T12:50:18Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=35601#p35601</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Problem Importing Item Purchase Price]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=35591#p35591" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[paul]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=44798</uri>
			</author>
			<updated>2019-08-01T18:20:59Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=35591#p35591</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Problem Importing Item Purchase Price]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=35588#p35588" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2019-08-01T18:07:30Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=35588#p35588</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Problem Importing Item Purchase Price]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=35584#p35584" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[paul]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=44798</uri>
			</author>
			<updated>2019-08-01T17:55:25Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=35584#p35584</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Problem Importing Item Purchase Price]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=35581#p35581" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2019-08-01T17:45:21Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=35581#p35581</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Problem Importing Item Purchase Price]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=35563#p35563" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[paul]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=44798</uri>
			</author>
			<updated>2019-07-31T16:34:22Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=35563#p35563</id>
		</entry>
</feed>
