Every time a client or carer is saved, Plait checks all of their contracts, and rejects the update with a suitable error if:
  • A contract has no start date
  • A contract finishes before it starts
  • A contract has been deleted, and there are ANY events or ANY run allocations using that contract
  • There are any events or run allocations that precede the contract start date (unless these are deleted series instances).  (This is to cover the presumably-very-unlikely case where they move the contract start forward after doing some scheduling.)
  • There are any paid or invoiced events after the finish date.  (It doesn't matter whether the cost/charge has since been credited - once it appears on an invoice or payslip, it must remain within the contract bounds.)
  • There are any events after the finish date where a carer has touched in or out.
  • There are any events after the finish date where a med was administered/done/marked as missed, or a careplanning task was completed/marked as 'unable to complete'.  (Really, this check shouldn't be necessary because the "carer has touched in or out" check should suffice.  However, since tasks and meds can also be updated from the office, I thought it was worth putting it in.)
If none of these cases apply, Plait will then look for:
  • One-off events after the contract finish - including any that have been cancelled
  • One-off run allocations after the contract finish
  • Recurring event / run allocation series that have no finish, or finish after the contract does.  If the series does finish after the contract, but all instances of that series falling after the contract finish have been either deleted, cancelled or otherwise materialised, then it is not mentioned.
  • Instances of recurring series falling after the contract finish that have been cancelled
If Plait finds any of these, it display a warning dialog, similar to the following.

For clients:


  • The system provides links for up to 10 examples in each case.  (If there are more than 10 one-off events, for example, then it would give 10 links and then say "are examples").
  • It only tells you about things that there is at least one of.  So, if there are no cancelled events, cancellations are not mentioned, if there are no multi-client events, the final NB is not included etc.
...or for carers:


If you click Cancel then the save is aborted and the client's / carer's record remains in edit mode.

If you click OK then:

...for a client:
  • One-off, single-client events (including cancelled events) are physically deleted
  • The client's allocation is spliced from one-off, multi-client events (so if it had 2 client allocations before, it would have 1 afterwards)
  • For recurring, single-client events, Plait sets an end date and physically delete all materialised instances after that date (including cancelled instances)
  • For recurring, multi-client events, the system:
    • Set an end date
    • Start a new series on that date with the client's allocation spliced.
    • All materialised instances of the original series are adopted by the new series, with the terminated client's allocation spliced from those instances.
...for a carer:
  • One-off run allocations are physically deleted
  • Recurring run allocations are ended.  Though it is very unlikely that there will be any, any materialised instances beyond the .until date are physically deleted.
  • One-off, single-carer, non-contact events (e.g., "Unpaid Leave") are physically deleted
  • The carer's allocation is spliced from one-off, multi-carer, non-contact events (e.g., "Meetings") (so if it had 2 carer allocations before, it would have 1 afterwards)
  • For one-off contact events, they are deallocated (leaving a blank carer alloc)
  • For recurring contact-events, the system:
    • Set an end date
    • Start a new series on that date, with the finished carer deallocated (leaving a blank carer alloc)
    • All materialised instances of the original series are adopted by the new series, with the finished carer deallocated (if they are assigned at all)