<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[FrontAccounting forum — Import Items $mb_flag 'S' wrong]]></title>
	<link rel="self" href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=5576&amp;type=atom" />
	<updated>2015-02-26T14:17:29Z</updated>
	<generator>PunBB</generator>
	<id>https://frontaccounting.com/punbb/viewtopic.php?id=5576</id>
		<entry>
			<title type="html"><![CDATA[Re: Import Items $mb_flag 'S' wrong]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=22718#p22718" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2015-02-26T14:17:29Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=22718#p22718</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Import Items $mb_flag 'S' wrong]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=22717#p22717" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[tm]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=17873</uri>
			</author>
			<updated>2015-02-26T11:12:55Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=22717#p22717</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Import Items $mb_flag 'S' wrong]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=22715#p22715" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2015-02-26T10:37:57Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=22715#p22715</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Import Items $mb_flag 'S' wrong]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=22701#p22701" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[tm]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=17873</uri>
			</author>
			<updated>2015-02-24T19:09:05Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=22701#p22701</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Import Items $mb_flag 'S' wrong]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=22699#p22699" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2015-02-24T18:38:15Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=22699#p22699</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Import Items $mb_flag 'S' wrong]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=22698#p22698" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[tm]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=17873</uri>
			</author>
			<updated>2015-02-24T13:25:57Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=22698#p22698</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Import Items $mb_flag 'S' wrong]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=22694#p22694" />
			<content type="html"><![CDATA[<p>@joe: Shall we change the core - what of the community and existing users data?</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2015-02-24T12:14:16Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=22694#p22694</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Import Items $mb_flag 'S' wrong]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=22693#p22693" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[tm]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=17873</uri>
			</author>
			<updated>2015-02-24T10:05:50Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=22693#p22693</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Import Items $mb_flag 'S' wrong]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=22692#p22692" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2015-02-24T08:29:57Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=22692#p22692</id>
		</entry>
</feed>
