def RefreshList(self, ID=False): pathtofiletypesfile = miscmethods.GetHome() + "/.evette/filetypes.conf" if os.path.isfile(pathtofiletypesfile) == False: out = open(pathtofiletypesfile, "w") out.write("") out.close() inp = open(pathtofiletypesfile, "r") self.htmllist = [] count = 0 for a in inp.readlines(): self.htmllist.append( (count, a.strip().split("$$$")) ) count = count + 1 inp.close() customwidgets.ListCtrlWrapper.RefreshList(self)
def run(self): localsettings = self.localsettings body = self.body home = miscmethods.GetHome() header = CreateHeader(localsettings) form = header + body + "</body></html>" pathtotempfolder = home + "/.evette/temp" filename = 1 while os.path.isfile(pathtotempfolder + "/" + str(filename) + ".html") == True: filename = filename + 1 filename = str(filename) + ".html" out = open(pathtotempfolder + "/" + filename, "w") out.write(form.encode('utf-8')) out.close() miscmethods.OpenMedia(False, filename)
def run(self): localsettings = self.localsettings body = self.body home = miscmethods.GetHome() username = localsettings.username time = datetime.datetime.today() time = time.strftime("%A %d %B %Y - %H:%M") header = CreateHeader(localsettings) form = header + body + "<p align=right><font size=1><hr>" + localsettings.dictionary["generatedbylabel"][localsettings.language] + " $$user$$ " + localsettings.dictionary["onlabel"][localsettings.language] + " $$time$$</font></p></body></html>" form = form.replace("$$user$$", username).replace("$$time$$", time) pathtotempfolder = home + "/.evette/temp" filename = 1 while os.path.isfile(pathtotempfolder + "/" + str(filename) + ".html") == True: filename = filename + 1 filename = str(filename) + ".html" out = open(pathtotempfolder + "/" + filename, "w") out.write(form.encode('utf-8')) out.close() miscmethods.OpenMedia(False, filename)
def CloseEvette(self, ID): tempfolder = miscmethods.GetHome() + "/.evette/temp" recursivemethods.EmptyFolder(tempfolder) self.logindialog.Show() wx.Frame.Destroy(self.frame)
def CreateConfFile(): home = miscmethods.GetHome() conffile = home + "/.evette.conf" output = "localhost\nroot\nFalse\n\nuser\n0" out = open(conffile, "w") out.write(output) out.close()
def SaveSettings(self, username=""): home = miscmethods.GetHome() out = open(home + "/.evette.conf", "w") out.write(self.dbip + "\n" + self.dbuser + "\n" + self.dbpass + "\n\n" + username + "\n" + str(self.language) + "\n" + str(self.appointmentrefresh)) out.close() self.GetSettings()
def Submit(self, ID): panel = ID.GetEventObject().GetParent() extension = panel.extensionentry.GetValue() program = panel.programentry.GetValue() output = "" success = True if panel.countid == -1: existingextensions = [] for a in range(0, len(self.listbox.htmllist)): existingextensions.append(self.listbox.htmllist[a][1][0].strip()) output = output + self.listbox.htmllist[a][1][0].strip() + "$$$" + self.listbox.htmllist[a][1][1].strip() + "\n" output = output + extension.strip() + "$$$" + program.strip() if existingextensions.__contains__(extension): success = False miscmethods.ShowMessage(self.GetLabel("fileassociationexistsmessage")) else: for a in range(0, len(self.listbox.htmllist)): if a == panel.countid: output = output + self.listbox.htmllist[a][1][0].strip() + "$$$" + program + "\n" else: output = output + self.listbox.htmllist[a][1][0].strip() + "$$$" + self.listbox.htmllist[a][1][1].strip() + "\n" output = output.strip() if success == True: pathtofiletypesfile = miscmethods.GetHome() + "/.evette/filetypes.conf" out = open(pathtofiletypesfile, "w") out.write(output) out.close() self.listbox.RefreshList() panel.GetParent().Close()
def FormSelected(self, ID): home = miscmethods.GetHome() listboxid = self.listbox.GetSelection() body = self.listbox.htmllist[listboxid][2] title = self.listbox.htmllist[listboxid][1] self.parent.editorpanel.entry.SetValue(body) self.parent.editorpanel.nameentry.SetValue(title) self.parent.editorpanel.deletebutton.Enable()
def Submit(self, ID): name = self.nameentry.GetValue() address = self.addressentry.GetValue() postcode = self.postcodeentry.GetValue() telephone = self.telephoneentry.GetValue() email = self.emailentry.GetValue() website = self.websiteentry.GetValue() prescriptionfee = miscmethods.ConvertPriceToPennies( self.prescriptionfeeentry.GetValue()) if prescriptionfee == -1: prescriptionfee = 0 self.localsettings.prescriptionfee = prescriptionfee openfrom = self.openfromentry.GetValue() opento = self.opentoentry.GetValue() operationtime = self.operationtimeentry.GetValue() self.localsettings.language = self.languageentry.GetSelection() self.localsettings.appointmentrefresh = self.appointmentrefreshentry.GetValue( ) try: self.localsettings.appointmentrefresh = int( self.localsettings.appointmentrefresh) except: self.localsettings.appointmentrefresh = "30" if language != self.localsettings.language: home = miscmethods.GetHome() self.localsettings.SaveSettings(self.localsettings.username) #out = open(home + "/.evette.conf", "w") #out.write(self.localsettings.dbip + "\n" + self.localsettings.dbuser + "\n" + self.localsettings.dbpass + "\n\n" + self.localsettings.lastuser + "\n" + str(language)) #out.close() action = "UPDATE settings SET PracticeName = \"" + name + "\", PracticeAddress = \"" + address + "\", PracticePostcode = \"" + postcode + "\", PracticeTelephone = \"" + telephone + "\", PracticeEmail = \"" + email + "\", PracticeWebsite = \"" + website + "\", OpenFrom = \"" + openfrom + "\", OpenTo = \"" + opento + "\", OperationTime = \"" + operationtime + "\", PrescriptionFee = " + str( prescriptionfee) db.SendSQL(action, self.localsettings.dbconnection) self.localsettings.SaveSettings(self.localsettings.username) self.notebook.ClosePage(self.notebook.activepage)
def GetASMDBSettings(): home = miscmethods.GetHome() jdbcsettings = home + "/.asm/jdbc.properties" inp = open(jdbcsettings, "r") filecontents = inp.readlines() inp.close() filecontentsstring = "" for a in filecontents: filecontentsstring = filecontentsstring + a filecontents = filecontentsstring.replace("\\", "") dbip = filecontents.split("://")[1].split("/")[0] #print "dbip detected as " + str(dbip) dbuser = filecontents.split("user="******"&")[0] #print "dbuser detected as " + str(dbuser) if filecontents.__contains__("password") == False: dbpass = False else: dbpass = filecontents.split("password="******"&")[0] #print "dbpass detected as " + str(dbpass) return (dbip, dbuser, dbpass)
def Delete(self, ID): if miscmethods.ConfirmMessage(self.GetLabel("deleteassociationconfirm")): listboxid = self.listbox.GetSelection() output = "" for a in range(0, len(self.listbox.htmllist)): if a != listboxid: output = output + self.listbox.htmllist[a][1][0] + "$$$" + self.listbox.htmllist[a][1][1] + "\n" output = output.strip() pathtofiletypesfile = miscmethods.GetHome() + "/.evette/filetypes.conf" out = open(pathtofiletypesfile, "w") out.write(output) out.close() self.listbox.RefreshList()
def CreateHeader(localsettings): home = miscmethods.GetHome() username = localsettings.username time = datetime.datetime.today() time = time.strftime("%A %d %B %Y - %H:%M") inp = open(home + "/.evette/html/header.dat", "r") filecontents = inp.readlines() inp.close() html = "" for a in filecontents: html = html + a html = html.replace("$$user$$", username).replace("$$time$$", time) return html
def GetSettings(self): home = miscmethods.GetHome() self.dictionary = language.GetDictionary() conffile = home + "/.evette.conf" try: if os.path.isfile(conffile): inp = open(conffile, "r") filecontents = "" for a in inp.readlines(): filecontents = filecontents + a inp.close() settingslist = filecontents.strip().split("\n") self.dbip = settingslist[0] self.dbuser = settingslist[1] self.dbpass = settingslist[2] self.lastuser = settingslist[4] self.language = int(settingslist[5]) self.appointmentrefresh = int(settingslist[6]) else: self.dbip = "localhost" self.dbuser = "******" self.dbpass = "" self.lastuser = "******" self.language = 0 self.appointmentrefresh = 30 except: #print sys.exc_info() self.dbip = "localhost" self.dbuser = "******" self.dbpass = "" self.lastuser = "******" self.language = 0 self.appointmentrefresh = 30 if self.userid != False: connection = db.GetConnection(self) self.dbconnection = connection action = "SELECT * FROM settings" results = db.SendSQL(action, connection) self.practicename = unicode(results[0][1], "utf8") self.openfrom = results[0][2] self.opento = results[0][3] self.operationtime = results[0][4] self.practiceaddress = unicode(results[0][5], "utf8") self.practicepostcode = unicode(results[0][6], "utf8") self.practicetelephone = unicode(results[0][7], "utf8") self.practiceemail = unicode(results[0][8], "utf8") self.practicewebsite = unicode(results[0][9], "utf8") self.shelterid = results[0][10] self.markupmultiplyby = results[0][11] self.markuproundto = results[0][12] self.asmvaccinationid = results[0][13] self.prescriptionfee = results[0][14] action = "SELECT * FROM user WHERE ID = " + str(self.userid) results = db.SendSQL(action, connection) self.username = unicode(results[0][1], "utf8") self.userposition = unicode(results[0][3], "utf8") changelog = results[0][4].split("$") self.editclients = int(changelog[0][0]) self.deleteclients = int(changelog[0][1]) self.editfinances = int(changelog[0][2]) self.editanimals = int(changelog[1][0]) self.deleteanimals = int(changelog[1][1]) self.editappointments = int(changelog[2][0]) self.deleteappointments = int(changelog[2][1]) self.vetform = int(changelog[2][2]) self.editmedication = int(changelog[3][0]) self.deletemedication = int(changelog[3][1]) self.editprocedures = int(changelog[4][0]) self.deleteprocedures = int(changelog[4][1]) self.editlookups = int(changelog[5][0]) self.deletelookups = int(changelog[5][1]) self.editforms = int(changelog[6][0]) self.deleteforms = int(changelog[6][1]) self.editusers = int(changelog[7][0]) self.deleteusers = int(changelog[7][1]) self.editrota = int(changelog[7][2]) self.toolbar = int(changelog[8][0]) self.changelog = int(changelog[8][1]) self.editsettings = int(changelog[8][2]) self.multiplepanels = int(changelog[8][3]) self.asmsync = int(changelog[8][4]) self.addtodiary = int(changelog[9][0]) self.editdiary = int(changelog[9][1]) self.deletefromdiary = int(changelog[9][2])
def CheckVersion(localsettings): success = False try: connection = db.GetConnection(localsettings) action = "SELECT VersionNo FROM version" results = db.SendSQL(action, connection) oldversion = results[0][0] connection.close() success = True except: if miscmethods.ConfirmMessage( GetLabel(localsettings, "versiontablenotfoundquestion")): action = "CREATE TABLE version (ID int unsigned not null auto_increment primary key, VersionNo varchar(10))" db.SendSQL(action, localsettings.dbconnection) action = "INSERT INTO version (VersionNo) VALUES (\"1.1.2\")" db.SendSQL(action, localsettings.dbconnection) oldversion = "1.1.2" success = True if success == True: if versionno > oldversion: if miscmethods.ConfirmMessage( GetLabel(localsettings, "versionupdatequestion1") + " " + versionno + ", " + GetLabel(localsettings, "versionupdatequestion2") + " " + oldversion + ". " + GetLabel(localsettings, "versionupdatequestion3")): if oldversion == "1.1.2": action = "CREATE TABLE manualvaccination (ID int unsigned not null auto_increment primary key, AnimalID int, Date date, Name varchar(50), Batch varchar(50), Next date)" db.SendSQL(action, localsettings.dbconnection) currenttime = datetime.datetime.today().strftime("%x %X") for a in ("medication", "medicationin", "medicationout", "vaccinationtype", "vaccinationin", "vaccinationout", "receipt"): action = "ALTER TABLE " + a + " ADD ChangeLog text" db.SendSQL(action, localsettings.dbconnection) action = "UPDATE " + a + " SET ChangeLog = \"" + currenttime + "%%%" + str( localsettings.userid) + "\"" db.SendSQL(action, localsettings.dbconnection) action = "REPLACE INTO version (ID, VersionNo) VALUES (1, \"1.1.3\")" db.SendSQL(action, localsettings.dbconnection) action = "ALTER TABLE settings DROP HTMLViewer" db.SendSQL(action, localsettings.dbconnection) action = "ALTER TABLE user ADD Permissions varchar(50)" db.SendSQL(action, localsettings.dbconnection) action = "UPDATE user SET Permissions = \"111$11$111$11$11$11$11$111$111\"" db.SendSQL(action, localsettings.dbconnection) oldversion = "1.1.3" if oldversion == "1.1.3": action = "REPLACE INTO version (ID, VersionNo) VALUES (1, \"1.1.4\")" db.SendSQL(action, localsettings.dbconnection) oldversion = "1.1.4" if oldversion == "1.1.4": action = "ALTER TABLE animal ADD IsDeceased int" db.SendSQL(action, localsettings.dbconnection) action = "UPDATE animal SET IsDeceased = 0" db.SendSQL(action, localsettings.dbconnection) action = "ALTER TABLE animal ADD DeceasedDate date" db.SendSQL(action, localsettings.dbconnection) action = "UPDATE animal SET DeceasedDate = \"0000-00-00\"" db.SendSQL(action, localsettings.dbconnection) action = "ALTER TABLE animal ADD CauseOfDeath text" db.SendSQL(action, localsettings.dbconnection) action = "UPDATE animal SET CauseOfDeath = \"\"" db.SendSQL(action, localsettings.dbconnection) action = "REPLACE INTO version (ID, VersionNo) VALUES (1, \"1.1.5\")" db.SendSQL(action, localsettings.dbconnection) oldversion = "1.1.5" if oldversion == "1.1.5": action = "DROP TABLE staff" db.SendSQL(action, localsettings.dbconnection) action = "CREATE TABLE staff (ID int unsigned not null auto_increment primary key, Name varchar(20), Date date, Position varchar(20), TimeOn varchar(20), TimeOff varchar(20), Operating int)" db.SendSQL(action, localsettings.dbconnection) action = "REPLACE INTO version (ID, VersionNo) VALUES (1, \"1.1.6\")" db.SendSQL(action, localsettings.dbconnection) oldversion = "1.1.6" if oldversion == "1.1.6": dbmethods.CreateDiaryTable(localsettings.dbconnection) action = "REPLACE INTO version (ID, VersionNo) VALUES (1, \"1.1.7\")" db.SendSQL(action, localsettings.dbconnection) action = "UPDATE user SET Permissions = CONCAT(Permissions, \"$111\")" db.SendSQL(action, localsettings.dbconnection) oldversion = "1.1.7" if oldversion == "1.1.7": dbmethods.CreateMediaTable(localsettings.dbconnection) action = "REPLACE INTO version (ID, VersionNo) VALUES (1, \"1.1.8\")" db.SendSQL(action, localsettings.dbconnection) oldversion = "1.1.8" if oldversion == "1.1.8": dbmethods.CreateWeightTable(localsettings.dbconnection) action = "ALTER TABLE medication ADD ReOrderNo int" db.SendSQL(action, localsettings.dbconnection) action = "UPDATE medication SET ReOrderNo = 0" db.SendSQL(action, localsettings.dbconnection) action = "REPLACE INTO version (ID, VersionNo) VALUES (1, \"1.1.9\")" db.SendSQL(action, localsettings.dbconnection) oldversion = "1.1.9" if oldversion == "1.1.9" or oldversion == "1.2": action = "ALTER TABLE settings ADD PracticeAddress varchar(250)" db.SendSQL(action, localsettings.dbconnection) action = "ALTER TABLE settings ADD PracticePostcode varchar(10)" db.SendSQL(action, localsettings.dbconnection) action = "ALTER TABLE settings ADD PracticeTelephone varchar(20)" db.SendSQL(action, localsettings.dbconnection) action = "ALTER TABLE settings ADD PracticeEmail varchar(100)" db.SendSQL(action, localsettings.dbconnection) action = "ALTER TABLE settings ADD PracticeWebsite varchar(250)" db.SendSQL(action, localsettings.dbconnection) action = "UPDATE settings SET PracticeAddress = \"\", PracticePostcode = \"\", PracticeTelephone = \"\", PracticeEmail = \"\", PracticeWebsite = \"\"" db.SendSQL(action, localsettings.dbconnection) action = "ALTER TABLE form ADD FormType varchar(50)" db.SendSQL(action, localsettings.dbconnection) action = "UPDATE form SET FormType = \"animal\"" db.SendSQL(action, localsettings.dbconnection) formbody = """ <p> <<PracticeName>><br> <<PracticeAddress>><br> <<PracticePostcode>><br> <<PracticeTelephone>> </p> <p> <<Today>> </p> <p> <<ClientName>><br> <<ClientAddress>><br> <<ClientPostcode>> </p> <p> Dear <<ClientName>> </p> <p> We have been trying to contact you unsuccessfully for some time on the following numbers: </p> <p> <ul> <li><<ClientHomeTelephone>></li> <li><<ClientMobileTelephone>></li> <li><<ClientWorkTelephone>></li> </ul> </p> <p> Could you please contact us on <<PracticeTelephone>> so that we can update you record. </p> <p> Thank you in advance </p> <p> <<PracticeName>> </p> """ action = "INSERT INTO form (Title, Body, FormType) VALUES (\"Unable to contact letter\", \"" + formbody + "\", \"client\")" db.SendSQL(action, localsettings.dbconnection) formbody = """ <h2 align=center>Invoice #<<InvoiceNumber>></h2> <p align=center>from <<FromDate>> to <<ToDate>></p> <table align=center> <tr> <td valign=top> <fieldset> <legend>Client</legend> <<ClientName>><br> <<ClientAddress>><br> <<ClientPostcode>> </td> <td width=20> </td> <td valign=top> <<InvoiceBreakdown>> <br> <table align=right> <tr> <td> <fieldset> <legend>Total</legend> <font size=5>£<<InvoiceTotal>></font> </fieldset> </td> </tr> </table> </td> <td width=20> </td> <td valign=top> <fieldset> <legend>Payable to</legend> <<PracticeName>><br> <<PracticeAddress>><br> <<PracticePostcode>> </fieldset> </td> </tr> </table> """ action = "INSERT INTO form (Title, Body, FormType) VALUES (\"Standard Invoice\", \"" + formbody + "\", \"invoice\")" db.SendSQL(action, localsettings.dbconnection) formbody = """ <table width=300 align=center> <tr> <td colspan=2 align=center> <font size=2><b><<PracticeName>></b></font><br> <font size=1><<PracticeAddress>>, <<PracticePostcode>>, <<PracticeTelephone>>.</font> </td> </tr> <tr> <td valign=top> <fieldset><legend><font size=1>Client</font></legend> <font size=1><<ClientName>><br><<ClientAddress>><br><<ClientPostcode>></font> </fieldset> </td> <td valign=top> <fieldset><legend><font size=1>Animal</font></legend> <font size=1><<AnimalName>><br><<AnimalSpecies>><br><<AnimalColour>></font> </fieldset> </td> </tr> <tr> <td colspan=2> <fieldset><legend><div><font size=1>Medication</font></div></legend> <font size=2><b><<MedicationName>> x <<Quantity>></b></font> </fieldset> </td> </tr> <tr> <td colspan=2> <fieldset><legend><font size=1>Instructions</font></legend> <font size=2><b><<Instructions>></b></font> </fieldset> </td> </tr> <tr> <td colspan=2 align=center> <font size=1>Keep all medicines out of reach of children<br>ANIMAL TREATMENT ONLY</font> </td> </tr> </table> """ action = "INSERT INTO form (Title, Body, FormType) VALUES (\"Medication Label\", \"" + formbody + "\", \"medication\")" db.SendSQL(action, localsettings.dbconnection) action = "ALTER TABLE medication ADD ExpiryDate date" db.SendSQL(action, localsettings.dbconnection) action = "UPDATE medication SET ExpiryDate = \"0000-00-00\"" db.SendSQL(action, localsettings.dbconnection) action = "CREATE TABLE invoice (ID int unsigned not null auto_increment primary key, ClientID int, FromDate date, ToDate date, Total int, Body text, Paid int)" db.SendSQL(action, localsettings.dbconnection) action = "REPLACE INTO version (ID, VersionNo) VALUES (1, \"1.2.1\")" db.SendSQL(action, localsettings.dbconnection) oldversion = "1.2.1" if oldversion == "1.2.1": action = "ALTER TABLE medication ADD Type int" db.SendSQL(action, localsettings.dbconnection) action = "UPDATE medication SET Type = 0" db.SendSQL(action, localsettings.dbconnection) action = "ALTER TABLE medicationout ADD NextDue date" db.SendSQL(action, localsettings.dbconnection) action = "UPDATE medicationout SET NextDue = \"0000-00-00\"" db.SendSQL(action, localsettings.dbconnection) try: action = "SELECT * FROM vaccinationtype" results = db.SendSQL(action, localsettings.dbconnection) action = "SELECT * FROM vaccinationin" vaccinationindata = db.SendSQL( action, localsettings.dbconnection) action = "SELECT * FROM vaccinationout" vaccinationoutdata = db.SendSQL( action, localsettings.dbconnection) for a in results: #VaccinationType --- (ID, Name, Description, CurrentBatch, Price, ChangeLog) #MedicationType --- (ID, Name, Description, Unit, BatchNo, CurrentPrice, ChangeLog, ReOrderNo, ExpiryDate) vaccinationid = a[0] action = "INSERT INTO medication (Name, description, Unit, BatchNo, CurrentPrice, ChangeLog, ReOrderNo, ExpiryDate, Type) VALUES (\"" + a[ 1] + "\", \"" + a[2] + "\", \"" + GetLabel( localsettings, "vaccinationsvaccinelabel" ).lower() + "\", \"" + a[3] + "\", " + str( a[4] ) + ", \"" + a[5] + "\", 0, \"0000-00-00\", 1)" db.SendSQL(action, localsettings.dbconnection) #action = "SELECT LAST_INSERT_ID() FROM medication" action = "SELECT ID from medication ORDER BY ID DESC LIMIT 1" medicationid = db.SendSQL( action, localsettings.dbconnection) #print 'medicationid', type(medicationid), medicationid if type(medicationid) in [ type(['array']), type(('touple')) ]: pass medicationid = medicationid[0][0] print 'medicationid', type( medicationid), medicationid for b in vaccinationindata: if a[0] == b[1]: #Vaccinationin --- (ID, VaccinationID, Date, Amount, BatchNo, Expires, WhereFrom, ChangeLog) #Medicationin --- (ID, MedicationID, Date, Amount, BatchNo, Expires, WhereFrom, ChangeLog) action = "INSERT INTO medicationin (MedicationID, Date, Amount, BatchNo, Expires, WhereFrom, ChangeLog) VALUES (" + \ str(medicationid) + ", \"" + str(b[2]) + "\", \"" + str(b[3]) + "\", \"" + b[4] + "\", \"" + str(b[5]) + "\", \"" + b[6] + "\", \"" + b[7] + "\")" db.SendSQL(action, localsettings.dbconnection) for b in vaccinationoutdata: if a[0] == b[1]: #Vaccinationout --- (ID, VaccinationID, Date, Amount, BatchNo, WhereTo, AppointmentID, NextDue, ChangeLog) #Medicationout --- (ID, MedicationID, Date, Amount, BatchNo, WhereTo, AppointmentID, ChangeLog, NextDue) action = "INSERT INTO medicationout (MedicationID, Date, Amount, BatchNo, WhereTo, AppointmentID, ChangeLog, NextDue) VALUES (" + str( medicationid ) + ", \"" + str(b[2]) + "\", \"" + str( b[3] ) + "\", \"" + b[4] + "\", \"" + str( b[5]) + "\", " + str( b[6] ) + ", \"" + b[8] + "\", \"" + str( b[7]) + "\")" db.SendSQL(action, localsettings.dbconnection) action = "DROP TABLE vaccinationtype" db.SendSQL(action, localsettings.dbconnection) action = "DROP TABLE vaccinationin" db.SendSQL(action, localsettings.dbconnection) action = "DROP TABLE vaccinationout" db.SendSQL(action, localsettings.dbconnection) except: print "Vaccination tables not found - ignored!" action = "REPLACE INTO version (ID, VersionNo) VALUES (1, \"1.2.2\")" db.SendSQL(action, localsettings.dbconnection) oldversion = "1.2.2" if oldversion == "1.2.2": dbmethods.CreateKennelTables(localsettings.dbconnection) action = "ALTER TABLE appointment ADD Staying int" db.SendSQL(action, localsettings.dbconnection) action = "UPDATE appointment SET Staying = 0" db.SendSQL(action, localsettings.dbconnection) action = "ALTER TABLE animal ADD ASMRef varchar(10)" db.SendSQL(action, localsettings.dbconnection) action = "UPDATE animal SET ASMRef = \"\"" db.SendSQL(action, localsettings.dbconnection) action = "ALTER TABLE settings ADD ShelterID int" db.SendSQL(action, localsettings.dbconnection) action = "UPDATE settings SET ShelterID = 0" db.SendSQL(action, localsettings.dbconnection) action = "CREATE TABLE reason (ID int unsigned not null auto_increment primary key, ReasonName varchar(200))" db.SendSQL(action, localsettings.dbconnection) action = "REPLACE INTO version (ID, VersionNo) VALUES (1, \"1.2.3\")" db.SendSQL(action, localsettings.dbconnection) oldversion = "1.2.3" if oldversion == "1.2.3": action = "ALTER TABLE appointment ADD ArrivalTime time" db.SendSQL(action, localsettings.dbconnection) action = "UPDATE appointment SET ArrivalTime = NULL" db.SendSQL(action, localsettings.dbconnection) action = "SELECT ID, Permissions FROM user" results = db.SendSQL(action, localsettings.dbconnection) for a in results: permissions = a[1] permissions = permissions[:30] + "1" + permissions[30:] action = "UPDATE user SET Permissions = \"" + str( permissions) + "\" WHERE ID = " + str(a[0]) db.SendSQL(action, localsettings.dbconnection) action = "ALTER TABLE medication ADD CostPrice int" db.SendSQL(action, localsettings.dbconnection) action = "UPDATE medication SET CostPrice = 0" db.SendSQL(action, localsettings.dbconnection) action = "REPLACE INTO version (ID, VersionNo) VALUES (1, \"1.2.6\")" db.SendSQL(action, localsettings.dbconnection) oldversion = "1.2.6" if oldversion == "1.2.6": action = "ALTER TABLE settings ADD MarkupMultiplyBy varchar(10)" db.SendSQL(action, localsettings.dbconnection) action = "UPDATE settings SET MarkupMultiplyBy = \"1.175\"" db.SendSQL(action, localsettings.dbconnection) action = "ALTER TABLE settings ADD MarkupRoundTo int" db.SendSQL(action, localsettings.dbconnection) action = "UPDATE settings SET MarkupRoundTo = 5" db.SendSQL(action, localsettings.dbconnection) action = "REPLACE INTO version (ID, VersionNo) VALUES (1, \"1.2.7\")" db.SendSQL(action, localsettings.dbconnection) oldversion = "1.2.7" if oldversion == "1.2.7": dbmethods.CreateLostAndFoundTables( localsettings.dbconnection) action = "ALTER TABLE client ADD PhonePermissions int" db.SendSQL(action, localsettings.dbconnection) action = "UPDATE client SET PhonePermissions = 0" db.SendSQL(action, localsettings.dbconnection) animalsexes = [] action = "ALTER TABLE animal ADD TempSex int" db.SendSQL(action, localsettings.dbconnection) action = "UPDATE animal SET TempSex = 0" db.SendSQL(action, localsettings.dbconnection) action = "UPDATE animal SET TempSex = 1 WHERE Sex = \"" + GetLabel( localsettings, "malelabel") + "\"" db.SendSQL(action, localsettings.dbconnection) action = "UPDATE animal SET TempSex = 2 WHERE Sex = \"" + GetLabel( localsettings, "femalelabel") + "\"" db.SendSQL(action, localsettings.dbconnection) action = "ALTER TABLE animal MODIFY Sex int" db.SendSQL(action, localsettings.dbconnection) action = "UPDATE animal SET Sex = TempSex" db.SendSQL(action, localsettings.dbconnection) action = "ALTER TABLE animal DROP TempSex" db.SendSQL(action, localsettings.dbconnection) action = "REPLACE INTO version (ID, VersionNo) VALUES (1, \"1.2.8\")" db.SendSQL(action, localsettings.dbconnection) oldversion = "1.2.8" if oldversion == "1.2.8": action = "REPLACE INTO version (ID, VersionNo) VALUES (1, \"1.2.9\")" db.SendSQL(action, localsettings.dbconnection) oldversion = "1.2.9" if oldversion == "1.2.9": action = "REPLACE INTO version (ID, VersionNo) VALUES (1, \"1.3\")" db.SendSQL(action, localsettings.dbconnection) oldversion = "1.3" if oldversion == "1.3": action = "REPLACE INTO version (ID, VersionNo) VALUES (1, \"1.3.1\")" db.SendSQL(action, localsettings.dbconnection) oldversion = "1.3.1" if oldversion == "1.3.1": action = "ALTER TABLE settings ADD ASMVaccinationID int" db.SendSQL(action, localsettings.dbconnection) action = "UPDATE settings SET ASMVaccinationID = 0" db.SendSQL(action, localsettings.dbconnection) action = "ALTER TABLE settings ADD PrescriptionFee int" db.SendSQL(action, localsettings.dbconnection) action = "UPDATE settings SET PrescriptionFee = 0" db.SendSQL(action, localsettings.dbconnection) action = "SELECT ID, Permissions FROM user" results = db.SendSQL(action, localsettings.dbconnection) for a in results: permissions = a[1] permissions = permissions[:31] + "0" + permissions[31:] action = "UPDATE user SET Permissions = \"" + str( permissions) + "\" WHERE ID = " + str(a[0]) db.SendSQL(action, localsettings.dbconnection) action = "REPLACE INTO version (ID, VersionNo) VALUES (1, \"1.3.2\")" db.SendSQL(action, localsettings.dbconnection) oldversion = "1.3.2" home = miscmethods.GetHome() out = open(home + "/.evette.conf", "w") out.write(localsettings.dbip + "\n" + localsettings.dbuser + "\n" + localsettings.dbpass + "\n\nuser\n" + str(localsettings.language) + "\n15") out.close() else: success = False elif versionno < oldversion: miscmethods.ShowMessage( GetLabel(localsettings, "clientolderthanservermessage")) success = False return success