diff --git a/workflow/engine/classes/class.reportTables.php b/workflow/engine/classes/class.reportTables.php index 653a70e9d..7e0eb8a1a 100755 --- a/workflow/engine/classes/class.reportTables.php +++ b/workflow/engine/classes/class.reportTables.php @@ -646,32 +646,34 @@ class ReportTables $aAux = explode( '-', $aRow['REP_TAB_GRID'] ); if (isset( $aFields[$aAux[0]] )) { - foreach ($aFields[$aAux[0]] as $iRow => $aGridRow) { - $sQuery = 'INSERT INTO `' . $aRow['REP_TAB_NAME'] . '` ('; - $sQuery .= '`APP_UID`,`APP_NUMBER`,`ROW`'; - foreach ($aTableFields as $aField) { - $sQuery .= ',`' . $aField['sFieldName'] . '`'; - } - $sQuery .= ") VALUES ('" . $sApplicationUid . "'," . (int) $iApplicationNumber . ',' . $iRow; - foreach ($aTableFields as $aField) { - switch ($aField['sType']) { - case 'number': - $sQuery .= ',' . (isset( $aGridRow[$aField['sFieldName']] ) ? (float) str_replace( ',', '', $aGridRow[$aField['sFieldName']] ) : '0'); - break; - case 'char': - case 'text': - if (! isset( $aGridRow[$aField['sFieldName']] )) { - $aGridRow[$aField['sFieldName']] = ''; - } - $sQuery .= ",'" . (isset( $aGridRow[$aField['sFieldName']] ) ? mysql_real_escape_string( $aGridRow[$aField['sFieldName']] ) : '') . "'"; - break; - case 'date': - $sQuery .= ",'" . (isset( $aGridRow[$aField['sFieldName']] ) ? $aGridRow[$aField['sFieldName']] : '') . "'"; - break; + if (is_array($aFields[$aAux[0]])) { + foreach ($aFields[$aAux[0]] as $iRow => $aGridRow) { + $sQuery = 'INSERT INTO `' . $aRow['REP_TAB_NAME'] . '` ('; + $sQuery .= '`APP_UID`,`APP_NUMBER`,`ROW`'; + foreach ($aTableFields as $aField) { + $sQuery .= ',`' . $aField['sFieldName'] . '`'; } + $sQuery .= ") VALUES ('" . $sApplicationUid . "'," . (int) $iApplicationNumber . ',' . $iRow; + foreach ($aTableFields as $aField) { + switch ($aField['sType']) { + case 'number': + $sQuery .= ',' . (isset( $aGridRow[$aField['sFieldName']] ) ? (float) str_replace( ',', '', $aGridRow[$aField['sFieldName']] ) : '0'); + break; + case 'char': + case 'text': + if (! isset( $aGridRow[$aField['sFieldName']] )) { + $aGridRow[$aField['sFieldName']] = ''; + } + $sQuery .= ",'" . (isset( $aGridRow[$aField['sFieldName']] ) ? mysql_real_escape_string( $aGridRow[$aField['sFieldName']] ) : '') . "'"; + break; + case 'date': + $sQuery .= ",'" . (isset( $aGridRow[$aField['sFieldName']] ) ? $aGridRow[$aField['sFieldName']] : '') . "'"; + break; + } + } + $sQuery .= ')'; + $rs = $stmt->executeQuery( $sQuery ); } - $sQuery .= ')'; - $rs = $stmt->executeQuery( $sQuery ); } } } diff --git a/workflow/engine/templates/pmTables/export.js b/workflow/engine/templates/pmTables/export.js index ecebdf675..8655acd09 100755 --- a/workflow/engine/templates/pmTables/export.js +++ b/workflow/engine/templates/pmTables/export.js @@ -166,7 +166,7 @@ Export.submit = function() if (result.success) { location.href = result.link; } else { - PMExt.error(_('ID_ERROR'), result.message)); + PMExt.error(_('ID_ERROR'), result.message); } }, failure: function(obj, resp){