<?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 Voiding Customer Payment]]></title>
		<link>https://frontaccounting.com/punbb/viewtopic.php?id=10111</link>
		<atom:link href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=10111&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Bug in Voiding Customer Payment.]]></description>
		<lastBuildDate>Fri, 02 Dec 2022 07:28:16 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Bug in Voiding Customer Payment]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=41795#p41795</link>
			<description><![CDATA[<p>Ok Thank you. I missed that Post earlier</p>]]></description>
			<author><![CDATA[null@example.com (boxygen)]]></author>
			<pubDate>Fri, 02 Dec 2022 07:28:16 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=41795#p41795</guid>
		</item>
		<item>
			<title><![CDATA[Re: Bug in Voiding Customer Payment]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=41794#p41794</link>
			<description><![CDATA[<p>This bug has already been fixed, see topic</p><p><a href="https://frontaccounting.com/punbb/viewtopic.php?id=10038]">https://frontaccounting.com/punbb/viewt … ?id=10038]</a>.</p><p>Joe</p>]]></description>
			<author><![CDATA[null@example.com (joe)]]></author>
			<pubDate>Fri, 02 Dec 2022 06:41:59 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=41794#p41794</guid>
		</item>
		<item>
			<title><![CDATA[Bug in Voiding Customer Payment]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=41792#p41792</link>
			<description><![CDATA[<p>I faced a case with one of my installation.</p><p>I tried voiding a Customer Payment.</p><p>When It comes to the following Line of code in void_transaction() function</p><div class="codebox"><pre><code>case ST_CUSTPAYMENT : // it&#039;s a customer payment
            if (!check_void_bank_trans($type, $type_no))
                return _(&#039;This transaction cannot be voided because the operation would decrease account balance below allowed limit in some point of account history.&#039;);
        case ST_SALESINVOICE : // it&#039;s a customer invoice
             if (is_cust_invoice_credited($type_no))
                return _(&#039;This invoice cannot be voided because it was already credited.&#039;);

    case ST_CUSTCREDIT : // it&#039;s a customer credit note
        case ST_CUSTDELIVERY : // it&#039;s a customer dispatch
            if (!exists_customer_trans($type, $type_no))
                return _(&#039;Selected transaction does not exists.&#039;);
            if ($type == ST_CUSTDELIVERY)    // added 04 Oct 2008 by Joe Hunt. If delivery note has a not voided invoice, then NO.
            {
                $vers = get_customer_trans_version($type, $type_no);
                if ($vers[$type_no] == 1) {
                    $childs = get_sales_child_lines($type, $type_no, false); // 2011-03-17 This had been changed. Joe
                    if ($childs &amp;&amp; db_num_rows($childs))
                        return _(&#039;This delivery cannot be voided because it was already invoiced.&#039;);
                }
            }
            post_void_customer_trans($type, $type_no);
            break;</code></pre></div><p>it gave the error message <strong>This invoice cannot be voided because it was already credited</strong></p><p>Means there is no break after ST_CUSTPAYMENT condition so it attempted the next switch case ST_SALESINVOICE</p><p>I resolved the bug with following changes.</p><div class="codebox"><pre><code>case ST_CUSTPAYMENT : // it&#039;s a customer payment
            if (!check_void_bank_trans($type, $type_no))
                return _(&#039;This transaction cannot be voided because the operation would decrease account balance below allowed limit in some point of account history.&#039;);
            post_void_customer_trans($type, $type_no);
            break;
        case ST_SALESINVOICE : // it&#039;s a customer invoice
             if (is_cust_invoice_credited($type_no))
                return _(&#039;This invoice cannot be voided because it was already credited.&#039;);
            post_void_customer_trans($type, $type_no);
            break;</code></pre></div><p>Please let me know if this is the right way to handle this bug?</p>]]></description>
			<author><![CDATA[null@example.com (boxygen)]]></author>
			<pubDate>Fri, 02 Dec 2022 06:00:42 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=41792#p41792</guid>
		</item>
	</channel>
</rss>
