Merge branch 'ent-4201-Agent-info-campos-vacios-siguen-saliendo' into 'develop'

Dont show empty custom fields in agent view - #4201

See merge request artica/pandorafms!2572
This commit is contained in:
Daniel Rodriguez 2019-07-16 11:20:53 +02:00
commit b8f6626947
1 changed files with 15 additions and 16 deletions

View File

@ -461,18 +461,16 @@ if ($fields === false) {
$custom_fields = []; $custom_fields = [];
foreach ($fields as $field) { foreach ($fields as $field) {
$data = [];
$data[0] = '<b>'.$field['name'].ui_print_help_tip(__('Custom field'), true).'</b>';
$custom_value = db_get_all_rows_sql( $custom_value = db_get_all_rows_sql(
'select tagent_custom_data.description,tagent_custom_fields.is_password_type from tagent_custom_fields 'select tagent_custom_data.description,tagent_custom_fields.is_password_type from tagent_custom_fields
INNER JOIN tagent_custom_data ON tagent_custom_fields.id_field = tagent_custom_data.id_field where tagent_custom_fields.id_field = '.$field['id_field'].' and tagent_custom_data.id_agent = '.$id_agente INNER JOIN tagent_custom_data ON tagent_custom_fields.id_field = tagent_custom_data.id_field where tagent_custom_fields.id_field = '.$field['id_field'].' and tagent_custom_data.id_agent = '.$id_agente
); );
if ($custom_value[0]['description'] === false || $custom_value[0]['description'] == '') { if ($custom_value[0]['description'] !== false && $custom_value[0]['description'] != '') {
$custom_value[0]['description'] = '<i>-'.__('empty').'-</i>'; $data = [];
} else {
$data[0] = '<b>'.$field['name'].ui_print_help_tip(__('Custom field'), true).'</b>';
$custom_value[0]['description'] = ui_bbcode_to_html($custom_value[0]['description']); $custom_value[0]['description'] = ui_bbcode_to_html($custom_value[0]['description']);
}
if ($custom_value[0]['is_password_type']) { if ($custom_value[0]['is_password_type']) {
$data[1] = '&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;'; $data[1] = '&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;';
@ -482,6 +480,7 @@ foreach ($fields as $field) {
$custom_fields[] = $data; $custom_fields[] = $data;
} }
}
$custom_fields_count = count($custom_fields); $custom_fields_count = count($custom_fields);
for ($i = 0; $i < $custom_fields_count; $i++) { for ($i = 0; $i < $custom_fields_count; $i++) {