Project

General

Profile

Actions

Bug #19222

closed

eval double gives warning if not all 0 after comma are entered

Added by Franz Holzinger over 16 years ago. Updated almost 10 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2008-08-15
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.2
PHP Version:
5.2
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

When you enter a double value which has 6 digits after the comma in the database and you do not enter all zeros in the TCE, then you get the warning message:

These fields are not properly updated.

However everything has been stored correctly into the database.

Use this patch.
Or it would be even better to have the number of digits after the comma stored somewhere in TCA to check this too. But the warning message should contain all details if some digit has been lost.

t3lib_tcemain:

function checkStoredRecord($table,$id,$fieldArray,$action) {
global $TCA;

$id = intval($id);
if (is_array($TCA[$table]) && $id) {
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $table, 'uid='.intval($id));
if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
// Traverse array of values that was inserted into the database and compare with the actually stored value:
$errorString = array();
foreach($fieldArray as $key => $value) {
if ($this->checkStoredRecords_loose && !$value && !$row[$key])    {
// Nothing...
} elseif (strcmp($value,$row[$key])) {
if (strpos($TCA[$table]['columns'][$key]['config']['eval'],'double') !== FALSE && doubleval($value) == doubleval($value)) {
// nothing
} else {
$errorString[] = $key;
}
}
}

(issue imported from #M9181)


Files

patch_20100602_1.diff (850 Bytes) patch_20100602_1.diff Administrator Admin, 2010-06-02 12:06
patch_20100602_2.diff (1.3 KB) patch_20100602_2.diff Administrator Admin, 2010-06-02 12:20
patch-19222.diff (1.31 KB) patch-19222.diff Franz Holzinger, 2013-10-02 10:31
Actions #1

Updated by Franz Holzinger over 16 years ago

Some bugfix:

if (strpos($TCA[$table]['columns'][$key]['config']['eval'],'double') !== FALSE && doubleval($value) == doubleval($row[$key])) {

Actions #2

Updated by Franz Holzinger over 16 years ago

You have double2 as eval. Please make more digits possible!

t3lib_tcemain:

case 'double2':
case 'double3':
case 'double4':
case 'double5':
case 'double6':
case 'double7':
case 'double8':
case 'double9':
$theDec = 0;
for ($a=strlen($value); $a>0; $a--) {
if (substr($value,$a-1,1)=='.' || substr($value,$a-1,1)==',') {
$theDec = substr($value,$a);
$value = substr($value,0,$a-1);
break;
}
}
$digits = $func{6};
$theDec = ereg_replace('[^0-9]','',$theDec).'0000000';
$value = intval(str_replace(' ','',$value)).'.'.substr($theDec,0,$digits);
break;

Actions #3

Updated by Dmitry Dulepov over 16 years ago

There is no patch... Patch should be in unified diff format.

Actions #4

Updated by Julian Hofmann over 14 years ago

Making more digits possible would be a nice feature.
patch_20100602_1.diff: new feature.
patch_20100602_2.diff: bugfix as discribed and the new feature.

Actions #5

Updated by Alexander Opitz over 11 years ago

  • Status changed from New to Needs Feedback
  • Target version deleted (0)

The issue is very old, does this issue exists in newer versions of TYPO3 CMS (4.5 or 6.1)?

Actions #6

Updated by Alexander Opitz about 11 years ago

  • Status changed from Needs Feedback to Closed
  • Is Regression set to No

No feedback for over 90 days.

Actions #7

Updated by Franz Holzinger about 11 years ago

This feature is still missing in TYPO3 6.2 alpha2

Actions #8

Updated by Alexander Opitz about 11 years ago

  • Status changed from Closed to Needs Feedback

Can you give this patch to Gerrit? See http://wiki.typo3.org/Contribution_Walkthrough_Tutorials

Actions #9

Updated by Alexander Opitz almost 11 years ago

Hi Franz,

can you bring the patch to Gerrit?

Actions #10

Updated by Alexander Opitz almost 10 years ago

  • Status changed from Needs Feedback to Closed

No feedback within the last 90 days => closing this issue.

If you think that this is the wrong decision or experience this issue again, then please write to the mailing list typo3.teams.bugs with issue number and an explanation or open a new ticket and add a relation to this ticket number.

Actions #11

Updated by Franz Holzinger almost 10 years ago

Hello, I have written the patch for TYPO3 6.2. So this issue is still present.

Sorry, I have no clue how to put this into Gerrit.

Actions

Also available in: Atom PDF