예제 #1
0
 def generate_mag_id_payload(self, orgunit: OrgUnit):
     from_date, to_date = util.convert_validities(orgunit.start_date,
                                                  orgunit.end_date)
     obj_uuid = self.uuid_generator(str(orgunit.org_uuid) + "mag_id")
     assert orgunit.mag_id
     return mo_payloads.create_address(
         uuid=obj_uuid,
         value=orgunit.mag_id,
         address_type_uuid=uuids.UNIT_MAG_ID,
         org_unit_uuid=orgunit.org_uuid,
         from_date=from_date,
         to_date=to_date,
     )
예제 #2
0
 def generate_postaddr_payload(self, orgunit: OrgUnit):
     from_date, to_date = util.convert_validities(orgunit.start_date,
                                                  orgunit.end_date)
     obj_uuid = self.uuid_generator(str(orgunit.org_uuid) + "postaddr")
     assert orgunit.post_address
     return mo_payloads.create_address(
         uuid=obj_uuid,
         value=self.dar_cache[orgunit.post_address],
         address_type_uuid=uuids.UNIT_POSTADDR,
         org_unit_uuid=orgunit.org_uuid,
         from_date=from_date,
         to_date=to_date,
     )
예제 #3
0
 def generate_debitornr_payload(self, orgunit: OrgUnit):
     from_date, to_date = util.convert_validities(orgunit.start_date,
                                                  orgunit.end_date)
     obj_uuid = self.uuid_generator(str(orgunit.org_uuid) + "debitornr")
     assert orgunit.int_debitor_number
     return mo_payloads.create_address(
         uuid=obj_uuid,
         value=orgunit.int_debitor_number,
         address_type_uuid=uuids.UNIT_DEBITORNR,
         org_unit_uuid=orgunit.org_uuid,
         from_date=from_date,
         to_date=to_date,
     )
예제 #4
0
 def generate_employee_az_id_payload(self, person: Person, filedate: str):
     # For creation of Employee address/IT details we always
     # use the parsed file-date as from-date
     # The start_time field is still used for creating engagements
     _, to_date = util.convert_validities(person.start_time.date(),
                                          person.end_time.date())
     return mo_payloads.create_it_rel(
         uuid=self.uuid_generator(person.cpr + "azid"),
         user_key=person.az_id,
         person_uuid=self.uuid_generator(person.cpr),
         itsystem_uuid=self.settings.azid_it_system_uuid,
         from_date=filedate,
         to_date=to_date,
     )
예제 #5
0
 def generate_employee_email_payload(self, person: Person, filedate: str):
     # For creation of Employee address/IT details we always
     # use the parsed file-date as from-date
     # The start_time field is still used for creating engagements
     _, to_date = util.convert_validities(person.start_time.date(),
                                          person.end_time.date())
     return mo_payloads.create_address(
         uuid=self.uuid_generator(person.cpr + "email"),
         value=person.email,
         from_date=filedate,
         to_date=to_date,
         person_uuid=self.uuid_generator(person.cpr),
         address_type_uuid=uuids.PERSON_EMAIL,
     )
예제 #6
0
    def generate_engagement_payload(self, person: Person):
        from_date, to_date = util.convert_validities(person.start_time.date(),
                                                     person.end_time.date())

        primary_uuids = {"Nej": uuids.NOT_PRIMARY, "Ja": uuids.PRIMARY}
        return mo_payloads.create_engagement(
            uuid=person.person_uuid,
            org_unit_uuid=person.org_unit_uuid,
            person_uuid=self.uuid_generator(person.cpr),
            job_function_uuid=person.job_function_uuid,
            engagement_type_uuid=person.engagement_type_uuid,
            primary_uuid=primary_uuids[person.primary],
            user_key=person.bvn,
            from_date=from_date,
            to_date=to_date,
        )
예제 #7
0
    def generate_unit_payload(self, orgunit: OrgUnit):
        from_date, to_date = util.convert_validities(orgunit.start_date,
                                                     orgunit.end_date)
        parent_uuid = orgunit.parent_uuid
        if parent_uuid == orgunit.org_uuid:
            parent_uuid = uuids.ORG_UUID

        return mo_payloads.create_org_unit(
            uuid=orgunit.org_uuid,
            user_key=orgunit.bvn,
            name=orgunit.org_unit_name,
            parent_uuid=parent_uuid,
            org_unit_hierarchy=uuids.LINJE_ORG_HIERARCHY
            if orgunit.is_in_line_org else None,
            org_unit_type_uuid=orgunit.org_unit_type_uuid,
            from_date=from_date,
            to_date=to_date,
        )