This commit is contained in:
Julio Cesar Laura Avendaño
2019-08-21 08:53:28 -04:00
parent 7854275d5d
commit c18072eae5
10 changed files with 227 additions and 338 deletions

View File

@@ -26,7 +26,7 @@ class Archive
* @return void * @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' => "" $this->options = array('basedir' => ".", 'name' => $name, 'prepend' => "", 'inmemory' => 0, 'overwrite' => 0, 'recurse' => 1, 'storepaths' => 1, 'followlinks' => 0, 'level' => 3, 'method' => 1, 'sfx' => "", 'type' => "", 'comment' => ""
); );

View File

@@ -12,7 +12,7 @@ class BzipFile extends TarFile
* @param string $name * @param string $name
* @return void * @return void
*/ */
public function BzipFile($name) public function __construct($name)
{ {
$this->tar_file($name); $this->tar_file($name);
$this->options['type'] = "bzip"; $this->options['type'] = "bzip";

View File

@@ -694,7 +694,7 @@ class LdapAdvanced
$ldapcnn = $this->ldapcnn; $ldapcnn = $this->ldapcnn;
//Get Users //Get Users
$limit = $this->__getPageSizeLimitByData($arrayAuthenticationSourceData); $limit = $this->getPageSizeLimitByData($arrayAuthenticationSourceData);
$flagError = false; $flagError = false;
if (!isset($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["AUTH_SOURCE_USERS_FILTER"])) { if (!isset($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["AUTH_SOURCE_USERS_FILTER"])) {
@@ -801,7 +801,7 @@ class LdapAdvanced
* *
* @return array Return array data * @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 { try {
unset($arrayData['countMembers']); unset($arrayData['countMembers']);
@@ -946,7 +946,7 @@ class LdapAdvanced
} }
} }
$arrayData = $this->__ldapGroupSynchronizeMembers( $arrayData = $this->ldapGroupSynchronizeMembers(
$ldapcnn, $ldapcnn,
$arrayAuthenticationSourceData, $arrayAuthenticationSourceData,
$arrayGroupData['GRP_UID'], $arrayGroupData['GRP_UID'],
@@ -984,7 +984,7 @@ class LdapAdvanced
} }
} }
$arrayData = $this->__ldapGroupSynchronizeMembers( $arrayData = $this->ldapGroupSynchronizeMembers(
$ldapcnn, $ldapcnn,
$arrayAuthenticationSourceData, $arrayAuthenticationSourceData,
$arrayGroupData['GRP_UID'], $arrayGroupData['GRP_UID'],
@@ -1107,7 +1107,7 @@ class LdapAdvanced
$user = new User(); $user = new User();
$arrayUserData = $user->getUserRecordByPk($usrUid, [], false); $arrayUserData = $user->getUserRecordByPk($usrUid, [], false);
$result = $this->__ldapUserUpdateByDnAndData( $result = $this->ldapUserUpdateByDnAndData(
$this->ldapcnn, $this->ldapcnn,
$arrayAuthSource, $arrayAuthSource,
$userDn, $userDn,
@@ -1625,7 +1625,7 @@ class LdapAdvanced
$ldapcnn = $this->ldapcnn; $ldapcnn = $this->ldapcnn;
//Get Departments //Get Departments
$limit = $this->__getPageSizeLimitByData($arrayAuthenticationSourceData); $limit = $this->getPageSizeLimitByData($arrayAuthenticationSourceData);
$flagError = false; $flagError = false;
$filter = '(' . $this->arrayObjectClassFilter['department'] . ')'; $filter = '(' . $this->arrayObjectClassFilter['department'] . ')';
@@ -2251,7 +2251,7 @@ class LdapAdvanced
$ldapcnn = $this->ldapcnn; $ldapcnn = $this->ldapcnn;
//Get Groups //Get Groups
$limit = $this->__getPageSizeLimitByData($arrayAuthenticationSourceData); $limit = $this->getPageSizeLimitByData($arrayAuthenticationSourceData);
$flagError = false; $flagError = false;
$filter = '(' . $this->arrayObjectClassFilter['group'] . ')'; $filter = '(' . $this->arrayObjectClassFilter['group'] . ')';
@@ -2677,7 +2677,7 @@ class LdapAdvanced
* *
* @return bool * @return bool
*/ */
private function __ldapUserUpdateByDnAndData($ldapcnn, array $arrayAuthSourceData, $userDn, array $arrayUser) private function ldapUserUpdateByDnAndData($ldapcnn, array $arrayAuthSourceData, $userDn, array $arrayUser)
{ {
try { try {
//Set variables //Set variables
@@ -2799,7 +2799,7 @@ class LdapAdvanced
* *
* @return array * @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 { try {
$totalUser = $arrayData['totalUser']; $totalUser = $arrayData['totalUser'];
@@ -2835,7 +2835,7 @@ class LdapAdvanced
$entry = ldap_first_entry($ldapcnn, $searchResult); $entry = ldap_first_entry($ldapcnn, $searchResult);
do { do {
if ($this->__ldapUserUpdateByDnAndData( if ($this->ldapUserUpdateByDnAndData(
$ldapcnn, $ldapcnn,
$arrayAuthSourceData, $arrayAuthSourceData,
ldap_get_dn($ldapcnn, $entry), ldap_get_dn($ldapcnn, $entry),
@@ -2887,7 +2887,7 @@ class LdapAdvanced
$ldapcnn = $this->ldapcnn; $ldapcnn = $this->ldapcnn;
//Update Users //Update Users
$limit = $this->__getPageSizeLimitByData($arrayAuthenticationSourceData); $limit = $this->getPageSizeLimitByData($arrayAuthenticationSourceData);
$count = 0; $count = 0;
$uidUserIdentifier = (isset($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["AUTH_SOURCE_IDENTIFIER_FOR_USER"])) ? $arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["AUTH_SOURCE_IDENTIFIER_FOR_USER"] : "uid"; $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"]; $arrayUserUid[] = $arrayUserData["USR_UID"];
if ($count == $limit) { if ($count == $limit) {
list($totalUser, $countUser) = $this->__ldapUsersUpdateData( list($totalUser, $countUser) = $this->ldapUsersUpdateData(
$ldapcnn, $ldapcnn,
$arrayAuthenticationSourceData, $arrayAuthenticationSourceData,
$filterUsers, $filterUsers,
@@ -2920,7 +2920,7 @@ class LdapAdvanced
} }
if ($count > 0) { if ($count > 0) {
list($totalUser, $countUser) = $this->__ldapUsersUpdateData( list($totalUser, $countUser) = $this->ldapUsersUpdateData(
$ldapcnn, $ldapcnn,
$arrayAuthenticationSourceData, $arrayAuthenticationSourceData,
$filterUsers, $filterUsers,
@@ -2940,7 +2940,7 @@ class LdapAdvanced
* *
* @return int Returns the page size limit for a search result * @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'])) { if (isset($arrayAuthSourceData['AUTH_SOURCE_DATA']['LDAP_PAGE_SIZE_LIMIT'])) {
return $arrayAuthSourceData['AUTH_SOURCE_DATA']['LDAP_PAGE_SIZE_LIMIT']; return $arrayAuthSourceData['AUTH_SOURCE_DATA']['LDAP_PAGE_SIZE_LIMIT'];

View File

@@ -252,29 +252,20 @@ class Net
} }
break; break;
case 'mssql': case 'mssql':
//todo case 'sqlsrv':
if (extension_loaded('sqlsrv')) { if ($this->db_instance != "") {
if ($this->db_instance != "") { $server = $this->ip . "\\" . $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);
} else { } else {
if ($this->db_instance != "") { $server = $this->ip;
$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);
}
} }
$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) { if ($link) {
$stat->status = 'SUCCESS'; $stat->status = 'SUCCESS';
@@ -397,32 +388,21 @@ class Net
} }
break; break;
case 'mssql': case 'mssql':
if (extension_loaded('sqlsrv')) { case 'sqlsrv':
if ($this->db_instance != "") { if ($this->db_instance != "") {
$server = $this->ip . "\\" . $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);
} else { } else {
if ($this->db_instance != "") { $server = $this->ip;
$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);
}
} }
$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 ($link) {
if (!extension_loaded('sqlsrv')) {
$db = @mssql_select_db($this->db_sourcename, $link);
}
if ($db) { if ($db) {
$stat->status = 'SUCCESS'; $stat->status = 'SUCCESS';
$this->errstr = ""; $this->errstr = "";

View 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;
}
}

View File

@@ -595,304 +595,182 @@ class ReportTables
$oDataset = ReportTablePeer::doSelectRS($oCriteria); $oDataset = ReportTablePeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next(); $oDataset->next();
$aVars = array();
while ($aRow = $oDataset->getRow()) { while ($aRow = $oDataset->getRow()) {
$aRow['REP_TAB_NAME'] = $this->sPrefix . $aRow['REP_TAB_NAME']; $aRow['REP_TAB_NAME'] = $this->sPrefix . $aRow['REP_TAB_NAME'];
$PropelDatabase = $this->chooseDB($aRow['REP_TAB_CONNECTION']); $PropelDatabase = $this->chooseDB($aRow['REP_TAB_CONNECTION']);
$con = Propel::getConnection($PropelDatabase); $con = Propel::getConnection($PropelDatabase);
$con->getResource(); $con->getResource();
$stmt = $con->createStatement(); $stmt = $con->createStatement();
switch (DB_ADAPTER) { $aTableFields = $this->getTableVars($aRow['REP_TAB_UID'], true);
case 'mysql': if ($aRow['REP_TAB_TYPE'] == 'NORMAL') {
$aTableFields = $this->getTableVars($aRow['REP_TAB_UID'], true); $sqlExists = "SELECT * FROM `" . $aRow['REP_TAB_NAME'] . "` WHERE APP_UID = '" . $sApplicationUid . "'";
if ($aRow['REP_TAB_TYPE'] == 'NORMAL') { $rsExists = $stmt->executeQuery($sqlExists, ResultSet::FETCHMODE_ASSOC);
$sqlExists = "SELECT * FROM `" . $aRow['REP_TAB_NAME'] . "` WHERE APP_UID = '" . $sApplicationUid . "'"; $rsExists->next();
$rsExists = $stmt->executeQuery($sqlExists, ResultSet::FETCHMODE_ASSOC); $aRow2 = $rsExists->getRow();
$rsExists->next();
$aRow2 = $rsExists->getRow();
if (is_array($aRow2)) { if (is_array($aRow2)) {
$sQuery = 'UPDATE `' . $aRow['REP_TAB_NAME'] . '` SET '; $sQuery = 'UPDATE `' . $aRow['REP_TAB_NAME'] . '` SET ';
foreach ($aTableFields as $aField) { foreach ($aTableFields as $aField) {
$sQuery .= '`' . $aField['sFieldName'] . '` = '; $sQuery .= '`' . $aField['sFieldName'] . '` = ';
if (!$isBpmn && !isset($aFields[$aField['sFieldName']])) { if (!$isBpmn && !isset($aFields[$aField['sFieldName']])) {
foreach ($aFields as $row) { foreach ($aFields as $row) {
if (is_array($row) && isset($row[count($row)])) { if (is_array($row) && isset($row[count($row)])) {
$aFields = $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;
} }
} }
$sQuery = substr($sQuery, 0, -1); }
$sQuery .= " WHERE APP_UID = '" . $sApplicationUid . "'";
//Only we will to executeQuery if we have additional field switch ($aField['sType']) {
if (count($aTableFields) > 0) { case 'number':
try { $sQuery .= (isset($aFields[$aField['sFieldName']]) ? (float)str_replace(
$rs = $stmt->executeQuery($sQuery); ',',
} catch (Exception $e) { '',
Bootstrap::registerMonolog( $aFields[$aField['sFieldName']]
'sqlExecution', ) : '0') . ',';
400, break;
'Sql Execution', case 'char':
['sql' => $sQuery, 'error' => $e->getMessage()], case 'text':
config("system.workspace"), if (!isset($aFields[$aField['sFieldName']])) {
'processmaker.log' $aFields[$aField['sFieldName']] = '';
);
} }
} if (!isset($aFields[$aField['sFieldName'] . '_label'])) {
} else { $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 = 'INSERT INTO `' . $aRow['REP_TAB_NAME'] . '` (';
$sQuery .= '`APP_UID`,`APP_NUMBER`'; $sQuery .= '`APP_UID`,`APP_NUMBER`,`ROW`';
foreach ($aTableFields as $aField) { foreach ($aTableFields as $aField) {
$sQuery .= ',`' . $aField['sFieldName'] . '`'; $sQuery .= ',`' . $aField['sFieldName'] . '`';
} }
$sQuery .= ") VALUES ('" . $sApplicationUid . "'," . (int)$iApplicationNumber; $sQuery .= ") VALUES ('" . $sApplicationUid . "'," . (int)$iApplicationNumber . ',' . $iRow;
foreach ($aTableFields as $aField) { foreach ($aTableFields as $aField) {
switch ($aField['sType']) { switch ($aField['sType']) {
case 'number': 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'); ) : '0');
break; break;
case 'char': case 'char':
case 'text': case 'text':
if (!isset($aFields[$aField['sFieldName']])) { if (!isset($aGridRow[$aField['sFieldName']])) {
$aFields[$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(), $con->getResource(),
$aFields[$aField['sFieldName']] $aGridRow[$aField['sFieldName']]
) : '') . "'"; ) : '') . "'";
break; break;
case 'date': case 'date':
$mysqlDate = (isset($aFields[$aField['sFieldName']]) ? $aFields[$aField['sFieldName']] : ''); $sQuery .= ",'" . (isset($aGridRow[$aField['sFieldName']]) ? $aGridRow[$aField['sFieldName']] : '') . "'";
if ($mysqlDate != '') {
$mysqlDate = str_replace('/', '-', $mysqlDate);
$mysqlDate = date('Y-m-d', strtotime($mysqlDate));
}
$value = trim($mysqlDate) != '' ? "'" . $mysqlDate . "'" : 'NULL';
$sQuery .= "," . $value;
break; break;
} }
} }
$sQuery .= ')'; $sQuery .= ')';
$rs = $stmt->executeQuery($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);
}
}
} }
} }
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(); $oDataset->next();
} }

View File

@@ -12,9 +12,9 @@ class TarFile extends Archive
* *
* @param string $name * @param string $name
*/ */
public function TarFile($name) public function __construct($name)
{ {
$this->archive($name); parent::__construct($name);
$this->options['type'] = "tar"; $this->options['type'] = "tar";
} }

View File

@@ -21,9 +21,9 @@
*/ */
class ZipFile extends Archive class ZipFile extends Archive
{ {
public function ZipFile($name) public function __construct($name)
{ {
$this->archive($name); parent::__construct($name);
$this->options['type'] = "zip"; $this->options['type'] = "zip";
} }

View File

@@ -5,7 +5,7 @@ use ProcessMaker\Plugins\PluginRegistry;
/** /**
* @package workflow.engine.classes * @package workflow.engine.classes
*/ */
class PMPlugin class PMPlugin extends PmPluginCompatibility
{ {
public $sNamespace; public $sNamespace;
public $sClassName; public $sClassName;
@@ -22,7 +22,7 @@ class PMPlugin
* @param string $sFilename * @param string $sFilename
* @return void * @return void
*/ */
public function PMPlugin($sNamespace, $sFilename = null) public function __construct($sNamespace, $sFilename = null)
{ {
$this->sNamespace = $sNamespace; $this->sNamespace = $sNamespace;
$this->sClassName = $sNamespace . 'Plugin'; $this->sClassName = $sNamespace . 'Plugin';

View File

@@ -6,7 +6,7 @@ require_once 'classes/model/om/BaseAppTimeoutActionExecuted.php';
/** /**
* Skeleton subclass for representing a row from the 'APP_TIMEOUT_ACTION_EXECUTED' table. * Skeleton subclass for representing a row from the 'APP_TIMEOUT_ACTION_EXECUTED' table.
* *
* *
* *
* You should add additional methods to this class to meet the * You should add additional methods to this class to meet the
* application requirements. This class will only be generated as * application requirements. This class will only be generated as
@@ -14,17 +14,18 @@ require_once 'classes/model/om/BaseAppTimeoutActionExecuted.php';
* *
* @package classes.model * @package classes.model
*/ */
class AppTimeoutActionExecuted extends BaseAppTimeoutActionExecuted { class AppTimeoutActionExecuted extends BaseAppTimeoutActionExecuted
{
public function create ($aData)
{ public function create($aData)
$con = Propel::getConnection( AppTimeoutActionExecutedPeer::DATABASE_NAME ); {
$con = Propel::getConnection(AppTimeoutActionExecutedPeer::DATABASE_NAME);
try { try {
$this->fromArray( $aData, BasePeer::TYPE_FIELDNAME ); $this->fromArray($aData, BasePeer::TYPE_FIELDNAME);
if ($this->validate()) { if ($this->validate()) {
$result = $this->save(); $result = $this->save();
} else { } 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(); $e->aValidationFailures = $this->getValidationFailures();
throw ($e); throw ($e);
} }
@@ -33,6 +34,6 @@ class AppTimeoutActionExecuted extends BaseAppTimeoutActionExecuted {
} catch (Exception $e) { } catch (Exception $e) {
$con->rollback(); $con->rollback();
throw ($e); throw ($e);
} }
} }
} // AppTimeoutActionExecuted } // AppTimeoutActionExecuted