Migration to flag sroc supp. billing invoices #2088
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
https://eaflood.atlassian.net/browse/WATER-3951
We had an issue that the current
include_in_supplementary_billing
flag was added when there was only 1 charge scheme. A licence gets flagged irrespective of whether the change relates to PRESROC or SROC.Where that has impacted us is when sending a billing batch. When it gets sent it clears the flag for all licences included. But if we cancel one, for example, the PRESROC bill run, and send the SROC one we lose which licences still need to be processed on the PRESROC one.
Our solution was to add a new
include_in_sroc_supplementary_billing
flag to thelicences
table and only set it to 'true' when an SROC charge version is approved. That is all now working for new charge versions created and approved.The remaining issue is existing charge versions that have been processed. When this change goes live there will be some SROC charge versions that have been approved and should be considered. But when they were approved only the
include_in_supplementary_billing
flag existed.We could try and do something clever, and look at all the SROC charge versions that have been approved this year and then only set the flag against their connect licences. But we've decided instead to set
include_in_sroc_supplementary_billing
to true for those licences whereinclude_in_supplementary_billing
is true.It might result in some empty SROC bill runs. But it's far simpler, so there is less chance we'll get something wrong and miss licences.
So, this change adds a migration that will set the flags when first deployed.