'Validate appointment form
- Future appointments can not be set to completed
- Undated appointments can not be set to completed
@param form: the FORM'

@staticmethod
def case_appointment_onvalidation(form):

    formvars = form.vars
    date = formvars.get('date')
    status = formvars.get('status')
    if (str(status) == '4'):
        if (date is None):
            form.errors['date'] = current.T('Date    is    required    when    marking    the    appointment    as    completed')
        elif (date > current.request.utcnow.date()):
            form.errors['status'] = current.T('Appointments    with    future    dates    can    not    be    marked    as    completed')
