<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[FrontAccounting forum — Import Items $mb_flag 'S' wrong]]></title>
		<link>https://frontaccounting.com/punbb/viewtopic.php?id=5576</link>
		<atom:link href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=5576&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Import Items $mb_flag 'S' wrong.]]></description>
		<lastBuildDate>Thu, 26 Feb 2015 14:17:29 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Import Items $mb_flag 'S' wrong]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=22718#p22718</link>
			<description><![CDATA[<p>@tm: That&#039;s a fine way to tolerate old habits. Thanks. <a href="https://github.com/apmuthu/frontaccounting/commit/8d2adf1edc5449703c921e3737463f34c63f8278">Committed</a> in my GitHub Repo.</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Thu, 26 Feb 2015 14:17:29 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=22718#p22718</guid>
		</item>
		<item>
			<title><![CDATA[Re: Import Items $mb_flag 'S' wrong]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=22717#p22717</link>
			<description><![CDATA[<p>Hmm... But that still puts the &quot;S&quot; into stock_master.</p><p>My idea was adding<br /></p><div class="codebox"><pre><code>if ($mb_flag == &quot;S&quot;)
  $mb_flag =&quot;D&quot;;</code></pre></div><p>after<br /></p><div class="codebox"><pre><code> 
$mb_flag = strtoupper($mb_flag);</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (tm)]]></author>
			<pubDate>Thu, 26 Feb 2015 11:12:55 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=22717#p22717</guid>
		</item>
		<item>
			<title><![CDATA[Re: Import Items $mb_flag 'S' wrong]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=22715#p22715</link>
			<description><![CDATA[<p><a href="https://github.com/apmuthu/frontaccounting/commit/be21d1cc1e18efc5045c82f5d740e092fc515a38">Committed</a> the fix to the <a href="https://github.com/apmuthu/frontaccounting/tree/master/extensions/Extensions/import_items">extension&#039;s files in my GitHub repo</a>.</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Thu, 26 Feb 2015 10:37:57 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=22715#p22715</guid>
		</item>
		<item>
			<title><![CDATA[Re: Import Items $mb_flag 'S' wrong]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=22701#p22701</link>
			<description><![CDATA[<p>Well... D it is, then.</p><p>Looking at the import_items extension, it seems to insert and update tables with whatever $mb_flag it gets from the CSV. And the documentation suggests using S, which means service items will be stored as inventory items. (Or, rather, read back as such when retrieved from the database later.)</p><p>So it&#039;s broken. People already have items in their databases with an invalid mb_flag, which can be easily corrected by the upgrade script. But to prevent such data from being written in the future, the extension has to handle both cases, rewriting S to D before feeding anything to the database. It&#039;s not ideal, but there will be other scripts preparing the data for import, which have been written according to the instructions in the readme file. At least we don&#039;t need to put THAT in the core...</p>]]></description>
			<author><![CDATA[null@example.com (tm)]]></author>
			<pubDate>Tue, 24 Feb 2015 19:09:05 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=22701#p22701</guid>
		</item>
		<item>
			<title><![CDATA[Re: Import Items $mb_flag 'S' wrong]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=22699#p22699</link>
			<description><![CDATA[<p>There are quite a few placed where <strong>D</strong> is hard coded in the core and in the extension files. </p><p>A brief history of <strong>mb_flag</strong> changes:<br /></p><div class="codebox"><pre><code>2014-09-12: Removed redundant mb_flag &#039;A&#039;.
2009-05-18: Added mb_flag &#039;M&#039; in demand checks
2009-05-17: Removed obsolete &#039;K&#039; mb_flag checks.</code></pre></div><p>Extensions having <strong>mb_flag</strong> and referencing &#039;D&#039; or &#039;S&#039;:<br /></p><div class="codebox"><pre><code>Extensions/api/sync_db.inc : Lines 393, 418, 1069, 1109, 1152 =&gt; D
Extensions/import_items/import_items.php : Line 246 =&gt; S
Extensions/import_items/readme.txt : Line 111, 163 =&gt; S</code></pre></div><p>Core files having <strong>mb_flag</strong> and referencing &#039;D&#039; or &#039;S&#039;:<br /></p><div class="codebox"><pre><code>includes/data_checks.inc : Line 333 =&gt; D
includes/manufacturing.inc : Line 27 =&gt; D
includes/db/inventory_db.inc : Line 114 =&gt; D
includes/ui/ui_lists.inc : Lines 915, 924 =&gt; D
manufacturing/work_order_add_finished.php : Line 139 =&gt; D
reporting/rep301.php : Line 113 =&gt; D
reporting/rep307.php : Line 40 =&gt; D
reporting/rep308.php : Line 70 =&gt; D</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Tue, 24 Feb 2015 18:38:15 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=22699#p22699</guid>
		</item>
		<item>
			<title><![CDATA[Re: Import Items $mb_flag 'S' wrong]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=22698#p22698</link>
			<description><![CDATA[<p>Found this. Do imported items actually get stored with an S? Then I guess they will be treated as inventory items. </p><p>includes/db/inventory_db.inc:</p><p>function is_inventory_item($stock_id)<br />{<br />$sql = &quot;SELECT stock_id FROM &quot;.TB_PREF.&quot;stock_master<br />WHERE stock_id=&quot;.db_escape($stock_id).&quot; AND mb_flag &lt;&gt; &#039;D&#039;&quot;;<br />$result = db_query($sql, &quot;Cannot query is inventory item or not&quot;);<br />return db_num_rows($result) &gt; 0;<br />} </p><br /><p>If we have data stored with an S, it is already broken. If not, changing the core will not break anything. But we can&#039;t have two different representations for the same thing and only test for one. It should be simple enough for an upgrade script to change the database values.</p>]]></description>
			<author><![CDATA[null@example.com (tm)]]></author>
			<pubDate>Tue, 24 Feb 2015 13:25:57 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=22698#p22698</guid>
		</item>
		<item>
			<title><![CDATA[Re: Import Items $mb_flag 'S' wrong]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=22694#p22694</link>
			<description><![CDATA[<p>@joe: Shall we change the core - what of the community and existing users data?</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Tue, 24 Feb 2015 12:14:16 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=22694#p22694</guid>
		</item>
		<item>
			<title><![CDATA[Re: Import Items $mb_flag 'S' wrong]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=22693#p22693</link>
			<description><![CDATA[<p>Probably a typo, then. The question is which one is correct. The S certainly makes more sense.</p><p>Generally, modules should adapt to the core. Not the other way around. </p><p>But if there are no other occurrences, I would change the core here.</p>]]></description>
			<author><![CDATA[null@example.com (tm)]]></author>
			<pubDate>Tue, 24 Feb 2015 10:05:50 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=22693#p22693</guid>
		</item>
		<item>
			<title><![CDATA[Import Items $mb_flag 'S' wrong]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=22692#p22692</link>
			<description><![CDATA[<p>The file <strong>includes/manufacturing.inc</strong> had the acceptable values of the $mb_flag variable / mb_flag field:<br />M =&gt; <strong>M</strong>anufactured<br />B =&gt; Purchased or <strong>B</strong>ought<br />D =&gt; Services - do not know the rationale for this assignment. Possibly <strong>D</strong>eStocked or <strong>D</strong>iscard Inventory.</p><p>The extensions file <strong>modules/import_items/import_items.php</strong> lines 246-247:<br /></p><div class="codebox"><pre><code>if ($mb_flag != &quot;S&quot;) {
    $sql = &quot;INSERT INTO &quot;.TB_PREF.&quot;loc_stock (loc_code, stock_id) VALUES (&#039;{$_POST[&#039;location&#039;]}&#039;, &#039;$id&#039;)&quot;;</code></pre></div><p>Should we change the D =&gt; S in the core file <strong>includes/manufacturing.inc</strong> or S =&gt; D in the extension file <strong>import_items.php</strong> ?</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Tue, 24 Feb 2015 08:29:57 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=22692#p22692</guid>
		</item>
	</channel>
</rss>
