1 (edited by doug86 10/19/2022 05:17:11 pm)

Topic: Can't void customer payment

Hi All,

I'm running 2.4.13 although the payments in question may have been entered under 2.4.9

I have a customer payment which isn't allocated to anything (in fact I have two).

If I try to void the transaction I get the error "This invoice cannot be voided because it was already credited."

Again, I'm trying to void a customer payment, not an invoice.

The bank account has (and did have) enough in it to avoid going negative.

Any help appretiated.

Re: Can't void customer payment

With go_debug set to 2 I get the following extra info:

/PATH/frontaccounting/includes/ui/ui_msgs.inc:14:    trigger_error('This invoice cannot be voided because it was already credited.','256')
/PATH/frontaccounting/admin/void_transaction.php:320:    display_error('This invoice cannot be voided because it was already credited.')
/PATH/frontaccounting/admin/void_transaction.php:345:    handle_void_transaction()

Re: Can't void customer payment

This is an issue in core.

@joe check admin/db/voiding_db.inc line no 44 onwards. The void for customer payment and sales invoice is missing. And also along with break.

Is it have any specific reason for removing it, if its removed recently ?

Subscription service based on FA
HRM CRM POS batch Themes

Re: Can't void customer payment

This is strange. I have no problem voiding customer payments.

There are no missing lines in /admin/db/voiding_db.inc.

You can download the right file here.

Joe

Re: Can't void customer payment

But there  should be a problem in it. I will further check this and let you know

Subscription service based on FA
HRM CRM POS batch Themes

Re: Can't void customer payment

Thanks so far! kvvaradha, did you find an issue or Should I just replace my /admin/db/voiding_db.inc with the one linked above?

Thanks!

Doug x

Re: Can't void customer payment

Not yet traced this problem again.
But my above solution worked.

Subscription service based on FA
HRM CRM POS batch Themes

Re: Can't void customer payment

I replaced my admin/db/voiding_db.inc with the file linked above however the files were the exact same size and the problem remains.

Doing a diff on the two files shows they are the same.

Happy to cary out any experiments that might be useful!

Dx


This invoice cannot be voided because it was already credited.
/PATH/frontaccounting/includes/ui/ui_msgs.inc:14:    trigger_error('This invoice cannot be voided because it was already credited.','256')
/PATH/frontaccounting/admin/void_transaction.php:320:    display_error('This invoice cannot be voided because it was already credited.')
/PATH/frontaccounting/admin/void_transaction.php:345:    handle_void_transaction()

Re: Can't void customer payment

The reason you are encountering this problem is because you won the lottery: you happen to have an invoice with the same transaction number that cannot be voided.

The code is indeed broken.  A void of a customer payment shouldn't fall through the case statement and check for an invoice using the same transaction number (is_cust_invoice_credited).

This should be an easy fix.  You can condition the call to cust_invoice_credited with && $type == ST_SALES_INVOICE

Re: Can't void customer payment

Thanks @Braath Waate.

This has been fixed in the core and committed to stable repo.

The fixed file can be downloaded here.

Joe

Re: Can't void customer payment

Sorry, I meant to say ST_SALESINVOICE instead of ST_SALES_INVOICE.

Line 48 should read:
if ($type == ST_SALESINVOICE && is_cust_invoice_credited($type_no))

That way, the call to is_cust_invoice_credited is not called unless the type is an invoice.

Re: Can't void customer payment

Oops, will make a rerun.

Joe

Re: Can't void customer payment

Thanks Everyone, works as expected!

Dx

Re: Can't void customer payment

Sorry! False alarm. Should check things myself.

Still getting the same error with 2.4.14 from source forge.

Let me know if I can help narrow it down.

Dx

Re: Can't void customer payment

@doug86

Did you download the new file /admin/db/voiding_db.inc and replaced it after the new install from sourceforge.net?
This install file is not updated yet. This file is only updated after a new release.

Joe

Re: Can't void customer payment

@joe

Break is missing for  payment and invoice  cases.  Can we try this. ?

Subscription service based on FA
HRM CRM POS batch Themes

Re: Can't void customer payment

Shouldn't the return statements obviate the need for break statements.

Re: Can't void customer payment

@joe did you check the break missing on voiding_db.inc

Subscription service based on FA
HRM CRM POS batch Themes

Re: Can't void customer payment

@kvvaradha

There are no missing breaks. I will explain.

The Customer Payment and the Sales Invoice must fall thru down to post_void_customer_trans($type, $type_no) on line 63 (inside ST_CUSTCREDIT and ST_CUSTDELIVERY.

Joe

Re: Can't void customer payment

Just check this way.

Customerpayment fall through the invoice,  there we are passing only the trans_no. Not type. So what happens that tries to check the same customer payment trans_no on invoice.  If the invoice exist. It voids the invoice instead of payment.

I am sure that fall through idea is not good here. So you need to have separate post_void_customer_trans.  Hope you got me explanation. If not let me explain with an example

Subscription service based on FA
HRM CRM POS batch Themes

Re: Can't void customer payment

@kvvaradha

I hope you are looking at the last committed code from the core.

In the Invoice case we are first testing for $type == ST_SALESINVOICE before the return action (not voiding).

The code works smoothly. And it falls down to post_void_customer_trans with the correct $type and $type_no.

The $type and $type_no are never changed inside the function.

Joe