VirtueMart Forum

VirtueMart 2 + 3 => Virtuemart Development and bug reports => Topic started by: sprachrohr on May 22, 2020, 09:17:29 am

Title: Wrong Invoice Number - ends with 01
Post by: sprachrohr on May 22, 2020, 09:17:29 am
Hi,

is there a bug in creating invoice numbers?

I'm using VM 3.8.2 an Joomla 3.9.18. Invoice numbers are created correct, if i update the order satus from the orders list view.
When i update the order status from the order details view, i allways get an invoice number ending with 01.

Is this a bug? Did i miss something? Can anyone confirm?

Thanks for your help!
Best regards
Title: Re: Wrong Invoice Number - ends with 01
Post by: Jörgen on May 22, 2020, 10:06:16 am
Quote
Invoice numbers are created correct,

What does this mean ? Order number is not the same as invoice number.

Quote
When i update the order status from the order details view, i allways get an invoice number ending with 01

Invoice should only be created one time right ? This means same invoive number or a, am I wrong ?

Are You using any plugin for the order and invoise numbers ?

Jörgen @ Kreativ Fotografi
Title: Re: Wrong Invoice Number - ends with 01
Post by: GJC Web Design on May 22, 2020, 10:59:55 am
if u keep flipping between the status set for invoice creation a new invoice is created

If u go C -> P > C etc  - is this what u mean?
Title: Re: Wrong Invoice Number - ends with 01
Post by: sprachrohr on May 22, 2020, 11:03:32 am
Hi,

thanks for your answers. No, i dont use any Plugin.

Ok, let me explain again. I'm not talking of order numbers. I mean invoice numbers.

My Invoices are created on satus shipped. There are two views where an status might be changed. Order details view and orders list view.

For example:
My last invoice number ends with: 21 --> expected behavior for the next invoice number is ending with 22.
If i change order status from orders list view, then my next invoice would end with 22.
BUT: If i change the status in order details view, then it would end with 01.

I can see this behavior on every generated invoice. If i do it in list view, numbers are correct. If i do it in details view, number is not correct (01). It doesn't depend on flipping between status.

Best regards

Title: Re: Wrong Invoice Number - ends with 01
Post by: sprachrohr on May 22, 2020, 11:35:05 am
Here is a screenshot of my invoice numbers... the invoice ending with 01 was created from details view. all others were created in list view.
Title: Re: Wrong Invoice Number - ends with 01
Post by: GJC Web Design on May 22, 2020, 14:20:39 pm
I don't get this effect

in the screenshot  the top one was created in the detail view, the bottom one in the orders view .. the last 2 digits are consecutive

VirtueMart 3.8.0 10311
Title: Re: Wrong Invoice Number - ends with 01
Post by: sprachrohr on May 22, 2020, 14:56:37 pm
Thank you very much, but now i'm confused.
I hoped someone else has this problem too.

Title: Re: Wrong Invoice Number - ends with 01
Post by: Milbo on May 22, 2020, 15:39:36 pm
could it be, that you create a replacing invoice? You can also use the german forum btw, makes it maybe easier. forum.virtuemart.de
Title: Re: Wrong Invoice Number - ends with 01
Post by: sprachrohr on May 22, 2020, 15:53:33 pm
Hi Milbo,

thanks for your answer.

This happens for new invoices and replacing invoices as well.

Some days ago i wanted to delete all testorders. For that, i deleted all invoices stored in database (cleared table virtuemart_invoices). After that i deleted all orders in backend. Might this be my problem?

next time i will use the german forum ;)
Title: Re: Wrong Invoice Number - ends with 01
Post by: sprachrohr on May 28, 2020, 11:15:46 am
Has nobody an idea anymore? I would be very grateful!
Title: Re: Wrong Invoice Number - ends with 01
Post by: sprachrohr on May 28, 2020, 13:05:08 pm
I just figured out, that this behavior even exists on a blank new installation.
Nobody else has this problem?
Title: Re: Wrong Invoice Number - ends with 01
Post by: sprachrohr on May 29, 2020, 17:52:43 pm
Hi,

i just did a fresh install again on MAMP. This time i used sample data. Same behavior.

Here is what i've done.
I installed joomla 3.9.18. Then i installed VM 3.8.2.10325_package. Then i installed sample data. In configuration i have set the safe-path. Then i made a new menu entry pointing to a vm category.

Nothing else!

I did three orders of the same product.

I changed order status for the first two orders to confirmed in detail-view. Both invoices end with 01.
The third order i changed the status to confirmed in orders list view. Invoice ends with 03.
Screenshot attached!

This was a absolute clean install. No configuration by myselfe.

Could someone else please do the same thing?
Thanks a lot!
Title: Re: Wrong Invoice Number - ends with 01
Post by: Milbo on June 09, 2020, 19:05:23 pm
Thank you Sprachrohr.

I was able to reproduce the problem and I also found the reason and wrote the fix

Open the invoice model and go to line 197 in function createStoreNewInvoiceNumberById replace the existing
Code: [Select]
} else if(empty($orderDetails['virtuemart_order_id'])){

against
Code: [Select]
} else if(empty($orderDetails['virtuemart_order_id']) or empty($orderDetails['virtuemart_vendor_id'])){
That solves the problem without touching the form
Title: Re: Wrong Invoice Number - ends with 01
Post by: sprachrohr on June 11, 2020, 09:48:53 am
Thank you Milbo... the fix works for me too!

I nearly thought I was too stupid...

You will merge it in the next release?

Again... thank you and best regards!
Title: Re: Wrong Invoice Number - ends with 01
Post by: Milbo on June 15, 2020, 10:02:21 am
Of course, already merged. :-) Thanks for keep posting