<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[FrontAccounting forum — Not exactly bug -Reference Auto Increment when prefix size is bigger]]></title>
	<link rel="self" href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=6724&amp;type=atom" />
	<updated>2017-03-30T05:53:30Z</updated>
	<generator>PunBB</generator>
	<id>https://frontaccounting.com/punbb/viewtopic.php?id=6724</id>
		<entry>
			<title type="html"><![CDATA[Re: Not exactly bug -Reference Auto Increment when prefix size is bigger]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=27653#p27653" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2017-03-30T05:53:30Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=27653#p27653</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Not exactly bug -Reference Auto Increment when prefix size is bigger]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=27647#p27647" />
			<content type="html"><![CDATA[<p>@joe: can we add this in?</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2017-03-28T16:55:48Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=27647#p27647</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Not exactly bug -Reference Auto Increment when prefix size is bigger]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=27644#p27644" />
			<content type="html"><![CDATA[<p>Solution: replace &#039;strlen&#039; with &#039;mb_strlen&#039; and everything works fine...</p>]]></content>
			<author>
				<name><![CDATA[stefan]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=20008</uri>
			</author>
			<updated>2017-03-26T16:54:10Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=27644#p27644</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Not exactly bug -Reference Auto Increment when prefix size is bigger]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=27643#p27643" />
			<content type="html"><![CDATA[<p>What is the sql statement after the variables get populated? Does the evaluation of the expressions match the desired sql output?</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2017-03-26T16:48:21Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=27643#p27643</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Not exactly bug -Reference Auto Increment when prefix size is bigger]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=27642#p27642" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[stefan]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=20008</uri>
			</author>
			<updated>2017-03-26T11:23:42Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=27642#p27642</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Not exactly bug -Reference Auto Increment when prefix size is bigger]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=27635#p27635" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2017-03-26T07:39:05Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=27635#p27635</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Not exactly bug -Reference Auto Increment when prefix size is bigger]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=27632#p27632" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[stefan]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=20008</uri>
			</author>
			<updated>2017-03-25T19:37:22Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=27632#p27632</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Not exactly bug -Reference Auto Increment when prefix size is bigger]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=27631#p27631" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[stefan]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=20008</uri>
			</author>
			<updated>2017-03-25T19:11:00Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=27631#p27631</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Not exactly bug -Reference Auto Increment when prefix size is bigger]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=27629#p27629" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2017-03-25T17:20:17Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=27629#p27629</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Not exactly bug -Reference Auto Increment when prefix size is bigger]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=27625#p27625" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[stefan]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=20008</uri>
			</author>
			<updated>2017-03-24T10:20:59Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=27625#p27625</id>
		</entry>
</feed>
