diff --git a/workflow/engine/classes/Archive.php b/workflow/engine/classes/Archive.php index c73f6d248..88471af6c 100644 --- a/workflow/engine/classes/Archive.php +++ b/workflow/engine/classes/Archive.php @@ -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' => "" ); diff --git a/workflow/engine/classes/BzipFile.php b/workflow/engine/classes/BzipFile.php index 4cf6414cf..6e186a145 100644 --- a/workflow/engine/classes/BzipFile.php +++ b/workflow/engine/classes/BzipFile.php @@ -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"; diff --git a/workflow/engine/classes/LdapAdvanced.php b/workflow/engine/classes/LdapAdvanced.php index 95073af3f..5d7bade73 100644 --- a/workflow/engine/classes/LdapAdvanced.php +++ b/workflow/engine/classes/LdapAdvanced.php @@ -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']; diff --git a/workflow/engine/classes/Net.php b/workflow/engine/classes/Net.php index d5950d92e..2e4d6f52b 100644 --- a/workflow/engine/classes/Net.php +++ b/workflow/engine/classes/Net.php @@ -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 = ""; diff --git a/workflow/engine/classes/PmPluginCompatibility.php b/workflow/engine/classes/PmPluginCompatibility.php new file mode 100644 index 000000000..c559de6be --- /dev/null +++ b/workflow/engine/classes/PmPluginCompatibility.php @@ -0,0 +1,30 @@ +sNamespace = $namespace; + $this->sClassName = $namespace . 'Plugin'; + $this->sPluginFolder = $namespace; + $this->sFilename = $filename; + } +} diff --git a/workflow/engine/classes/ReportTables.php b/workflow/engine/classes/ReportTables.php index 2bdea2167..155e9c9b0 100644 --- a/workflow/engine/classes/ReportTables.php +++ b/workflow/engine/classes/ReportTables.php @@ -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(); } diff --git a/workflow/engine/classes/TarFile.php b/workflow/engine/classes/TarFile.php index 626b4da95..ebae7872c 100644 --- a/workflow/engine/classes/TarFile.php +++ b/workflow/engine/classes/TarFile.php @@ -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"; } diff --git a/workflow/engine/classes/ZipFile.php b/workflow/engine/classes/ZipFile.php index dbbfd677b..b20389e23 100644 --- a/workflow/engine/classes/ZipFile.php +++ b/workflow/engine/classes/ZipFile.php @@ -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"; } diff --git a/workflow/engine/classes/class.plugin.php b/workflow/engine/classes/class.plugin.php index 8f1c46a7c..e2e5cee51 100644 --- a/workflow/engine/classes/class.plugin.php +++ b/workflow/engine/classes/class.plugin.php @@ -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'; diff --git a/workflow/engine/classes/model/AppTimeoutActionExecuted.php b/workflow/engine/classes/model/AppTimeoutActionExecuted.php index c96dddd5e..cb446434d 100644 --- a/workflow/engine/classes/model/AppTimeoutActionExecuted.php +++ b/workflow/engine/classes/model/AppTimeoutActionExecuted.php @@ -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