Resolved
Reported for: WPML Multilingual CMS 4.5.12
Resolved in: 4.6.0
Overview of the issue
The following PHP error appears when you try to update a translation or add a new translation job to the basket by going to WPML → Translation Management:
Fatal error: Uncaught Exception: DateTime::__construct(): Failed to parse time string in …/wp-content/plugins/sitepress-multilingual-cms/classes/jobs/class-wpml-tm-jobs-repository.php on line 155
Workaround
Please be sure of having a full backup of your website before proceeding.
- Open the wp-content/plugins/sitepress-multilingual-cms/classes/jobs/query/StringQuery.php file.
- Look for line 49.
- Replace:
public function get_data_query( WPML_TM_Jobs_Search_Params $params ) { $columns = array( 'string_translations.id as id', '"' . WPML_TM_Job_Entity::STRING_TYPE . '" as type', 'string_status.rid as tp_id', 'batches.id as local_batch_id', 'batches.tp_id as tp_batch_id', $this->batch_name_column, 'string_translations.status as status', 'strings.id as original_element_id', 'strings.language as source_language', 'string_translations.language as target_language', 'string_translations.translation_service as translation_service', 'string_status.timestamp as sent_date', 'NULL as deadline_date', 'NULL as completed_date', 'strings.value as title', 'source_languages.english_name as source_language_name', 'target_languages.english_name as target_language_name', 'string_translations.translator_id as translator_id', 'NULL as translate_job_id', 'core_status.tp_revision AS revision', 'core_status.ts_status AS ts_status', 'NULL AS needs_update', 'NULL AS editor', 'string_translations.status = ' . ICL_TM_COMPLETE . ' AS has_completed_translation', 'NULL AS editor_job_id', '0 AS automatic', 'NULL AS review_status', 'NULL AS trid', 'NULL AS element_type', 'NULL AS job_title', ); return $this->build_query( $params, $columns ); }
With:
public function get_data_query( WPML_TM_Jobs_Search_Params $params ) { $columns = array( 'string_translations.id as id', '"' . WPML_TM_Job_Entity::STRING_TYPE . '" as type', 'string_status.rid as tp_id', 'batches.id as local_batch_id', 'batches.tp_id as tp_batch_id', $this->batch_name_column, 'string_translations.status as status', 'strings.id as original_element_id', 'strings.language as source_language', 'string_translations.language as target_language', 'NULL AS trid', 'NULL AS element_type', 'string_translations.translation_service as translation_service', 'string_status.timestamp as sent_date', 'NULL as deadline_date', 'NULL as completed_date', 'strings.value as title', 'source_languages.english_name as source_language_name', 'target_languages.english_name as target_language_name', 'string_translations.translator_id as translator_id', 'NULL as translate_job_id', 'core_status.tp_revision AS revision', 'core_status.ts_status AS ts_status', 'NULL AS needs_update', 'NULL AS editor', 'string_translations.status = ' . ICL_TM_COMPLETE . ' AS has_completed_translation', 'NULL AS editor_job_id', '0 AS automatic', 'NULL AS job_title', 'NULL AS review_status', 'NULL AS element_id', ); return $this->build_query( $params, $columns ); }
this fixed my problem.
will this be required every time I update the plugin ?
Hey there,
Until we don’t release a WPML version including this patch, I’m afraid of that. However, this is already reported and it is on our developers road map.
We’ll keep this errata updated.
Cheers