Merged in bugfix/HOR-3910 (pull request #6073)

HOR-3910

Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
Approved-by: Paula Quispe <paula.quispe@processmaker.com>
This commit is contained in:
Paula Quispe
2017-09-26 13:00:18 +00:00

View File

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