def set_location(self, ticket, lat, lon): """ sets the ticket location in the db * ticket: the ticket id (int) * lat, lon: the lattitude and longtitude (degrees) """ # determine if we need to insert or update the table # (SQL is retarded) if get_first_row(self.env, "select ticket from ticket_location where ticket='%s'" % ticket): execute_non_query( self.env, "update ticket_location set ticket=%s, latitude=%s, longitude=%s where ticket=%s", ticket, lat, lon, ticket, ) else: execute_non_query( self.env, "insert into ticket_location (ticket, latitude, longitude) values (%s, %s, %s)", ticket, lat, lon, )
def delete_location(self, ticket): """ deletes a ticket location in the db * ticket: the ticket id (int) """ if get_first_row(self.env, "select ticket from ticket_location where ticket='%s'" % ticket): execute_non_query(self.env, "delete from ticket_location where ticket='%s'" % ticket)
def delete_location(self, ticket): """ deletes a ticket location in the db * ticket: the ticket id (int) """ if get_first_row( self.env, "select ticket from ticket_location where ticket='%s'" % ticket): execute_non_query( self.env, "delete from ticket_location where ticket='%s'" % ticket)
def set_location(self, ticket, lat, lon): """ sets the ticket location in the db * ticket: the ticket id (int) * lat, lon: the lattitude and longtitude (degrees) """ # determine if we need to insert or update the table # (SQL is retarded) if get_first_row( self.env, "select ticket from ticket_location where ticket='%s'" % ticket): execute_non_query( self.env, "update ticket_location set ticket=%s, latitude=%s, longitude=%s where ticket=%s", ticket, lat, lon, ticket) else: execute_non_query( self.env, "insert into ticket_location (ticket, latitude, longitude) values (%s, %s, %s)", ticket, lat, lon)