Exemplo n.º 1
0
def update_workflows(portal):
    """Updates the affected workflows
    """
    logger.info("Updating workflows ...")

    # Re-import rolemap and workflow tools
    setup = portal.portal_setup
    setup.runImportStepFromProfile(profile, "rolemap")
    setup.runImportStepFromProfile(profile, "workflow")

    # Update role mappings for Patient objects
    ut = UpgradeUtils(portal)
    ut.recursiveUpdateRoleMappings(portal.patients, commit_window=500)
    commit_transaction()
Exemplo n.º 2
0
def update_workflows(portal):
    """Updates the affected workflows
    """
    logger.info("Updating workflows ...")

    # Re-import rolemap and workflow tools
    setup = portal.portal_setup
    setup.runImportStepFromProfile(profile, "rolemap")
    setup.runImportStepFromProfile(profile, "workflow")

    # Update role mappings for Patient objects
    ut = UpgradeUtils(portal)
    ut.recursiveUpdateRoleMappings(portal.patients, commit_window=500)
    commit_transaction()
Exemplo n.º 3
0
def setup_batches_ownership(portal):
    """Walks-through all batches and set the role "Owner" to all the client
    contacts that belong to the same client as the batch, if any
    """
    logger.info("Setup Batches/Cases ownership ...")
    batches = portal.batches.objectValues("Batch")
    total = len(batches)
    for num, batch in enumerate(batches):
        if num % 100 == 0:
            logger.info("Setup Batches ownership {}/{}".format(num, total))
        purge_owners_for(batch)

        if num % 1000 == 0:
            commit_transaction()
    commit_transaction()
Exemplo n.º 4
0
def setup_patients_ownership(portal):
    """Set the role "Owner" to all the client contacts that belong to the same
    client as the patient, if any
    """
    logger.info("Applying Patients ownership ...")
    brains = api.search(dict(portal_type="Patient"), CATALOG_PATIENTS)
    total = len(brains)
    for num, brain in enumerate(brains):
        if num % 100 == 0:
            logger.info("Applying Patients Ownership {}/{}".format(num, total))
        purge_owners_for(api.get_object(brain))

        if num % 1000 == 0:
            commit_transaction()
    commit_transaction()
Exemplo n.º 5
0
def setup_patients_ownership(portal):
    """Set the role "Owner" to all the client contacts that belong to the same
    client as the patient, if any
    """
    logger.info("Applying Patients ownership ...")
    brains = api.search(dict(portal_type="Patient"), CATALOG_PATIENTS)
    total = len(brains)
    for num, brain in enumerate(brains):
        if num % 100 == 0:
            logger.info("Applying Patients Ownership {}/{}".format(num, total))
        purge_owners_for(api.get_object(brain))

        if num % 1000 == 0:
            commit_transaction()
    commit_transaction()