Пример #1
0
    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
    a.EntryReasonID = asm.iif(a.IsTransfer == 1, 15, 17)
    a.ReasonForEntry = d.source
    comments = ""
    if d.racing_name != "":
        asm.additional_field("racingname", 2, a.ID, d.racing_name)
    if d.housed_location != "":
        comments = "Housed Location: " + d.housed_location
    if not has_intake:
        comments += "\nBlank intake date on original record"
    a.BreedID = asm.iif(d.breed == "Greyhound", 101, 443)
    a.Breed2ID = a.BreedID
    a.BreedName = asm.iif(d.breed == "Greyhound", "Greyhound", "Lurcher")
    a.HiddenAnimalDetails = "%s\n%s" % (comments, note_fix(d.notes))
    if d.deceased == 1:
        a.DeceasedDate = a.DateBroughtIn
        a.PTSReasonID = 2
        a.Archived = 1

# Process fosters first so that the behaviour where we close existing
# movements never closes out a valid adoption
Пример #2
0
    comments += "\nGood with dogs: " + d["Good w/ dogs"] + " " + d[
        "Good w/ dogs notes"]
    comments += "\nGood with kids: " + d["Good w/ children"]
    comments += "\nEnergy: " + d["Energy level"]
    comments += "\nBehavior: " + d["Behavior Notes"]
    comments += "\nKennel Card Notes: " + d["Kennel Card Notes"]
    a.HiddenAnimalDetails = comments
    a.AnimalComments = d["About"]

    if d["Where from?"].startswith("DV"):
        flags += "Domestic Violence|"

    if d["Pit?"] == "Yes":
        flags += "Pitbull"

    asm.additional_field("CollarColor", 6, a.ID, d["Tcolor"])

    if d["Kennel Card Notes"].strip() != "":
        l = asm.Log()
        logs.append(l)
        l.LogTypeID = 3  # History
        l.LinkID = a.ID
        l.LinkType = 0
        l.Date = a.DateBroughtIn
        l.Comments = "Kennel Card: " + d["Kennel Card Notes"]

    if d["Behavior Notes"].strip() != "":
        l = asm.Log()
        logs.append(l)
        l.LogTypeID = 3  # History
        l.LinkID = a.ID
Пример #3
0
        if row["Type"] == "Home" or row["Type"] == "Main Number" or row[
                "Type"].strip() == "":
            o.HomeTelephone = row["Telephone"]
        elif row["Type"] == "Work":
            o.WorkTelephone = row["Telephone"]
        elif row["Type"] == "Mobile":
            o.MobileTelephone = row["Telephone"]

# ids
asm.stderr("Process person ID numbers")
for row in cpersonsids:
    # TODO: 1 == Driver's licence - user specific
    if row["sysKnownPersonsIDTypesID"] == "1":
        if ppo.has_key(row["tblKnownPersonsID"]):
            o = ppo[row["tblKnownPersonsID"]]
            asm.additional_field("DriversLicense", 1, o.ID, row["Code"])

# build intakes map
for row in canimalintakes:
    if row["tblAnimalsID"] not in intakes: intakes[row["tblAnimalsID"]] = row

# animals
asm.stderr("Process animals")
for row in canimals:
    if row["PrimaryIDString"] == "": continue
    a = asm.Animal()
    animals.append(a)
    ppa[row["tblAnimalsID"]] = a
    species = asm.find_value(cspecies, "sysSpeciesID", row["sysSpeciesID"],
                             "CommonName")
    a.AnimalTypeID = 2
Пример #4
0
    if d["Cross_Breed"] != "":
        a.Breed2ID = asm.breed_from_db(d["Cross_Breed"], 1)
        a.CrossBreed = 1
        a.BreedName = "%s / %s" % (d["Breed"], d["Cross_Breed"])
    #a.BaseColourID = asm.colour_id_for_names(d["Base_Colour"], d["Secondary_Colour"])
    a.BaseColourID = asm.colour_from_db(d["Base_"])
    a.AnimalComments = d["Notes"]
    a.Sex = asm.getsex_mf(d["Sex"])
    a.Size = asm.size_id_for_name(d["Size"])
    a.NeuteredDate = getdate(d["Date_Desexed"])
    if a.NeuteredDate is not None: a.Neutered = 1
    a.IsNotForRegistration = 0
    a.IsNotAvailableForAdoption = 1
    a.IdentichipNumber = d["Microchip_no"]
    a.Identichip2Number = d["Alternate_Chip_No"]
    asm.additional_field("MChipType", 5, a.ID,
                         d["Microchip_Type"])  # MChipType additional field
    if a.IdentichipNumber != "": a.Identichipped = 1
    if a.IdentichipNumber == "0":
        a.Identichipped = 0
        a.IdentichipNumber = ""
    a.IdentichipDate = asm.getdate_ddmmyyyy(d["Date_Microchipped"])
    a.IsGoodWithCats = 2
    a.IsGoodWithDogs = 2
    a.IsGoodWithChildren = 2
    a.HouseTrained = 0
    a.AcceptanceNumber = d["Litter No"]

    comments = "Breed: " + d["Breed"] + "/" + d["Cross_Breed"]
    comments += "\nSpecies: " + d["Species"]
    comments += "\nMicrochip Type: " + d["Microchip_Type"]
    comments += "\nSize: " + d["Size"]
Пример #5
0
print "DELETE FROM adoption WHERE ID >= 100 AND CreatedBy = 'conversion';"

# Create an unknown owner
uo = asm.Owner()
owners.append(uo)
uo.OwnerSurname = "Unknown Owner"
uo.OwnerName = uo.OwnerSurname

# Each row contains an animal with possible adoption and owner info
for d in asm.csv_to_list(FILENAME):

    a = asm.Animal()
    animals.append(a)
    # ACC Number
    if d["ACC Number"].strip() != "":
        asm.additional_field("accno", 2, a.ID, d["ACC Number"])
    # animaltype is upstairs or downstairs, upstairs = 42, downstairs = 43
    if d["Cat Cafe Down (Y/N)"] == "Y":
        a.AnimalTypeID = 43
        a.generateCode("D")
    else:
        a.AnimalTypeID = 42
        a.generateCode("U")
    # all cats
    a.SpeciesID = 2
    a.ShortCode = d["BBAWC Animal ID #"]
    a.AnimalName = d["Name (s) of Animal (list all names)"]
    if a.AnimalName.strip() == "":
        a.AnimalName = "(unknown)"
    a.DateBroughtIn = getpartdate(d["Intake Year"], d["Intake Month"])
    if a.DateBroughtIn is None:
Пример #6
0
     if d["Pound_Reason"] == "Stray":
         a.AnimalTypeID = 10  # Stray Dog
 else:
     a.AnimalTypeID = 40  # Misc
 a.SpeciesID = asm.species_id_for_name(d["Species"])
 a.AnimalName = d["Name"]
 if a.AnimalName.strip() == "":
     a.AnimalName = "(unknown)"
 a.DateBroughtIn = getdate(d["Date_Admitted"]) or asm.today()
 if d["Date_Of_Birth"].strip() != "":
     a.DateOfBirth = getdate(d["Date_Of_Birth"])
 if a.DateOfBirth is None:
     a.DateOfBirth = asm.subtract_days(a.DateBroughtIn, 365)
 a.CreatedDate = a.DateBroughtIn
 a.LastChangedDate = a.DateBroughtIn
 asm.additional_field("Legacy_Tag_No", 0, a.ID, d["Tag_no"])
 asm.additional_field("Legacy_Tag_No_Q", 0, a.ID, d["Tag_no_qualifier"])
 a.ShortCode = "%s:%s" % (d["Tag_no"], d["Tag_no_qualifier"])
 a.ShelterCode = a.ShortCode
 asm.breed_ids(a, d["Breed"], d["Cross_Breed"])
 a.BaseColourID = asm.colour_id_for_names(d["Base_Colour"],
                                          d["Secondary_Colour"])
 a.AnimalComments = d["Notes"]
 a.Sex = asm.getsex_mf(d["Sex"])
 a.Size = asm.size_id_for_name(d["Size"])
 a.NeuteredDate = getdate(d["Date_Desexed"])
 if a.NeuteredDate is not None: a.Neutered = 1
 a.IdentichipNumber = d["Microchip_no"]
 a.Identichip2Number = d["Alternate_Chip_No"]
 if a.IdentichipNumber != "": a.Identichipped = 1
 a.IdentichipDate = asm.getdate_ddmmyyyy(d["Date_Microchipped"])
Пример #7
0
    if ppo.has_key(row["tblKnownPersonsID"]):
        o = ppo[row["tblKnownPersonsID"]]
        if row["Type"] == "Home" or row["Type"] == "Main Number" or row["Type"].strip() == "":
            o.HomeTelephone = row["Telephone"]
        elif row["Type"] == "Work":
            o.WorkTelephone = row["Telephone"]
        elif row["Type"] == "Mobile":
            o.MobileTelephone = row["Telephone"]

# ids
for row in cpersonsids:
    # TODO: 1 == Driver's licence - user specific
    if row["sysKnownPersonsIDTypesID"] == "1":
        if ppo.has_key(row["tblKnownPersonsID"]):
            o = ppo[row["tblKnownPersonsID"]]
            asm.additional_field("DriversLicense", 1, o.ID, row["Code"])

# animals
for row in canimals:
    if row["PrimaryIDString"] == "": continue
    a = asm.Animal()
    animals.append(a)
    ppa[row["tblAnimalsID"]] = a
    species = asm.find_value(cspecies, "sysSpeciesID", row["sysSpeciesID"], "CommonName")
    a.AnimalTypeID = 2
    a.SpeciesID = asm.species_id_for_name(asm.fw(species))
    a.AnimalName = row["Name"]
    if a.AnimalName.strip() == "":
        a.AnimalName = "(unknown)"
    a.DateOfBirth = asm.getdate_mmddyy(row["DateOfBirth"])
    if a.DateOfBirth is None: a.DateOfBirth = asm.now()