<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[FrontAccounting forum — Not exactly bug -Reference Auto Increment when prefix size is bigger]]></title>
		<link>https://frontaccounting.com/punbb/viewtopic.php?id=6724</link>
		<atom:link href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=6724&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Not exactly bug -Reference Auto Increment when prefix size is bigger.]]></description>
		<lastBuildDate>Thu, 30 Mar 2017 05:53:30 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Not exactly bug -Reference Auto Increment when prefix size is bigger]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=27653#p27653</link>
			<description><![CDATA[<p><a href="https://frontaccounting.com/punbb/profile.php?id=20008">@stefan</a>: The changing of the <strong>prefix</strong> from CHAR to VARCHAR mitigates some cryllic alphabet issues.&nbsp; Also when the number of characters exceeds 4 or so, the<strong> mb_strlen</strong> mitigates it.</p><p>How will it affect those without <strong>mb_strlen</strong> (any situations) and whether it can be incorporated wherever <strong>strlen</strong> is used in both FA 2.3 and 2.4? Any changes here will have to be carried through to everywhere it is used.</p><p>Please note that <strong>mb_strlen</strong> is used in both A 2.3 and 2.4 in the following files:<br /></p><div class="codebox"><pre><code>reporting/includes/class.graphic.inc
reporting/includes/Workbook.php</code></pre></div><p>The usage in the last file above is:<br /></p><div class="codebox"><pre><code>    $strlen = function_exists(&#039;mb_strlen&#039;) ? mb_strlen($str, &#039;UTF-16LE&#039;) : (strlen($str) / 2);</code></pre></div><p>whilst in the former it is:<br /></p><div class="codebox"><pre><code>    $width = mb_strlen($string, &quot;UTF-8&quot;);</code></pre></div><p><strong>@itronics:</strong> Using VARCHAR results in slightly bigger memory usage, and slower processing (though probably both issues are hardly noticed).Using VARCHAR results in slightly bigger memory usage, and slower processing (though probably both issues are hardly noticed).</p><p><strong>@itronics:</strong> Regarding <strong>mb_strlen</strong> function, it should be used indeed, but it is available only when <strong><em>mbstring</em> php extension</strong> is enabled, so to avoid problems the conditional call should be used as it is done in Workbook.php.</p><p><strong>References:</strong></p><p>* <a href="http://kunststube.net/encoding/">What Every Programmer Absolutely, Positively Needs to Know About Encodings and Character Sets to Work With Text</a></p><p>* <a href="http://php.net/manual/en/mbstring.configuration.php#ini.mbstring.func-overload">php.ini mbstring overload</a></p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Thu, 30 Mar 2017 05:53:30 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=27653#p27653</guid>
		</item>
		<item>
			<title><![CDATA[Re: Not exactly bug -Reference Auto Increment when prefix size is bigger]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=27647#p27647</link>
			<description><![CDATA[<p>@joe: can we add this in?</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Tue, 28 Mar 2017 16:55:48 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=27647#p27647</guid>
		</item>
		<item>
			<title><![CDATA[Re: Not exactly bug -Reference Auto Increment when prefix size is bigger]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=27644#p27644</link>
			<description><![CDATA[<p>Solution: replace &#039;strlen&#039; with &#039;mb_strlen&#039; and everything works fine...</p>]]></description>
			<author><![CDATA[null@example.com (stefan)]]></author>
			<pubDate>Sun, 26 Mar 2017 16:54:10 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=27644#p27644</guid>
		</item>
		<item>
			<title><![CDATA[Re: Not exactly bug -Reference Auto Increment when prefix size is bigger]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=27643#p27643</link>
			<description><![CDATA[<p>What is the sql statement after the variables get populated? Does the evaluation of the expressions match the desired sql output?</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Sun, 26 Mar 2017 16:48:21 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=27643#p27643</guid>
		</item>
		<item>
			<title><![CDATA[Re: Not exactly bug -Reference Auto Increment when prefix size is bigger]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=27642#p27642</link>
			<description><![CDATA[<p>&quot;The prefix field is defined as CHAR in the original sql - why did you change it to VARCHAR?&quot; - To avoid blocking problems with cyrilic alphabet characters.</p><p>In the actual statement the prefix is displayed 1:1</p>]]></description>
			<author><![CDATA[null@example.com (stefan)]]></author>
			<pubDate>Sun, 26 Mar 2017 11:23:42 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=27642#p27642</guid>
		</item>
		<item>
			<title><![CDATA[Re: Not exactly bug -Reference Auto Increment when prefix size is bigger]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=27635#p27635</link>
			<description><![CDATA[<p>The <strong>prefix</strong> field is defined as CHAR in the original sql - why did you change it to VARCHAR?</p><p>Display the actual SQL statement after replacement of the variables and compare with the <strong>$ref_fld</strong> value. Refer <a href="https://frontaccounting.com/fawiki/index.php?n=Devel.TrobleshootingFrontAccounting">Troubleshooting FA</a> in the wiki.</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Sun, 26 Mar 2017 07:39:05 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=27635#p27635</guid>
		</item>
		<item>
			<title><![CDATA[Re: Not exactly bug -Reference Auto Increment when prefix size is bigger]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=27632#p27632</link>
			<description><![CDATA[<p>This query in includes/references.inc returns 0 when prefix is longer... When prefix is short it returns number</p><p>// retrieve last ref number in the refline from original transaction table<br />$sql = &quot;SELECT MAX(CAST(SUBSTR($ref_fld, &quot;.(strlen($prefix)+1).&quot;,LENGTH($ref_fld)-&quot;.(strlen($postfix)+strlen($prefix)).&quot;) AS UNSIGNED))&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .&quot; FROM `$trans_table` tbl<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LEFT JOIN &quot;.TB_PREF.&quot;voided v ON tbl.`$tno_fld`=v.id AND v.type=$type&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .&quot; WHERE ISNULL(v.id)&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .($type_fld ? &quot; AND tbl.`$type_fld`=$type&quot; : &#039;&#039;)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .&quot; AND `$ref_fld` REGEXP &quot;.db_escape(&#039;^&#039;.preg_quote($prefix).&#039;[0-9]*&#039;.preg_quote($postfix).&#039;$&#039;);</p>]]></description>
			<author><![CDATA[null@example.com (stefan)]]></author>
			<pubDate>Sat, 25 Mar 2017 19:37:22 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=27632#p27632</guid>
		</item>
		<item>
			<title><![CDATA[Re: Not exactly bug -Reference Auto Increment when prefix size is bigger]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=27631#p27631</link>
			<description><![CDATA[<p>Yes, it&#039;s 2.4.rc1 reflines table.</p><p>It is increased to 12. All refs are recorded and recalled correctly, but the auto increment of reflines with prefix longer than 5 characters is not working.</p><p>It looks like this and with the short prefixes works perfect, so i guess this is hard-coded somewhere else about the auto increment, and I can&#039;t find where.</p><p>Here is the DB table config:</p><p>`prefix` varchar(12) COLLATE utf8_unicode_ci NOT NULL DEFAULT &#039;&#039;,</p>]]></description>
			<author><![CDATA[null@example.com (stefan)]]></author>
			<pubDate>Sat, 25 Mar 2017 19:11:00 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=27631#p27631</guid>
		</item>
		<item>
			<title><![CDATA[Re: Not exactly bug -Reference Auto Increment when prefix size is bigger]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=27629#p27629</link>
			<description><![CDATA[<p>Are you referring to FA 2.4RC1 <em>Setup =&gt; Transaction References</em> ?</p><p>If so, you might want to increase the prefix size from the default of 5 in the table:<br /></p><div class="codebox"><pre><code>ALTER TABLE `0_reflines` CHANGE `prefix` `prefix` CHAR(10) DEFAULT &#039;&#039; NOT NULL; </code></pre></div>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Sat, 25 Mar 2017 17:20:17 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=27629#p27629</guid>
		</item>
		<item>
			<title><![CDATA[Not exactly bug -Reference Auto Increment when prefix size is bigger]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=27625#p27625</link>
			<description><![CDATA[<p>I need to change the size of the prefix of the reflines. I have changed the size of DB cell and it is joined, recorded and displayed with the number correctly.<br />However, when the prefix is with more than 5 characters, the number after the prefix does not auto increase. I can&#039;t find where to change the prefix size for the auto increment purposes. It seems to be done in /includes/references.inc but I am not good enough to handle this my self. </p><p>I need the long prefixes for Sales Orders and Delivery Notes</p>]]></description>
			<author><![CDATA[null@example.com (stefan)]]></author>
			<pubDate>Fri, 24 Mar 2017 10:20:59 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=27625#p27625</guid>
		</item>
	</channel>
</rss>
