Skip to content

Commit f7cbc22

Browse files
committed
Fix missing table prefix in customforms::get_custom_form_fields() #932
1 parent 6538852 commit f7cbc22

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

application/helpers/customforms.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -55,23 +55,23 @@ public static function get_custom_form_fields($incident_id = FALSE, $form_id = N
5555
// Check if the provided incident exists, then fill in the data
5656
if ($valid_incident)
5757
{
58-
$sql = "SELECT form_field.*, form_response.form_response
59-
FROM form_field
60-
LEFT JOIN roles ON (roles.id = field_ispublic_visible)
58+
$sql = "SELECT ff.*, fr.form_response
59+
FROM `{$table_prefix}form_field` ff
60+
LEFT JOIN `{$table_prefix}roles` r ON (r.id = field_ispublic_visible)
6161
LEFT JOIN
62-
form_response ON (
63-
form_response.form_field_id = form_field.id AND
64-
form_response.incident_id = :incident_id
62+
`{$table_prefix}form_response` fr ON (
63+
fr.form_field_id = ff.id AND
64+
fr.incident_id = :incident_id
6565
)
6666
WHERE (access_level <= :user_level OR access_level IS NULL) "
6767
. ( ! empty($form_id) ? "AND form_id = :form_id " : '')
6868
. "ORDER BY field_position ASC";
6969
}
7070
else
7171
{
72-
$sql = "SELECT form_field.*
73-
FROM form_field
74-
LEFT JOIN roles ON (roles.id = field_ispublic_visible)
72+
$sql = "SELECT ff.*
73+
FROM `{$table_prefix}form_field` ff
74+
LEFT JOIN `{$table_prefix}roles` r ON (r.id = field_ispublic_visible)
7575
WHERE (access_level <= :user_level OR access_level IS NULL) "
7676
. ( ! empty($form_id) ? "AND form_id = :form_id " : '')
7777
. "ORDER BY field_position ASC";

0 commit comments

Comments
 (0)