This commit is contained in:
Paula Quispe
2017-09-21 13:40:29 -04:00
parent 704a1b1ad7
commit 3ff07e15b4

View File

@@ -599,6 +599,16 @@ class ReportTables
} }
$sQuery = substr($sQuery, 0, -1); $sQuery = substr($sQuery, 0, -1);
$sQuery .= " WHERE APP_UID = '" . $sApplicationUid . "'"; $sQuery .= " WHERE APP_UID = '" . $sApplicationUid . "'";
//Only we will to executeQuery if we have additional field
if (count($aTableFields) > 0) {
try {
$rs = $stmt->executeQuery($sQuery);
} catch (Exception $e) {
Bootstrap::registerMonolog('sqlExecution', 400, 'Sql Execution', ['sql' => $sQuery,'error' => $e->getMessage()], SYS_SYS, 'processmaker.log');
}
}
} else { } else {
$sQuery = 'INSERT INTO `' . $aRow['REP_TAB_NAME'] . '` ('; $sQuery = 'INSERT INTO `' . $aRow['REP_TAB_NAME'] . '` (';
$sQuery .= '`APP_UID`,`APP_NUMBER`'; $sQuery .= '`APP_UID`,`APP_NUMBER`';
@@ -630,8 +640,13 @@ class ReportTables
} }
} }
$sQuery .= ')'; $sQuery .= ')';
try {
$rs = $stmt->executeQuery($sQuery);
} catch (Exception $e) {
Bootstrap::registerMonolog('sqlExecution', 400, 'Sql Execution', ['sql' => $sQuery,'error' => $e->getMessage()], SYS_SYS, 'processmaker.log');
}
} }
$rs = $stmt->executeQuery($sQuery);
} else { } else {
//remove old rows from database //remove old rows from database
$sqlDelete = 'DELETE FROM `' . $aRow['REP_TAB_NAME'] . "` WHERE APP_UID = '" . $sApplicationUid . "'"; $sqlDelete = 'DELETE FROM `' . $aRow['REP_TAB_NAME'] . "` WHERE APP_UID = '" . $sApplicationUid . "'";