Quotes counter on generated quotes does not follow counter settings (v5.2.11-C53)

Hi,

I was in the process of building a new quote pattern when I realized that the counter used when auto generating a quote number somehow got unlinked from the counter in the Generated Numbers panel. It seems like at some point it “borrowed” the invoice counter, which was 3063, and it’s been incrementing by 1 from there ever since on its own, without being influenced by its own counter settings:

As you can see, my quote counter is stuck at 1:

image

In the meantime, my invoice counter hasn’t gone up at all, it’s still at 3063 - so it’s not like the quotes just happened to get linked to the invoice counter; they are following a new, uncontrollable path.

I tried resetting the quote counter to 1 and running php artisan optimize: it didn’t work, the created quotes are still calculating in the 3K range and the quote counter is still at 1…! Other pattern rules seem to work OK with quote naming, but the counter is running amok.

As far as I can tell, other counters are working fine on their own: I tested the invoices counter and the projects counter and both add up one increment at the time to their own counter like intended.

Thanks in advance for your help!

EDIT:

I made sure that the counter sharing between quotes and invoices is disabled:

@david do you have any thoughts?

I cannot recreate this, you may want to try not using {$counter} unless you are appending other variables on.

Hi David,

Thanks for the suggestion, but I actually tried adding the {$counter} variable as a potential fix, since the wonky behaviour happens with nothing in the Number Pattern field:

image

image

The counter is stuck at 1, but it used to work for at least one test quote, which was numbered 0001. I then testing converting that test quote to a test invoice, and after that the counter got broken, if that helps to know the steps.

Is there anything I can try to edit in the database in order to possibly reset this?

Thanks

EDIT: The “bad” Quote counter is back at 3066 after I tried changing the pattern: it reset itself to the actual active counter on the Invoices Pattern.

EDIT2: I checked the database under companies > settings and I can confirm that my quote counter is stuck at 1, it’s not just a display issue:

"quote_number_pattern":"","quote_number_counter":1

So there must be something happening somewhere else which makes my quotes get their numbers from the invoices counter.

Maybe this is related to the shared counter option not being read correctly? I think it behaves as if I did in fact set it to “ON”, even though the db reads "shared_invoice_quote_counter":false.

@hillel

Could charles be seeing stale settings? ie, after creating an invoice/quote - the company settings may not yet have updated?

I’m not sure, if that’s the case clicking ‘Refresh data’ on Settings > Device Settings should update the data.

Hi @hillel,

Thanks for your suggestion, but that did not fix it. I created a few more quotes and they all follow the invoice counter. The invoice counter itself did not go up until I created a new invoice, and then it got updated to match the sequence. Sow that’s how it went:

Quote 3066 → Quote 3067 → Invoice 3068 → Quote 3069 (even though my settings are to not share the counter between invoices and quotes)

So I thought the quotes somehow had their own “ghost counter” initially based on the invoice counter, but in fact I now have the proof that they share the same counter behind the scenes, and creating an invoice refreshes the counter display to match where it’s really at.

Any other ideas on how I can reset this behaviour? My database is backed up every hour so I don’t mind getting my hands a little dirty if necessary, I can always revert to a previous state easily. I just want to fix this and be able to rely on the built-in counters! :pray:

UPDATE

OK so @david and @hillel,

I found how to reproduce the bug (on my system):

I had to turn off the Shared Invoice/Credit Counter:

It actually behaves as if it was the other option (shared invoice/quote counter).

With this turned off, my quotes follow the quote counter:

image

And if I do turn the switch back on:

then my quotes are back to following the invoice counter:

image

With that being said, I still have the quote counter stuck at 1 in the admin, even though it is incrementing the numbers in the actual quotes:

image

UPDATE 1:

I could also reproduce the bug on your hosted demo. I set the invoice counter at 999 and I turned on Shared Invoice/Credit counter, which gave me quote “#0999”, even though the quote counter was at “7”:

UPDATE 2:

with the invoice/credit shared counter turned off, I also experience a stuck admin counter on your demo. Here are a couple of quotes incrementing in the 20s

image

and yet the counter is stuck at “7”:

Hi @charles,

following those steps i was able to recreate the issue.

I’ve checked in a fix, this will be available in the next release.

thanks for reporting!

1 Like