예제 #1
0
def add_user_to_local_db_from_fortnox(customer):
    tmp_usr = User(customer['Name'], customer['Email'], customer['Phone'],
                   customer['Address1'], customer['Address2'],
                   customer['City'], customer['Zipcode'], None,
                   customer['FortnoxID'], None, strip_ssn(customer),
                   get_gender_from_ssn(customer), None)
    tmp_usr.status = 'Inactive'
    db.session.add(tmp_usr)
    db.session.commit()
def add_user_to_local_db_from_fortnox(customer):
    tmp_usr = User(customer['Name'], customer['Email'], customer['Phone'],
                   customer['Address1'], customer['Address2'], customer['City'],
                   customer['Zipcode'], None, customer['FortnoxID'],
                   None, strip_ssn(customer),
                   get_gender_from_ssn(customer), None)
    tmp_usr.status = 'Inactive'
    db.session.add(tmp_usr)
    db.session.commit()
def update_user_in_local_db_from_fortnox(customer):
    user = User.query.filter_by(fortnox_id=customer['FortnoxID']).first()
    if user is None:
        return "she wrote upon it; no such number, no such zone"
    else:
        user.name = customer['Name']
        user.email = customer['Email']
        user.phone = customer['Phone']
        user.address = customer['Address1']
        user.address2 = customer['Address2']
        user.city = customer['City']
        user.zip_code = customer['Zipcode']
        user.gender = get_gender_from_ssn(customer)
        user.ssn = strip_ssn(customer)
        user.expiry_date = user.expiry_date
        user.create_date = user.create_date
        user.tag_id = user.tag_id
        if(user.tagcounter is None):
            user.tagcounter = 0
        if user.status is None:
            user.status = 'Inactive'

        db.session.commit()
def update_user_in_local_db_from_fortnox(customer):
    user = User.query.filter_by(fortnox_id=customer['FortnoxID']).first()
    if user is None:
        return "she wrote upon it; no such number, no such zone"
    else:
        user.name = customer['Name']
        user.email = customer['Email']
        user.phone = customer['Phone']
        user.address = customer['Address1']
        user.address2 = customer['Address2']
        user.city = customer['City']
        user.zip_code = customer['Zipcode']
        user.gender = get_gender_from_ssn(customer)
        user.ssn = strip_ssn(customer)
        user.expiry_date = user.expiry_date
        user.create_date = user.create_date
        user.tag_id = user.tag_id
        if (user.tagcounter is None):
            user.tagcounter = 0
        if user.status is None:
            user.status = 'Inactive'

        db.session.commit()