crater icon indicating copy to clipboard operation
crater copied to clipboard

All invoices showing "OVERDUE" after migration

Open profiteroles1 opened this issue 2 years ago • 6 comments

I recently migrated from 4.x to 6.x and all my invoices now show the "OVERDUE" badge, even if I set overdue flag to 0 in the database, or set the due date to a distant date in the future. Please help! Thank you :)

profiteroles1 avatar May 16 '22 09:05 profiteroles1

This is quite a jump. Are you sure that all of the DB migrations have been applied?

rihards-simanovics avatar May 17 '22 09:05 rihards-simanovics

Yes

profiteroles1 avatar May 20 '22 17:05 profiteroles1

@profiteroles1 I think it's the same issue as I've described here for the currency model. Essentially, "0" boolean false values in the db (that aren't casted by the model) are evaluating as true in client-side JS.

Try adding 'overdue' => 'boolean' to the $casts property in app/Models/Invoice.php

southan avatar May 28 '22 14:05 southan

Were these invoices unpaid (no payments) and has the due date already passed?

In that case, these invoices will be considered as overdue.

Also, try the solution mentioned by @southan to see if that's the issue.

mohitpanjwani avatar May 28 '22 14:05 mohitpanjwani

Also, try the solution mentioned by @southan to see if that's the issue.

This fixes the issue. Thank you

profiteroles1 avatar Jun 08 '22 17:06 profiteroles1

Try adding 'overdue' => 'boolean' to the $casts property in app/Models/Invoice.php

I tried this, and it does remove the "overdue" flag from invoices. However, invoices which are overdue aren't marked as such, either. So it's not really a complete fix.

jakeparis avatar Jul 26 '22 15:07 jakeparis