<?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 in Customer Payments Recording]]></title>
		<link>https://frontaccounting.com/punbb/viewtopic.php?id=9125</link>
		<atom:link href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=9125&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Bug in Customer Payments Recording.]]></description>
		<lastBuildDate>Thu, 04 Feb 2021 07:28:50 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Bug in Customer Payments Recording]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=39091#p39091</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (joe)]]></author>
			<pubDate>Thu, 04 Feb 2021 07:28:50 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=39091#p39091</guid>
		</item>
		<item>
			<title><![CDATA[Re: Bug in Customer Payments Recording]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=39089#p39089</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (detkenn)]]></author>
			<pubDate>Wed, 03 Feb 2021 17:28:57 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=39089#p39089</guid>
		</item>
		<item>
			<title><![CDATA[Re: Bug in Customer Payments Recording]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=39088#p39088</link>
			<description><![CDATA[<p>Thank you guys for solving this. Will fix and commit the changes tonight.</p><p>Joe</p>]]></description>
			<author><![CDATA[null@example.com (joe)]]></author>
			<pubDate>Wed, 03 Feb 2021 17:11:41 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=39088#p39088</guid>
		</item>
		<item>
			<title><![CDATA[Re: Bug in Customer Payments Recording]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=39087#p39087</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (boxygen)]]></author>
			<pubDate>Wed, 03 Feb 2021 09:57:12 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=39087#p39087</guid>
		</item>
		<item>
			<title><![CDATA[Re: Bug in Customer Payments Recording]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=39033#p39033</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (seahawk)]]></author>
			<pubDate>Mon, 25 Jan 2021 13:26:48 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=39033#p39033</guid>
		</item>
		<item>
			<title><![CDATA[Re: Bug in Customer Payments Recording]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=39032#p39032</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (seahawk)]]></author>
			<pubDate>Mon, 25 Jan 2021 13:16:33 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=39032#p39032</guid>
		</item>
		<item>
			<title><![CDATA[Re: Bug in Customer Payments Recording]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=38899#p38899</link>
			<description><![CDATA[<p>I will ask Janusz to look into this.</p><p>/Joe</p>]]></description>
			<author><![CDATA[null@example.com (joe)]]></author>
			<pubDate>Sun, 10 Jan 2021 06:53:26 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=38899#p38899</guid>
		</item>
		<item>
			<title><![CDATA[Re: Bug in Customer Payments Recording]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=38897#p38897</link>
			<description><![CDATA[<p>@joe, @itronics: ??</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Sun, 10 Jan 2021 04:56:42 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=38897#p38897</guid>
		</item>
		<item>
			<title><![CDATA[Re: Bug in Customer Payments Recording]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=38895#p38895</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (detkenn)]]></author>
			<pubDate>Sat, 09 Jan 2021 20:53:46 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=38895#p38895</guid>
		</item>
		<item>
			<title><![CDATA[Bug in Customer Payments Recording]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=38801#p38801</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (boxygen)]]></author>
			<pubDate>Mon, 21 Dec 2020 15:54:24 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=38801#p38801</guid>
		</item>
	</channel>
</rss>
