<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[FrontAccounting forum — Bug in Customer Payments Recording]]></title>
	<link rel="self" href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=9125&amp;type=atom" />
	<updated>2021-02-04T07:28:50Z</updated>
	<generator>PunBB</generator>
	<id>https://frontaccounting.com/punbb/viewtopic.php?id=9125</id>
		<entry>
			<title type="html"><![CDATA[Re: Bug in Customer Payments Recording]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=39091#p39091" />
			<content type="html"><![CDATA[<p>This has now been fixed and committed to stable repo.</p><p>The fixed file can be downloaded <a href="https://sourceforge.net/p/frontaccounting/git/ci/master/tree/includes/ui/allocation_cart.inc">here</a>.</p><p>/Joe</p>]]></content>
			<author>
				<name><![CDATA[joe]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=3</uri>
			</author>
			<updated>2021-02-04T07:28:50Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=39091#p39091</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Bug in Customer Payments Recording]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=39089#p39089" />
			<content type="html"><![CDATA[<p>As I noted earlier, this fix will still throw an error when you have purchase orders on the supplier payment form. I still stand with the fix I provided. It will cater for all scenarios for both customer and supplier payments.</p>]]></content>
			<author>
				<name><![CDATA[detkenn]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=45282</uri>
			</author>
			<updated>2021-02-03T17:28:57Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=39089#p39089</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Bug in Customer Payments Recording]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=39088#p39088" />
			<content type="html"><![CDATA[<p>Thank you guys for solving this. Will fix and commit the changes tonight.</p><p>Joe</p>]]></content>
			<author>
				<name><![CDATA[joe]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=3</uri>
			</author>
			<updated>2021-02-03T17:11:41Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=39088#p39088</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Bug in Customer Payments Recording]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=39087#p39087" />
			<content type="html"><![CDATA[<p>The similar handling needs to be done for Supplier Transactions Allocation at Line # 410</p><div class="codebox"><pre><code>                $trans = get_supp_trans($_SESSION[&#039;alloc&#039;]-&gt;allocs[$counter]-&gt;type_no, $_SESSION[&#039;alloc&#039;]-&gt;allocs[$counter]-&gt;type, $_SESSION[&#039;alloc&#039;]-&gt;person_id);            </code></pre></div><p>I suggest to commit the core for this.</p>]]></content>
			<author>
				<name><![CDATA[boxygen]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=20175</uri>
			</author>
			<updated>2021-02-03T09:57:12Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=39087#p39087</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Bug in Customer Payments Recording]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=39033#p39033" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>boxygen wrote:</cite><blockquote><p>The bug I am going to detail here needs a scenario.</p><p>Using on Journal Entry I recorded the Opening Balances of all customers.<br />Upon recording payment for one out of those customers I encountered following error.</p><div class="codebox"><pre><code>/PATH-TO-FA/includes/errors.inc:207:    trigger_error(&#039;DATABASE ERROR : duplicate debtor transactions found for given params
sql that failed was : SELECT trans.*,ov_amount+ov_gst+ov_freight+ov_freight_tax+ov_discount AS Total,cust.name AS DebtorName, cust.address, cust.curr_code, cust.tax_id, trans.prep_amount&gt;0 as prepaid,com.memo_, branch.* FROM debtor_trans trans LEFT JOIN comments com ON trans.type=com.type AND trans.trans_no=com.id LEFT JOIN shippers ON shippers.shipper_id=trans.ship_via, debtors_master cust, cust_branch branch WHERE trans.trans_no=&#039;96&#039; AND trans.type=&#039;0&#039; AND trans.debtor_no=cust.debtor_no AND branch.branch_code = trans.branch_code


&#039;,&#039;256&#039;)
/PATH-TO-FA/sales/includes/db/cust_trans_db.inc:214:    display_db_error(&#039;duplicate debtor transactions found for given params&#039;,&#039;SELECT trans.*,ov_amount+ov_gst+ov_freight+ov_freight_tax+ov_discount AS Total,cust.name AS DebtorName, cust.address, cust.curr_code, cust.tax_id, trans.prep_amount&gt;0 as prepaid,com.memo_, branch.* FROM &amp;TB_PREF&amp;debtor_trans trans LEFT JOIN &amp;TB_PREF&amp;comments com ON trans.type=com.type AND trans.trans_no=com.id LEFT JOIN &amp;TB_PREF&amp;shippers ON &amp;TB_PREF&amp;shippers.shipper_id=trans.ship_via, &amp;TB_PREF&amp;debtors_master cust, &amp;TB_PREF&amp;cust_branch branch WHERE trans.trans_no=&#039;96&#039; AND trans.type=&#039;0&#039; AND trans.debtor_no=cust.debtor_no AND branch.branch_code = trans.branch_code &#039;,&#039;1&#039;)
/PATH-TO-FA/includes/ui/allocation_cart.inc:381:    get_customer_trans(&#039;96&#039;,&#039;0&#039;)
/PATH-TO-FA/sales/customer_payments.php:222:    check_allocations()
/PATH-TO-FA/sales/customer_payments.php:236:    can_process()</code></pre></div><p>The reason for this bug is that multiple customer payments are recorded for One Transaction Number and Same Transaction Type.</p><p>I found the solution to this is to add 3rd argument in function call <strong>get_customer_trans()</strong> in <strong>/includes/ui/allocation_cart.inc</strong> as below on Line#399</p><div class="codebox"><pre><code>                $trans = get_customer_trans($_SESSION[&#039;alloc&#039;]-&gt;allocs[$counter]-&gt;type_no, $_SESSION[&#039;alloc&#039;]-&gt;allocs[$counter]-&gt;type, $_SESSION[&#039;alloc&#039;]-&gt;person_id);</code></pre></div><p>I hope this shall not cause any other bug.</p></blockquote></div><p>The suggested solution for line 399 worked. Will report if I find another issue as a result.</p>]]></content>
			<author>
				<name><![CDATA[seahawk]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=544</uri>
			</author>
			<updated>2021-01-25T13:26:48Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=39033#p39033</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Bug in Customer Payments Recording]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=39032#p39032" />
			<content type="html"><![CDATA[<p>I also experience this issue where I had to do a journal entry to fix the Debtors control account and outstanding balances. Now because there is an unallocated journal entry, I cannot process the Allocate Customer Payment nor add Customer payment nor Bank Deposit.&nbsp; When I process nothing happens. This means that the client account is stuck, but the debtor&#039;s control account balances is now correct.</p><p>How do we fix this issue?</p>]]></content>
			<author>
				<name><![CDATA[seahawk]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=544</uri>
			</author>
			<updated>2021-01-25T13:16:33Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=39032#p39032</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Bug in Customer Payments Recording]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=38899#p38899" />
			<content type="html"><![CDATA[<p>I will ask Janusz to look into this.</p><p>/Joe</p>]]></content>
			<author>
				<name><![CDATA[joe]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=3</uri>
			</author>
			<updated>2021-01-10T06:53:26Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=38899#p38899</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Bug in Customer Payments Recording]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=38897#p38897" />
			<content type="html"><![CDATA[<p>@joe, @itronics: ??</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2021-01-10T04:56:42Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=38897#p38897</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Bug in Customer Payments Recording]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=38895#p38895" />
			<content type="html"><![CDATA[<p>This line of code was modified a while ago in this topic:<a href="http://frontaccounting.com/punbb/viewtopic.php?id=8672">frontaccounting.com/punbb/viewtopic.php?id=8672</a><br />This code however throws an error on journal entries (As mentioned above), Prepaid sales Orders and purchase orders. To rectify all these I have modified the code as below:</p><div class="codebox"><pre><code>if ($_SESSION[&#039;alloc&#039;]-&gt;person_type == PT_CUSTOMER) {
            if ($_SESSION[&#039;alloc&#039;]-&gt;allocs[$counter]-&gt;type == ST_SALESORDER)
                $trans = get_sales_order_header($_SESSION[&#039;alloc&#039;]-&gt;allocs[$counter]-&gt;type_no, $_SESSION[&#039;alloc&#039;]-&gt;allocs[$counter]-&gt;type);
            else if($_SESSION[&#039;alloc&#039;]-&gt;allocs[$counter]-&gt;type == ST_JOURNAL){
                            $trans[&#039;debtor_no&#039;] = db_num_rows(get_gl_transactions($_SESSION[&#039;alloc&#039;]-&gt;allocs[$counter]-&gt;date_, $_SESSION[&#039;alloc&#039;]-&gt;allocs[$counter]-&gt;date_, $_SESSION[&#039;alloc&#039;]-&gt;allocs[$counter]-&gt;type_no,null, 0, 0, $_SESSION[&#039;alloc&#039;]-&gt;allocs[$counter]-&gt;type,null,null, PT_CUSTOMER, $_SESSION[&#039;alloc&#039;]-&gt;person_id))?$_SESSION[&#039;alloc&#039;]-&gt;person_id:0;
                        } else
                $trans = get_customer_trans($_SESSION[&#039;alloc&#039;]-&gt;allocs[$counter]-&gt;type_no, $_SESSION[&#039;alloc&#039;]-&gt;allocs[$counter]-&gt;type);

            if ($trans[&#039;debtor_no&#039;] != $_SESSION[&#039;alloc&#039;]-&gt;person_id) {
                display_error(_(&quot;Allocated transaction allocated is not related to company selected.&quot;));
                set_focus(&#039;amount&#039;.$counter);
                return false;
            }
        } elseif ($_SESSION[&#039;alloc&#039;]-&gt;person_type == PT_SUPPLIER) {
            if ($_SESSION[&#039;alloc&#039;]-&gt;allocs[$counter]-&gt;type == ST_PURCHORDER)
                $trans[&#039;supplier_id&#039;] = $_SESSION[&#039;alloc&#039;]-&gt;person_id;
            else if($_SESSION[&#039;alloc&#039;]-&gt;allocs[$counter]-&gt;type == ST_JOURNAL){
                            $trans[&#039;supplier_id&#039;] = db_num_rows(get_gl_transactions($_SESSION[&#039;alloc&#039;]-&gt;allocs[$counter]-&gt;date_, $_SESSION[&#039;alloc&#039;]-&gt;allocs[$counter]-&gt;date_, $_SESSION[&#039;alloc&#039;]-&gt;allocs[$counter]-&gt;type_no,null, 0, 0, $_SESSION[&#039;alloc&#039;]-&gt;allocs[$counter]-&gt;type,null,null, PT_SUPPLIER, $_SESSION[&#039;alloc&#039;]-&gt;person_id))?$_SESSION[&#039;alloc&#039;]-&gt;person_id:0;
                        } else 
                            $trans = get_supp_trans($_SESSION[&#039;alloc&#039;]-&gt;allocs[$counter]-&gt;type_no, $_SESSION[&#039;alloc&#039;]-&gt;allocs[$counter]-&gt;type);
            if ($trans[&#039;supplier_id&#039;] != $_SESSION[&#039;alloc&#039;]-&gt;person_id) {
                display_error(_(&quot;Allocated transaction allocated is not related to company selected.&quot;));
                set_focus(&#039;amount&#039;.$counter);
                return false;
            }
        }</code></pre></div><p>@Administrators please re-look into this issue because this bug is serious</p>]]></content>
			<author>
				<name><![CDATA[detkenn]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=45282</uri>
			</author>
			<updated>2021-01-09T20:53:46Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=38895#p38895</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Bug in Customer Payments Recording]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=38801#p38801" />
			<content type="html"><![CDATA[<p>The bug I am going to detail here needs a scenario.</p><p>Using on Journal Entry I recorded the Opening Balances of all customers.<br />Upon recording payment for one out of those customers I encountered following error.</p><div class="codebox"><pre><code>/PATH-TO-FA/includes/errors.inc:207:    trigger_error(&#039;DATABASE ERROR : duplicate debtor transactions found for given params
sql that failed was : SELECT trans.*,ov_amount+ov_gst+ov_freight+ov_freight_tax+ov_discount AS Total,cust.name AS DebtorName, cust.address, cust.curr_code, cust.tax_id, trans.prep_amount&gt;0 as prepaid,com.memo_, branch.* FROM debtor_trans trans LEFT JOIN comments com ON trans.type=com.type AND trans.trans_no=com.id LEFT JOIN shippers ON shippers.shipper_id=trans.ship_via, debtors_master cust, cust_branch branch WHERE trans.trans_no=&#039;96&#039; AND trans.type=&#039;0&#039; AND trans.debtor_no=cust.debtor_no AND branch.branch_code = trans.branch_code


&#039;,&#039;256&#039;)
/PATH-TO-FA/sales/includes/db/cust_trans_db.inc:214:    display_db_error(&#039;duplicate debtor transactions found for given params&#039;,&#039;SELECT trans.*,ov_amount+ov_gst+ov_freight+ov_freight_tax+ov_discount AS Total,cust.name AS DebtorName, cust.address, cust.curr_code, cust.tax_id, trans.prep_amount&gt;0 as prepaid,com.memo_, branch.* FROM &amp;TB_PREF&amp;debtor_trans trans LEFT JOIN &amp;TB_PREF&amp;comments com ON trans.type=com.type AND trans.trans_no=com.id LEFT JOIN &amp;TB_PREF&amp;shippers ON &amp;TB_PREF&amp;shippers.shipper_id=trans.ship_via, &amp;TB_PREF&amp;debtors_master cust, &amp;TB_PREF&amp;cust_branch branch WHERE trans.trans_no=&#039;96&#039; AND trans.type=&#039;0&#039; AND trans.debtor_no=cust.debtor_no AND branch.branch_code = trans.branch_code &#039;,&#039;1&#039;)
/PATH-TO-FA/includes/ui/allocation_cart.inc:381:    get_customer_trans(&#039;96&#039;,&#039;0&#039;)
/PATH-TO-FA/sales/customer_payments.php:222:    check_allocations()
/PATH-TO-FA/sales/customer_payments.php:236:    can_process()</code></pre></div><p>The reason for this bug is that multiple customer payments are recorded for One Transaction Number and Same Transaction Type.</p><p>I found the solution to this is to add 3rd argument in function call get_customer_trans() in /includes/ui/allocation_cart.inc as below on Line#399</p><div class="codebox"><pre><code>                $trans = get_customer_trans($_SESSION[&#039;alloc&#039;]-&gt;allocs[$counter]-&gt;type_no, $_SESSION[&#039;alloc&#039;]-&gt;allocs[$counter]-&gt;type, $_SESSION[&#039;alloc&#039;]-&gt;person_id);</code></pre></div><p>I hope this shall not cause any other bug.</p>]]></content>
			<author>
				<name><![CDATA[boxygen]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=20175</uri>
			</author>
			<updated>2020-12-21T15:54:24Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=38801#p38801</id>
		</entry>
</feed>
