[TASK] Improve error message 'These fields are not properly updated' 07/35507/5
authorGeorg Ringer <georg.ringer@gmail.com>
Tue, 16 Dec 2014 06:56:16 +0000 (07:56 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 18 Jan 2015 21:06:36 +0000 (22:06 +0100)
If something went wrong while updating a record via DataHandler show
the table name and record uid too instead of only the field names.

Resolves: #49000
Releases: master
Change-Id: I0e5291324ec2be511ffb12164e4c0aec6f48f096
Reviewed-on: http://review.typo3.org/35507
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Andreas Fernandez <andreas.fernandez@aspedia.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Classes/DataHandling/DataHandler.php

index d7b1508..576449e 100644 (file)
@@ -5964,17 +5964,23 @@ class DataHandler {
                        $res = $this->databaseConnection->exec_SELECTquery('*', $table, 'uid=' . (int)$id);
                        if ($row = $this->databaseConnection->sql_fetch_assoc($res)) {
                                // Traverse array of values that was inserted into the database and compare with the actually stored value:
-                               $errorString = array();
+                               $errors = array();
                                foreach ($fieldArray as $key => $value) {
                                        if ($this->checkStoredRecords_loose && !$value && !$row[$key]) {
 
                                        } elseif ((string)$value !== (string)$row[$key]) {
-                                               $errorString[] = $key;
+                                               $errors[] = $key;
                                        }
                                }
                                // Set log message if there were fields with unmatching values:
-                               if (count($errorString)) {
-                                       $this->log($table, $id, $action, 0, 1, 'These fields are not properly updated in database: (' . implode(',', $errorString) . ') Probably value mismatch with fieldtype.');
+                               if (!empty($errors)) {
+                                       $message = sprintf(
+                                               'These fields of record %d in table "%s" have not been saved correctly: %s! The values might have changed due to type casting of the database.',
+                                               $id,
+                                               $table,
+                                               implode(', ', $errors)
+                                       );
+                                       $this->log($table, $id, $action, 0, 1, $message);
                                }
                                // Return selected rows:
                                return $row;