Esempio n. 1
0
    create_repeat_records(CaseRepeater, case)


def create_short_form_repeat_records(sender, xform, **kwargs):
    from corehq.apps.receiverwrapper.models import ShortFormRepeater

    xform.domain = _get_domain(xform)
    create_repeat_records(ShortFormRepeater, xform)


def create_repeat_records(repeater_cls, payload):
    domain = payload.domain
    if domain:
        repeaters = repeater_cls.by_domain(domain)
        for repeater in repeaters:
            repeater.register(payload)


form_received.connect(scrub_meta)
form_received.connect(add_domain)
form_received.connect(add_export_tag)
form_received.connect(add_app_id)

submission_error_received.connect(add_domain)
submission_error_received.connect(add_app_id)

successful_form_received.connect(create_form_repeat_records)
successful_form_received.connect(create_short_form_repeat_records)
case_post_save.connect(create_case_repeat_records)
Esempio n. 2
0
def create_repeat_records(repeater_cls, payload):
    domain = payload.domain
    if domain:
        repeaters = repeater_cls.by_domain(domain)
        for repeater in repeaters:
            repeater.register(payload)


def form_processing(sender, xform, **kwargs):
    should_update = scrub_meta(sender, xform)
    should_update = add_domain(sender, xform) or should_update
    should_update = add_export_tag(sender, xform) or should_update
    should_update = add_app_id(sender, xform) or should_update
    # form received saves the doc right after calling this signal,
    # so we don't have to save, though would need to here if that changes
    return should_update


def error_processing(sender, xform, **kwargs):
    should_update = add_domain(sender, xform)
    should_update = add_app_id(sender, xform) or should_update
    return should_update


form_received.connect(form_processing)
submission_error_received.connect(error_processing)

successful_form_received.connect(create_form_repeat_records)
successful_form_received.connect(create_short_form_repeat_records)
case_post_save.connect(create_case_repeat_records)
Esempio n. 3
0
    xform.domain = _get_domain(xform)
    create_repeat_records(ShortFormRepeater, xform)

def create_repeat_records(repeater_cls, payload):
    domain = payload.domain
    if domain:
        repeaters = repeater_cls.by_domain(domain)
        for repeater in repeaters:
            repeater.register(payload)

def form_processing(sender, xform, **kwargs):
    should_update = scrub_meta(sender, xform)
    should_update = add_domain(sender, xform) or should_update
    should_update = add_export_tag(sender, xform) or should_update
    should_update = add_app_id(sender, xform) or should_update
    # form received saves the doc right after calling this signal,
    # so we don't have to save, though would need to here if that changes
    return should_update

def error_processing(sender, xform, **kwargs):
    should_update = add_domain(sender, xform)
    should_update = add_app_id(sender, xform) or should_update
    return should_update

form_received.connect(form_processing)
submission_error_received.connect(error_processing)

successful_form_received.connect(create_form_repeat_records)
successful_form_received.connect(create_short_form_repeat_records)
case_post_save.connect(create_case_repeat_records)