Exemplo n.º 1
0
 a.DateBroughtIn = getdate(d["Intake Date"]) or asm.today()
 if "Date Of Birth" in d and d["Date Of Birth"].strip() != "":
     a.DateOfBirth = getdate(d["Date Of Birth"])
 else:
     a.DateOfBirth = asm.subtract_days(a.DateBroughtIn, 365)
 a.CreatedDate = a.DateBroughtIn
 a.LastChangedDate = a.DateBroughtIn
 if d["Intake Type"] == "Transfer In":
     a.IsTransfer = 1
 a.generateCode()
 a.ShortCode = d["ARN"]
 if a.ShortCode.strip() == "": a.ShortCode = d["Animal #"]
 if "Distinguishing Markings" in d:
     a.Markings = d["Distinguishing Markings"]
 a.IsNotAvailableForAdoption = 0
 a.ShelterLocation = asm.location_id_for_name(d["Location"])
 a.Sex = asm.getsex_mf(d["Gender"])
 a.Size = 2
 a.Neutered = d["Altered"] == "Yes" and 1 or 0
 a.EntryReasonID = 17  # Surrender
 if d["Intake Type"] == "Stray": a.EntryReasonID = 7  # Stray
 if d["Intake Type"] == "Transfer In":
     a.EntryReasonID = 15  # Transfer from other shelter
 a.ReasonForEntry = d["Reason"]
 if "Microchip Issue Date" in d:
     a.IdentichipDate = getdate(d["Microchip Issue Date"])
 if "Microchip Number" in d: a.IdentichipNumber = d["Microchip Number"]
 a.IsGoodWithCats = 2
 a.IsGoodWithDogs = 2
 a.IsGoodWithChildren = 2
 if "Intake Condition" in d:
Exemplo n.º 2
0
 if "Intake Date" in d: a.DateBroughtIn = getdate(d["Intake Date"])
 # Intake person
 linkperson = 0
 if "Intake From Name" in d and d["Intake From Name"] != "" and d[
         "Intake From Name"] in ppo:
     linkperson = ppo[d["Intake From Name"]].ID
 # Age
 if "Age (Months)" in d:
     a.DateOfBirth = asm.subtract_days(
         a.DateBroughtIn, 30 * asm.atoi(asm.cint(d["Age (Months)"])))
 # Location
 if "Location" in d and d["Location"] != "":
     locs = d[
         "Location"]  # Locations are a comma separated list, with latest on the right
     if locs.find(",") != -1: locs = locs[locs.rfind(",") + 1:]
     a.ShelterLocation = asm.location_id_for_name(locs, True)
     # a.ShelterLocation = asm.location_from_db(locs)
 if intaketype == "Transfer In":
     a.IsTransfer = 1
     a.EntryReasonID = 15
     a.BroughtInByOwnerID = linkperson
 elif intaketype == "Stray":
     a.EntryReasonID = 7
     a.BroughtInByOwnerID = linkperson
 elif intaketype == "Surrender":
     a.EntryReasonID = 17
     a.OriginalOwnerID = linkperson
     a.BroughtInByOwnerID = linkperson
 elif intaketype == "Return":
     a.EntryReasonID = 17  # Surrender
     a.OriginalOwnerID = linkperson
        a.AnimalName = "(unknown)"
    a.DateOfBirth = getdate(row["BIRTHDATE"])
    a.DateBroughtIn = getdate(row["INTAKETS"])
    if a.DateBroughtIn is None:
        a.DateBroughtIn = datetime.datetime.today()
    a.LastChangedDate = a.DateBroughtIn
    a.CreatedDate = a.DateBroughtIn
    a.Neutered = row["ALTERED"] == "Y" and 1 or 0
    a.NeuteredDate = (row["ALTEREDATINTAKE"] == "N"
                      and a.Neutered == 1) and a.DateBroughtIn or None
    a.EntryReasonID = 7  # Stray
    if row["INTAKE"].startswith("Owner"): a.EntryReasonID = 17  # Owner
    a.ReasonForEntry = "%s %s %s" % (row["INTAKE"], row["INTAKE REASON"],
                                     row["INTAKE LOCATION"])
    a.IsNotAvailableForAdoption = 0
    a.ShelterLocation = asm.location_id_for_name(row["INTAKE LOCATION"])
    if row["DISPOSIT"] == "Euthanize":
        a.DeceasedDate = getdate(row["DISPOSITTS"])
        a.PutToSleep = 1
        a.PTSReason = row["DISPOSIT REASON"]
        a.Archived = 1

# Adoptions
for row in cadopt:
    # Rows contain a person, animal and adoption - person first
    if row["CUSTUID"] in ppo:
        o = ppo[row["CUSTUID"]]
    else:
        o = asm.Owner()
        owners.append(o)
        ppo[row["CUSTUID"]] = o
Exemplo n.º 4
0
     a.DateBroughtIn = DEFAULT_INTAKE_DATE
 if d.dob is not None:
     a.DateOfBirth = d.dob
 elif d.date_of_entry is not None and d.approx_age is not None:
     a.DateOfBirth = asm.subtract_days(d.date_of_entry, d.approx_age * 365)
 elif a.DateBroughtIn != DEFAULT_INTAKE_DATE:
     a.DateOfBirth = asm.subtract_days(a.DateBroughtIn, 365 * 2)
 else:
     a.DateOfBirth = DEFAULT_DATE_OF_BIRTH
 a.CreatedDate = a.DateBroughtIn
 a.LastChangedDate = a.DateBroughtIn
 if d.relinquishment_ownership == 0:
     a.IsTransfer = 1
 a.generateCode()
 a.IsNotAvailableForAdoption = 0
 a.ShelterLocation = asm.location_id_for_name(d.locationname)
 a.Sex = asm.iif(d.sex == "Dog", 1, 0)
 a.Size = 2
 a.Neutered = 1
 a.NeuteredDate = d.neutering_date
 a.IdentichipNumber = d.microchip_no
 if a.IdentichipNumber != "":
     a.Identichipped = 1
 if d.left_ear_tattoo != "":
     a.Tattoo = 1
     a.TattooNumber = "L:%s R:%s" % (d.left_ear_tattoo, d.right_ear_tattoo)
 a.IsGoodWithCats = 2
 a.IsGoodWithDogs = 2
 a.IsGoodWithChildren = 2
 a.HouseTrained = 0
 a.Archived = 0