def add_person_paper_needs_manual_review(pid, bibrec): ''' Adds to a person a paper which needs manual review before bibref assignment @param pid: personid, int @param bibrec: the bibrec, int ''' dbinter.set_person_data(pid, 'paper_needs_bibref_manual_confirm', bibrec)
def set_processed_external_recids(pid, recid_list_str): ''' Set processed external recids @param pid: pid @param recid_list_str: str ''' dbinter.del_person_data(person_id=pid, tag='processed_external_recids') dbinter.set_person_data(pid, "processed_external_recids", recid_list_str)
def assign_uid_to_person(uid, pid, create_new_pid=False, force=False): ''' Assigns a userid to a person, counterchecknig with get_personid_from_uid. If uid has already other person returns other person. If create_new_pid and the pid is -1 creates a new person. If force, deletes any reference to that uid from the tables and assigns to pid, if pid wrong (less then zero) returns -1. @param uid: user id, int @param pid: person id, int @param create_new_pid: bool @param force, bool ''' if force and pid >= 0: dbinter.del_person_data(tag='uid', value=str(uid)) dbinter.set_person_data(pid, 'uid', str(uid)) return pid elif force and pid < 0: return -1 current = dbinter.get_personid_from_uid(((uid,),)) if current[1]: return current[0][0] else: if pid >= 0: cuid = dbinter.get_person_data(pid, 'uid') if len(cuid) > 0: if str(cuid[0][1]) == str(uid): return pid else: if create_new_pid: dbinter.create_new_person_from_uid(uid) else: return -1 else: dbinter.set_person_data(pid, 'uid', str(uid)) return pid else: if create_new_pid: dbinter.create_new_person_from_uid(uid) else: return -1
def assign_person_to_uid(uid, pid): ''' Assigns a person to a userid. If person already assigned to someone else, create new person. Returns the peron id assigned. @param uid: user id, int @param pid: person id, int, if -1 creates new person. @return: pid int ''' if pid == -1: pid = dbinter.create_new_person_from_uid(uid) return pid else: current_uid = dbinter.get_person_data(pid, 'uid') if len(current_uid) == 0: dbinter.set_person_data(pid, 'uid', str(uid)) return pid else: pid = dbinter.create_new_person_from_uid(uid) return pid
def assign_uid_to_person(uid, pid, create_new_pid=False, force=False): ''' Assigns a userid to a person, counterchecknig with get_personid_from_uid. If uid has already other person returns other person. If create_new_pid and the pid is -1 creates a new person. If force, deletes any reference to that uid from the tables and assigns to pid, if pid wrong (less then zero) returns -1. @param uid: user id, int @param pid: person id, int @param create_new_pid: bool @param force, bool ''' if force and pid >= 0: dbinter.del_person_data(tag='uid', value=str(uid)) dbinter.set_person_data(pid, 'uid', str(uid)) return pid elif force and pid < 0: return -1 current = dbinter.get_personid_from_uid(((uid, ), )) if current[1]: return current[0][0] else: if pid >= 0: cuid = dbinter.get_person_data(pid, 'uid') if len(cuid) > 0: if str(cuid[0][1]) == str(uid): return pid else: if create_new_pid: dbinter.create_new_person_from_uid(uid) else: return -1 else: dbinter.set_person_data(pid, 'uid', str(uid)) return pid else: if create_new_pid: dbinter.create_new_person_from_uid(uid) else: return -1