Jump to content
  • 0

Blesta Creating Duplicate Invoices


kikloo

Question

22 answers to this question

Recommended Posts

  • 0

We have to trace where is the bug, very, very strange. This cannot happen :)

 

For exemple if you have Auto Debit or Credit and Blesta will run on cron the "Apply Payments to Open Invoices", it will debit twice, that is critical if it is a confirmed bug.

 

Can you please see on:

 

Tools->Logs->Cron  (click on the date and time in "Deliver Invoices" that you setup to create)
 
and post it here the entries.
 
Only two situations that I know can reproduce something like this:
 
a.) Duplicated service in database, but on Blesta Admin only shows one. (I will test in a few minuts if it can happen)  (tested and it dosent duplicate invoice, even if we manually add on php,yadmin)
b.) "Date Renews" was changed in that service after the first invoice was alredy sended (tested and it dosent creat a new invoice even if you change the date renews for exemple to create a new invoice)
 
Outher situations, that I think can cause but probably Blesta devs have thinked on that is php date() function. If server time change, but this I think is not the case :)  (its not possible because the text in b.) we have done also dosent send anouther invoice)
 
The importing thing is, we have to detect :)
 
I will trie to reproduce the problem.
Edited by PauloV
Link to comment
Share on other sites

  • 0

PauloV, were you able to duplicate this issue?

 

Blesta creates invoices based on the renew date and days before renewal settings. Based on your screenshot, it looks like the second invoice was created two days after the first. This could be if you did one of the following between the time the first and second invoices were created:

  1. You changed the service's renew date to a date closer to the current date, or in the past
  2. You've deleted cron logs, in particular the Create Invoice cron log responsible for the first invoice being created

We would need steps to duplicate this issue if we were to deem it a bug. Anything you have in terms of your company/client group settings, whether you've changed them, whether you've edited the service, invoice, etc., would all be useful information.

Link to comment
Share on other sites

  • 0

PauloV, were you able to duplicate this issue?

 

Blesta creates invoices based on the renew date and days before renewal settings. Based on your screenshot, it looks like the second invoice was created two days after the first. This could be if you did one of the following between the time the first and second invoices were created:

  1. You changed the service's renew date to a date closer to the current date, or in the past
  2. You've deleted cron logs, in particular the Create Invoice cron log responsible for the first invoice being created

We would need steps to duplicate this issue if we were to deem it a bug. Anything you have in terms of your company/client group settings, whether you've changed them, whether you've edited the service, invoice, etc., would all be useful information.

 

Could be number 1, I do that a lot  whilst waiting for 3.3 so that's probably why I get it.

Link to comment
Share on other sites

  • 0

PauloV, were you able to duplicate this issue?

 

Blesta creates invoices based on the renew date and days before renewal settings. Based on your screenshot, it looks like the second invoice was created two days after the first. This could be if you did one of the following between the time the first and second invoices were created:

  1. You changed the service's renew date to a date closer to the current date, or in the past
  2. You've deleted cron logs, in particular the Create Invoice cron log responsible for the first invoice being created

We would need steps to duplicate this issue if we were to deem it a bug. Anything you have in terms of your company/client group settings, whether you've changed them, whether you've edited the service, invoice, etc., would all be useful information.

 

 

No, I have done several tests and cannot replicate, but the strange thing is that LicenseCart and Kikloo said that they have, LicenseCart even says that happen a few times, I assume more than once or twice :)

 

@LicenseCart: Can you trie to sse what have happen in your case? did you change the date or deleted the cron logs?

 

@Kikloo: Did you deleted the cron logs?

 

@Tyson: How the hell can I delete the cron logs in Blesta admin (without going to phpMyAdmin)? :P  One more thing, can it be the case that if we set the:

 

Settings->Company->Automatation->Create Invoice
and on
Settings->Company->Automatation->Clean up Logs
 
the same time and can sometime cause the problem depending on how much time the "Create Invoice" and the "Clean up Logs" takes to finish?
Link to comment
Share on other sites

  • 0

 

No, I have done several tests and cannot replicate, but the strange thing is that LicenseCart and Kikloo said that they have, LicenseCart even says that happen a few times, I assume more than once or twice :)

 

@LicenseCart: Can you trie to sse what have happen in your case? did you change the date or deleted the cron logs?

 

@Kikloo: Did you deleted the cron logs?

 

@Tyson: How the hell can I delete the cron logs in Blesta admin (without going to phpMyAdmin)? :P  One more thing, can it be the case that if we set the:

 

Settings->Company->Automatation->Create Invoice
and on
Settings->Company->Automatation->Clean up Logs
 
the same time and can sometime cause the problem depending on how much time the "Create Invoice" and the "Clean up Logs" takes to finish?

 

 

changing renew dates, if someone orders today 11/07/2014, I will change the renew date to 01/08/2014 and record a payment of the difference. Until Blesta 3.3 comes out :).

Link to comment
Share on other sites

  • 0

@Tyson: How the hell can I delete the cron logs in Blesta admin (without going to phpMyAdmin)? :P  One more thing, can it be the case that if we set the:

 

Settings->Company->Automatation->Create Invoice
and on
Settings->Company->Automatation->Clean up Logs
 
the same time and can sometime cause the problem depending on how much time the "Create Invoice" and the "Clean up Logs" takes to finish?

 

 

The cron logs don't adhere to the Clean Up Logs setting, since removing cron logs too frequently can lead to several issues. Instead, cron logs are purged based on the cron log retention policy set in the Blesta config, defaulting to 10 days.

 

Looking at it again, I don't think this would be due to the logs. However, if the cron created a duplicate invoice for the service, then I would expect it to have bumped the renew date as well, and it looks like it didn't do that a second time.

Link to comment
Share on other sites

  • 0

but the invoice has a 2 days of range .

so the second invoice was aded 2 days to the first invoice . that mean that blesta has created a second invoice for the same service that has already a open invoice .

EDIT : another theory is that the invoice has losed the link to the service , i mean the first invoice is considereted as a normal invoice and not attached to a specific services .

NOTE : this is a trivial case , i prefer if you can open a ticket support in your blesta client and give aces to the stuff to check that for you .

Link to comment
Share on other sites

  • 0

OK, I managed to replicate duplicates/triplicate invoices. :)

 

I only have changed the "Renew Date". After 3 changes just for testing on day 10 it has send 2 new invoices on day 10 and today, day 12 has sended one more for the same service.

 

Blesta has to had some sort of check for what is causing the duplication every time we change the "Change Renew Date", if we change tree, four ou five times, it seems blesta will send several invoices for the same service.

 

 

After Blesta fix/detect this, maybe add this also:

 

On "Managing" a service,  wen we select in "Actions on"  "Change Renew Date", dont let it change if the date is =< (equal or less then the default term selected on that package).

 

Please can anybody test this? change the "Renew Date" several times, saving it, and then let it run for a couple of days and check it it it duplicates/triplicates the invoices fro the same service.

 

Regards,

PV ;)

Link to comment
Share on other sites

  • 0

OK, I managed to replicate duplicates/triplicate invoices. :)

 

I only have changed the "Renew Date". After 3 changes just for testing on day 10 it has send 2 new invoices on day 10 and today, day 12 has sended one more for the same service.

 

Blesta has to had some sort of check for what is causing the duplication every time we change the "Change Renew Date", if we change tree, four ou five times, it seems blesta will send several invoices for the same service.

 

 

After Blesta fix/detect this, maybe add this also:

 

On "Managing" a service,  wen we select in "Actions on"  "Change Renew Date", dont let it change if the date is =< (equal or less then the default term selected on that package).

 

Please can anybody test this? change the "Renew Date" several times, saving it, and then let it run for a couple of days and check it it it duplicates/triplicates the invoices fro the same service.

 

Regards,

PV ;)

 

So it is changing the renew date ;) haha well we know why now.

Link to comment
Share on other sites

  • 0

Are you saying this happens if you move the renewal date backwards? If so, this may be the intended result and rather than a change to the implementation, some sort of warning or notice may be in order when performing such an action.

 

No. it happens in both ways, (<older than< current renew date >greater than>) now Im testing a new teory, I have "change" the renew date for the same current date (I have only click save) Now tomorow I will see if it creats a new invoice for the same service only clickin on Save wen selecting "Change Renew Date".

Link to comment
Share on other sites

  • 0

Depending on what you change the renew date to, what your Invoice Days Before Renewal setting is, and whether you invoice suspended services, Blesta can create an additional invoice. This is because, essentially, you changed the renew date such that system determines an invoice should be created. And this is by design. The cron can renew services multiple times to 'catch up' to what it may have missed--and this may be what you are causing by changing the renew date back, and now Blesta thinks it 'missed' renewing the service.

 

Consider an example: If a service renews on a daily basis, starting from Jan. 1, 2013, then a new invoice should be created every day. If you disable the cron from running, for instance, it will not be able to renew those services, and no invoices will be created. If you then enable the cron on Jan. 1, 2014, the cron will start where it left off by creating 365 invoices for that service and finally changing the renew date to Jan. 2, 2014.

 

If you think the system behaves differently than this, then please create a duplicable test case and send me the details so I can replicate it. Information on the service (term, date created, date renews), both before and after the service renews would be useful.

Link to comment
Share on other sites

  • 0

Im leting the cron run tomorow just to see if there is no "bug" :)

 

But for now, for exemple:

 

I Have to bill "1 Month" on day 14/07/2014

 

The cron runs and it invoices correctly, but the client have not payed yet

 

Now Im going to "Manage" the service and acidently click on "Action",  "Change Renew Date" and I select one day after.

 

Blesta should check if there is alredy an Open Invoice betwin the term selected, in this case "1 Month" and if alredy is a Open Invoice, blesta should not create anouther invoice because is alredy one open betwin that date/time space (1 Month)

 

For exemple:

// if current service renew date, greater than ( service last open invoice date minus service term selected)

If ($service_renew_date > ($service_last_open_invoce_date - $service_term_selected))
{

//then, create a new invoice

}else{

//do nothing

}

My opinion is that blesta should not creat a new invoice if it is in betwin the term selected.

 

I hope my "confusing" solution can be understand by Tyson/Cody/Paul :)

 

Regards,

PV

Link to comment
Share on other sites

  • 0

Changing the renew date to a day further in the future shouldn't send an invoice. I don't see how it would be possible for a new invoice to be created after you moved the renew date forward. Can you consistently replicate this behavior? If so, please let me know what dates and settings you're using to do so.

Link to comment
Share on other sites

  • 0

Changing the renew date to a day further in the future shouldn't send an invoice. I don't see how it would be possible for a new invoice to be created after you moved the renew date forward. Can you consistently replicate this behavior? If so, please let me know what dates and settings you're using to do so.

 

Yes, I have recived 3 invoices in total for the same service.

 

To replicate:

 

Let a service create a normal renew invoice, then manage the service and change the next renew date to one day after, let the cron run again after one day.

Link to comment
Share on other sites

  • 0

Yes, I have recived 3 invoices in total for the same service.

 

To replicate:

 

Let a service create a normal renew invoice, then manage the service and change the next renew date to one day after, let the cron run again after one day.

 

I'm not able to duplicate this issue. The expected outcome of setting the renew date to a day in the future is for it to not be invoiced/renewed for an additional day, which is the behavior that I'm observing.

 

I would need more clarification on the details necessary to duplicate this issue consistently.

Link to comment
Share on other sites

  • 0

I'm not able to duplicate this issue. The expected outcome of setting the renew date to a day in the future is for it to not be invoiced/renewed for an additional day, which is the behavior that I'm observing.

 

I would need more clarification on the details necessary to duplicate this issue consistently.

 

 

All week Im trying to figure it out wats causing the issue at 100%

 

I only have sucessfull to reproduce in two days in a row and has reproduced 3 invoices for the same invoice only by doing a change in the next renew day. Now with 3 invoices I cannot reproduce it anymore.

 

I will try anouther thing, to make sure wat is in deep the problem and will post it tomorow the results :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...