BUG 10458 Error creating report table with currency text field SOLVED
- not taken into account the types of mask and separators in fields currency and percentage - was add validation. - In fields currency and percentage was changed FLOAT -> DOUBLE.
This commit is contained in:
@@ -18,6 +18,40 @@ require_once 'classes/model/om/BaseAdditionalTables.php';
|
|||||||
*
|
*
|
||||||
* @package workflow.engine.classes.model
|
* @package workflow.engine.classes.model
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
function validateType ($value, $type)
|
||||||
|
{
|
||||||
|
switch ($type) {
|
||||||
|
case 'INTEGER':
|
||||||
|
$value = str_replace(",", "", $value);
|
||||||
|
$value = str_replace(".", "", $value);
|
||||||
|
break;
|
||||||
|
case 'FLOAT':
|
||||||
|
case 'DOUBLE':
|
||||||
|
$pos = strrpos($value, ",");
|
||||||
|
$pos = ($pos === false) ? 0 : $pos;
|
||||||
|
|
||||||
|
$posPoint = strrpos($value, ".");
|
||||||
|
$posPoint = ($posPoint === false) ? 0 : $posPoint;
|
||||||
|
|
||||||
|
if ($pos > $posPoint) {
|
||||||
|
$value2 = substr($value, $pos+1);
|
||||||
|
$value1 = substr($value, 0, $pos);
|
||||||
|
$value1 = str_replace(".", "", $value1);
|
||||||
|
$value = $value1.".".$value2;
|
||||||
|
} else {
|
||||||
|
$value2 = substr($value, $posPoint+1);
|
||||||
|
$value1 = substr($value, 0, $posPoint);
|
||||||
|
$value1 = str_replace(",", "", $value1);
|
||||||
|
$value = $value1.".".$value2;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
class AdditionalTables extends BaseAdditionalTables
|
class AdditionalTables extends BaseAdditionalTables
|
||||||
{
|
{
|
||||||
public $fields = array();
|
public $fields = array();
|
||||||
@@ -669,8 +703,35 @@ class AdditionalTables extends BaseAdditionalTables
|
|||||||
switch ($row['ADD_TAB_TYPE']) {
|
switch ($row['ADD_TAB_TYPE']) {
|
||||||
//switching by report table type
|
//switching by report table type
|
||||||
case 'NORMAL':
|
case 'NORMAL':
|
||||||
|
require_once 'classes/model/Fields.php';
|
||||||
|
$criteriaField = new Criteria('workflow');
|
||||||
|
$criteriaField->add(FieldsPeer::ADD_TAB_UID, $row['ADD_TAB_UID']);
|
||||||
|
$datasetField = FieldsPeer::doSelectRS($criteriaField);
|
||||||
|
$datasetField->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
$fieldType = array();
|
||||||
|
while ($datasetField->next()) {
|
||||||
|
$rowfield = $datasetField->getRow();
|
||||||
|
switch ($rowfield['FLD_TYPE']) {
|
||||||
|
case 'FLOAT':
|
||||||
|
case 'DOUBLE':
|
||||||
|
case 'INTEGER':
|
||||||
|
$fieldType[] = array($rowfield['FLD_NAME']=>$rowfield['FLD_TYPE']);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// parsing empty values to null
|
// parsing empty values to null
|
||||||
foreach ($caseData as $i => $v) {
|
foreach ($caseData as $i => $v) {
|
||||||
|
foreach ($fieldType as $key => $value) {
|
||||||
|
foreach ($value as $keys => $values) {
|
||||||
|
if ( strtoupper ( $i) == $keys) {
|
||||||
|
$v = validateType ($v, $values);
|
||||||
|
unset($key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
$caseData[$i] = $v === '' ? null : $v;
|
$caseData[$i] = $v === '' ? null : $v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -186,7 +186,6 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1384,14 +1383,25 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
$arrayNode = $dynaformHandler->getArray( $node );
|
$arrayNode = $dynaformHandler->getArray( $node );
|
||||||
$fieldName = $arrayNode['__nodeName__'];
|
$fieldName = $arrayNode['__nodeName__'];
|
||||||
$fieldType = $arrayNode['type'];
|
$fieldType = $arrayNode['type'];
|
||||||
|
$fieldValidate = ( isset($arrayNode['validate'])) ? $arrayNode['validate'] : '';
|
||||||
|
|
||||||
if (! in_array( $fieldType, $excludeFieldsList ) && ! in_array( $fieldName, $fieldsNames )) {
|
if (! in_array( $fieldType, $excludeFieldsList ) && ! in_array( $fieldName, $fieldsNames ) ) {
|
||||||
$fields[] = array ('FIELD_UID' => $fieldName . '-' . $fieldType,'FIELD_NAME' => $fieldName,'_index' => $index ++,'_isset' => true
|
$fields[] = array (
|
||||||
|
'FIELD_UID' => $fieldName . '-' . $fieldType,
|
||||||
|
'FIELD_NAME' => $fieldName,
|
||||||
|
'FIELD_VALIDATE'=>$fieldValidate,
|
||||||
|
'_index' => $index ++,
|
||||||
|
'_isset' => true
|
||||||
);
|
);
|
||||||
$fieldsNames[] = $fieldName;
|
$fieldsNames[] = $fieldName;
|
||||||
|
|
||||||
if (in_array( $fieldType, $labelFieldsTypeList ) && ! in_array( $fieldName . '_label', $fieldsNames )) {
|
if (in_array( $fieldType, $labelFieldsTypeList ) && ! in_array( $fieldName . '_label', $fieldsNames )) {
|
||||||
$fields[] = array ('FIELD_UID' => $fieldName . '_label' . '-' . $fieldType,'FIELD_NAME' => $fieldName . '_label','_index' => $index ++,'_isset' => true
|
$fields[] = array (
|
||||||
|
'FIELD_UID' => $fieldName . '_label' . '-' . $fieldType,
|
||||||
|
'FIELD_NAME' => $fieldName . '_label',
|
||||||
|
'FIELD_VALIDATE'=>$fieldValidate,
|
||||||
|
'_index' => $index ++,
|
||||||
|
'_isset' => true
|
||||||
);
|
);
|
||||||
$fieldsNames[] = $fieldName;
|
$fieldsNames[] = $fieldName;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ Ext.onReady(function(){
|
|||||||
totalProperty: 'count',
|
totalProperty: 'count',
|
||||||
fields : [
|
fields : [
|
||||||
{name : 'FIELD_UID'},
|
{name : 'FIELD_UID'},
|
||||||
|
{name : 'FIELD_VALIDATE'},
|
||||||
{name : 'FIELD_NAME'},
|
{name : 'FIELD_NAME'},
|
||||||
{name : '_index'},
|
{name : '_index'},
|
||||||
{name : '_isset'}
|
{name : '_isset'}
|
||||||
@@ -69,6 +70,11 @@ Ext.onReady(function(){
|
|||||||
hidden:true,
|
hidden:true,
|
||||||
hideable:false
|
hideable:false
|
||||||
}, {
|
}, {
|
||||||
|
dataIndex:'FIELD_VALIDATE',
|
||||||
|
hidden:true,
|
||||||
|
hideable:false
|
||||||
|
}
|
||||||
|
, {
|
||||||
dataIndex:'_index',
|
dataIndex:'_index',
|
||||||
hidden:true,
|
hidden:true,
|
||||||
hideable:false
|
hideable:false
|
||||||
@@ -1175,6 +1181,15 @@ function setReportFields(records) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var meta = mapPMFieldType(records[i].data['FIELD_UID']);
|
var meta = mapPMFieldType(records[i].data['FIELD_UID']);
|
||||||
|
var typeField = meta.type;
|
||||||
|
var sizeField = meta.size;
|
||||||
|
if (records[i].data['FIELD_VALIDATE'].toUpperCase() == 'REAL') {
|
||||||
|
typeField = 'DOUBLE';
|
||||||
|
sizeField = '';
|
||||||
|
}
|
||||||
|
if (records[i].data['FIELD_VALIDATE'].toUpperCase() == 'INT') {
|
||||||
|
typeField = 'INTEGER';
|
||||||
|
}
|
||||||
var row = new PMRow({
|
var row = new PMRow({
|
||||||
uid : '',
|
uid : '',
|
||||||
_index : records[i].data['_index'] !== '' ? records[i].data['_index'] : records[i].data['FIELD_DYN'],
|
_index : records[i].data['_index'] !== '' ? records[i].data['_index'] : records[i].data['FIELD_DYN'],
|
||||||
@@ -1182,8 +1197,8 @@ function setReportFields(records) {
|
|||||||
field_dyn : records[i].data['FIELD_NAME'],
|
field_dyn : records[i].data['FIELD_NAME'],
|
||||||
field_name : records[i].data['FIELD_NAME'].toUpperCase(),
|
field_name : records[i].data['FIELD_NAME'].toUpperCase(),
|
||||||
field_label : records[i].data['FIELD_NAME'].toUpperCase(),
|
field_label : records[i].data['FIELD_NAME'].toUpperCase(),
|
||||||
field_type : meta.type,
|
field_type : typeField,
|
||||||
field_size : meta.size,
|
field_size : sizeField,
|
||||||
field_key : 0,
|
field_key : 0,
|
||||||
field_null : 1,
|
field_null : 1,
|
||||||
field_filter: 0,
|
field_filter: 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user