'Update detection for hrm_job_title
@param item: the S3ImportItem'

@staticmethod
def hrm_job_title_duplicate(item):

    data = item.data
    name = data.get('name', None)
    if current.deployment_settings.get_hrm_org_dependent_job_titles():
        org = data.get('organisation_id', None)
    else:
        org = None
    role_type = data.get('type', None)
    table = item.table
    query = (table.name.lower() == s3_unicode(name).lower())
    if org:
        query = (query & (table.organisation_id == org))
    if role_type:
        query = (query & (table.type == role_type))
    duplicate = current.db(query).select(table.id, limitby=(0, 1)).first()
    if duplicate:
        item.id = duplicate.id
        item.method = item.METHOD.UPDATE
