BUG 6865 report tables with date fields is being saved correctly now

the main problem was that ins a several version of mysql datetime can't have a empty string as value in
the insert.
so the definition for a report tables was updated to date type field permitting NULL value, and before insert
the empty string is converted to NULL for date fields
This commit is contained in:
Erik Amaru Ortiz
2011-05-13 12:40:03 -04:00
parent a4db59dcd1
commit 9130582277

View File

@@ -141,7 +141,7 @@ class ReportTables
$sQuery .= '`' . $aField['sFieldName'] . '` ' . $this->aDef['mysql'][$aField['sType']] . " ,";
break;
case 'date':
$sQuery .= '`' . $aField['sFieldName'] . '` ' . $this->aDef['mysql'][$aField['sType']] . " NOT NULL DEFAULT '0000-00-00 00:00:00',";
$sQuery .= '`' . $aField['sFieldName'] . '` ' . $this->aDef['mysql'][$aField['sType']] . " NULL,";
break;
}
}
@@ -251,7 +251,8 @@ class ReportTables
$sQuery .= ",'" . (isset($aData[$aField['sFieldName']]) ? mysql_real_escape_string($aData[$aField['sFieldName']]) : '') . "'";
break;
case 'date':
$sQuery .= ",'" . (isset($aData[$aField['sFieldName']]) ? $aData[$aField['sFieldName']] : '') . "'";
$value = (isset($aData[$aField['sFieldName']]) && trim($aData[$aField['sFieldName']])) != '' ? "'" . $aData[$aField['sFieldName']] . "'" : 'NULL';
$sQuery .= "," . $value;
break;
}
}
@@ -280,7 +281,8 @@ class ReportTables
$sQuery .= ",'" . (isset($aGridRow[$aField['sFieldName']]) ? mysql_real_escape_string($aGridRow[$aField['sFieldName']]) : '') . "'";
break;
case 'date':
$sQuery .= ",'" . (isset($aGridRow[$aField['sFieldName']]) ? $aGridRow[$aField['sFieldName']] : '') . "'";
$value = (isset($aGridRow[$aField['sFieldName']]) && trim($aGridRow[$aField['sFieldName']])) != '' ? "'" . $aGridRow[$aField['sFieldName']] . "'" : 'NULL';
$sQuery .= "," . $value;
break;
}
}