| | 63 | def delete_ticket_change( comp, ticket_id, author, change_time, field): |
|---|
| | 64 | """ removes a ticket change from the database """ |
|---|
| | 65 | db=comp.env.get_db_cnx() |
|---|
| | 66 | cursor = db.cursor(); |
|---|
| | 67 | sql = """DELETE FROM ticket_change |
|---|
| | 68 | WHERE ticket=%s and author=%s and time=%s and field=%s""" |
|---|
| | 69 | cursor.execute(sql, (ticket_id, author, change_time, field)) |
|---|
| | 70 | db.commit() |
|---|
| | 71 | |
|---|
| | 72 | |
|---|
| | 73 | |
|---|
| | 74 | |
|---|
| 101 | | |
|---|
| | 114 | |
|---|
| | 115 | self.log.debug("Checking permissions") |
|---|
| | 116 | perm = PermissionCache(self.env, author) |
|---|
| | 117 | if not perm or not perm.has_permission("TIME_RECORD"): |
|---|
| | 118 | self.log.debug("Skipping recording because no permission to affect time") |
|---|
| | 119 | if hours != 0: |
|---|
| | 120 | |
|---|
| | 121 | tup = (ticket_id, author, change_time, "hours") |
|---|
| | 122 | self.log.debug("deleting ticket change %s %s %s %s" % tup) |
|---|
| | 123 | try: |
|---|
| | 124 | delete_ticket_change(self, ticket_id, author, change_time, "hours") |
|---|
| | 125 | except Exception, e: |
|---|
| | 126 | self.log.debug("FAIL: %s" % e) |
|---|
| | 127 | self.log.debug("hours change deleted") |
|---|
| | 128 | return |
|---|
| | 129 | self.log.debug("passed permissions check") |
|---|