7 | | A configurable ticket change listener plugin that can update other fields or fields on other tickets when a ticket changes. |
| 7 | A configurable ticket change listener plugin that can update other fields or fields on other tickets when a ticket changes. This is a fairly rough first draft. It handles ticket changes fairly well, doesn't blow up on ticket creation and doesn't do anything on ticket deletion. Looking for feedback. |
| 8 | |
| 9 | Update values in other tickets based on ticket changes. For example, with Subtickets plugin and Timing and Estimation plugin in place, a parent ticket's estimate may be the sum of its children's estimates. This plugin can update the parent when the child changes. |
| 10 | |
| 11 | There are three types of relationships: |
| 12 | |
| 13 | * self - the "other" ticket is the current ticket (update another field) |
| 14 | * link - the other tickets are listed in a field of this ticket |
| 15 | * query - the other tickets can be queried based on this ticket's ID |
| 16 | |
| 17 | There are several methods of updating the other ticket's value: |
| 18 | |
| 19 | * sum - add this ticket's value to the other ticket's value. (This ticket's old value is subtracted first.) Essentially: |
| 20 | |
| 21 | {{{ |
| 22 | oldOther[to] -= old_values[from] |
| 23 | newOther[to] += ticket[from] |
| 24 | }}} |
| 25 | |
| 26 | * min - the other ticket's value is the minimum of it's old value and this ticket's value |
| 27 | * max - the other ticket's value is the maximum of it's old value and this ticket's value |
| 28 | * suffix - this ticket's value is added as a suffix to the other ticket's value. (This ticket's old value is removed first.) |
| 29 | * prefix - this ticket's value is added as a prefix to the other ticket's value. (This ticket's old value is removed first.) |
| 30 | |
| 31 | Other desirable methods which are not yet implemented: |
| 32 | |
| 33 | * union: like sum but field f is a list (set) |
| 34 | * set: other's f2 is ticket's f1. |
| 35 | |
| 36 | FIXME - A system of pluggable types and methods would be nice. |
| 37 | |
| 38 | |
| 39 | When the enum priority changes, the pseudo-field "priority_value" is available for processing. |
| 40 | |
| 41 | Configuration looks something like: |
| 42 | |
| 43 | {{{ |
| 44 | [value_propagation] |
| 45 | r1.type = link |
| 46 | r1.link = parents |
| 47 | r1.fields = estimatedhours, hours |
| 48 | r1.method.estimatedhours = sum |
| 49 | r1.method.hours = sum |
| 50 | |
| 51 | r2.type = query |
| 52 | r2.query = SELECT child FROM subtickets WHERE parent = %s |
| 53 | r2.fields = effpriority |
| 54 | r2.method.effpriority = prefix |
| 55 | |
| 56 | r3.type = self |
| 57 | r3.fields = priority:effpriority |
| 58 | r2.method.priority = suffix |
| 59 | }}} |