예제 #1
0
파일: shelterbuddy.py 프로젝트: magul/asm3
    comments += "\nOriginal Breed: " + breedcol + "/" + breed2col
    comments += "\nOriginal Colour: " + row["Colour"] + "/" + row["SecondaryColour"]
    comments += "\nCircumstance: " + row["circumstance"]
    a.HiddenAnimalDetails = comments
    a.AnimalComments = getsbnotes(row["AnimalID"])
    if row["euthanasiaType"] != "0":
        a.Archived = 1
        a.DeceasedDate = a.DateBroughtIn
        a.PutToSleep = 1
        a.PTSReasonID = 4
    if row["crueltyCase"] == "TRUE":
        a.CrueltyCase = 1
    a.LastChangedDate = getdate(row["AddDateTime"])
    # Do we have a default image for this animal in the images folder and document table?
    if documents.has_key(row["AnimalID"]):
        imagedata = asm.load_image_from_file(documents[row["AnimalID"]])
        if imagedata is not None:
            asm.animal_image(a.ID, imagedata)

# tblperson.csv
for row in asm.csv_to_list(PATH + "tblperson.csv"):
    o = asm.Owner()
    owners.append(o)
    ppo[row["recnum"]] = o
    o.OwnerTitle = row["Title"]
    o.OwnerForeNames = row["FirstName"]
    o.OwnerSurname = row["LastName"]
    o.OwnerName = o.OwnerForeNames + " " + o.OwnerSurname
    o.HomeTelephone = row["dep_HomePhone"]
    o.WorkTelephone = row["dep_WorkPhone"]
    o.MobileTelephone = row["dep_MobilePhone"]
예제 #2
0
        a.BreedName = "%s / %s" % ( asm.breed_name_for_id(a.BreedID), asm.breed_name_for_id(a.Breed2ID) )
    a.HiddenAnimalDetails = comments
    # They also jammed rabies into VACC
    a.RabiesTag = row["VACC"]
    # If the animal is dead, mark it as such
    if row["LICENSE"] == "DECEASED":
        a.Archived = 1
        a.DeceasedDate = a.DateBroughtIn
    elif row["PERSOWNR"] != "0" and row["PERSOWNR"].strip() != "":
        # Is there an adopter link?
        asm.adopt_to(a, ppo[row["PERSOWNR"]].ID)
    else:
        # Create a fake adoption to an unknown owner get this animal off shelter
        asm.adopt_to(a, uo.ID)
    # Does this animal have an image? If so, add media/dbfs entries for it
    imdata = asm.load_image_from_file(PATH + "/images/%s.jpg" % row["ANIMALKEY"])
    if imdata is None: imdata = asm.load_image_from_file(PATH + "/images/%s.JPG" % row["ANIMALKEY"])
    if imdata is not None:
        asm.animal_image(a.ID, imdata)

# Vaccinations
for row in cvacc:
    if not ppa.has_key(row["ANIMALKEY"]): continue
    a = ppa[row["ANIMALKEY"]]
    # Each row contains a vaccination
    av = asm.AnimalVaccination()
    animalvaccinations.append(av)
    vaccdate = asm.getdate_yyyymmdd(row["VACCEFFECT"])
    if vaccdate is None:
        vaccdate = a.DateBroughtIn
    av.AnimalID = a.ID
예제 #3
0
파일: shelterbuddy.py 프로젝트: tgage/asm3
        "SecondaryColour"]
    comments += "\nCircumstance: " + row["circumstance"]
    a.HiddenAnimalDetails = comments
    a.AnimalComments = getsbnotes(row["AnimalID"])
    if row["euthanasiaType"] != "0":
        a.Archived = 1
        a.DeceasedDate = a.DateBroughtIn
        a.PutToSleep = 1
        a.PTSReasonID = 4
    if row["crueltyCase"] == "TRUE":
        a.CrueltyCase = 1
    a.CreatedBy = "conversion/%s" % users[row["AddAdminID"]]
    a.LastChangedDate = getdate(row["AddDateTime"])
    # Do we have a default image for this animal in the images folder and document table?
    if documents.has_key(row["AnimalID"]):
        imagedata = asm.load_image_from_file(documents[row["AnimalID"]])
        if imagedata is not None:
            asm.animal_image(a.ID, imagedata)

# tblperson.csv
for row in asm.csv_to_list(PATH + "tblperson.csv"):
    o = asm.Owner()
    owners.append(o)
    ppo[row["recnum"]] = o
    o.OwnerTitle = row["Title"]
    o.OwnerForeNames = row["FirstName"]
    o.OwnerSurname = row["LastName"]
    o.OwnerName = o.OwnerForeNames + " " + o.OwnerSurname
    o.HomeTelephone = row["dep_HomePhone"]
    o.WorkTelephone = row["dep_WorkPhone"]
    o.MobileTelephone = row["dep_MobilePhone"]
예제 #4
0
파일: multiops.py 프로젝트: Reeco2014/asm3
    comments += ", Color: " + color1 + "/" + color2
    comments += ", Status: " + status
    comments += ", Area: " + location + ", Pen: " + pen
    a.HiddenAnimalDetails = comments
    # All animals are non-shelter until we find them in the intake list
    a.NonShelterAnimal = 1
    a.Archived = 1

# Read and store images
asm.stderr("Process images")
for row in canimalimages:
    if not ppa.has_key(row["tblAnimalsID"]): continue
    a = ppa[row["tblAnimalsID"]]
    asm.animal_image(
        a.ID,
        asm.load_image_from_file("%s/images/%s" %
                                 (PATH, row["ImageFilename"])))

# microchips, animal codes and document ids
asm.stderr("Process animal ID numbers")
for row in canimalids:
    if not ppa.has_key(row["tblAnimalsID"]): continue
    a = ppa[row["tblAnimalsID"]]
    # TODO: These can be customer specific, but appear to be default/fixed 2 == microchip
    if row["sysAnimalIDTypesID"] == "2":
        a.IdentichipNumber = row["Code"]
        a.Identichipped = 1
        a.IdentichipDate = asm.getdate_mmddyy(row["LastUpdate"])
    # 10 = police document id
    if row["sysAnimalIDTypesID"] == "10":
        asm.additional_field("DocumentID", 0, a.ID, row["Code"])
    # 21 = shelter's animal code
예제 #5
0
        markings = "Breed: %s" % d["Breed"]
        markings += "\nColor: %s" % d["Color"]
        markings += "\nCoat: %s %s" % (d["CoatLength"], d["CoatTexture"])
        markings += "\nCollar: %s" % d["Collar"]
        markings += "\nTail: %s" % d["Tail"]
        if d["Weight"] != "": markings += "\nWeight: %s" % d["Weight"]
        a.Markings = markings
        a.HiddenAnimalDetails = d["Comments"]
        a.AnimalComments = d["CageCardNotes"]
        a.IsGoodWithCats = 2
        a.IsGoodWithDogs = 2
        a.IsGoodWithChildren = 2
        a.HouseTrained = 0

        if d["ID"] in atoi:
            imagedata = asm.load_image_from_file("%s/%s" %
                                                 (IMAGE_PATH, atoi[d["ID"]]))
            asm.animal_image(a.ID, imagedata)

        if d["PrevOwnerID"] != "0" and d["PrevOwnerID"] != "":
            if d["PrevOwnerID"] in ppo:
                a.OriginalOwnerID = ppo[d["PrevOwnerID"]].ID
                activeowner = a.OriginalOwnerID
        if d["DateEuthanized"] != "":
            a.DeceasedDate = getdate(d["DateEuthanized"])
            a.Archived = 1
            a.PutToSleep = 1
            a.PTSReasonID = 2
        if d["DateAdopted"] != "":
            m = asm.Movement()
            m.AnimalID = a.ID
            m.OwnerID = get_asm_ownerid(d["ID"])
예제 #6
0
        a.PutToSleep = 0
        a.PTSReasonID = 2 # Died
        a.Archived = 1
    elif d["Status"] == "Euthanized":
        a.DeceasedDate = broughtin
        a.PutToSleep = 1
        a.PTSReasonID = 4 # Sick
        a.Archived = 1

    # Now do the dbfs and media inserts for a photo if one is available
    if IMPORT_PICTURES and "Picture 1" in d and d["Picture 1"] != "":
        pic1 = d["Picture 1"]
        picurl = "%s/%s" % (RG_AWS_PREFIX, pic1)
        # Check for locally saved photo first
        if pic1.rfind("/") != -1: pic1 = pic1[pic1.rfind("/")+1:]
        imdata = asm.load_image_from_file("%s/%s" % (PATH, pic1))
        if imdata is not None:
            asm.animal_image(a.ID, imdata)
        # Try online
        imdata = asm.load_image_from_url(picurl)
        if imdata is not None:
            asm.animal_image(a.ID, imdata)
        # Try PetFinder
        if a.Archived == 0 and imdata is None and pfpage != "":
            asm.petfinder_image(pfpage, a.ID, a.AnimalName)

if os.path.exists("%s/Contacts.csv" % PATH):
    for d in asm.csv_to_list("%s/Contacts.csv" % PATH):
        # Each row contains a person
        o = asm.Owner()
        owners.append(o)
예제 #7
0
파일: multiops.py 프로젝트: magul/asm3
    if row["sysAnimalStatusChoicesID"] == "15":
        a.DeceasedDate = a.DateBroughtIn
        a.PutToSleep = 0
        a.PTSReasonID = 2
        a.Archived = 1
    comments = "Original breed: " + breed1 + "/" + breed2
    comments += ", Color: " + color1 + "/" + color2
    comments += ", Status: " + status
    comments += ", Area: " + location + ", Pen: " + pen
    a.HiddenAnimalDetails = comments

# Read and store images
for row in canimalimages:
    if not ppa.has_key(row["tblAnimalsID"]): continue
    a = ppa[row["tblAnimalsID"]]
    asm.animal_image(a.ID, asm.load_image_from_file("%s/images/%s" % (PATH, row["ImageFilename"])))

# microchips, animal codes and document ids
for row in canimalids:
    if not ppa.has_key(row["tblAnimalsID"]): continue
    a = ppa[row["tblAnimalsID"]]
    # TODO: These are customer specific. 2 == microchip
    if row["sysAnimalIDTypesID"] == "2":
        a.IdentichipNumber = row["Code"]
        a.Identichipped = 1
        a.IdentichipDate = asm.getdate_mmddyy(row["LastUpdate"])
    # 10 = police document id
    if row["sysAnimalIDTypesID"] == "10":
        asm.additional_field("DocumentID", 0, a.ID, row["Code"])
    # 21 = jcas animal code
    if row["sysAnimalIDTypesID"] == "21" and row["Code"].strip() != "":
예제 #8
0
            o = ppo[d["ADPT_ID"]]
            m = asm.Movement()
            movements.append(m)
            m.AnimalID = a.ID
            m.OwnerID = o.ID
            m.MovementType = 1
            m.MovementDate = asm.todatetime(d["DATE_DISPO"])
            if d["RECLAIMED"] == "X": 
                m.MovementType = 5
            m.LastChangedDate = m.MovementDate
            a.Archived = 1
            a.ActiveMovementType = m.MovementType
            a.ActiveMovementDate = m.MovementDate
    if PICTURE_IMPORT and d["IMAGE"] != "" and d["IMAGE"] != "no_image.jpg" and d["IMAGE"] != "NO_IMAGE.JPG":
        fpath = "%s/pictures/Animals/%s" % (PATH, d["IMAGE"])
        imdata = asm.load_image_from_file(fpath, case_sensitive = False) # ARK is a Windows program
        if imdata is not None:
            asm.animal_image(a.ID, imdata)

for p in asm.read_dbf("%s/PAYMENTS.DBF" % PATH):
    if p["PMNT_ID"] not in ppo: continue
    od = asm.OwnerDonation()
    ownerdonations.append(od)
    o = ppo[p["PMNT_ID"]]
    od.OwnerID = o.ID
    od.Donation = asm.get_currency(p["AMOUNT"])
    od.Date = p["PMNT_DATE"]
    od.DonationTypeID = 4 # Surrender
    if p["PMNT_CODE"] == "ADP":
        od.DonationTypeID = 2