apsmir / custom_field_sql

redmine sql custom field
14 stars 8 forks source link

New Issue page cannot use %id% #4

Closed tianyang-abc closed 3 years ago

tianyang-abc commented 3 years ago

Let's say SQL expression: select subject from issues where id=%id% If the issue exists, EDIT ISSUE is OK. If create a new issue, it's Internal error

ActionView::Template::Error (Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1: select subject from issues where id=): 19: <% i = 0 %> 20: <% split_on = (lr_values.size / 2.0).ceil - 1 %> 21: <% lr_values.each do |value| %> 22:

<%= custom_field_tag_with_label :issue, value, :required => @issue.required_attribute?(value.custom_field_id) %>

23: <% if i == split_on %> 24:
25: <% end %>

plugins/custom_field_sql/lib/custom_field_sql/custom_fields/formats/sql.rb:15:in possible_values_options' lib/redmine/field_format.rb:162:inpossible_custom_value_options' lib/redmine/field_format.rb:613:in select_edit_tag' lib/redmine/field_format.rb:578:inedit_tag' app/helpers/custom_fields_helper.rb:91:in custom_field_tag' app/helpers/custom_fields_helper.rb:120:incustom_field_tag_with_label' app/views/issues/_form_custom_fields.html.erb:22:in block (2 levels) in _9a8a4f882f5988e4bc110ca6763fd21b' app/views/issues/_form_custom_fields.html.erb:21:ineach' app/views/issues/_form_custom_fields.html.erb:21:in block in _9a8a4f882f5988e4bc110ca6763fd21b' app/views/issues/_form_custom_fields.html.erb:1:ineach' app/views/issues/_form_custom_fields.html.erb:1:in _9a8a4f882f5988e4bc110ca6763fd21b' app/views/issues/_attributes.html.erb:83:inblock in _31d901be448779fb8bcc513422c492e7' app/helpers/application_helper.rb:1365:in labelled_fields_for' app/views/issues/_attributes.html.erb:1:in_31d901be448779fb8bcc513422c492e7' app/views/issues/_form.html.erb:50:in block in _80d472f4a750771d2125048d87bbdde3' app/helpers/application_helper.rb:1365:inlabelled_fields_for' app/views/issues/_form.html.erb:1:in _80d472f4a750771d2125048d87bbdde3' app/views/issues/new.html.erb:13:inblock in _e80235d30eb35dd73c2a3f21753346e8' app/helpers/application_helper.rb:1358:in labelled_form_for' app/views/issues/new.html.erb:5:in_e80235d30eb35dd73c2a3f21753346e8' app/controllers/issues_controller.rb:122:in block (2 levels) in new' app/controllers/issues_controller.rb:121:innew'