<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[FrontAccounting forum — Active/Inactive bank]]></title>
	<link rel="self" href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=3917&amp;type=atom" />
	<updated>2013-03-06T16:24:07Z</updated>
	<generator>PunBB</generator>
	<id>https://frontaccounting.com/punbb/viewtopic.php?id=3917</id>
		<entry>
			<title type="html"><![CDATA[Re: Active/Inactive bank]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=15920#p15920" />
			<content type="html"><![CDATA[<p>Hi Joe</p><p>The fix has solve the bug.</p><p>Thanks</p>]]></content>
			<author>
				<name><![CDATA[dvarsani]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=16332</uri>
			</author>
			<updated>2013-03-06T16:24:07Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=15920#p15920</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Active/Inactive bank]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=15916#p15916" />
			<content type="html"><![CDATA[<p>The cast fix is rather from Janusz <img src="https://frontaccounting.com/punbb/img/smilies/smile.png" width="15" height="15" alt="smile" /></p><p>Joe</p>]]></content>
			<author>
				<name><![CDATA[joe]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=3</uri>
			</author>
			<updated>2013-03-06T15:02:54Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=15916#p15916</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Active/Inactive bank]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=15911#p15911" />
			<content type="html"><![CDATA[<p>Thanks Joe. <a href="https://frontaccounting.hg.sourceforge.net/hgweb/frontaccounting/frontaccounting/rev/6dcb53cc88df">HG 3196</a> fixes it. Your cast fix is elegant:<br /></p><div class="codebox"><pre><code>$sql = &quot;UPDATE &quot;.TB_PREF.$table.&quot; SET inactive = &quot;
        . ((int)$status).&quot; WHERE $key=&quot;.db_escape($id);</code></pre></div><p>The list of tables and fields that have a non integer primary key or multiple keys and having field name &quot;inactive&quot; are:<br /></p><div class="quotebox"><blockquote><p><strong>Table Name&nbsp; &nbsp; &nbsp; Primary Key&nbsp; &nbsp; &nbsp; Field Type</strong><br />chart_class&nbsp; &nbsp; &nbsp; cid&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;varchar(3)<br />chart_master&nbsp; &nbsp;account_code&nbsp; &nbsp; varchar(15)<br />chart_types&nbsp; &nbsp; &nbsp;id&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; varchar(10)<br />currencies&nbsp; &nbsp; &nbsp; &nbsp; curr_abbrev&nbsp; &nbsp; &nbsp; char(3)<br />item_units&nbsp; &nbsp; &nbsp; &nbsp;abbr&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; varchar(20)<br />locations&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; loc_code&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;varchar(5)<br />stock_master&nbsp; &nbsp;stock_id&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; varchar(20)</p><p>cust_branch&nbsp; &nbsp; &nbsp;branch_code, debtor_no&nbsp; &nbsp; &nbsp; &nbsp;int(11), int(11)</p></blockquote></div><p>It is the last one above that is worrisome as the function used assumes a single primary key only. Kindly test what happens when same debtor is in multiple branches (or multiple debtors for same branch) and it is sought to make inactive a certain branch_code/debtor_no combination only.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2013-03-06T11:22:49Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=15911#p15911</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Active/Inactive bank]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=15908#p15908" />
			<content type="html"><![CDATA[<p>Hello guys,</p><p>Yes, certain releases of MySql don&#039;t like this.</p><p>This has now been fixed in file sql_functions.inc. Please download and replace on your server.</p><p>HG repository updated.</p><p>/Joe</p>]]></content>
			<author>
				<name><![CDATA[joe]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=3</uri>
			</author>
			<updated>2013-03-05T22:36:42Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=15908#p15908</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Active/Inactive bank]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=15904#p15904" />
			<content type="html"><![CDATA[<p>Hi</p><p>after updating the .inc file, I am now getting this error</p><p>DATABASE ERROR : Can&#039;t update record status<br />error code : 1064<br />error message : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near &#039;0 WHERE id=&#039;6&#039;&#039; at line 1<br />sql that failed was : 0 WHERE id=&#039;6&#039;</p>]]></content>
			<author>
				<name><![CDATA[dvarsani]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=16332</uri>
			</author>
			<updated>2013-03-05T17:29:16Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=15904#p15904</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Active/Inactive bank]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=15902#p15902" />
			<content type="html"><![CDATA[<p>Roles and Permissions issue?<br />Should the statement be to set <strong>inactive=0</strong> instead of <strong>inactive=&#039;&#039;</strong>?</p><p>Offending code is at lines 56-61 in <strong>includes/db/sql_functions.inc</strong>:<br /></p><div class="codebox"><pre><code>function update_record_status($id, $status, $table, $key) {
    $sql = &quot;UPDATE &quot;.TB_PREF.$table.&quot; SET inactive = &quot;
        . db_escape($status).&quot; WHERE $key=&quot;.db_escape($id);
        
      db_query($sql, &quot;Can&#039;t update record status&quot;);
}</code></pre></div><p>Beware of legacy issues of if and when the column changed to be integer and whether all such tables have the same field type for field name <strong>inactive</strong>.</p><p>There are a total of 31 tables having <strong>inactive tinyint(1)</strong> and none having a field name of <strong>inactive</strong> with any other field type. Extensions are another matter though and whether they use this function here is also to be checked especially if they are not tinyint(1) or any int() for that matter.</p><p>Therefore it can be safely be changed to:<br /></p><div class="codebox"><pre><code>function update_record_status($id, $status, $table, $key) {
    $sql = &quot;UPDATE &quot;.TB_PREF.$table.&quot; SET inactive = &quot; . $status+0
                . &quot; WHERE $key=&quot;.db_escape($id);
        
      db_query($sql, &quot;Can&#039;t update record status&quot;);
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2013-03-05T15:09:59Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=15902#p15902</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Active/Inactive bank]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=15893#p15893" />
			<content type="html"><![CDATA[<p>I am using 2.3.15</p>]]></content>
			<author>
				<name><![CDATA[dvarsani]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=16332</uri>
			</author>
			<updated>2013-03-05T11:42:02Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=15893#p15893</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Active/Inactive bank]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=15891#p15891" />
			<content type="html"><![CDATA[<p>No problem here. Which version are you using? I tested with v 2.3.15.</p>]]></content>
			<author>
				<name><![CDATA[doitashimashite]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=17099</uri>
			</author>
			<updated>2013-03-05T10:59:17Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=15891#p15891</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Active/Inactive bank]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=15889#p15889" />
			<content type="html"><![CDATA[<p>There is a bug on bank accounts. When I untick inactive box I am getting this error. I am also getting this type when I make taxes active from inactive status.</p><p>DATABASE ERROR : Can&#039;t update record status<br />error code : 1366<br />error message : Incorrect integer value: &#039;&#039; for column &#039;inactive&#039; at row 1<br />sql that failed was : UPDATE 0_bank_accounts SET inactive = &#039;&#039; WHERE id=&#039;6&#039;</p>]]></content>
			<author>
				<name><![CDATA[dvarsani]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=16332</uri>
			</author>
			<updated>2013-03-05T10:40:41Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=15889#p15889</id>
		</entry>
</feed>
