clarity-h2020 / docker-drupal

Drupal 8 Project for implememting the CLARTIY CSIS Platform.
https://csis.myclimateservice.eu
GNU Lesser General Public License v3.0
3 stars 0 forks source link

Error when saving study context #142

Closed p-a-s-c-a-l closed 4 years ago

p-a-s-c-a-l commented 4 years ago

When editing and trying to save the study context at https://csis.myclimateservice.eu/group/109/edit/context?destination=/study/109/view/context, the following error occurred:

grafik

The website encountered an unexpected error. Please try again later.

Drupal\Core\Database\DatabaseExceptionWrapper: Exception in Cities to Countries mapping[cities_to_countries_mapping]: SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for integer: "_none" LINE 5: ...omy_termfield_country.field_country_target_id = '_none')) ... ^: SELECT taxonomy_term_field_data.langcode AS taxonomy_term_field_data_langcode, taxonomy_term_field_data.name AS taxonomy_term_field_data_name, taxonomy_term_field_data.tid AS tid FROM {taxonomy_term_field_data} taxonomy_term_field_data LEFT JOIN {taxonomy_termfield_country} taxonomy_termfield_country ON taxonomy_term_field_data.tid = taxonomy_termfield_country.entity_id AND taxonomy_termfield_country.deleted = :views_join_condition_0 WHERE ((taxonomy_term__field_country.field_country_target_id = :taxonomy_termfield_country_field_country_target_id)) AND ((taxonomy_term_field_data.status = :db_condition_placeholder_1) AND (taxonomy_term_field_data.vid IN (:db_condition_placeholder_2))) ORDER BY taxonomy_term_field_data_name ASC NULLS FIRST; Array ( [:taxonomy_term__field_country_field_country_target_id] => _none [:db_condition_placeholder_1] => 1 [:db_condition_placeholder_2] => cities_regions [:views_join_condition_0] => 0 ) in Drupal\views\Plugin\views\query\Sql->execute() (line 1543 of core/modules/views/src/Plugin/views/query/Sql.php).

Probably, because no country was selected. If this field is required, the form validation should be implemented or the save button should be disabled or at least the system should not crash.

patrickkaleta commented 4 years ago

Probably, because no country was selected. If this field is required, the form validation should be implemented or the save button should be disabled or at least the system should not crash.

Definitely the cause of this problem. Seems like we're having another issue with Dependent Fields. Bug was already reported, but so far no fix available. To me it seems like Dependent Fields are bypassing the default validation checks (or at least executed before them). For our other required fields (e.g. title or study goal) validation is triggered properly.

As a temporary fix, I will just set the first country in the list as the default placeholder. When I find the time I'll check if there is a way for us to handle the validation inside our csis-helpers module.

p-a-s-c-a-l commented 4 years ago

As a temporary fix, I will just set the first country in the list as the default placeholder.

I think we can live with that as a permanent fix. :-)