'Handle Updates of entries to reset the hidden start_date'

@staticmethod
def budget_monitoring_onaccept(form):

    db = current.db
    table = current.s3db.budget_monitoring
    record_id = form.vars.id
    record = db((table.id == record_id)).select(table.budget_entity_id, table.start_date, table.end_date, limitby=(0, 1)).first()
    if (not record):
        s3_debug("Cannot    find    Budget    Monitoring    record    (no    record    for    this    ID),    so    can't    update    start_date")
        return
    budget_entity_id = record.budget_entity_id
    start_date = record.start_date
    end_date = record.end_date
    query = (((table.budget_entity_id == budget_entity_id) & (table.deleted == False)) & (table.end_date < end_date))
    record = db(query).select(table.end_date, limitby=(0, 1), orderby=(~ table.end_date)).first()
    if (record and (record.end_date != start_date)):
        db((table.id == record_id)).update(start_date=record.end_date)
    query = (((table.budget_entity_id == budget_entity_id) & (table.deleted == False)) & (table.end_date > end_date))
    record = db(query).select(table.id, table.start_date, limitby=(0, 1), orderby=table.end_date).first()
    if (record and (record.start_date != end_date)):
        record.update_record(start_date=end_date)
