diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2019-01-09 16:42:06 +0000 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2019-01-10 09:50:35 +0000 |
commit | 64dd1e896e20f48f3656e0f1fba3779106f2028e (patch) | |
tree | 12806587b520c01bb66dd7e00b83f96c6df299c8 | |
parent | 7b2b0132c372fb840d3d1e130ce9a66fbb9ee75b (diff) |
Only select body by default if user has a body.
Otherwise you can get an error trying to look up the body name on
submission.
-rw-r--r-- | templates/web/base/report/new/form_user_loggedin.html | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/templates/web/base/report/new/form_user_loggedin.html b/templates/web/base/report/new/form_user_loggedin.html index cf6c067c6..37f0c6f0b 100644 --- a/templates/web/base/report/new/form_user_loggedin.html +++ b/templates/web/base/report/new/form_user_loggedin.html @@ -17,7 +17,7 @@ [% BLOCK form_as %] <label for="form_as">[% loc('Report as') %]</label> <select id="form_as" class="form-control js-contribute-as" name="form_as"> - <option value="myself" [% ( c.user.has_body_permission_to('planned_reports') || c.user.has_body_permission_to('default_to_body') ) ? '' : 'selected' %]>[% loc('Yourself') %]</option> + <option value="myself" [% c.user.from_body AND ( c.user.has_body_permission_to('planned_reports') || c.user.has_body_permission_to('default_to_body') ) ? '' : 'selected' %]>[% loc('Yourself') %]</option> [% IF js || can_contribute_as_anonymous_user %] <option value="anonymous_user">[% loc('Anonymous user') %]</option> [% END %] @@ -25,7 +25,7 @@ <option value="another_user">[% loc('Another user') %]</option> [% END %] [% IF js || can_contribute_as_body %] - <option value="body" [% ( c.user.has_body_permission_to('planned_reports') || c.user.has_body_permission_to('default_to_body') ) ? 'selected' : '' %]>[% c.user.from_body.name %]</option> + <option value="body" [% c.user.from_body AND ( c.user.has_body_permission_to('planned_reports') || c.user.has_body_permission_to('default_to_body') ) ? 'selected' : '' %]>[% c.user.from_body.name %]</option> [% END %] </select> [% END %] |