<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[FrontAccounting forum — Bug Found in Invoice Creation]]></title>
		<link>https://frontaccounting.com/punbb/viewtopic.php?id=10163</link>
		<atom:link href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=10163&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Bug Found in Invoice Creation.]]></description>
		<lastBuildDate>Sat, 28 Jan 2023 04:17:21 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Bug Found in Invoice Creation]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=41981#p41981</link>
			<description><![CDATA[<p>I have been facing this issue quite a long but couldn&#039;t find the reason becuase this is not happening always but only once in 1000 attempts may be.</p><p>While Creating Invoice From Delivery Notes a function <strong>write_customer_trans_detail_item</strong> is called from customer_invoice.php with following backtrace and function arguments</p><div class="codebox"><pre><code>Function Arguments
(
    [0] =&gt; 10
    [1] =&gt; 916
    [2] =&gt; 10036
    [3] =&gt; 50/3 Polyester Color SKY 2500
    [4] =&gt; 88
    [5] =&gt; 139
    [6] =&gt; 0
    [7] =&gt; 0
    [8] =&gt; 62.160883841992
    [9] =&gt; 9783
    [10] =&gt; 9783
)
/home/sites/22a/e/eeb3fd1d98/public_html/boxyerp/sales/includes/db/sales_invoice_db.inc:122: write_customer_trans_detail_item(&#039;10&#039;,&#039;916&#039;,&#039;10036&#039;,&#039;50/3 Polyester Color SKY 2500&#039;,&#039;88&#039;,&#039;139&#039;,&#039;0&#039;,&#039;0&#039;,&#039;62.160883841992&#039;,&#039;9783&#039;,&#039;9783&#039;)

/home/sites/22a/e/eeb3fd1d98/public_html/boxyerp/sales/includes/cart_class.inc:343: write_sales_invoice((Cart Object))

/home/sites/22a/e/eeb3fd1d98/public_html/boxyerp/sales/customer_invoice.php:396: (Cart Object)-&gt;write()&lt;/td</code></pre></div><p>I have just added following lines in the beginning of function to alert the user</p><div class="codebox"><pre><code>function write_customer_trans_detail_item($debtor_trans_type, $debtor_trans_no, $stock_id, $description,
    $quantity, $unit_price, $unit_tax, $discount_percent, $std_cost, $src_id, $line_id=0)
{
    if ($debtor_trans_type == ST_SALESINVOICE &amp;&amp; $src_id == $line_id){
        display_error (&quot;High Alert. Bug Found in Invoice Creation. Please Try Again&quot;);
        exit();
    }</code></pre></div><p>Here $line_id was supposed to be Zero but it was same as $src_id and that is creating a big database anomaly.</p><p>Still trying to investigate why this happens.<br />Just sharing here if anyone else facing same issue.</p><p>Regards.</p>]]></description>
			<author><![CDATA[null@example.com (boxygen)]]></author>
			<pubDate>Sat, 28 Jan 2023 04:17:21 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=41981#p41981</guid>
		</item>
	</channel>
</rss>
