Esempio n. 1
0
def getdate(s):
    if DATE_FORMAT == "DMY":
        return asm.getdate_ddmmyyyy(s)
    else:
        return asm.getdate_mmddyyyy(s)
def getdate(s):
    return asm.getdate_ddmmyyyy(s)
Esempio n. 3
0
def getdate(s):
    """ Returns a python date for s """
    if s == "NA": return None
    return asm.getdate_ddmmyyyy(s)
Esempio n. 4
0
def getdate(d):
    return asm.getdate_ddmmyyyy(d)
Esempio n. 5
0
# customers.csv
for row in asm.csv_to_list(PATH + "customers.csv"):
    if ppo.has_key(row["id"]): continue
    o = asm.Owner()
    owners.append(o)
    ppo[row["id"]] = o
    o.OwnerForeNames = row["First"]
    o.OwnerSurname = row["Last"]
    o.OwnerName = o.OwnerForeNames + " " + o.OwnerSurname
    o.OwnerAddress = row["Address"]
    o.OwnerTown = row["City"]
    o.OwnerCounty = row["State"]
    o.OwnerPostcode = row["Zip"]
    o.HomeTelephone = row["Phone"]
    o.CreatedDate = asm.getdate_ddmmyyyy(row["DateAdd"])
    o.Comments = row["Notes"]

# items.csv
for row in asm.csv_to_list(PATH + "items.csv"):
    if ppt.has_key(row["Item"]): continue
    dt = asm.DonationType()
    donationtypes.append(dt)
    ppt[row["Item"]] = dt
    dt.Name = "%s - %s" % (row["Item"], row["Desc"])
    dt.Description = row["Desc"]
    dt.DefaultCost = asm.get_currency(row["Amount"])

# invoices.csv
for row in asm.csv_to_list(PATH + "invoices.csv"):
    if not ppt.has_key(row["Item"]): continue
Esempio n. 6
0
# customers.csv
for row in asm.csv_to_list(PATH + "customers.csv"):
    if ppo.has_key(row["id"]): continue
    o = asm.Owner()
    owners.append(o)
    ppo[row["id"]] = o
    o.OwnerForeNames = row["First"]
    o.OwnerSurname = row["Last"]
    o.OwnerName = o.OwnerForeNames + " " + o.OwnerSurname
    o.OwnerAddress = row["Address"]
    o.OwnerTown = row["City"]
    o.OwnerCounty = row["State"]
    o.OwnerPostcode = row["Zip"]
    o.HomeTelephone = row["Phone"]
    o.CreatedDate = asm.getdate_ddmmyyyy(row["DateAdd"])
    o.Comments = row["Notes"]

# items.csv
for row in asm.csv_to_list(PATH + "items.csv"):
    if ppt.has_key(row["Item"]): continue
    dt = asm.DonationType()
    donationtypes.append(dt)
    ppt[row["Item"]] = dt
    dt.Name = "%s - %s" % (row["Item"], row["Desc"])
    dt.Description = row["Desc"]
    dt.DefaultCost = asm.get_currency(row["Amount"])

# invoices.csv
for row in asm.csv_to_list(PATH + "invoices.csv"):
    if not ppt.has_key(row["Item"]): continue
Esempio n. 7
0
def getdate(d):
    if d == "02/01/1900": return None  # Weird quirk of their files
    return asm.getdate_ddmmyyyy(d)
Esempio n. 8
0
    a.BaseColourID = asm.colour_from_db(d["Base_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.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"]
    comments += "\nCondition: " + d["Animal_Condition"]
    a.HiddenAnimalDetails = comments

    entrycomments = "Pound Reason: " + d["Pound_Reason"]
    entrycomments += "\nWhere Found: " + d["Where_found"]
Esempio n. 9
0
    ol = asm.OwnerLicence()
    ownerlicences.append(ol)
    lt = row["Licence Type"]
    ol.OwnerID = o.ID
    ol.AnimalID = a.ID
    ol.LicenceTypeID = asm.licencetype_from_db(lt)
    licnum = "%s%s-%s" % (lt[0:3].upper(), lt[len(lt) - 2:],
                          row["Licence Number"])
    if numused.has_key(licnum):
        licnum = licnum + "-2"
    if numused.has_key(licnum) and licnum.endswith("-2"):
        licnum = licnum[0:len(licnum) - 2] + "-3"
    ol.LicenceNumber = licnum
    numused[licnum] = "X"
    ol.LicenceFee = asm.get_currency(row["Fee"])
    ol.IssueDate = asm.getdate_ddmmyyyy(row["Issued"])
    ol.ExpiryDate = asm.getdate_ddmmyyyy(row["Expired"])
    if ol.IssueDate is None: ol.IssueDate = asm.today()
    if ol.ExpiryDate is None: ol.ExpiryDate = asm.today()
    ol.Comments = row["Comments"]

# Now that everything else is done, output stored records
for a in animals:
    print a
for o in owners:
    print o
for ol in ownerlicences:
    print ol

asm.stderr_summary(animals=animals, ownerlicences=ownerlicences, owners=owners)