Modify ↓
#12957 closed defect (fixed)
[PATCH]: javascript TypeError when changing ticket type
Reported by: | Cinc-th | Owned by: | tkob-trac |
---|---|---|---|
Priority: | normal | Component: | TicketStencilPlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 1.0 |
Description
The javascript error TypeError is triggered when changing ticket types while the description field is not empty and no template is defined.
Configuration
The following ticket types are defined:
- defect
- task
- foo
- ...
Only for type foo a template is defined.
Browser: Firefox 50.0
How to trigger the problem:
- Create a new ticket, it defaults to defect
- Enter something into the description field
- Change the ticket type from defect to task
On the javascript console of your browser the following error is shown
TypeError: _tracticketstencil[prev_type] is undefined ticketstencil.js:8:1
and subsequent jacascript code is not executed.
Patch
- The patch makes sure that for every ticket type a default description is defined in the array _tracticketstencil[] thus
_tracticketstencil[prev_type].trim().replace(/\r\n/g, "\n")
can be calculated.
- In addition it ensures the data attribute is always set.
- It defines a default for prev_type in case the data attribute is lost. This one is probably superfluous because of the former changes but it doesn't hurt.
Attachments (1)
Note: See
TracTickets for help on using
tickets.
Fix for TypeError during javascript execution when changing ticket types.