<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[FrontAccounting forum — Bug in Voiding Customer Payment]]></title>
	<link rel="self" href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=10111&amp;type=atom" />
	<updated>2022-12-02T07:28:16Z</updated>
	<generator>PunBB</generator>
	<id>https://frontaccounting.com/punbb/viewtopic.php?id=10111</id>
		<entry>
			<title type="html"><![CDATA[Re: Bug in Voiding Customer Payment]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=41795#p41795" />
			<content type="html"><![CDATA[<p>Ok Thank you. I missed that Post earlier</p>]]></content>
			<author>
				<name><![CDATA[boxygen]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=20175</uri>
			</author>
			<updated>2022-12-02T07:28:16Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=41795#p41795</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Bug in Voiding Customer Payment]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=41794#p41794" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[joe]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=3</uri>
			</author>
			<updated>2022-12-02T06:41:59Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=41794#p41794</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Bug in Voiding Customer Payment]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=41792#p41792" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[boxygen]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=20175</uri>
			</author>
			<updated>2022-12-02T06:00:42Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=41792#p41792</id>
		</entry>
</feed>
