PMC-1092
This commit is contained in:
@@ -26,7 +26,7 @@ class Archive
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
public function archive($name)
|
||||
public function __construct($name)
|
||||
{
|
||||
$this->options = array('basedir' => ".", 'name' => $name, 'prepend' => "", 'inmemory' => 0, 'overwrite' => 0, 'recurse' => 1, 'storepaths' => 1, 'followlinks' => 0, 'level' => 3, 'method' => 1, 'sfx' => "", 'type' => "", 'comment' => ""
|
||||
);
|
||||
|
||||
@@ -12,7 +12,7 @@ class BzipFile extends TarFile
|
||||
* @param string $name
|
||||
* @return void
|
||||
*/
|
||||
public function BzipFile($name)
|
||||
public function __construct($name)
|
||||
{
|
||||
$this->tar_file($name);
|
||||
$this->options['type'] = "bzip";
|
||||
|
||||
@@ -694,7 +694,7 @@ class LdapAdvanced
|
||||
$ldapcnn = $this->ldapcnn;
|
||||
|
||||
//Get Users
|
||||
$limit = $this->__getPageSizeLimitByData($arrayAuthenticationSourceData);
|
||||
$limit = $this->getPageSizeLimitByData($arrayAuthenticationSourceData);
|
||||
$flagError = false;
|
||||
|
||||
if (!isset($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["AUTH_SOURCE_USERS_FILTER"])) {
|
||||
@@ -801,7 +801,7 @@ class LdapAdvanced
|
||||
*
|
||||
* @return array Return array data
|
||||
*/
|
||||
private function __ldapGroupSynchronizeMembers($ldapcnn, array $arrayAuthSourceData, $groupUid, array $arrayGroupLdap, $memberAttribute, array $arrayData = [])
|
||||
private function ldapGroupSynchronizeMembers($ldapcnn, array $arrayAuthSourceData, $groupUid, array $arrayGroupLdap, $memberAttribute, array $arrayData = [])
|
||||
{
|
||||
try {
|
||||
unset($arrayData['countMembers']);
|
||||
@@ -946,7 +946,7 @@ class LdapAdvanced
|
||||
}
|
||||
}
|
||||
|
||||
$arrayData = $this->__ldapGroupSynchronizeMembers(
|
||||
$arrayData = $this->ldapGroupSynchronizeMembers(
|
||||
$ldapcnn,
|
||||
$arrayAuthenticationSourceData,
|
||||
$arrayGroupData['GRP_UID'],
|
||||
@@ -984,7 +984,7 @@ class LdapAdvanced
|
||||
}
|
||||
}
|
||||
|
||||
$arrayData = $this->__ldapGroupSynchronizeMembers(
|
||||
$arrayData = $this->ldapGroupSynchronizeMembers(
|
||||
$ldapcnn,
|
||||
$arrayAuthenticationSourceData,
|
||||
$arrayGroupData['GRP_UID'],
|
||||
@@ -1107,7 +1107,7 @@ class LdapAdvanced
|
||||
$user = new User();
|
||||
$arrayUserData = $user->getUserRecordByPk($usrUid, [], false);
|
||||
|
||||
$result = $this->__ldapUserUpdateByDnAndData(
|
||||
$result = $this->ldapUserUpdateByDnAndData(
|
||||
$this->ldapcnn,
|
||||
$arrayAuthSource,
|
||||
$userDn,
|
||||
@@ -1625,7 +1625,7 @@ class LdapAdvanced
|
||||
$ldapcnn = $this->ldapcnn;
|
||||
|
||||
//Get Departments
|
||||
$limit = $this->__getPageSizeLimitByData($arrayAuthenticationSourceData);
|
||||
$limit = $this->getPageSizeLimitByData($arrayAuthenticationSourceData);
|
||||
$flagError = false;
|
||||
|
||||
$filter = '(' . $this->arrayObjectClassFilter['department'] . ')';
|
||||
@@ -2251,7 +2251,7 @@ class LdapAdvanced
|
||||
$ldapcnn = $this->ldapcnn;
|
||||
|
||||
//Get Groups
|
||||
$limit = $this->__getPageSizeLimitByData($arrayAuthenticationSourceData);
|
||||
$limit = $this->getPageSizeLimitByData($arrayAuthenticationSourceData);
|
||||
$flagError = false;
|
||||
|
||||
$filter = '(' . $this->arrayObjectClassFilter['group'] . ')';
|
||||
@@ -2677,7 +2677,7 @@ class LdapAdvanced
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function __ldapUserUpdateByDnAndData($ldapcnn, array $arrayAuthSourceData, $userDn, array $arrayUser)
|
||||
private function ldapUserUpdateByDnAndData($ldapcnn, array $arrayAuthSourceData, $userDn, array $arrayUser)
|
||||
{
|
||||
try {
|
||||
//Set variables
|
||||
@@ -2799,7 +2799,7 @@ class LdapAdvanced
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function __ldapUsersUpdateData($ldapcnn, array $arrayAuthSourceData, $filterUsers, array $arrayUserUid, array $arrayData)
|
||||
private function ldapUsersUpdateData($ldapcnn, array $arrayAuthSourceData, $filterUsers, array $arrayUserUid, array $arrayData)
|
||||
{
|
||||
try {
|
||||
$totalUser = $arrayData['totalUser'];
|
||||
@@ -2835,7 +2835,7 @@ class LdapAdvanced
|
||||
$entry = ldap_first_entry($ldapcnn, $searchResult);
|
||||
|
||||
do {
|
||||
if ($this->__ldapUserUpdateByDnAndData(
|
||||
if ($this->ldapUserUpdateByDnAndData(
|
||||
$ldapcnn,
|
||||
$arrayAuthSourceData,
|
||||
ldap_get_dn($ldapcnn, $entry),
|
||||
@@ -2887,7 +2887,7 @@ class LdapAdvanced
|
||||
$ldapcnn = $this->ldapcnn;
|
||||
|
||||
//Update Users
|
||||
$limit = $this->__getPageSizeLimitByData($arrayAuthenticationSourceData);
|
||||
$limit = $this->getPageSizeLimitByData($arrayAuthenticationSourceData);
|
||||
$count = 0;
|
||||
|
||||
$uidUserIdentifier = (isset($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["AUTH_SOURCE_IDENTIFIER_FOR_USER"])) ? $arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["AUTH_SOURCE_IDENTIFIER_FOR_USER"] : "uid";
|
||||
@@ -2904,7 +2904,7 @@ class LdapAdvanced
|
||||
$arrayUserUid[] = $arrayUserData["USR_UID"];
|
||||
|
||||
if ($count == $limit) {
|
||||
list($totalUser, $countUser) = $this->__ldapUsersUpdateData(
|
||||
list($totalUser, $countUser) = $this->ldapUsersUpdateData(
|
||||
$ldapcnn,
|
||||
$arrayAuthenticationSourceData,
|
||||
$filterUsers,
|
||||
@@ -2920,7 +2920,7 @@ class LdapAdvanced
|
||||
}
|
||||
|
||||
if ($count > 0) {
|
||||
list($totalUser, $countUser) = $this->__ldapUsersUpdateData(
|
||||
list($totalUser, $countUser) = $this->ldapUsersUpdateData(
|
||||
$ldapcnn,
|
||||
$arrayAuthenticationSourceData,
|
||||
$filterUsers,
|
||||
@@ -2940,7 +2940,7 @@ class LdapAdvanced
|
||||
*
|
||||
* @return int Returns the page size limit for a search result
|
||||
*/
|
||||
private function __getPageSizeLimitByData(array $arrayAuthSourceData)
|
||||
private function getPageSizeLimitByData(array $arrayAuthSourceData)
|
||||
{
|
||||
if (isset($arrayAuthSourceData['AUTH_SOURCE_DATA']['LDAP_PAGE_SIZE_LIMIT'])) {
|
||||
return $arrayAuthSourceData['AUTH_SOURCE_DATA']['LDAP_PAGE_SIZE_LIMIT'];
|
||||
|
||||
@@ -252,29 +252,20 @@ class Net
|
||||
}
|
||||
break;
|
||||
case 'mssql':
|
||||
//todo
|
||||
if (extension_loaded('sqlsrv')) {
|
||||
if ($this->db_instance != "") {
|
||||
$server = $this->ip . "\\" . $this->db_instance;
|
||||
} else {
|
||||
$server = $this->ip;
|
||||
}
|
||||
$port = (($this->db_port == "") || ($this->db_port == 0) || ($this->db_port == 1433)) ? "" : ", " . $this->db_port;
|
||||
$server .= $port;
|
||||
$opt = [
|
||||
'UID' => $this->db_user,
|
||||
'PWD' => $this->db_passwd,
|
||||
'Database' => $this->db_sourcename
|
||||
];
|
||||
$link = @sqlsrv_connect($server, $opt);
|
||||
case 'sqlsrv':
|
||||
if ($this->db_instance != "") {
|
||||
$server = $this->ip . "\\" . $this->db_instance;
|
||||
} else {
|
||||
if ($this->db_instance != "") {
|
||||
$link = @mssql_connect($this->ip . "\\" . $this->db_instance, $this->db_user, $this->db_passwd);
|
||||
} else {
|
||||
$port = (($this->db_port == "") || ($this->db_port == 0) || ($this->db_port == 1433)) ? "" : ":" . $this->db_port;
|
||||
$link = @mssql_connect($this->ip . $port, $this->db_user, $this->db_passwd);
|
||||
}
|
||||
$server = $this->ip;
|
||||
}
|
||||
$port = (($this->db_port == "") || ($this->db_port == 0) || ($this->db_port == 1433)) ? "" : ", " . $this->db_port;
|
||||
$server .= $port;
|
||||
$opt = [
|
||||
'UID' => $this->db_user,
|
||||
'PWD' => $this->db_passwd,
|
||||
'Database' => $this->db_sourcename
|
||||
];
|
||||
$link = @sqlsrv_connect($server, $opt);
|
||||
|
||||
if ($link) {
|
||||
$stat->status = 'SUCCESS';
|
||||
@@ -397,32 +388,21 @@ class Net
|
||||
}
|
||||
break;
|
||||
case 'mssql':
|
||||
if (extension_loaded('sqlsrv')) {
|
||||
if ($this->db_instance != "") {
|
||||
$server = $this->ip . "\\" . $this->db_instance;
|
||||
} else {
|
||||
$server = $this->ip;
|
||||
}
|
||||
$port = (($this->db_port == "") || ($this->db_port == 0) || ($this->db_port == 1433)) ? "" : ", " . $this->db_port;
|
||||
$server .= $port;
|
||||
$opt = [
|
||||
'UID' => $this->db_user,
|
||||
'PWD' => $this->db_passwd,
|
||||
'Database' => $this->db_sourcename
|
||||
];
|
||||
$link = $db = @sqlsrv_connect($server, $opt);
|
||||
case 'sqlsrv':
|
||||
if ($this->db_instance != "") {
|
||||
$server = $this->ip . "\\" . $this->db_instance;
|
||||
} else {
|
||||
if ($this->db_instance != "") {
|
||||
$link = @mssql_connect($this->ip . "\\" . $this->db_instance, $this->db_user, $this->db_passwd);
|
||||
} else {
|
||||
$port = (($this->db_port == "") || ($this->db_port == 0) || ($this->db_port == 1433)) ? "" : ":" . $this->db_port;
|
||||
$link = @mssql_connect($this->ip . $port, $this->db_user, $this->db_passwd);
|
||||
}
|
||||
$server = $this->ip;
|
||||
}
|
||||
$port = (($this->db_port == "") || ($this->db_port == 0) || ($this->db_port == 1433)) ? "" : ", " . $this->db_port;
|
||||
$server .= $port;
|
||||
$opt = [
|
||||
'UID' => $this->db_user,
|
||||
'PWD' => $this->db_passwd,
|
||||
'Database' => $this->db_sourcename
|
||||
];
|
||||
$link = $db = @sqlsrv_connect($server, $opt);
|
||||
if ($link) {
|
||||
if (!extension_loaded('sqlsrv')) {
|
||||
$db = @mssql_select_db($this->db_sourcename, $link);
|
||||
}
|
||||
if ($db) {
|
||||
$stat->status = 'SUCCESS';
|
||||
$this->errstr = "";
|
||||
|
||||
30
workflow/engine/classes/PmPluginCompatibility.php
Normal file
30
workflow/engine/classes/PmPluginCompatibility.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Class PmPluginCompatibility
|
||||
*
|
||||
* This class was created in order to keep the compatibility of the plugins that uses the method "PMPlugin"
|
||||
*/
|
||||
class PmPluginCompatibility
|
||||
{
|
||||
// The name of these properties should be equal that the properties in class "PMPlugin"
|
||||
public $sNamespace;
|
||||
public $sClassName;
|
||||
public $sPluginFolder = '';
|
||||
public $sFilename = null;
|
||||
|
||||
/**
|
||||
* Method similar to PMPlugin::__construct, this method was created in order to keep the compatibility for the plugins,
|
||||
* the plugins uses something similar to: parent::PMPlugin($namespace, $filename);
|
||||
*
|
||||
* @param string $namespace
|
||||
* @param string $filename
|
||||
*/
|
||||
public function PMPlugin($namespace, $filename = null)
|
||||
{
|
||||
$this->sNamespace = $namespace;
|
||||
$this->sClassName = $namespace . 'Plugin';
|
||||
$this->sPluginFolder = $namespace;
|
||||
$this->sFilename = $filename;
|
||||
}
|
||||
}
|
||||
@@ -595,304 +595,182 @@ class ReportTables
|
||||
$oDataset = ReportTablePeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
$aVars = array();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
$aRow['REP_TAB_NAME'] = $this->sPrefix . $aRow['REP_TAB_NAME'];
|
||||
$PropelDatabase = $this->chooseDB($aRow['REP_TAB_CONNECTION']);
|
||||
$con = Propel::getConnection($PropelDatabase);
|
||||
$con->getResource();
|
||||
$stmt = $con->createStatement();
|
||||
switch (DB_ADAPTER) {
|
||||
case 'mysql':
|
||||
$aTableFields = $this->getTableVars($aRow['REP_TAB_UID'], true);
|
||||
if ($aRow['REP_TAB_TYPE'] == 'NORMAL') {
|
||||
$sqlExists = "SELECT * FROM `" . $aRow['REP_TAB_NAME'] . "` WHERE APP_UID = '" . $sApplicationUid . "'";
|
||||
$rsExists = $stmt->executeQuery($sqlExists, ResultSet::FETCHMODE_ASSOC);
|
||||
$rsExists->next();
|
||||
$aRow2 = $rsExists->getRow();
|
||||
$aTableFields = $this->getTableVars($aRow['REP_TAB_UID'], true);
|
||||
if ($aRow['REP_TAB_TYPE'] == 'NORMAL') {
|
||||
$sqlExists = "SELECT * FROM `" . $aRow['REP_TAB_NAME'] . "` WHERE APP_UID = '" . $sApplicationUid . "'";
|
||||
$rsExists = $stmt->executeQuery($sqlExists, ResultSet::FETCHMODE_ASSOC);
|
||||
$rsExists->next();
|
||||
$aRow2 = $rsExists->getRow();
|
||||
|
||||
if (is_array($aRow2)) {
|
||||
$sQuery = 'UPDATE `' . $aRow['REP_TAB_NAME'] . '` SET ';
|
||||
foreach ($aTableFields as $aField) {
|
||||
$sQuery .= '`' . $aField['sFieldName'] . '` = ';
|
||||
if (is_array($aRow2)) {
|
||||
$sQuery = 'UPDATE `' . $aRow['REP_TAB_NAME'] . '` SET ';
|
||||
foreach ($aTableFields as $aField) {
|
||||
$sQuery .= '`' . $aField['sFieldName'] . '` = ';
|
||||
|
||||
if (!$isBpmn && !isset($aFields[$aField['sFieldName']])) {
|
||||
foreach ($aFields as $row) {
|
||||
if (is_array($row) && isset($row[count($row)])) {
|
||||
$aFields = $row[count($row)];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch ($aField['sType']) {
|
||||
case 'number':
|
||||
$sQuery .= (isset($aFields[$aField['sFieldName']]) ? (float)str_replace(
|
||||
',',
|
||||
'',
|
||||
$aFields[$aField['sFieldName']]
|
||||
) : '0') . ',';
|
||||
break;
|
||||
case 'char':
|
||||
case 'text':
|
||||
if (!isset($aFields[$aField['sFieldName']])) {
|
||||
$aFields[$aField['sFieldName']] = '';
|
||||
}
|
||||
if (!isset($aFields[$aField['sFieldName'] . '_label'])) {
|
||||
$aFields[$aField['sFieldName'] . '_label'] = '';
|
||||
}
|
||||
if (is_array($aFields[$aField['sFieldName']])) {
|
||||
$sQuery .= "'" . (isset($aFields[$aField['sFieldName']]) ? $aFields[$aField['sFieldName']][0] : '') . "',";
|
||||
} else {
|
||||
$sQuery .= '\'' . ((isset($aFields[$aField['sFieldName']])) ? mysqli_real_escape_string(
|
||||
$con->getResource(),
|
||||
$aFields[$aField['sFieldName']]
|
||||
) : '') . '\',';
|
||||
}
|
||||
break;
|
||||
case 'date':
|
||||
$mysqlDate = (isset($aFields[$aField['sFieldName']]) ? $aFields[$aField['sFieldName']] : '');
|
||||
if ($mysqlDate != '') {
|
||||
$mysqlDate = str_replace('/', '-', $mysqlDate);
|
||||
$mysqlDate = date('Y-m-d', strtotime($mysqlDate));
|
||||
}
|
||||
$value = trim($mysqlDate) != '' ? "'" . $mysqlDate . "'" : 'NULL';
|
||||
$sQuery .= $value . ",";
|
||||
break;
|
||||
if (!$isBpmn && !isset($aFields[$aField['sFieldName']])) {
|
||||
foreach ($aFields as $row) {
|
||||
if (is_array($row) && isset($row[count($row)])) {
|
||||
$aFields = $row[count($row)];
|
||||
}
|
||||
}
|
||||
$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()],
|
||||
config("system.workspace"),
|
||||
'processmaker.log'
|
||||
);
|
||||
switch ($aField['sType']) {
|
||||
case 'number':
|
||||
$sQuery .= (isset($aFields[$aField['sFieldName']]) ? (float)str_replace(
|
||||
',',
|
||||
'',
|
||||
$aFields[$aField['sFieldName']]
|
||||
) : '0') . ',';
|
||||
break;
|
||||
case 'char':
|
||||
case 'text':
|
||||
if (!isset($aFields[$aField['sFieldName']])) {
|
||||
$aFields[$aField['sFieldName']] = '';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!isset($aFields[$aField['sFieldName'] . '_label'])) {
|
||||
$aFields[$aField['sFieldName'] . '_label'] = '';
|
||||
}
|
||||
if (is_array($aFields[$aField['sFieldName']])) {
|
||||
$sQuery .= "'" . (isset($aFields[$aField['sFieldName']]) ? $aFields[$aField['sFieldName']][0] : '') . "',";
|
||||
} else {
|
||||
$sQuery .= '\'' . ((isset($aFields[$aField['sFieldName']])) ? mysqli_real_escape_string(
|
||||
$con->getResource(),
|
||||
$aFields[$aField['sFieldName']]
|
||||
) : '') . '\',';
|
||||
}
|
||||
break;
|
||||
case 'date':
|
||||
$mysqlDate = (isset($aFields[$aField['sFieldName']]) ? $aFields[$aField['sFieldName']] : '');
|
||||
if ($mysqlDate != '') {
|
||||
$mysqlDate = str_replace('/', '-', $mysqlDate);
|
||||
$mysqlDate = date('Y-m-d', strtotime($mysqlDate));
|
||||
}
|
||||
$value = trim($mysqlDate) != '' ? "'" . $mysqlDate . "'" : 'NULL';
|
||||
$sQuery .= $value . ",";
|
||||
break;
|
||||
}
|
||||
}
|
||||
$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()],
|
||||
config("system.workspace"),
|
||||
'processmaker.log'
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$sQuery = 'INSERT INTO `' . $aRow['REP_TAB_NAME'] . '` (';
|
||||
$sQuery .= '`APP_UID`,`APP_NUMBER`';
|
||||
foreach ($aTableFields as $aField) {
|
||||
$sQuery .= ',`' . $aField['sFieldName'] . '`';
|
||||
}
|
||||
$sQuery .= ") VALUES ('" . $sApplicationUid . "'," . (int)$iApplicationNumber;
|
||||
foreach ($aTableFields as $aField) {
|
||||
switch ($aField['sType']) {
|
||||
case 'number':
|
||||
$sQuery .= ',' . (isset($aFields[$aField['sFieldName']]) ? (float)str_replace(
|
||||
',',
|
||||
'',
|
||||
$aFields[$aField['sFieldName']]
|
||||
) : '0');
|
||||
break;
|
||||
case 'char':
|
||||
case 'text':
|
||||
if (!isset($aFields[$aField['sFieldName']])) {
|
||||
$aFields[$aField['sFieldName']] = '';
|
||||
}
|
||||
$sQuery .= ",'" . (isset($aFields[$aField['sFieldName']]) ? mysqli_real_escape_string(
|
||||
$con->getResource(),
|
||||
$aFields[$aField['sFieldName']]
|
||||
) : '') . "'";
|
||||
break;
|
||||
case 'date':
|
||||
$mysqlDate = (isset($aFields[$aField['sFieldName']]) ? $aFields[$aField['sFieldName']] : '');
|
||||
if ($mysqlDate != '') {
|
||||
$mysqlDate = str_replace('/', '-', $mysqlDate);
|
||||
$mysqlDate = date('Y-m-d', strtotime($mysqlDate));
|
||||
}
|
||||
$value = trim($mysqlDate) != '' ? "'" . $mysqlDate . "'" : 'NULL';
|
||||
$sQuery .= "," . $value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$sQuery .= ')';
|
||||
|
||||
try {
|
||||
$rs = $stmt->executeQuery($sQuery);
|
||||
} catch (Exception $e) {
|
||||
Bootstrap::registerMonolog(
|
||||
'sqlExecution',
|
||||
400,
|
||||
'Sql Execution',
|
||||
['sql' => $sQuery, 'error' => $e->getMessage()],
|
||||
config("system.workspace"),
|
||||
'processmaker.log'
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//remove old rows from database
|
||||
$sqlDelete = 'DELETE FROM `' . $aRow['REP_TAB_NAME'] . "` WHERE APP_UID = '" . $sApplicationUid . "'";
|
||||
$rsDelete = $stmt->executeQuery($sqlDelete);
|
||||
|
||||
$aAux = explode('-', $aRow['REP_TAB_GRID']);
|
||||
if (isset($aFields[$aAux[0]])) {
|
||||
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`';
|
||||
$sQuery .= '`APP_UID`,`APP_NUMBER`,`ROW`';
|
||||
foreach ($aTableFields as $aField) {
|
||||
$sQuery .= ',`' . $aField['sFieldName'] . '`';
|
||||
}
|
||||
$sQuery .= ") VALUES ('" . $sApplicationUid . "'," . (int)$iApplicationNumber;
|
||||
$sQuery .= ") VALUES ('" . $sApplicationUid . "'," . (int)$iApplicationNumber . ',' . $iRow;
|
||||
foreach ($aTableFields as $aField) {
|
||||
switch ($aField['sType']) {
|
||||
case 'number':
|
||||
$sQuery .= ',' . (isset($aFields[$aField['sFieldName']]) ? (float)str_replace(
|
||||
$sQuery .= ',' . (isset($aGridRow[$aField['sFieldName']]) ? (float)str_replace(
|
||||
',',
|
||||
'',
|
||||
$aFields[$aField['sFieldName']]
|
||||
$aGridRow[$aField['sFieldName']]
|
||||
) : '0');
|
||||
break;
|
||||
case 'char':
|
||||
case 'text':
|
||||
if (!isset($aFields[$aField['sFieldName']])) {
|
||||
$aFields[$aField['sFieldName']] = '';
|
||||
if (!isset($aGridRow[$aField['sFieldName']])) {
|
||||
$aGridRow[$aField['sFieldName']] = '';
|
||||
}
|
||||
$sQuery .= ",'" . (isset($aFields[$aField['sFieldName']]) ? mysqli_real_escape_string(
|
||||
$sQuery .= ",'" . (isset($aGridRow[$aField['sFieldName']]) ? mysqli_real_escape_string(
|
||||
$con->getResource(),
|
||||
$aFields[$aField['sFieldName']]
|
||||
$aGridRow[$aField['sFieldName']]
|
||||
) : '') . "'";
|
||||
break;
|
||||
case 'date':
|
||||
$mysqlDate = (isset($aFields[$aField['sFieldName']]) ? $aFields[$aField['sFieldName']] : '');
|
||||
if ($mysqlDate != '') {
|
||||
$mysqlDate = str_replace('/', '-', $mysqlDate);
|
||||
$mysqlDate = date('Y-m-d', strtotime($mysqlDate));
|
||||
}
|
||||
$value = trim($mysqlDate) != '' ? "'" . $mysqlDate . "'" : 'NULL';
|
||||
$sQuery .= "," . $value;
|
||||
$sQuery .= ",'" . (isset($aGridRow[$aField['sFieldName']]) ? $aGridRow[$aField['sFieldName']] : '') . "'";
|
||||
break;
|
||||
}
|
||||
}
|
||||
$sQuery .= ')';
|
||||
|
||||
try {
|
||||
$rs = $stmt->executeQuery($sQuery);
|
||||
} catch (Exception $e) {
|
||||
Bootstrap::registerMonolog(
|
||||
'sqlExecution',
|
||||
400,
|
||||
'Sql Execution',
|
||||
['sql' => $sQuery, 'error' => $e->getMessage()],
|
||||
config("system.workspace"),
|
||||
'processmaker.log'
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//remove old rows from database
|
||||
$sqlDelete = 'DELETE FROM `' . $aRow['REP_TAB_NAME'] . "` WHERE APP_UID = '" . $sApplicationUid . "'";
|
||||
$rsDelete = $stmt->executeQuery($sqlDelete);
|
||||
|
||||
$aAux = explode('-', $aRow['REP_TAB_GRID']);
|
||||
if (isset($aFields[$aAux[0]])) {
|
||||
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']]) ? mysqli_real_escape_string(
|
||||
$con->getResource(),
|
||||
$aGridRow[$aField['sFieldName']]
|
||||
) : '') . "'";
|
||||
break;
|
||||
case 'date':
|
||||
$sQuery .= ",'" . (isset($aGridRow[$aField['sFieldName']]) ? $aGridRow[$aField['sFieldName']] : '') . "'";
|
||||
break;
|
||||
}
|
||||
}
|
||||
$sQuery .= ')';
|
||||
$rs = $stmt->executeQuery($sQuery);
|
||||
}
|
||||
}
|
||||
$rs = $stmt->executeQuery($sQuery);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
/**
|
||||
* For SQLServer code
|
||||
*/
|
||||
case 'mssql':
|
||||
$aTableFields = $this->getTableVars($aRow['REP_TAB_UID'], true);
|
||||
if ($aRow['REP_TAB_TYPE'] == 'NORMAL') {
|
||||
$oDataset2 = mssql_query("SELECT * FROM [" . $aRow['REP_TAB_NAME'] . "] WHERE APP_UID = '" . $sApplicationUid . "'");
|
||||
if ($aRow2 = mssql_fetch_row($oDataset2)) {
|
||||
$sQuery = 'UPDATE [' . $aRow['REP_TAB_NAME'] . '] SET ';
|
||||
foreach ($aTableFields as $aField) {
|
||||
$sQuery .= '[' . $aField['sFieldName'] . '] = ';
|
||||
switch ($aField['sType']) {
|
||||
case 'number':
|
||||
$sQuery .= (isset($aFields[$aField['sFieldName']]) ? (float)str_replace(
|
||||
',',
|
||||
'',
|
||||
$aFields[$aField['sFieldName']]
|
||||
) : '0') . ',';
|
||||
break;
|
||||
case 'char':
|
||||
case 'text':
|
||||
if (!isset($aFields[$aField['sFieldName']])) {
|
||||
$aFields[$aField['sFieldName']] = '';
|
||||
}
|
||||
$sQuery .= "'" . (isset($aFields[$aField['sFieldName']]) ? mysqli_real_escape_string(
|
||||
$con->getResource(),
|
||||
$aFields[$aField['sFieldName']]
|
||||
) : '') . "',";
|
||||
break;
|
||||
case 'date':
|
||||
$sQuery .= "'" . (isset($aFields[$aField['sFieldName']]) ? $aFields[$aField['sFieldName']] : '') . "',";
|
||||
break;
|
||||
}
|
||||
}
|
||||
$sQuery = substr($sQuery, 0, -1);
|
||||
$sQuery .= " WHERE APP_UID = '" . $sApplicationUid . "'";
|
||||
} else {
|
||||
$sQuery = 'INSERT INTO [' . $aRow['REP_TAB_NAME'] . '] (';
|
||||
$sQuery .= '[APP_UID],[APP_NUMBER]';
|
||||
foreach ($aTableFields as $aField) {
|
||||
$sQuery .= ',[' . $aField['sFieldName'] . ']';
|
||||
}
|
||||
$sQuery .= ") VALUES ('" . $sApplicationUid . "'," . (int)$iApplicationNumber;
|
||||
foreach ($aTableFields as $aField) {
|
||||
switch ($aField['sType']) {
|
||||
case 'number':
|
||||
$sQuery .= ',' . (isset($aFields[$aField['sFieldName']]) ? (float)str_replace(
|
||||
',',
|
||||
'',
|
||||
$aFields[$aField['sFieldName']]
|
||||
) : '0');
|
||||
break;
|
||||
case 'char':
|
||||
case 'text':
|
||||
if (!isset($aFields[$aField['sFieldName']])) {
|
||||
$aFields[$aField['sFieldName']] = '';
|
||||
}
|
||||
$sQuery .= ",'" . (isset($aFields[$aField['sFieldName']]) ? mysqli_real_escape_string(
|
||||
$con->getResource(),
|
||||
$aFields[$aField['sFieldName']]
|
||||
) : '') . "'";
|
||||
break;
|
||||
case 'date':
|
||||
$sQuery .= ",'" . (isset($aFields[$aField['sFieldName']]) ? $aFields[$aField['sFieldName']] : '') . "'";
|
||||
break;
|
||||
}
|
||||
}
|
||||
$sQuery .= ')';
|
||||
}
|
||||
$rs = $stmt->executeQuery($sQuery);
|
||||
} else {
|
||||
//Verify use in mssql
|
||||
mysqli_query(
|
||||
$con->getResource(),
|
||||
'DELETE FROM [' . $aRow['REP_TAB_NAME'] . "] WHERE APP_UID = '" . $sApplicationUid . "'"
|
||||
);
|
||||
$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']]) ? mysqli_real_escape_string(
|
||||
$con->getResource(),
|
||||
$aGridRow[$aField['sFieldName']]
|
||||
) : '') . "'";
|
||||
break;
|
||||
case 'date':
|
||||
$sQuery .= ",'" . (isset($aGridRow[$aField['sFieldName']]) ? $aGridRow[$aField['sFieldName']] : '') . "'";
|
||||
break;
|
||||
}
|
||||
}
|
||||
$sQuery .= ')';
|
||||
$rs = $stmt->executeQuery($sQuery);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
$oDataset->next();
|
||||
}
|
||||
|
||||
@@ -12,9 +12,9 @@ class TarFile extends Archive
|
||||
*
|
||||
* @param string $name
|
||||
*/
|
||||
public function TarFile($name)
|
||||
public function __construct($name)
|
||||
{
|
||||
$this->archive($name);
|
||||
parent::__construct($name);
|
||||
$this->options['type'] = "tar";
|
||||
}
|
||||
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
*/
|
||||
class ZipFile extends Archive
|
||||
{
|
||||
public function ZipFile($name)
|
||||
public function __construct($name)
|
||||
{
|
||||
$this->archive($name);
|
||||
parent::__construct($name);
|
||||
$this->options['type'] = "zip";
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ use ProcessMaker\Plugins\PluginRegistry;
|
||||
/**
|
||||
* @package workflow.engine.classes
|
||||
*/
|
||||
class PMPlugin
|
||||
class PMPlugin extends PmPluginCompatibility
|
||||
{
|
||||
public $sNamespace;
|
||||
public $sClassName;
|
||||
@@ -22,7 +22,7 @@ class PMPlugin
|
||||
* @param string $sFilename
|
||||
* @return void
|
||||
*/
|
||||
public function PMPlugin($sNamespace, $sFilename = null)
|
||||
public function __construct($sNamespace, $sFilename = null)
|
||||
{
|
||||
$this->sNamespace = $sNamespace;
|
||||
$this->sClassName = $sNamespace . 'Plugin';
|
||||
|
||||
@@ -6,7 +6,7 @@ require_once 'classes/model/om/BaseAppTimeoutActionExecuted.php';
|
||||
/**
|
||||
* Skeleton subclass for representing a row from the 'APP_TIMEOUT_ACTION_EXECUTED' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
@@ -14,17 +14,18 @@ require_once 'classes/model/om/BaseAppTimeoutActionExecuted.php';
|
||||
*
|
||||
* @package classes.model
|
||||
*/
|
||||
class AppTimeoutActionExecuted extends BaseAppTimeoutActionExecuted {
|
||||
|
||||
public function create ($aData)
|
||||
{
|
||||
$con = Propel::getConnection( AppTimeoutActionExecutedPeer::DATABASE_NAME );
|
||||
class AppTimeoutActionExecuted extends BaseAppTimeoutActionExecuted
|
||||
{
|
||||
|
||||
public function create($aData)
|
||||
{
|
||||
$con = Propel::getConnection(AppTimeoutActionExecutedPeer::DATABASE_NAME);
|
||||
try {
|
||||
$this->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
||||
$this->fromArray($aData, BasePeer::TYPE_FIELDNAME);
|
||||
if ($this->validate()) {
|
||||
$result = $this->save();
|
||||
} else {
|
||||
$e = new Exception( "Failed Validation in class " . get_class( $this ) . "." );
|
||||
$e = new Exception("Failed Validation in class " . get_class($this) . ".");
|
||||
$e->aValidationFailures = $this->getValidationFailures();
|
||||
throw ($e);
|
||||
}
|
||||
@@ -33,6 +34,6 @@ class AppTimeoutActionExecuted extends BaseAppTimeoutActionExecuted {
|
||||
} catch (Exception $e) {
|
||||
$con->rollback();
|
||||
throw ($e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // AppTimeoutActionExecuted
|
||||
|
||||
Reference in New Issue
Block a user