martynnorman Posted October 18, 2013 Share Posted October 18, 2013 I have seen this issue in old threads. Running the latest 5.2.8. After deleting several invoices, we've noticed that WHMCS is reusing the invoice numbers (which is fine I guess) BUT it also appears to be including invoice items from invoices that no longer exist.. The invoices belong to the same customer, so I don't think the problem is with invoice items from invoices of other customers where the invoice IDs are the same. But it does raise the question, why isn't WHMCS deleting invoice items along with invoices ? I assume it's a bug, is there a work around, like a mysql trigger ? 0 Quote Link to comment Share on other sites More sharing options...
demaier Posted October 20, 2013 Share Posted October 20, 2013 I reported this a long long time ago to Matt, probably more than 4 years ago and apparently nothing was done and since then I tried to always delete the invoice items before actually deleting the invoice. At the time WHMCS support mentioned that the table should hold enough items and that I should not be worried. Go figure. That is totally leaving trash behind in the database and giving chance for future issues like the one you mentioned here. "Listen to your customers" always works! 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted October 20, 2013 Share Posted October 20, 2013 (edited) I understand your point of view about how invoiceitems are treated when you delete the related invoice. Years ago initially i was thinking the same but now that i have customized my invoicing system, i need invoiceitems like air. In fact i'm used to delete invoices that have been paid with credit since i already invoice my clients properly when they add funds to their accounts. I need invoiceitems to keep a track of all credit-transactions in a module i have. Anyway if you really want to delete invoiceitems when you delete the related invoice, it's really simple to do. You just need 2 lines of code (one single query) and run it with DailyCronJob. Edited October 20, 2013 by Kian 0 Quote Link to comment Share on other sites More sharing options...
JavierCN Posted December 31, 2021 Share Posted December 31, 2021 Hello, WHMCS 7.10.3 here. This is still happening, isn't it? Has been fixed? 0 Quote Link to comment Share on other sites More sharing options...
Bigol'tastynuggets Posted December 31, 2021 Share Posted December 31, 2021 13 hours ago, JavierCN said: Hello, WHMCS 7.10.3 here. This is still happening, isn't it? Has been fixed? Lol probably not 🤷🏻♂️ it doesn't earn extra money for them 1 Quote Link to comment Share on other sites More sharing options...
JavierCN Posted January 3, 2022 Share Posted January 3, 2022 From the thread: https://whmcs.community/topic/222841-rows-in-tblinvoiceitems-where-invoiceid-does-not-exist-in-tblinvoices/?do=findComment&comment=1056193 "If an invoice was deleted the record in tblinvoiceitems remains by design. This is how WHMCS knows not to generate a duplicate invoice for a service on a particular next due date - even if the original invoice was deleted. Leaving them would be totally normal, but if you wanted to delete them I don't see it causing a major problem." I don't know that moment in which "WHMCS knows not to generate a duplicate invoice". In fact, we've had the problem that WHMCS didn't generate new invoices because the orphaned tblinvoiceitems rows exist with no related invoice. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.