GanttCalendarPlugin: avoid KeyError: 'custom' in /ticketgantt page
@@ -307,7 +307,7 @@ | ||
307 | 307 | |
308 | 308 | ###### get_sql |
309 | 309 | custom_join = "" |
310 | - custom_fields = [f['name'] for f in fields if 'custom' in f] | |
310 | + custom_fields = [f['name'] for f in fields if f.get('custom')] | |
311 | 311 | |
312 | 312 | # Join with ticket_custom table as necessary |
313 | 313 | for k in [k for k in constraint_cols if k in custom_fields]: |
@@ -493,7 +493,7 @@ | ||
493 | 493 | |
494 | 494 | if sorted_field not in ('due_assign', 'due_close', 'complete', |
495 | 495 | 'estimatedhours', 'totalhours') and \ |
496 | - any(f['name'] == sorted_field and f['custom'] for f in fields): | |
496 | + any(f['name'] == sorted_field and f.get('custom') for f in fields): | |
497 | 497 | sort_expr = "(SELECT tc.value FROM ticket_custom tc " \ |
498 | 498 | "WHERE tc.ticket=t.id AND name=%s LIMIT 1)" |
499 | 499 | args.append(sorted_field) |