Merge with develop: solving conflicts
This commit is contained in:
@@ -5612,30 +5612,30 @@ class Cases
|
||||
/**
|
||||
* This function send an email for each task in $arrayTask if $to is definded
|
||||
*
|
||||
* @param $dataLastEmail
|
||||
* @param $arrayData
|
||||
* @param $arrayTask
|
||||
* @param array $dataLastEmail
|
||||
* @param array $arrayData
|
||||
* @param array $arrayTask
|
||||
* @return void
|
||||
*
|
||||
* @see \Cases->sendNotifications()
|
||||
*/
|
||||
public function sendMessage($dataLastEmail, $arrayData, $arrayTask)
|
||||
{
|
||||
foreach ($arrayTask as $aTask) {
|
||||
foreach ($arrayTask as $theTask) {
|
||||
//Check and fix if Task Id is complex
|
||||
if (strpos($aTask['TAS_UID'], "/") !== false) {
|
||||
$aux = explode("/", $aTask['TAS_UID']);
|
||||
if (strpos($theTask['TAS_UID'], "/") !== false) {
|
||||
$aux = explode("/", $theTask['TAS_UID']);
|
||||
if (isset($aux[1])) {
|
||||
$aTask['TAS_UID'] = $aux[1];
|
||||
$theTask['TAS_UID'] = $aux[1];
|
||||
}
|
||||
}
|
||||
//if the next is EOP dont send notification and continue with the next
|
||||
if ($aTask['TAS_UID'] === '-1') {
|
||||
if ($theTask['TAS_UID'] === '-1') {
|
||||
continue;
|
||||
}
|
||||
if (isset($aTask['DEL_INDEX'])) {
|
||||
if (isset($theTask['DEL_INDEX'])) {
|
||||
$arrayData2 = $arrayData;
|
||||
$appDelegation = AppDelegationPeer::retrieveByPK($dataLastEmail['applicationUid'], $aTask['DEL_INDEX']);
|
||||
$appDelegation = AppDelegationPeer::retrieveByPK($dataLastEmail['applicationUid'], $theTask['DEL_INDEX']);
|
||||
if (!is_null($appDelegation)) {
|
||||
$oTaskUpd = new Task();
|
||||
$aTaskUpdate = $oTaskUpd->load($appDelegation->getTasUid());
|
||||
@@ -5646,25 +5646,25 @@ class Cases
|
||||
$arrayData2 = $arrayData;
|
||||
}
|
||||
|
||||
if (isset($aTask['USR_UID']) && !empty($aTask['USR_UID'])) {
|
||||
if (isset($theTask['USR_UID']) && !empty($theTask['USR_UID'])) {
|
||||
$user = new \ProcessMaker\BusinessModel\User();
|
||||
$arrayUserData = $user->getUser($aTask['USR_UID'], true);
|
||||
$arrayUserData = $user->getUser($theTask['USR_UID'], true);
|
||||
$arrayData2 = \ProcessMaker\Util\DateTime::convertUtcToTimeZone($arrayData2,
|
||||
(trim($arrayUserData['USR_TIME_ZONE']) != '') ? trim($arrayUserData['USR_TIME_ZONE']) :
|
||||
\ProcessMaker\Util\System::getTimeZone());
|
||||
} else {
|
||||
$arrayData2 = \ProcessMaker\Util\DateTime::convertUtcToTimeZone($arrayData2);
|
||||
}
|
||||
$body2 = G::replaceDataGridField($dataLastEmail['body'], $arrayData2, false);
|
||||
$body2 = G::replaceDataGridField($dataLastEmail['body'], $arrayData2, false, true);
|
||||
$to = null;
|
||||
$cc = '';
|
||||
if ($aTask['TAS_UID'] != '-1') {
|
||||
$respTo = $this->getTo($aTask['TAS_UID'], $aTask['USR_UID'], $arrayData);
|
||||
if ($theTask['TAS_UID'] != '-1') {
|
||||
$respTo = $this->getTo($theTask['TAS_UID'], $theTask['USR_UID'], $arrayData);
|
||||
$to = $respTo['to'];
|
||||
$cc = $respTo['cc'];
|
||||
}
|
||||
|
||||
if ($aTask ["TAS_ASSIGN_TYPE"] === "SELF_SERVICE") {
|
||||
if ($theTask["TAS_ASSIGN_TYPE"] === "SELF_SERVICE") {
|
||||
if ($dataLastEmail['swtplDefault'] == 1) {
|
||||
G::verifyPath($dataLastEmail['pathEmail'], true); // Create if it does not exist
|
||||
$fileTemplate = $dataLastEmail['pathEmail'] . G::LoadTranslation('ID_UNASSIGNED_MESSAGE');
|
||||
|
||||
@@ -4,6 +4,7 @@ use ProcessMaker\Core\System;
|
||||
use ProcessMaker\BusinessModel\DynaForm\SuggestTrait;
|
||||
use ProcessMaker\BusinessModel\Cases;
|
||||
use ProcessMaker\BusinessModel\DynaForm\ValidatorFactory;
|
||||
use ProcessMaker\Model\Dynaform as ModelDynaform;
|
||||
|
||||
/**
|
||||
* Implementing pmDynaform library in the running case.
|
||||
@@ -78,6 +79,14 @@ class PmDynaform
|
||||
return $titleDynaform;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a dynaform.
|
||||
* @return array|null
|
||||
* @see ConsolidatedCases->processConsolidated()
|
||||
* @see workflow/engine/methods/cases/caseConsolidated.php
|
||||
* @see ProcessMaker\BusinessModel\Cases->getCaseVariables()
|
||||
* @see PmDynaform->__construct()
|
||||
*/
|
||||
public function getDynaform()
|
||||
{
|
||||
if (!isset($this->fields["CURRENT_DYNAFORM"])) {
|
||||
@@ -86,22 +95,21 @@ class PmDynaform
|
||||
if ($this->record != null) {
|
||||
return $this->record;
|
||||
}
|
||||
$a = new Criteria("workflow");
|
||||
$a->addSelectColumn(DynaformPeer::DYN_VERSION);
|
||||
$a->addSelectColumn(DynaformPeer::DYN_LABEL);
|
||||
$a->addSelectColumn(DynaformPeer::DYN_CONTENT);
|
||||
$a->addSelectColumn(DynaformPeer::PRO_UID);
|
||||
$a->addSelectColumn(DynaformPeer::DYN_UID);
|
||||
$a->add(DynaformPeer::DYN_UID, $this->fields["CURRENT_DYNAFORM"], Criteria::EQUAL);
|
||||
$ds = DynaformPeer::doSelectRS($a);
|
||||
$ds->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$ds->next();
|
||||
$row = $ds->getRow();
|
||||
$this->record = isset($row) ? $row : null;
|
||||
$this->langs = ($this->record["DYN_LABEL"] !== "" && $this->record["DYN_LABEL"] !== null) ? G::json_decode($this->record["DYN_LABEL"]) : null;
|
||||
$dynaform = ModelDynaform::getByDynUid($this->fields["CURRENT_DYNAFORM"]);
|
||||
if (empty($dynaform)) {
|
||||
$this->langs = null;
|
||||
return null;
|
||||
}
|
||||
$this->langs = empty($dynaform->DYN_LABEL) ? null : G::json_decode($dynaform->DYN_LABEL);
|
||||
$this->record = (array) $dynaform;
|
||||
return $this->record;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all dynaforms except this dynaform, related to process.
|
||||
* @return array
|
||||
* @see PmDynaform->__construct()
|
||||
*/
|
||||
public function getDynaforms()
|
||||
{
|
||||
if ($this->record === null) {
|
||||
@@ -110,21 +118,11 @@ class PmDynaform
|
||||
if ($this->records != null) {
|
||||
return $this->records;
|
||||
}
|
||||
$a = new Criteria("workflow");
|
||||
$a->addSelectColumn(DynaformPeer::DYN_UPDATE_DATE);
|
||||
$a->addSelectColumn(DynaformPeer::DYN_VERSION);
|
||||
$a->addSelectColumn(DynaformPeer::DYN_LABEL);
|
||||
$a->addSelectColumn(DynaformPeer::DYN_CONTENT);
|
||||
$a->addSelectColumn(DynaformPeer::PRO_UID);
|
||||
$a->addSelectColumn(DynaformPeer::DYN_UID);
|
||||
$a->add(DynaformPeer::PRO_UID, $this->record["PRO_UID"], Criteria::EQUAL);
|
||||
$a->add(DynaformPeer::DYN_UID, $this->record["DYN_UID"], Criteria::NOT_EQUAL);
|
||||
$ds = DynaformPeer::doSelectRS($a);
|
||||
$ds->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$this->records = array();
|
||||
while ($ds->next()) {
|
||||
array_push($this->records, $ds->getRow());
|
||||
}
|
||||
$result = ModelDynaform::getByProUidExceptDynUid($this->record["PRO_UID"], $this->record["DYN_UID"]);
|
||||
$result->transform(function($item) {
|
||||
return (array) $item;
|
||||
});
|
||||
$this->records = $result->toArray();
|
||||
return $this->records;
|
||||
}
|
||||
|
||||
@@ -1562,19 +1560,27 @@ class PmDynaform
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify the use of the variable in all the forms of the process.
|
||||
*
|
||||
* @param string $processUid
|
||||
* @param string $variable
|
||||
* @return boolean | string
|
||||
*
|
||||
* @see ProcessMaker\BusinessModel\Variable->delete()
|
||||
* @link https://wiki.processmaker.com/3.2/Variables#Managing_Variables
|
||||
*/
|
||||
public function isUsed($processUid, $variable)
|
||||
{
|
||||
$criteria = new Criteria("workflow");
|
||||
$criteria->addSelectColumn(DynaformPeer::DYN_UID);
|
||||
$criteria->addSelectColumn(DynaformPeer::DYN_CONTENT);
|
||||
$criteria->add(DynaformPeer::PRO_UID, $processUid, Criteria::EQUAL);
|
||||
$rsCriteria = DynaformPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
while ($rsCriteria->next()) {
|
||||
$aRow = $rsCriteria->getRow();
|
||||
$json = G::json_decode($aRow['DYN_CONTENT']);
|
||||
$result = ModelDynaform::getByProUid($processUid);
|
||||
if (empty($result)) {
|
||||
return false;
|
||||
}
|
||||
foreach ($result as $row) {
|
||||
$dynaform = new PmDynaform(["CURRENT_DYNAFORM" => $row->DYN_UID]);
|
||||
$json = G::json_decode($dynaform->record["DYN_CONTENT"]);
|
||||
if ($this->jsoni($json, $variable)) {
|
||||
return $aRow['DYN_UID'];
|
||||
return $row->DYN_UID;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use ProcessMaker\Model\Application;
|
||||
|
||||
/**
|
||||
* ReportTables - Report tables
|
||||
* Report Tables
|
||||
*/
|
||||
class ReportTables
|
||||
{
|
||||
@@ -184,218 +187,188 @@ class ReportTables
|
||||
* This Function fills the table
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param string $sTableName Table name
|
||||
* @param string $sConnection Connection name
|
||||
* @param string $sType
|
||||
* @param array $aFields
|
||||
* @param string $sProcessUid
|
||||
* @param string $sGrid
|
||||
*
|
||||
* @param string $tableName Table name
|
||||
* @param string $connectionShortName Connection name
|
||||
* @param string $type
|
||||
* @param array $fields
|
||||
* @param string $proUid
|
||||
* @param string $grid
|
||||
* @see ConsolidatedCases->processConsolidated()
|
||||
* @see Processes->createReportTables()
|
||||
* @see workflow/engine/methods/cases/caseConsolidated.php
|
||||
* @see workflow/engine/methods/processes/consolidated.php ajax_con->con_save_properties()
|
||||
* @see workflow/engine/methods/reportTables/reportTables_Save.php
|
||||
* @link https://wiki.processmaker.com/3.0/Report_Tables
|
||||
* @return void
|
||||
*/
|
||||
public function populateTable(
|
||||
$sTableName,
|
||||
$sConnection = 'report',
|
||||
$sType = 'NORMAL',
|
||||
$aFields = array(),
|
||||
$sProcessUid = '',
|
||||
$sGrid = ''
|
||||
)
|
||||
public function populateTable($tableName, $connectionShortName = 'report', $type = 'NORMAL', $fields = [], $proUid = '', $grid = '')
|
||||
{
|
||||
$sTableName = $this->sPrefix . $sTableName;
|
||||
$tableName = $this->sPrefix . $tableName;
|
||||
//we have to do the propel connection
|
||||
$PropelDatabase = $this->chooseDB($sConnection);
|
||||
$con = Propel::getConnection($PropelDatabase);
|
||||
$stmt = $con->createStatement();
|
||||
if ($sType == 'GRID') {
|
||||
$aAux = explode('-', $sGrid);
|
||||
$sGrid = $aAux[0];
|
||||
$database = $this->chooseDB($connectionShortName);
|
||||
$connection = Propel::getConnection($database);
|
||||
$statement = $connection->createStatement();
|
||||
if ($type == 'GRID') {
|
||||
$aux = explode('-', $grid);
|
||||
$grid = $aux[0];
|
||||
}
|
||||
$case = new Cases();
|
||||
try {
|
||||
switch (DB_ADAPTER) {
|
||||
case 'mysql':
|
||||
//select cases for this Process, ordered by APP_NUMBER
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->add(ApplicationPeer::PRO_UID, $sProcessUid);
|
||||
$oCriteria->addAscendingOrderByColumn(ApplicationPeer::APP_NUMBER);
|
||||
$oDataset = ApplicationPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
$aData = unserialize($aRow['APP_DATA']);
|
||||
//delete previous record from this report table ( previous records in case this is a grid )
|
||||
$deleteSql = 'DELETE FROM `' . $sTableName . "` WHERE APP_UID = '" . $aRow['APP_UID'] . "'";
|
||||
$rsDel = $stmt->executeQuery($deleteSql);
|
||||
if ($sType == 'NORMAL') {
|
||||
$sQuery = 'INSERT INTO `' . $sTableName . '` (';
|
||||
$sQuery .= '`APP_UID`,`APP_NUMBER`';
|
||||
foreach ($aFields as $aField) {
|
||||
$sQuery .= ',`' . $aField['sFieldName'] . '`';
|
||||
$applications = Application::getByProUid($proUid);
|
||||
foreach ($applications as $application) {
|
||||
$appData = $case->unserializeData($application->APP_DATA);
|
||||
DB::delete("DELETE FROM `{$tableName}` WHERE APP_UID = '{$application->APP_UID}'");
|
||||
if ($type == 'NORMAL') {
|
||||
$query = 'INSERT INTO `' . $tableName . '` (';
|
||||
$query .= '`APP_UID`,`APP_NUMBER`';
|
||||
foreach ($fields as $field) {
|
||||
$query .= ',`' . $field['sFieldName'] . '`';
|
||||
}
|
||||
$sQuery .= ") VALUES ('" . $aRow['APP_UID'] . "'," . (int)$aRow['APP_NUMBER'];
|
||||
foreach ($aFields as $aField) {
|
||||
switch ($aField['sType']) {
|
||||
$query .= ") VALUES ('" . $application->APP_UID . "'," . $application->APP_NUMBER;
|
||||
foreach ($fields as $field) {
|
||||
switch ($field['sType']) {
|
||||
case 'number':
|
||||
$sQuery .= ',' . (isset($aData[$aField['sFieldName']]) ? (float)str_replace(
|
||||
',',
|
||||
'',
|
||||
$aData[$aField['sFieldName']]
|
||||
) : '0');
|
||||
$query .= ',' . (isset($appData[$field['sFieldName']]) ? (float) str_replace(',', '', $appData[$field['sFieldName']]) : '0');
|
||||
break;
|
||||
case 'char':
|
||||
case 'text':
|
||||
if (!isset($aData[$aField['sFieldName']])) {
|
||||
$aData[$aField['sFieldName']] = '';
|
||||
if (!isset($appData[$field['sFieldName']])) {
|
||||
$appData[$field['sFieldName']] = '';
|
||||
}
|
||||
$sQuery .= ",'" . (isset($aData[$aField['sFieldName']]) ? mysqli_real_escape_string(
|
||||
$con->getResource(),
|
||||
$aData[$aField['sFieldName']]
|
||||
) : '') . "'";
|
||||
$string = $appData[$field['sFieldName']];
|
||||
if (is_array($string)) {
|
||||
$string = implode($string, ",");
|
||||
}
|
||||
$query .= ",'" . (isset($appData[$field['sFieldName']]) ? mysqli_real_escape_string($connection->getResource(), $string) : '') . "'";
|
||||
break;
|
||||
case 'date':
|
||||
$value = (isset($aData[$aField['sFieldName']]) && trim($aData[$aField['sFieldName']])) != '' ? "'" . $aData[$aField['sFieldName']] . "'" : 'NULL';
|
||||
$sQuery .= "," . $value;
|
||||
$value = (isset($appData[$field['sFieldName']]) && trim($appData[$field['sFieldName']])) != '' ? "'" . $appData[$field['sFieldName']] . "'" : 'NULL';
|
||||
$query .= "," . $value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$sQuery .= ')';
|
||||
$rs = $stmt->executeQuery($sQuery);
|
||||
$query .= ')';
|
||||
DB::insert($query);
|
||||
} else {
|
||||
if (isset($aData[$sGrid])) {
|
||||
foreach ($aData[$sGrid] as $iRow => $aGridRow) {
|
||||
$sQuery = 'INSERT INTO `' . $sTableName . '` (';
|
||||
$sQuery .= '`APP_UID`,`APP_NUMBER`,`ROW`';
|
||||
foreach ($aFields as $aField) {
|
||||
$sQuery .= ',`' . $aField['sFieldName'] . '`';
|
||||
if (isset($appData[$grid])) {
|
||||
foreach ($appData[$grid] as $indexRow => $gridRow) {
|
||||
$query = 'INSERT INTO `' . $tableName . '` (';
|
||||
$query .= '`APP_UID`,`APP_NUMBER`,`ROW`';
|
||||
foreach ($fields as $field) {
|
||||
$query .= ',`' . $field['sFieldName'] . '`';
|
||||
}
|
||||
$sQuery .= ") VALUES ('" . $aRow['APP_UID'] . "'," . (int)$aRow['APP_NUMBER'] . ',' . $iRow;
|
||||
foreach ($aFields as $aField) {
|
||||
switch ($aField['sType']) {
|
||||
$query .= ") VALUES ('" . $application->APP_UID . "'," . (int) $application->APP_NUMBER . ',' . $indexRow;
|
||||
foreach ($fields as $field) {
|
||||
switch ($field['sType']) {
|
||||
case 'number':
|
||||
$sQuery .= ',' . (isset($aGridRow[$aField['sFieldName']]) ? (float)str_replace(
|
||||
',',
|
||||
'',
|
||||
$aGridRow[$aField['sFieldName']]
|
||||
) : '0');
|
||||
$query .= ',' . (isset($gridRow[$field['sFieldName']]) ? (float) str_replace(',', '', $gridRow[$field['sFieldName']]) : '0');
|
||||
break;
|
||||
case 'char':
|
||||
case 'text':
|
||||
if (!isset($aGridRow[$aField['sFieldName']])) {
|
||||
$aGridRow[$aField['sFieldName']] = '';
|
||||
if (!isset($gridRow[$field['sFieldName']])) {
|
||||
$gridRow[$field['sFieldName']] = '';
|
||||
}
|
||||
$sQuery .= ",'" . (isset($aGridRow[$aField['sFieldName']]) ? mysqli_real_escape_string(
|
||||
$con->getResource(),
|
||||
$aGridRow[$aField['sFieldName']]
|
||||
) : '') . "'";
|
||||
$stringEscape = mysqli_real_escape_string($connection->getResource(), $gridRow[$field['sFieldName']]);
|
||||
$query .= ",'" . (isset($gridRow[$field['sFieldName']]) ? $stringEscape : '') . "'";
|
||||
break;
|
||||
case 'date':
|
||||
$value = (isset($aGridRow[$aField['sFieldName']]) && trim($aGridRow[$aField['sFieldName']])) != '' ? "'" . $aGridRow[$aField['sFieldName']] . "'" : 'NULL';
|
||||
$sQuery .= "," . $value;
|
||||
$value = (isset($gridRow[$field['sFieldName']]) && trim($gridRow[$field['sFieldName']])) != '' ? "'" . $gridRow[$field['sFieldName']] . "'" : 'NULL';
|
||||
$query .= "," . $value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$sQuery .= ')';
|
||||
$rs = $stmt->executeQuery($sQuery);
|
||||
$query .= ')';
|
||||
DB::insert($query);
|
||||
}
|
||||
}
|
||||
}
|
||||
$oDataset->next();
|
||||
}
|
||||
break;
|
||||
|
||||
/**
|
||||
* For SQLServer code
|
||||
* Note: It is only possible to create Report Tables in MySQL databases. The list will only show connections to those databases even if the project has connections to other DBMS.
|
||||
* This section is not used and has been marked for deletion.
|
||||
* @link https://wiki.processmaker.com/3.0/Report_Tables#Creating_Report_Tables
|
||||
* @deprecated
|
||||
*/
|
||||
case 'mssql':
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->add(ApplicationPeer::PRO_UID, $sProcessUid);
|
||||
$oCriteria->addAscendingOrderByColumn(ApplicationPeer::APP_NUMBER);
|
||||
$oDataset = ApplicationPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
$aData = unserialize($aRow['APP_DATA']);
|
||||
$criteria = new Criteria('workflow');
|
||||
$criteria->add(ApplicationPeer::PRO_UID, $proUid);
|
||||
$criteria->addAscendingOrderByColumn(ApplicationPeer::APP_NUMBER);
|
||||
$dataset = ApplicationPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$dataset->next();
|
||||
while ($row = $dataset->getRow()) {
|
||||
$appData = unserialize($row['APP_DATA']);
|
||||
//verify use mssql
|
||||
mysqli_query(
|
||||
$con->getResource(),
|
||||
'DELETE FROM [' . $sTableName . "] WHERE APP_UID = '" . $aRow['APP_UID'] . "'"
|
||||
$connection->getResource(), 'DELETE FROM [' . $tableName . "] WHERE APP_UID = '" . $row['APP_UID'] . "'"
|
||||
);
|
||||
if ($sType == 'NORMAL') {
|
||||
$sQuery = 'INSERT INTO [' . $sTableName . '] (';
|
||||
$sQuery .= '[APP_UID],[APP_NUMBER]';
|
||||
foreach ($aFields as $aField) {
|
||||
$sQuery .= ',[' . $aField['sFieldName'] . ']';
|
||||
if ($type == 'NORMAL') {
|
||||
$query = 'INSERT INTO [' . $tableName . '] (';
|
||||
$query .= '[APP_UID],[APP_NUMBER]';
|
||||
foreach ($fields as $field) {
|
||||
$query .= ',[' . $field['sFieldName'] . ']';
|
||||
}
|
||||
$sQuery .= ") VALUES ('" . $aRow['APP_UID'] . "'," . (int)$aRow['APP_NUMBER'];
|
||||
foreach ($aFields as $aField) {
|
||||
switch ($aField['sType']) {
|
||||
$query .= ") VALUES ('" . $row['APP_UID'] . "'," . (int) $row['APP_NUMBER'];
|
||||
foreach ($fields as $field) {
|
||||
switch ($field['sType']) {
|
||||
case 'number':
|
||||
$sQuery .= ',' . (isset($aData[$aField['sFieldName']]) ? (float)str_replace(
|
||||
',',
|
||||
'',
|
||||
$aData[$aField['sFieldName']]
|
||||
) : '0');
|
||||
$query .= ',' . (isset($appData[$field['sFieldName']]) ? (float) str_replace(',', '', $appData[$field['sFieldName']]) : '0');
|
||||
break;
|
||||
case 'char':
|
||||
case 'text':
|
||||
if (!isset($aData[$aField['sFieldName']])) {
|
||||
$aData[$aField['sFieldName']] = '';
|
||||
if (!isset($appData[$field['sFieldName']])) {
|
||||
$appData[$field['sFieldName']] = '';
|
||||
}
|
||||
$sQuery .= ",'" . (isset($aData[$aField['sFieldName']]) ? mysqli_real_escape_string(
|
||||
$con->getResource(),
|
||||
$aData[$aField['sFieldName']]
|
||||
) : '') . "'";
|
||||
$stringEscape = mysqli_real_escape_string($connection->getResource(), $appData[$field['sFieldName']]);
|
||||
$query .= ",'" . (isset($appData[$field['sFieldName']]) ? $stringEscape : '') . "'";
|
||||
break;
|
||||
case 'date':
|
||||
$sQuery .= ",'" . (isset($aData[$aField['sFieldName']]) ? $aData[$aField['sFieldName']] : '') . "'";
|
||||
$query .= ",'" . (isset($appData[$field['sFieldName']]) ? $appData[$field['sFieldName']] : '') . "'";
|
||||
break;
|
||||
}
|
||||
}
|
||||
$sQuery .= ')';
|
||||
$rs = $stmt->executeQuery($sQuery);
|
||||
$query .= ')';
|
||||
$rs = $statement->executeQuery($query);
|
||||
} else {
|
||||
if (isset($aData[$sGrid])) {
|
||||
foreach ($aData[$sGrid] as $iRow => $aGridRow) {
|
||||
$sQuery = 'INSERT INTO [' . $sTableName . '] (';
|
||||
$sQuery .= '`APP_UID`,`APP_NUMBER`,`ROW`';
|
||||
foreach ($aFields as $aField) {
|
||||
$sQuery .= ',[' . $aField['sFieldName'] . ']';
|
||||
if (isset($appData[$grid])) {
|
||||
foreach ($appData[$grid] as $indexRow => $gridRow) {
|
||||
$query = 'INSERT INTO [' . $tableName . '] (';
|
||||
$query .= '`APP_UID`,`APP_NUMBER`,`ROW`';
|
||||
foreach ($fields as $field) {
|
||||
$query .= ',[' . $field['sFieldName'] . ']';
|
||||
}
|
||||
$sQuery .= ") VALUES ('" . $aRow['APP_UID'] . "'," . (int)$aRow['APP_NUMBER'] . ',' . $iRow;
|
||||
foreach ($aFields as $aField) {
|
||||
switch ($aField['sType']) {
|
||||
$query .= ") VALUES ('" . $row['APP_UID'] . "'," . (int) $row['APP_NUMBER'] . ',' . $indexRow;
|
||||
foreach ($fields as $field) {
|
||||
switch ($field['sType']) {
|
||||
case 'number':
|
||||
$sQuery .= ',' . (isset($aGridRow[$aField['sFieldName']]) ? (float)str_replace(
|
||||
',',
|
||||
'',
|
||||
$aGridRow[$aField['sFieldName']]
|
||||
) : '0');
|
||||
$query .= ',' . (isset($gridRow[$field['sFieldName']]) ? (float) str_replace(',', '', $gridRow[$field['sFieldName']]) : '0');
|
||||
break;
|
||||
case 'char':
|
||||
case 'text':
|
||||
if (!isset($aGridRow[$aField['sFieldName']])) {
|
||||
$aGridRow[$aField['sFieldName']] = '';
|
||||
if (!isset($gridRow[$field['sFieldName']])) {
|
||||
$gridRow[$field['sFieldName']] = '';
|
||||
}
|
||||
$sQuery .= ",'" . (isset($aGridRow[$aField['sFieldName']]) ? mysqli_real_escape_string(
|
||||
$con->getResource(),
|
||||
$aGridRow[$aField['sFieldName']]
|
||||
) : '') . "'";
|
||||
$stringEscape = mysqli_real_escape_string($connection->getResource(), $gridRow[$field['sFieldName']]);
|
||||
$query .= ",'" . (isset($gridRow[$field['sFieldName']]) ? $stringEscape : '') . "'";
|
||||
break;
|
||||
case 'date':
|
||||
$sQuery .= ",'" . (isset($aGridRow[$aField['sFieldName']]) ? $aGridRow[$aField['sFieldName']] : '') . "'";
|
||||
$query .= ",'" . (isset($gridRow[$field['sFieldName']]) ? $gridRow[$field['sFieldName']] : '') . "'";
|
||||
break;
|
||||
}
|
||||
}
|
||||
$sQuery .= ')';
|
||||
$rs = $stmt->executeQuery($sQuery);
|
||||
$query .= ')';
|
||||
$rs = $statement->executeQuery($query);
|
||||
}
|
||||
}
|
||||
}
|
||||
$oDataset->next();
|
||||
$dataset->next();
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
} catch (Exception $oError) {
|
||||
throw ($oError);
|
||||
|
||||
@@ -991,7 +991,7 @@ class WsBase
|
||||
$subject,
|
||||
G::buildFrom($setup, $from),
|
||||
$to,
|
||||
G::replaceDataGridField(file_get_contents($fileTemplate), $fieldsCase, false),
|
||||
G::replaceDataGridField(file_get_contents($fileTemplate), $fieldsCase, false, true),
|
||||
$cc,
|
||||
$bcc,
|
||||
'',
|
||||
|
||||
@@ -508,20 +508,29 @@ class OutputDocument extends BaseOutputDocument
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Generate the output document
|
||||
* @param string $sUID
|
||||
* @param array $aFields
|
||||
* @param string $sPath
|
||||
* @return variant
|
||||
*
|
||||
* @param string $outDocUid
|
||||
* @param array $caseFields
|
||||
* @param string $path
|
||||
* @param string $filename
|
||||
* @param string $content
|
||||
* @param bool $landscape
|
||||
* @param string $typeDocsToGen
|
||||
* @param array $properties
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @see workflow/engine/methods/cases/cases_Step.php
|
||||
* @see workflow/engine/classes/class.pmFunctions.php:PMFGenerateOutputDocument()
|
||||
*/
|
||||
|
||||
public function generate($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape = false, $sTypeDocToGener = 'BOTH', $aProperties = array())
|
||||
public function generate($outDocUid, $caseFields, $path, $filename, $content, $landscape = false, $typeDocsToGen = 'BOTH', $properties = [])
|
||||
{
|
||||
if (($sUID != '') && is_array($aFields) && ($sPath != '')) {
|
||||
$sContent = G::replaceDataGridField($sContent, $aFields);
|
||||
if (($outDocUid != '') && is_array($caseFields) && ($path != '')) {
|
||||
$content = G::replaceDataGridField($content, $caseFields, true, true);
|
||||
|
||||
if (strpos($sContent, '<!---{') !== false) {
|
||||
if (strpos($content, '<!---{') !== false) {
|
||||
$template = new Smarty();
|
||||
$template->compile_dir = PATH_SMARTY_C;
|
||||
$template->cache_dir = PATH_SMARTY_CACHE;
|
||||
@@ -529,20 +538,20 @@ class OutputDocument extends BaseOutputDocument
|
||||
$template->caching = false;
|
||||
$template->left_delimiter = '<!---{';
|
||||
$template->right_delimiter = '}--->';
|
||||
$oFile = fopen($sPath . $sFilename . '_smarty.html', 'wb');
|
||||
fwrite($oFile, $sContent);
|
||||
fclose($oFile);
|
||||
$template->templateFile = $sPath . $sFilename . '_smarty.html';
|
||||
$fp = fopen($path . $filename . '_smarty.html', 'wb');
|
||||
fwrite($fp, $content);
|
||||
fclose($fp);
|
||||
$template->templateFile = $path . $filename . '_smarty.html';
|
||||
//assign the variables and use the template $template
|
||||
$template->assign($aFields);
|
||||
$sContent = $template->fetch($template->templateFile);
|
||||
$template->assign($caseFields);
|
||||
$content = $template->fetch($template->templateFile);
|
||||
unlink($template->templateFile);
|
||||
}
|
||||
|
||||
G::verifyPath($sPath, true);
|
||||
G::verifyPath($path, true);
|
||||
|
||||
//Start - Create .doc
|
||||
$oFile = fopen($sPath . $sFilename . '.doc', 'wb');
|
||||
$fp = fopen($path . $filename . '.doc', 'wb');
|
||||
|
||||
$size = [];
|
||||
$size["Letter"] = "216mm 279mm";
|
||||
@@ -566,6 +575,7 @@ class OutputDocument extends BaseOutputDocument
|
||||
$size["Screenshot800"] = "800mm 600mm";
|
||||
$size["Screenshot1024"] = "1024mm 768mm";
|
||||
|
||||
$sizeLandscape = [];
|
||||
$sizeLandscape["Letter"] = "279mm 216mm";
|
||||
$sizeLandscape["Legal"] = "357mm 216mm";
|
||||
$sizeLandscape["Executive"] = "267mm 184mm";
|
||||
@@ -587,41 +597,41 @@ class OutputDocument extends BaseOutputDocument
|
||||
$sizeLandscape["Screenshot800"] = "600mm 800mm";
|
||||
$sizeLandscape["Screenshot1024"] = "768mm 1024mm";
|
||||
|
||||
if (!isset($aProperties['media'])) {
|
||||
$aProperties['media'] = 'Letter';
|
||||
if (!isset($properties['media'])) {
|
||||
$properties['media'] = 'Letter';
|
||||
}
|
||||
|
||||
if ($sLandscape) {
|
||||
$media = $sizeLandscape[$aProperties['media']];
|
||||
if ($landscape) {
|
||||
$media = $sizeLandscape[$properties['media']];
|
||||
} else {
|
||||
$media = $size[$aProperties['media']];
|
||||
$media = $size[$properties['media']];
|
||||
}
|
||||
|
||||
$marginLeft = '15';
|
||||
|
||||
if (isset($aProperties['margins']['left'])) {
|
||||
$marginLeft = $aProperties['margins']['left'];
|
||||
if (isset($properties['margins']['left'])) {
|
||||
$marginLeft = $properties['margins']['left'];
|
||||
}
|
||||
|
||||
$marginRight = '15';
|
||||
|
||||
if (isset($aProperties['margins']['right'])) {
|
||||
$marginRight = $aProperties['margins']['right'];
|
||||
if (isset($properties['margins']['right'])) {
|
||||
$marginRight = $properties['margins']['right'];
|
||||
}
|
||||
|
||||
$marginTop = '15';
|
||||
|
||||
if (isset($aProperties['margins']['top'])) {
|
||||
$marginTop = $aProperties['margins']['top'];
|
||||
if (isset($properties['margins']['top'])) {
|
||||
$marginTop = $properties['margins']['top'];
|
||||
}
|
||||
|
||||
$marginBottom = '15';
|
||||
|
||||
if (isset($aProperties['margins']['bottom'])) {
|
||||
$marginBottom = $aProperties['margins']['bottom'];
|
||||
if (isset($properties['margins']['bottom'])) {
|
||||
$marginBottom = $properties['margins']['bottom'];
|
||||
}
|
||||
|
||||
fwrite($oFile, '<html xmlns:v="urn:schemas-microsoft-com:vml"
|
||||
fwrite($fp, '<html xmlns:v="urn:schemas-microsoft-com:vml"
|
||||
xmlns:o="urn:schemas-microsoft-com:office:office"
|
||||
xmlns:w="urn:schemas-microsoft-com:office:word"
|
||||
xmlns="http://www.w3.org/TR/REC-html40">
|
||||
@@ -667,31 +677,31 @@ class OutputDocument extends BaseOutputDocument
|
||||
<body>
|
||||
<div class=WordSection1>');
|
||||
|
||||
fwrite($oFile, $sContent);
|
||||
fwrite($oFile, "\n</div></body></html>\n\n");
|
||||
fclose($oFile);
|
||||
fwrite($fp, $content);
|
||||
fwrite($fp, "\n</div></body></html>\n\n");
|
||||
fclose($fp);
|
||||
/* End - Create .doc */
|
||||
|
||||
if ($sTypeDocToGener == 'BOTH' || $sTypeDocToGener == 'PDF') {
|
||||
$oFile = fopen($sPath . $sFilename . '.html', 'wb');
|
||||
fwrite($oFile, $sContent);
|
||||
fclose($oFile);
|
||||
if ($typeDocsToGen == 'BOTH' || $typeDocsToGen == 'PDF') {
|
||||
$fp = fopen($path . $filename . '.html', 'wb');
|
||||
fwrite($fp, $content);
|
||||
fclose($fp);
|
||||
/* Start - Create .pdf */
|
||||
if (isset($aProperties['report_generator'])) {
|
||||
switch ($aProperties['report_generator']) {
|
||||
if (isset($properties['report_generator'])) {
|
||||
switch ($properties['report_generator']) {
|
||||
case 'TCPDF':
|
||||
$this->generateTcpdf($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape, $aProperties);
|
||||
$this->generateTcpdf($outDocUid, $caseFields, $path, $filename, $content, $landscape, $properties);
|
||||
break;
|
||||
case 'HTML2PDF':
|
||||
default:
|
||||
$this->generateHtml2ps_pdf($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape, $aProperties);
|
||||
$this->generateHtml2ps_pdf($outDocUid, $caseFields, $path, $filename, $content, $landscape, $properties);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
$this->generateHtml2ps_pdf($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape, $aProperties);
|
||||
$this->generateHtml2ps_pdf($outDocUid, $caseFields, $path, $filename, $content, $landscape, $properties);
|
||||
}
|
||||
}
|
||||
//end if $sTypeDocToGener
|
||||
//end if $typeDocsToGen
|
||||
/* End - Create .pdf */
|
||||
} else {
|
||||
return PEAR::raiseError(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;Setting Android
|
||||
android[url] = "https://android.googleapis.com/gcm/send"
|
||||
android[serverApiKey] = "AIzaSyALwyLUYtZDcJQr54V5rxhZjoWnOLWCSvc"
|
||||
android[url] = "https://fcm.googleapis.com/fcm/send"
|
||||
android[serverApiKey] = "AAAAMvip2iU:APA91bHFAvHmCsSh0zbRaC9Xo2EPIbbRYzehkFAKUdXmj_ZVBOOO52npae183LYUONHjNPHaKo1MqT4BWiEuTF7HVEMfwn05XOA-h1LQ_bJ0ezAA35l-wADPq5VtKDiHT1VFGW1oeU7L"
|
||||
|
||||
;Setting Apple
|
||||
apple[url] = "ssl://gateway.push.apple.com:2195"
|
||||
|
||||
@@ -2,7 +2,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: ProcessMaker (Branch 3.3.1)\n"
|
||||
"POT-Creation-Date: \n"
|
||||
"PO-Revision-Date: 2018-11-23 20:16:26\n"
|
||||
"PO-Revision-Date: 2019-05-20 19:36:15\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: Colosa Developers Team <developers@colosa.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
@@ -23039,6 +23039,18 @@ msgstr "Rules and user groups"
|
||||
msgid "It sends a request to Sales Department, do you want to continue?"
|
||||
msgstr "It sends a request to Sales Department, do you want to continue?"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_SAML_ENABLE
|
||||
#: LABEL/ID_SAML_ENABLE
|
||||
msgid "SAML Authentication Enable"
|
||||
msgstr "SAML Authentication Enable"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_SAML_PROVIDER
|
||||
#: LABEL/ID_SAML_PROVIDER
|
||||
msgid "SAML Authentication Provider"
|
||||
msgstr "SAML Authentication Provider"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_SAMPLES
|
||||
#: LABEL/ID_SAMPLES
|
||||
@@ -23261,6 +23273,36 @@ msgstr "Username"
|
||||
msgid "Search XML metadata"
|
||||
msgstr "Search XML metadata"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_SEARCHING
|
||||
#: LABEL/ID_SEARCHING
|
||||
msgid "Searching..."
|
||||
msgstr "Searching..."
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_SEARCHING_CANCEL_MESSAGE
|
||||
#: LABEL/ID_SEARCHING_CANCEL_MESSAGE
|
||||
msgid "We are still gathering your search results. This may take a while based on your search criteria. You may cancel this search at any time"
|
||||
msgstr "We are still gathering your search results. This may take a while based on your search criteria. You may cancel this search at any time"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_SEARCHING_TIME_OUT
|
||||
#: LABEL/ID_SEARCHING_TIME_OUT
|
||||
msgid "Your search timed out"
|
||||
msgstr "Your search timed out"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_SEARCHING_UNEXPECTED_ERROR
|
||||
#: LABEL/ID_SEARCHING_UNEXPECTED_ERROR
|
||||
msgid "An unexpected error occurred while searching for your results. Error Code {0} and Please contact your administrator."
|
||||
msgstr "An unexpected error occurred while searching for your results. Error Code {0} and Please contact your administrator."
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_SEARCHING_UNEXPECTED_ERROR_DEFAULT
|
||||
#: LABEL/ID_SEARCHING_UNEXPECTED_ERROR_DEFAULT
|
||||
msgid "An unexpected error occurred while searching for your results. Please contact your administrator."
|
||||
msgstr "An unexpected error occurred while searching for your results. Please contact your administrator."
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_SECOND
|
||||
#: LABEL/ID_SECOND
|
||||
|
||||
@@ -11,8 +11,9 @@ use ProcessMaker\Core\System;
|
||||
use ProcessMaker\Validation\ExceptionRestApi;
|
||||
use ProcessMaker\Validation\ValidationUploadedFiles;
|
||||
|
||||
header("Content-type: text/html;charset=utf-8");
|
||||
require_once 'classes/model/AdditionalTables.php';
|
||||
//We need to suppress the error for the unittest that use this function
|
||||
@header("Content-type: text/html;charset=utf-8");
|
||||
|
||||
|
||||
class pmTablesProxy extends HttpProxyController
|
||||
{
|
||||
@@ -404,7 +405,6 @@ class pmTablesProxy extends HttpProxyController
|
||||
$this->className = $table['ADD_TAB_CLASS_NAME'];
|
||||
$this->classPeerName = $this->className . 'Peer';
|
||||
$sPath = PATH_DB . config("system.workspace") . PATH_SEP . 'classes' . PATH_SEP;
|
||||
|
||||
if (! file_exists( $sPath . $this->className . '.php' )) {
|
||||
throw new Exception( 'Update:: ' . G::loadTranslation( 'ID_PMTABLE_CLASS_DOESNT_EXIST', $this->className ) );
|
||||
}
|
||||
@@ -427,7 +427,6 @@ class pmTablesProxy extends HttpProxyController
|
||||
if ($result) {
|
||||
G::auditLog("UpdateDataPmtable", "Table Name: ".$table['ADD_TAB_NAME']." Table ID: (".$table['ADD_TAB_UID'].") ");
|
||||
}
|
||||
|
||||
$this->success = $result;
|
||||
$this->message = $result ? G::loadTranslation( 'ID_UPDATED_SUCCESSFULLY' ) : G::loadTranslation( 'ID_UPDATE_FAILED' );
|
||||
}
|
||||
@@ -1094,32 +1093,38 @@ class pmTablesProxy extends HttpProxyController
|
||||
/**
|
||||
* Update data from a addTable record
|
||||
*
|
||||
* @param $row
|
||||
* @param array $row
|
||||
* @param array $primaryKeys
|
||||
* @return boolean
|
||||
* @throws Exception
|
||||
*
|
||||
* @see workflow/engine/controllers/pmTablesProxy::dataUpdate()
|
||||
* @link https://wiki.processmaker.com/3.2/PM_Tables
|
||||
*/
|
||||
public function _dataUpdate ($row, $primaryKeys)
|
||||
public function _dataUpdate($row, $primaryKeys)
|
||||
{
|
||||
$keys = G::decrypt( $row['__index__'], 'pmtable' );
|
||||
$keys = explode( ',', $keys );
|
||||
unset( $row['__index__'] );
|
||||
$keys = G::decrypt($row['__index__'], 'pmtable');
|
||||
$keys = explode(',', $keys);
|
||||
unset($row['__index__']);
|
||||
|
||||
$params = array ();
|
||||
$params = [];
|
||||
|
||||
foreach ($keys as $key) {
|
||||
$params[] = is_numeric( $key ) ? $key : "'$key'";
|
||||
$params[] = is_int($key) ? (int)$key : (string)$key;
|
||||
}
|
||||
|
||||
$obj = null;
|
||||
eval( '$obj = ' . $this->classPeerName . '::retrieveByPk(' . implode( ',', $params ) . ');' );
|
||||
|
||||
if (is_object( $obj )) {
|
||||
$className = $this->classPeerName;
|
||||
$obj = call_user_func_array($className . "::retrieveByPk", $params);
|
||||
if (is_object($obj)) {
|
||||
foreach ($row as $key => $value) {
|
||||
// validation, don't modify primary keys
|
||||
if (in_array( $key, $primaryKeys )) {
|
||||
throw new Exception( G::loadTranslation( 'ID_DONT_MODIFY_PK_VALUE', array ($key
|
||||
) ) );
|
||||
if (in_array($key, $primaryKeys)) {
|
||||
throw new Exception(G::loadTranslation('ID_DONT_MODIFY_PK_VALUE', [
|
||||
$key
|
||||
]));
|
||||
}
|
||||
$action = 'set' . AdditionalTables::getPHPName( $key );
|
||||
$obj->$action( $value );
|
||||
$action = 'set' . AdditionalTables::getPHPName($key);
|
||||
$obj->$action($value);
|
||||
}
|
||||
if ($r = $obj->validate()) {
|
||||
$obj->save();
|
||||
@@ -1129,7 +1134,7 @@ class pmTablesProxy extends HttpProxyController
|
||||
foreach ($obj->getValidationFailures() as $objValidationFailure) {
|
||||
$msg .= $objValidationFailure->getMessage() . "\n";
|
||||
}
|
||||
throw new Exception( $msg );
|
||||
throw new Exception($msg);
|
||||
}
|
||||
} else {
|
||||
$result = false;
|
||||
@@ -1141,22 +1146,25 @@ class pmTablesProxy extends HttpProxyController
|
||||
/**
|
||||
* Update data from a addTable record
|
||||
*
|
||||
* @param $row
|
||||
* @param array $row
|
||||
* @return boolean
|
||||
* @see workflow/engine/controllers/pmTablesProxy::dataDestroy()
|
||||
* @link https://wiki.processmaker.com/3.2/PM_Tables
|
||||
*/
|
||||
public function _dataDestroy ($row)
|
||||
public function _dataDestroy($row)
|
||||
{
|
||||
$row = G::decrypt( $row, 'pmtable' );
|
||||
$row = str_replace( '"', '', $row );
|
||||
$keys = explode( ',', $row );
|
||||
$params = array ();
|
||||
$row = G::decrypt($row, 'pmtable');
|
||||
$row = str_replace('"', '', $row);
|
||||
$keys = explode(',', $row);
|
||||
$params = [];
|
||||
foreach ($keys as $key) {
|
||||
$params[] = is_numeric( $key ) ? $key : "'$key'";
|
||||
$params[] = is_int($key) ? (int)$key : (string)$key;
|
||||
}
|
||||
|
||||
$obj = null;
|
||||
eval( '$obj = ' . $this->classPeerName . '::retrieveByPk(' . implode( ',', $params ) . ');' );
|
||||
$className = $this->classPeerName;
|
||||
$obj = call_user_func_array($className . "::retrieveByPk", $params);
|
||||
|
||||
if (is_object( $obj )) {
|
||||
if (is_object($obj)) {
|
||||
$obj->delete();
|
||||
return true;
|
||||
} else {
|
||||
|
||||
@@ -60723,6 +60723,8 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
|
||||
( 'LABEL','ID_RT_RENAME_NAME_TABLE','en','All references to the previous table name are going to be invalid. Do you really want to change the table name?','2016-06-29') ,
|
||||
( 'LABEL','ID_RULES_AND_USER_GROUPS','en','Rules and user groups','2014-01-15') ,
|
||||
( 'LABEL','ID_SALES_DEPARTMENT_REQUEST','en','It sends a request to Sales Department, do you want to continue?','2014-10-21') ,
|
||||
( 'LABEL','ID_SAML_ENABLE','en','SAML Authentication Enable','2019-05-20') ,
|
||||
( 'LABEL','ID_SAML_PROVIDER','en','SAML Authentication Provider','2019-05-20') ,
|
||||
( 'LABEL','ID_SAMPLES','en','Samples','2014-01-15') ,
|
||||
( 'LABEL','ID_SAT','en','Sat','2014-01-15') ,
|
||||
( 'LABEL','ID_SAVE','en','Save','2014-01-15') ,
|
||||
@@ -60762,6 +60764,11 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
|
||||
( 'LABEL','ID_SEARCH_RESULT','en','Search results','2014-01-15') ,
|
||||
( 'LABEL','ID_SEARCH_USER','en','Username','2014-01-15') ,
|
||||
( 'LABEL','ID_SEARCH_XML_METADATA','en','Search XML metadata','2014-01-15') ,
|
||||
( 'LABEL','ID_SEARCHING','en','Searching...','2019-05-03') ,
|
||||
( 'LABEL','ID_SEARCHING_CANCEL_MESSAGE','en','We are still gathering your search results. This may take a while based on your search criteria. You may cancel this search at any time','2019-05-03') ,
|
||||
( 'LABEL','ID_SEARCHING_TIME_OUT','en','Your search timed out','2019-05-03') ,
|
||||
( 'LABEL','ID_SEARCHING_UNEXPECTED_ERROR','en','An unexpected error occurred while searching for your results. Error Code {0} and Please contact your administrator.','2019-05-03') ,
|
||||
( 'LABEL','ID_SEARCHING_UNEXPECTED_ERROR_DEFAULT','en','An unexpected error occurred while searching for your results. Please contact your administrator.','2019-05-15') ,
|
||||
( 'LABEL','ID_SECOND','en','Second','2014-01-15') ,
|
||||
( 'LABEL','ID_SECONDS','en','Seconds','2014-01-15') ,
|
||||
( 'LABEL','ID_SECOND_FIGURE','en','Second Graph','2015-03-09') ,
|
||||
|
||||
@@ -1010,7 +1010,7 @@ try {
|
||||
$aFields['TASK'][$sKey]['NEXT_TASK']['ROU_PREVIOUS_TYPE'] = '<input type="hidden" name="' . $hiddenName . '[ROU_PREVIOUS_TYPE]" id="' . $hiddenName . '[ROU_PREVIOUS_TYPE]" value="' . $aValues['NEXT_TASK']['ROU_PREVIOUS_TYPE'] . '">';
|
||||
}
|
||||
if (isset($aValues['ROU_CONDITION'])) {
|
||||
$aFields['TASK'][$sKey]['NEXT_TASK']['ROU_CONDITION'] = '<input type="hidden" name="' . $hiddenName . '[ROU_CONDITION]" id="' . $hiddenName . '[ROU_CONDITION]" value="' . $aValues['ROU_CONDITION'] . '">';
|
||||
$aFields['TASK'][$sKey]['NEXT_TASK']['ROU_CONDITION'] = '<input type="hidden" name="' . $hiddenName . '[ROU_CONDITION]" id="' . $hiddenName . '[ROU_CONDITION]" value="' . htmlentities($aValues['ROU_CONDITION'], ENT_QUOTES, 'UTF-8') . '">';
|
||||
}
|
||||
if (isset($aValues['SOURCE_UID'])) {
|
||||
$aFields['TASK'][$sKey]['NEXT_TASK']['SOURCE_UID'] = '<input type="hidden" name="' . $hiddenName . '[SOURCE_UID]" id="' . $hiddenName . '[SOURCE_UID]" value="' . $aValues['SOURCE_UID'] . '">';
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
<?php
|
||||
use ProcessMaker\Model\Delegation;
|
||||
|
||||
/**
|
||||
* Authentication check for session. If not logged in, return json error
|
||||
*/
|
||||
if (!isset($_SESSION['USER_LOGGED'])) {
|
||||
$responseObject = new stdclass();
|
||||
$responseObject->error = G::LoadTranslation('ID_LOGIN_AGAIN');
|
||||
@@ -9,31 +14,59 @@ if (!isset($_SESSION['USER_LOGGED'])) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Do input filtering, although filtering should be done on the frontend rendering, not here
|
||||
*/
|
||||
$filter = new InputFilter();
|
||||
$_GET = $filter->xssFilterHard($_GET);
|
||||
$_REQUEST = $filter->xssFilterHard($_REQUEST);
|
||||
$_SESSION['USER_LOGGED'] = $filter->xssFilterHard($_SESSION['USER_LOGGED']);
|
||||
|
||||
//Getting the extJs parameters
|
||||
// Callback in the UI to utilize
|
||||
$callback = isset($_REQUEST["callback"]) ? $_REQUEST["callback"] : "stcCallback1001";
|
||||
//This default value was defined in casesList.js
|
||||
$dir = isset($_REQUEST["dir"]) ? $_REQUEST["dir"] : "DESC";
|
||||
//This default value was defined in casesList.js
|
||||
|
||||
// Sort column
|
||||
$sort = isset($_REQUEST["sort"]) ? $_REQUEST["sort"] : "APP_NUMBER";
|
||||
// Sort direction
|
||||
$dir = isset($_REQUEST["dir"]) ? $_REQUEST["dir"] : "DESC";
|
||||
|
||||
// Pagination control
|
||||
$start = !empty($_REQUEST["start"]) ? $_REQUEST["start"] : 0;
|
||||
$limit = !empty($_REQUEST["limit"]) ? $_REQUEST["limit"] : 25;
|
||||
|
||||
// Our search filter
|
||||
$filter = isset($_REQUEST["filter"]) ? $_REQUEST["filter"] : "";
|
||||
|
||||
// What process
|
||||
$process = isset($_REQUEST["process"]) ? $_REQUEST["process"] : "";
|
||||
|
||||
// What category
|
||||
$category = isset($_REQUEST["category"]) ? $_REQUEST["category"] : "";
|
||||
|
||||
// What status
|
||||
$status = isset($_REQUEST["status"]) ? strtoupper($_REQUEST["status"]) : "";
|
||||
$filterStatus = isset($_REQUEST["filterStatus"]) ? strtoupper($_REQUEST["filterStatus"]) : "";
|
||||
|
||||
// What user
|
||||
$user = isset($_REQUEST["user"]) ? $_REQUEST["user"] : "";
|
||||
|
||||
// What keywords to search
|
||||
$search = isset($_REQUEST["search"]) ? $_REQUEST["search"] : "";
|
||||
|
||||
// What kind of action
|
||||
$action = isset($_GET["action"]) ? $_GET["action"] : (isset($_REQUEST["action"]) ? $_REQUEST["action"] : "todo");
|
||||
|
||||
// What kind of search
|
||||
$type = isset($_GET["type"]) ? $_GET["type"] : (isset($_REQUEST["type"]) ? $_REQUEST["type"] : "extjs");
|
||||
|
||||
// Date ranges
|
||||
$dateFrom = isset($_REQUEST["dateFrom"]) ? substr($_REQUEST["dateFrom"], 0, 10) : "";
|
||||
$dateTo = isset($_REQUEST["dateTo"]) ? substr($_REQUEST["dateTo"], 0, 10) : "";
|
||||
|
||||
// First? No idea
|
||||
$first = isset($_REQUEST["first"]) ? true : false;
|
||||
|
||||
|
||||
$openApplicationUid = (isset($_REQUEST['openApplicationUid']) && $_REQUEST['openApplicationUid'] != '') ?
|
||||
$_REQUEST['openApplicationUid'] : null;
|
||||
$search = (!is_null($openApplicationUid)) ? $openApplicationUid : $search;
|
||||
@@ -67,10 +100,8 @@ try {
|
||||
break;
|
||||
}
|
||||
|
||||
$apps = new Applications();
|
||||
|
||||
if ($action == 'search') {
|
||||
$data = $apps->searchAll(
|
||||
$data = Delegation::search(
|
||||
$userUid,
|
||||
$start,
|
||||
$limit,
|
||||
@@ -85,7 +116,7 @@ try {
|
||||
$columnSearch
|
||||
);
|
||||
} else {
|
||||
$data = $apps->getAll(
|
||||
$data = Delegation::search(
|
||||
$userUid,
|
||||
$start,
|
||||
$limit,
|
||||
|
||||
@@ -41,11 +41,11 @@ if (isset ($_POST['form']['USER_ENV'])) {
|
||||
//Save session variables
|
||||
$arraySession = array();
|
||||
|
||||
if (isset($_SESSION["G_MESSAGE"])) {
|
||||
if (!empty($_SESSION['G_MESSAGE'])) {
|
||||
$arraySession["G_MESSAGE"] = $_SESSION["G_MESSAGE"];
|
||||
}
|
||||
|
||||
if (isset($_SESSION["G_MESSAGE_TYPE"])) {
|
||||
if (!empty($_SESSION['G_MESSAGE_TYPE'])) {
|
||||
$arraySession["G_MESSAGE_TYPE"] = $_SESSION["G_MESSAGE_TYPE"];
|
||||
}
|
||||
|
||||
|
||||
@@ -172,7 +172,9 @@ class AuditLog
|
||||
"GSuiteConnect" => G::LoadTranslation("ID_G_SUITE_CONNECT"),
|
||||
"GSuiteDisconnect" => G::LoadTranslation("ID_G_SUITE_DISCONNECT"),
|
||||
"GSuiteLoadGroups" => G::LoadTranslation("ID_G_SUITE_LOAD_GROUPS"),
|
||||
"GSuiteSyncUsers" => G::LoadTranslation("ID_G_SUITE_SYNC_USERS")
|
||||
"GSuiteSyncUsers" => G::LoadTranslation("ID_G_SUITE_SYNC_USERS"),
|
||||
"SamlEnable" => G::LoadTranslation("ID_SAML_ENABLE"),
|
||||
"SamlProvider" => G::LoadTranslation("ID_SAML_PROVIDER")
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ use ProcessMaker\BusinessModel\Task as BmTask;
|
||||
use ProcessMaker\BusinessModel\User as BmUser;
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\Exception\UploadException;
|
||||
use ProcessMaker\Model\Delegation;
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
use ProcessMaker\Services\OAuth2\Server;
|
||||
use ProcessMaker\Util\DateTime as UtilDateTime;
|
||||
@@ -2438,6 +2439,14 @@ class Cases
|
||||
*
|
||||
* @return array Return an array with status info Case, array empty otherwise
|
||||
* @throws Exception
|
||||
*
|
||||
* @see workflow/engine/methods/cases/main_init.php
|
||||
* @see workflow/engine/methods/cases/opencase.php
|
||||
* @see ProcessMaker\BusinessModel\Cases->setCaseVariables()
|
||||
* @see ProcessMaker\BusinessModel\Cases\InputDocument->getCasesInputDocuments()
|
||||
* @see ProcessMaker\BusinessModel\Cases\InputDocument->throwExceptionIfHaventPermissionToDelete()
|
||||
* @see ProcessMaker\BusinessModel\Cases\OutputDocument->throwExceptionIfCaseNotIsInInbox()
|
||||
* @see ProcessMaker\BusinessModel\Cases\OutputDocument->throwExceptionIfHaventPermissionToDelete()
|
||||
*/
|
||||
public function getStatusInfo($applicationUid, $delIndex = 0, $userUid = "")
|
||||
{
|
||||
@@ -2598,19 +2607,7 @@ class Cases
|
||||
}
|
||||
|
||||
//Status is PARTICIPATED
|
||||
$criteria2 = clone $criteria;
|
||||
|
||||
$criteria2->setDistinct();
|
||||
$criteria2->clearSelectColumns();
|
||||
$criteria2->addSelectColumn($delimiter . 'PARTICIPATED' . $delimiter . ' AS APP_STATUS');
|
||||
$criteria2->addSelectColumn(AppDelegationPeer::DEL_INDEX);
|
||||
$criteria2->addSelectColumn(ApplicationPeer::APP_UID);
|
||||
$criteria2->addSelectColumn(ApplicationPeer::PRO_UID);
|
||||
|
||||
$rsCriteria2 = ApplicationPeer::doSelectRS($criteria2);
|
||||
$rsCriteria2->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$arrayData = $this->__getStatusInfoDataByRsCriteria($rsCriteria2);
|
||||
$arrayData = Delegation::getParticipatedInfo($applicationUid);
|
||||
|
||||
if (!empty($arrayData)) {
|
||||
return $arrayData;
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<?php
|
||||
namespace ProcessMaker\BusinessModel\Cases;
|
||||
|
||||
use G;
|
||||
use OutputDocument as ClassesOutputDocument;
|
||||
use PEAR;
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
|
||||
@@ -592,21 +595,31 @@ class OutputDocument
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Generate the output document
|
||||
* @param string $sUID
|
||||
* @param array $aFields
|
||||
* @param string $sPath
|
||||
* @return variant
|
||||
*
|
||||
* @param string $outDocUid
|
||||
* @param array $caseFields
|
||||
* @param string $path
|
||||
* @param string $filename
|
||||
* @param string $content
|
||||
* @param bool $landscape
|
||||
* @param string $typeDocsToGen
|
||||
* @param array $properties
|
||||
* @param string $application
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @see this->addCasesOutputDocument()
|
||||
*/
|
||||
public function generate($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape = false, $sTypeDocToGener = 'BOTH', $aProperties = array(), $sApplication)
|
||||
public function generate($outDocUid, $caseFields, $path, $filename, $content, $landscape = false, $typeDocsToGen = 'BOTH', $properties = [], $application = '')
|
||||
{
|
||||
if (($sUID != '') && is_array($aFields) && ($sPath != '')) {
|
||||
$sContent = \G::replaceDataGridField($sContent, $aFields);
|
||||
\G::verifyPath($sPath, true);
|
||||
if (($outDocUid != '') && is_array($caseFields) && ($path != '')) {
|
||||
$content = G::replaceDataGridField($content, $caseFields, true, true);
|
||||
G::verifyPath($path, true);
|
||||
//Start - Create .doc
|
||||
$oFile = fopen($sPath . $sFilename . '.doc', 'wb');
|
||||
$size = array();
|
||||
$fp = fopen($path . $filename . '.doc', 'wb');
|
||||
$size = [];
|
||||
$size["Letter"] = "216mm 279mm";
|
||||
$size["Legal"] = "216mm 357mm";
|
||||
$size["Executive"] = "184mm 267mm";
|
||||
@@ -627,6 +640,7 @@ class OutputDocument
|
||||
$size["Screenshot640"] = "640mm 480mm";
|
||||
$size["Screenshot800"] = "800mm 600mm";
|
||||
$size["Screenshot1024"] = "1024mm 768mm";
|
||||
$sizeLandscape = [];
|
||||
$sizeLandscape["Letter"] = "279mm 216mm";
|
||||
$sizeLandscape["Legal"] = "357mm 216mm";
|
||||
$sizeLandscape["Executive"] = "267mm 184mm";
|
||||
@@ -647,31 +661,31 @@ class OutputDocument
|
||||
$sizeLandscape["Screenshot640"] = "480mm 640mm";
|
||||
$sizeLandscape["Screenshot800"] = "600mm 800mm";
|
||||
$sizeLandscape["Screenshot1024"] = "768mm 1024mm";
|
||||
if (!isset($aProperties['media'])) {
|
||||
$aProperties['media'] = 'Letter';
|
||||
if (!isset($properties['media'])) {
|
||||
$properties['media'] = 'Letter';
|
||||
}
|
||||
if ($sLandscape) {
|
||||
$media = $sizeLandscape[$aProperties['media']];
|
||||
if ($landscape) {
|
||||
$media = $sizeLandscape[$properties['media']];
|
||||
} else {
|
||||
$media = $size[$aProperties['media']];
|
||||
$media = $size[$properties['media']];
|
||||
}
|
||||
$marginLeft = '15';
|
||||
if (isset($aProperties['margins']['left'])) {
|
||||
$marginLeft = $aProperties['margins']['left'];
|
||||
if (isset($properties['margins']['left'])) {
|
||||
$marginLeft = $properties['margins']['left'];
|
||||
}
|
||||
$marginRight = '15';
|
||||
if (isset($aProperties['margins']['right'])) {
|
||||
$marginRight = $aProperties['margins']['right'];
|
||||
if (isset($properties['margins']['right'])) {
|
||||
$marginRight = $properties['margins']['right'];
|
||||
}
|
||||
$marginTop = '15';
|
||||
if (isset($aProperties['margins']['top'])) {
|
||||
$marginTop = $aProperties['margins']['top'];
|
||||
if (isset($properties['margins']['top'])) {
|
||||
$marginTop = $properties['margins']['top'];
|
||||
}
|
||||
$marginBottom = '15';
|
||||
if (isset($aProperties['margins']['bottom'])) {
|
||||
$marginBottom = $aProperties['margins']['bottom'];
|
||||
if (isset($properties['margins']['bottom'])) {
|
||||
$marginBottom = $properties['margins']['bottom'];
|
||||
}
|
||||
fwrite($oFile, '<html xmlns:v="urn:schemas-microsoft-com:vml"
|
||||
fwrite($fp, '<html xmlns:v="urn:schemas-microsoft-com:vml"
|
||||
xmlns:o="urn:schemas-microsoft-com:office:office"
|
||||
xmlns:w="urn:schemas-microsoft-com:office:word"
|
||||
xmlns="http://www.w3.org/TR/REC-html40">
|
||||
@@ -716,40 +730,40 @@ class OutputDocument
|
||||
</head>
|
||||
<body>
|
||||
<div class=WordSection1>');
|
||||
fwrite($oFile, $sContent);
|
||||
fwrite($oFile, "\n</div></body></html>\n\n");
|
||||
fclose($oFile);
|
||||
fwrite($fp, $content);
|
||||
fwrite($fp, "\n</div></body></html>\n\n");
|
||||
fclose($fp);
|
||||
/* End - Create .doc */
|
||||
if ($sTypeDocToGener == 'BOTH' || $sTypeDocToGener == 'PDF') {
|
||||
$oFile = fopen($sPath . $sFilename . '.html', 'wb');
|
||||
fwrite($oFile, $sContent);
|
||||
fclose($oFile);
|
||||
if ($typeDocsToGen == 'BOTH' || $typeDocsToGen == 'PDF') {
|
||||
$fp = fopen($path . $filename . '.html', 'wb');
|
||||
fwrite($fp, $content);
|
||||
fclose($fp);
|
||||
/* Start - Create .pdf */
|
||||
if (isset($aProperties['report_generator'])) {
|
||||
switch ($aProperties['report_generator']) {
|
||||
if (isset($properties['report_generator'])) {
|
||||
switch ($properties['report_generator']) {
|
||||
case 'TCPDF':
|
||||
$o = new \OutputDocument();
|
||||
if (strlen($sContent) == 0) {
|
||||
$o = new ClassesOutputDocument();
|
||||
if (strlen($content) == 0) {
|
||||
libxml_use_internal_errors(true);
|
||||
$o->generateTcpdf($sUID, $aFields, $sPath, $sFilename, ' ', $sLandscape, $aProperties);
|
||||
$o->generateTcpdf($outDocUid, $caseFields, $path, $filename, ' ', $landscape, $properties);
|
||||
libxml_use_internal_errors(false);
|
||||
} else {
|
||||
$o->generateTcpdf($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape, $aProperties);
|
||||
$o->generateTcpdf($outDocUid, $caseFields, $path, $filename, $content, $landscape, $properties);
|
||||
}
|
||||
break;
|
||||
case 'HTML2PDF':
|
||||
default:
|
||||
$this->generateHtml2ps_pdf($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape, $aProperties, $sApplication);
|
||||
$this->generateHtml2ps_pdf($outDocUid, $caseFields, $path, $filename, $content, $landscape, $properties, $application);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
$this->generateHtml2ps_pdf($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape, $aProperties);
|
||||
$this->generateHtml2ps_pdf($outDocUid, $caseFields, $path, $filename, $content, $landscape, $properties);
|
||||
}
|
||||
}
|
||||
//end if $sTypeDocToGener
|
||||
//end if $typeDocsToGen
|
||||
/* End - Create .pdf */
|
||||
} else {
|
||||
return \PEAR::raiseError(
|
||||
return PEAR::raiseError(
|
||||
null,
|
||||
G_ERROR_USER_UID,
|
||||
null,
|
||||
|
||||
@@ -17,9 +17,9 @@ use ProcessMaker\Core\System;
|
||||
|
||||
class PushMessageAndroid
|
||||
{
|
||||
private $url = 'https://android.googleapis.com/gcm/send';
|
||||
private $serverApiKey = "AIzaSyBO-VLXGhjf0PPlwmPFTPQEKIBfVDydLAk";
|
||||
private $devices = array();
|
||||
private $url = 'https://fcm.googleapis.com/fcm/send';
|
||||
private $serverApiKey = "AAAAMvip2iU:APA91bHFAvHmCsSh0zbRaC9Xo2EPIbbRYzehkFAKUdXmj_ZVBOOO52npae183LYUONHjNPHaKo1MqT4BWiEuTF7HVEMfwn05XOA-h1LQ_bJ0ezAA35l-wADPq5VtKDiHT1VFGW1oeU7L";
|
||||
private $devices = [];
|
||||
private $numberDevices = 0;
|
||||
|
||||
/**
|
||||
@@ -78,24 +78,24 @@ class PushMessageAndroid
|
||||
}
|
||||
|
||||
if (!is_null($data)) {
|
||||
$fields = array(
|
||||
$fields = [
|
||||
'registration_ids' => $this->devices,
|
||||
'data' => array(
|
||||
"message" => $message,
|
||||
"data" => $data
|
||||
),
|
||||
);
|
||||
'notification' => [
|
||||
"body" => $message,
|
||||
"data" => $data,
|
||||
],
|
||||
];
|
||||
} else {
|
||||
$fields = array(
|
||||
$fields = [
|
||||
'registration_ids' => $this->devices,
|
||||
'data' => array("message" => $message),
|
||||
);
|
||||
'data' => ["message" => $message],
|
||||
];
|
||||
}
|
||||
|
||||
$headers = array(
|
||||
$headers = [
|
||||
'Authorization: key=' . $this->serverApiKey,
|
||||
'Content-Type: application/json'
|
||||
);
|
||||
];
|
||||
// Open connection
|
||||
$ch = curl_init();
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AppAssignSelfServiceValue extends Model
|
||||
{
|
||||
protected $table = 'APP_ASSIGN_SELF_SERVICE_VALUE';
|
||||
protected $primaryKey = 'ID';
|
||||
// We do not have create/update timestamps for this table
|
||||
public $timestamps = false;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AppAssignSelfServiceValueGroup extends Model
|
||||
{
|
||||
protected $table = 'APP_ASSIGN_SELF_SERVICE_VALUE_GROUP';
|
||||
// We do not have create/update timestamps for this table
|
||||
public $timestamps = false;
|
||||
}
|
||||
|
||||
55
workflow/engine/src/ProcessMaker/Model/Application.php
Normal file
55
workflow/engine/src/ProcessMaker/Model/Application.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Application extends Model
|
||||
{
|
||||
protected $table = "APPLICATION";
|
||||
// No timestamps
|
||||
public $timestamps = false;
|
||||
|
||||
public function delegations()
|
||||
{
|
||||
return $this->hasMany(Delegation::class, 'APP_UID', 'APP_UID');
|
||||
}
|
||||
|
||||
public function parent()
|
||||
{
|
||||
return $this->hasOne(Application::class, 'APP_PARENT', 'APP_UID');
|
||||
}
|
||||
|
||||
public function currentUser()
|
||||
{
|
||||
return $this->hasOne(User::class, 'APP_CUR_USER', 'USR_UID');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Applications by PRO_UID, ordered by APP_NUMBER.
|
||||
* @param string $proUid
|
||||
* @return object
|
||||
* @see ReportTables->populateTable()
|
||||
*/
|
||||
public static function getByProUid($proUid)
|
||||
{
|
||||
$query = Application::query()
|
||||
->select()
|
||||
->proUid($proUid)
|
||||
->orderBy('APP_NUMBER', 'ASC');
|
||||
return $query->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope for query to get the applications by PRO_UID.
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
* @param string $proUid
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function scopeProUid($query, $proUid)
|
||||
{
|
||||
$result = $query->where('PRO_UID', '=', $proUid);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
392
workflow/engine/src/ProcessMaker/Model/Delegation.php
Normal file
392
workflow/engine/src/ProcessMaker/Model/Delegation.php
Normal file
@@ -0,0 +1,392 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use G;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Delegation extends Model
|
||||
{
|
||||
protected $table = "APP_DELEGATION";
|
||||
|
||||
// We don't have our standard timestamp columns
|
||||
public $timestamps = false;
|
||||
|
||||
/**
|
||||
* Returns the application this delegation belongs to
|
||||
*/
|
||||
public function application()
|
||||
{
|
||||
return $this->belongsTo(Application::class, 'APP_UID', 'APP_UID');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the user this delegation belongs to
|
||||
*/
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'USR_ID', 'USR_ID');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the process task this belongs to
|
||||
*/
|
||||
public function task()
|
||||
{
|
||||
return $this->belongsTo(Task::class, 'TAS_ID', 'TAS_ID');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the process this delegation belongs to
|
||||
*/
|
||||
public function process()
|
||||
{
|
||||
return $this->belongsTo(Process::class, 'PRO_ID', 'PRO_ID');
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope a query to get the delegations from a case by APP_UID
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
* @param string $appUid
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function scopeAppUid($query, $appUid)
|
||||
{
|
||||
return $query->where('APP_UID', '=', $appUid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches for delegations which match certain criteria
|
||||
*
|
||||
* The query is related to advanced search with different filters
|
||||
* We can search by process, status of case, category of process, users, delegate date from and to
|
||||
*
|
||||
* @param integer $userId The USR_ID to search for (Note, this is no longer the USR_UID)
|
||||
* @param integer $start for the pagination
|
||||
* @param integer $limit for the pagination
|
||||
* @param string $search
|
||||
* @param integer $process the pro_id
|
||||
* @param integer $status of the case
|
||||
* @param string $dir if the order is DESC or ASC
|
||||
* @param string $sort name of column by sort, can be:
|
||||
* [APP_NUMBER, APP_TITLE, APP_PRO_TITLE, APP_TAS_TITLE, APP_CURRENT_USER, APP_UPDATE_DATE, DEL_DELEGATE_DATE, DEL_TASK_DUE_DATE, APP_STATUS_LABEL]
|
||||
* @param string $category uid for the process
|
||||
* @param date $dateFrom
|
||||
* @param date $dateTo
|
||||
* @param string $filterBy name of column for a specific search, can be: [APP_NUMBER, APP_TITLE, TAS_TITLE]
|
||||
* @return array $result result of the query
|
||||
*/
|
||||
|
||||
public static function search(
|
||||
$userId = null,
|
||||
// Default pagination values
|
||||
$start = 0,
|
||||
$limit = 25,
|
||||
$search = null,
|
||||
$process = null,
|
||||
$status = null,
|
||||
$dir = null,
|
||||
$sort = null,
|
||||
$category = null,
|
||||
$dateFrom = null,
|
||||
$dateTo = null,
|
||||
$filterBy = 'APP_TITLE'
|
||||
) {
|
||||
$search = trim($search);
|
||||
|
||||
// Start the query builder, selecting our base attributes
|
||||
$selectColumns = [
|
||||
'APPLICATION.APP_NUMBER',
|
||||
'APPLICATION.APP_UID',
|
||||
'APPLICATION.APP_STATUS',
|
||||
'APPLICATION.APP_STATUS AS APP_STATUS_LABEL',
|
||||
'APPLICATION.PRO_UID',
|
||||
'APPLICATION.APP_CREATE_DATE',
|
||||
'APPLICATION.APP_FINISH_DATE',
|
||||
'APPLICATION.APP_UPDATE_DATE',
|
||||
'APPLICATION.APP_TITLE',
|
||||
'APP_DELEGATION.USR_UID',
|
||||
'APP_DELEGATION.TAS_UID',
|
||||
'APP_DELEGATION.USR_ID',
|
||||
'APP_DELEGATION.PRO_ID',
|
||||
'APP_DELEGATION.DEL_INDEX',
|
||||
'APP_DELEGATION.DEL_LAST_INDEX',
|
||||
'APP_DELEGATION.DEL_DELEGATE_DATE',
|
||||
'APP_DELEGATION.DEL_INIT_DATE',
|
||||
'APP_DELEGATION.DEL_FINISH_DATE',
|
||||
'APP_DELEGATION.DEL_TASK_DUE_DATE',
|
||||
'APP_DELEGATION.DEL_RISK_DATE',
|
||||
'APP_DELEGATION.DEL_THREAD_STATUS',
|
||||
'APP_DELEGATION.DEL_PRIORITY',
|
||||
'APP_DELEGATION.DEL_DURATION',
|
||||
'APP_DELEGATION.DEL_QUEUE_DURATION',
|
||||
'APP_DELEGATION.DEL_STARTED',
|
||||
'APP_DELEGATION.DEL_DELAY_DURATION',
|
||||
'APP_DELEGATION.DEL_FINISHED',
|
||||
'APP_DELEGATION.DEL_DELAYED',
|
||||
'APP_DELEGATION.DEL_DELAY_DURATION',
|
||||
'TASK.TAS_TITLE AS APP_TAS_TITLE',
|
||||
'TASK.TAS_TYPE AS APP_TAS_TYPE',
|
||||
];
|
||||
$query = DB::table('APP_DELEGATION')->select(DB::raw(implode(',', $selectColumns)));
|
||||
|
||||
// Add join for task, filtering for task title if needed
|
||||
// It doesn't make sense for us to search for any delegations that match tasks that are events or web entry
|
||||
$query->join('TASK', function ($join) use ($filterBy, $search) {
|
||||
$join->on('APP_DELEGATION.TAS_ID', '=', 'TASK.TAS_ID')
|
||||
->whereNotIn('TASK.TAS_TYPE', [
|
||||
'WEBENTRYEVENT',
|
||||
'END-MESSAGE-EVENT',
|
||||
'START-MESSAGE-EVENT',
|
||||
'INTERMEDIATE-THROW',
|
||||
]);
|
||||
if ($filterBy == 'TAS_TITLE' && $search) {
|
||||
$join->where('TASK.TAS_TITLE', 'LIKE', "%${search}%");
|
||||
}
|
||||
});
|
||||
|
||||
// Add join for application, taking care of status and filtering if necessary
|
||||
$query->join('APPLICATION', function ($join) use ($filterBy, $search, $status, $query) {
|
||||
$join->on('APP_DELEGATION.APP_NUMBER', '=', 'APPLICATION.APP_NUMBER');
|
||||
if ($filterBy == 'APP_TITLE' && $search) {
|
||||
$join->where('APPLICATION.APP_TITLE', 'LIKE', "%${search}%");
|
||||
}
|
||||
// Based on the below, we can further limit the join so that we have a smaller data set based on join criteria
|
||||
switch ($status) {
|
||||
case 1: //DRAFT
|
||||
$join->where('APPLICATION.APP_STATUS_ID', 1);
|
||||
break;
|
||||
case 2: //TO_DO
|
||||
$join->where('APPLICATION.APP_STATUS_ID', 2);
|
||||
break;
|
||||
case 3: //COMPLETED
|
||||
$join->where('APPLICATION.APP_STATUS_ID', 3);
|
||||
break;
|
||||
case 4: //CANCELLED
|
||||
$join->where('APPLICATION.APP_STATUS_ID', 4);
|
||||
break;
|
||||
case "PAUSED":
|
||||
$join->where('APPLICATION.APP_STATUS', 'TO_DO');
|
||||
break;
|
||||
default: //All status
|
||||
// Don't do anything here, we'll need to do the more advanced where below
|
||||
}
|
||||
});
|
||||
|
||||
// Add join for process, but only for certain scenarios such as category or process
|
||||
if ($category || $process || $sort == 'APP_PRO_TITLE') {
|
||||
$query->join('PROCESS', function ($join) use ($category) {
|
||||
$join->on('APP_DELEGATION.PRO_ID', '=', 'PROCESS.PRO_ID');
|
||||
if ($category) {
|
||||
$join->where('PROCESS.PRO_CATEGORY', $category);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Add join for user, but only for certain scenarios as sorting
|
||||
if ($sort == 'APP_CURRENT_USER') {
|
||||
$query->join('USERS', function ($join) use ($userId) {
|
||||
$join->on('APP_DELEGATION.USR_ID', '=', 'USERS.USR_ID');
|
||||
});
|
||||
}
|
||||
|
||||
// Search for specified user
|
||||
if ($userId) {
|
||||
$query->where('APP_DELEGATION.USR_ID', $userId);
|
||||
}
|
||||
|
||||
// Search for specified process
|
||||
if ($process) {
|
||||
$query->where('APP_DELEGATION.PRO_ID', $process);
|
||||
}
|
||||
|
||||
// Search for an app/case number
|
||||
if ($filterBy == 'APP_NUMBER' && $search) {
|
||||
$query->where('APP_DELEGATION.APP_NUMBER', 'LIKE', "%${search}%");
|
||||
}
|
||||
|
||||
// Date range filter
|
||||
if (!empty($dateFrom)) {
|
||||
$query->where('APP_DELEGATION.DEL_DELEGATE_DATE', '>=', $dateFrom);
|
||||
}
|
||||
if (!empty($dateTo)) {
|
||||
$dateTo = $dateTo . " 23:59:59";
|
||||
// This is inclusive
|
||||
$query->where('APP_DELEGATION.DEL_DELEGATE_DATE', '<=', $dateTo);
|
||||
}
|
||||
|
||||
// Status Filter
|
||||
// This is tricky, the below behavior is combined with the application join behavior above
|
||||
switch ($status) {
|
||||
case 1: //DRAFT
|
||||
$query->where('APP_DELEGATION.DEL_THREAD_STATUS', 'OPEN');
|
||||
break;
|
||||
case 2: //TO_DO
|
||||
$query->where('APP_DELEGATION.DEL_THREAD_STATUS', 'OPEN');
|
||||
break;
|
||||
case 3: //COMPLETED
|
||||
$query->where('APP_DELEGATION.DEL_LAST_INDEX', 1);
|
||||
break;
|
||||
case 4: //CANCELLED
|
||||
$query->where('APP_DELEGATION.DEL_LAST_INDEX', 1);
|
||||
break;
|
||||
case "PAUSED":
|
||||
// Do nothing, as the app status check for TO_DO is performed in the join above
|
||||
break;
|
||||
default: //All statuses.
|
||||
$query->where(function ($query) {
|
||||
// Check to see if thread status is open
|
||||
$query->where('APP_DELEGATION.DEL_THREAD_STATUS', 'OPEN')
|
||||
->orWhere(function ($query) {
|
||||
// Or, we make sure if the thread is closed, and it's the last delegation, and if the app is completed or cancelled
|
||||
$query->where('APP_DELEGATION.DEL_THREAD_STATUS', 'CLOSED')
|
||||
->where('APP_DELEGATION.DEL_LAST_INDEX', 1)
|
||||
->whereIn('APPLICATION.APP_STATUS_ID', [3, 4]);
|
||||
});
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
// Add any sort if needed
|
||||
if($sort) {
|
||||
switch ($sort) {
|
||||
case 'APP_NUMBER':
|
||||
$query->orderBy('APP_DELEGATION.APP_NUMBER', $dir);
|
||||
break;
|
||||
case 'APP_PRO_TITLE':
|
||||
// We can do this because we joined the process table if sorting by it
|
||||
$query->orderBy('PROCESS.PRO_TITLE', $dir);
|
||||
break;
|
||||
case 'APP_TAS_TITLE':
|
||||
$query->orderBy('TASK.TAS_TITLE', $dir);
|
||||
break;
|
||||
case 'APP_CURRENT_USER':
|
||||
// We can do this because we joined the user table if sorting by it
|
||||
$query->orderBy('USERS.USR_LASTNAME', $dir);
|
||||
$query->orderBy('USERS.USR_FIRSTNAME', $dir);
|
||||
break;
|
||||
default:
|
||||
$query->orderBy($sort, $dir);
|
||||
}
|
||||
}
|
||||
|
||||
// Add pagination to the query
|
||||
$query = $query->offset($start)
|
||||
->limit($limit);
|
||||
|
||||
// Fetch results and transform to a laravel collection
|
||||
$results = $query->get();
|
||||
|
||||
// Transform with additional data
|
||||
$priorities = ['1' => 'VL', '2' => 'L', '3' => 'N', '4' => 'H', '5' => 'VH'];
|
||||
$results->transform(function ($item, $key) use ($priorities) {
|
||||
// Convert to an array as our results must be an array
|
||||
$item = json_decode(json_encode($item), true);
|
||||
// If it's assigned, fetch the user
|
||||
if($item['USR_ID']) {
|
||||
$user = User::where('USR_ID', $item['USR_ID'])->first();
|
||||
} else {
|
||||
$user = null;
|
||||
}
|
||||
$process = Process::where('PRO_ID', $item['PRO_ID'])->first();
|
||||
|
||||
// Rewrite priority string
|
||||
if ($item['DEL_PRIORITY']) {
|
||||
$item['DEL_PRIORITY'] = G::LoadTranslation("ID_PRIORITY_{$priorities[$item['DEL_PRIORITY']]}");
|
||||
}
|
||||
|
||||
// Merge in desired application data
|
||||
if ($item['APP_STATUS']) {
|
||||
$item['APP_STATUS_LABEL'] = G::LoadTranslation("ID_${item['APP_STATUS']}");
|
||||
} else {
|
||||
$item['APP_STATUS_LABEL'] = $item['APP_STATUS'];
|
||||
}
|
||||
|
||||
// Merge in desired process data
|
||||
// Handle situation where the process might not be in the system anymore
|
||||
$item['APP_PRO_TITLE'] = $process ? $process->PRO_TITLE : '';
|
||||
|
||||
// Merge in desired user data
|
||||
$item['USR_LASTNAME'] = $user ? $user->USR_LASTNAME : '';
|
||||
$item['USR_FIRSTNAME'] = $user ? $user->USR_FIRSTNAME : '';
|
||||
$item['USR_USERNAME'] = $user ? $user->USR_USERNAME : '';
|
||||
|
||||
//@todo: this section needs to use 'User Name Display Format', currently in the extJs is defined this
|
||||
$item["APP_CURRENT_USER"] = $item["USR_LASTNAME"] . ' ' . $item["USR_FIRSTNAME"];
|
||||
|
||||
$item["APPDELCR_APP_TAS_TITLE"] = '';
|
||||
|
||||
$item["USRCR_USR_UID"] = $item["USR_UID"];
|
||||
$item["USRCR_USR_FIRSTNAME"] = $item["USR_FIRSTNAME"];
|
||||
$item["USRCR_USR_LASTNAME"] = $item["USR_LASTNAME"];
|
||||
$item["USRCR_USR_USERNAME"] = $item["USR_USERNAME"];
|
||||
$item["APP_OVERDUE_PERCENTAGE"] = '';
|
||||
|
||||
return $item;
|
||||
});
|
||||
|
||||
// Remove any empty erroenous data
|
||||
$results = $results->filter();
|
||||
|
||||
// Bundle into response array
|
||||
$response = [
|
||||
// Fake totalCount to show pagination
|
||||
'totalCount' => $start + $limit + 1,
|
||||
'sql' => $query->toSql(),
|
||||
'bindings' => $query->getBindings(),
|
||||
'data' => $results->values()->toArray(),
|
||||
];
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get participation information for a case
|
||||
*
|
||||
* @param string $appUid
|
||||
* @return array
|
||||
*
|
||||
* @see ProcessMaker\BusinessModel\Cases:getStatusInfo()
|
||||
*/
|
||||
public static function getParticipatedInfo($appUid)
|
||||
{
|
||||
// Build the query
|
||||
$query = Delegation::query()->select([
|
||||
'APP_UID',
|
||||
'DEL_INDEX',
|
||||
'PRO_UID'
|
||||
]);
|
||||
$query->appUid($appUid);
|
||||
$query->orderBy('DEL_INDEX', 'ASC');
|
||||
|
||||
// Fetch results
|
||||
$results = $query->get();
|
||||
|
||||
// Initialize the array to return
|
||||
$arrayData = [];
|
||||
|
||||
// If the collection have at least one item, build the main array to return
|
||||
if ($results->count() > 0) {
|
||||
// Get the first item
|
||||
$first = $results->first();
|
||||
|
||||
// Build the main array to return
|
||||
$arrayData = [
|
||||
'APP_STATUS' => 'PARTICIPATED', // Value hardcoded because we need to return the same structure previously sent
|
||||
'DEL_INDEX' => [], // Initialize this item like an array
|
||||
'PRO_UID' => $first->PRO_UID
|
||||
];
|
||||
|
||||
// Populate the DEL_INDEX key with the values of the items collected
|
||||
$results->each(function ($item) use (&$arrayData) {
|
||||
$arrayData['DEL_INDEX'][] = $item->DEL_INDEX;
|
||||
});
|
||||
}
|
||||
|
||||
return $arrayData;
|
||||
}
|
||||
|
||||
}
|
||||
64
workflow/engine/src/ProcessMaker/Model/Dynaform.php
Normal file
64
workflow/engine/src/ProcessMaker/Model/Dynaform.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
/**
|
||||
* Class Dynaform
|
||||
* @package ProcessMaker\Model
|
||||
*
|
||||
* Represents a dynaform object in the system.
|
||||
*/
|
||||
class Dynaform extends Model
|
||||
{
|
||||
protected $table = 'DYNAFORM';
|
||||
public $timestamps = false;
|
||||
|
||||
public function process()
|
||||
{
|
||||
return $this->belongsTo(Process::class, 'PRO_UID', 'PRO_UID');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get dynaforms by PRO_UID.
|
||||
* @param string $proUid
|
||||
* @return object
|
||||
*/
|
||||
public static function getByProUid($proUid)
|
||||
{
|
||||
return DB::table('DYNAFORM')
|
||||
->select()
|
||||
->where('DYNAFORM.PRO_UID', '=', $proUid)
|
||||
->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get dynaform by DYN_UID.
|
||||
* @param string $dynUid
|
||||
* @return object
|
||||
*/
|
||||
public static function getByDynUid($dynUid)
|
||||
{
|
||||
return DB::table('DYNAFORM')
|
||||
->select()
|
||||
->where('DYNAFORM.DYN_UID', '=', $dynUid)
|
||||
->first();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get dynaforms by PRO_UID except the DYN_UID specified in the second parameter.
|
||||
* @param string $proUid
|
||||
* @param string $dynUid
|
||||
* @return object
|
||||
*/
|
||||
public static function getByProUidExceptDynUid($proUid, $dynUid)
|
||||
{
|
||||
return DB::table('DYNAFORM')
|
||||
->select()
|
||||
->where('DYNAFORM.PRO_UID', '=', $proUid)
|
||||
->where('DYNAFORM.DYN_UID', '!=', $dynUid)
|
||||
->get();
|
||||
}
|
||||
}
|
||||
13
workflow/engine/src/ProcessMaker/Model/GroupUser.php
Normal file
13
workflow/engine/src/ProcessMaker/Model/GroupUser.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class GroupUser extends Model
|
||||
{
|
||||
protected $table = 'GROUP_USER';
|
||||
// We do not have create/update timestamps for this table
|
||||
public $timestamps = false;
|
||||
}
|
||||
|
||||
14
workflow/engine/src/ProcessMaker/Model/Groupwf.php
Normal file
14
workflow/engine/src/ProcessMaker/Model/Groupwf.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Groupwf extends Model
|
||||
{
|
||||
protected $table = 'GROUPWF';
|
||||
protected $primaryKey = 'GRP_ID';
|
||||
// We do not have create/update timestamps for this table
|
||||
public $timestamps = false;
|
||||
}
|
||||
|
||||
70
workflow/engine/src/ProcessMaker/Model/ListUnassigned.php
Normal file
70
workflow/engine/src/ProcessMaker/Model/ListUnassigned.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use ListUnassigned as PropelListUnassigned;
|
||||
|
||||
class ListUnassigned extends Model
|
||||
{
|
||||
protected $table = "LIST_UNASSIGNED";
|
||||
// No timestamps
|
||||
public $timestamps = false;
|
||||
|
||||
/**
|
||||
* Returns the application this belongs to
|
||||
*/
|
||||
public function application()
|
||||
{
|
||||
return $this->belongsTo(Application::class, 'APP_UID', 'APP_UID');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the process task this belongs to
|
||||
*/
|
||||
public function task()
|
||||
{
|
||||
return $this->belongsTo(Task::class, 'TAS_ID', 'TAS_ID');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the process this belongs to
|
||||
*/
|
||||
public function process()
|
||||
{
|
||||
return $this->belongsTo(Process::class, 'PRO_ID', 'PRO_ID');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get count
|
||||
*
|
||||
* @param string $userUid
|
||||
* @param array $filters
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function doCount($userUid, $filters = [])
|
||||
{
|
||||
$list = new PropelListUnassigned();
|
||||
$result = $list->getCountList($userUid, $filters);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search data
|
||||
*
|
||||
* @param string $userUid
|
||||
* @param array $filters
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function loadList($userUid, $filters = [])
|
||||
{
|
||||
$list = new PropelListUnassigned();
|
||||
$result = $list->loadList($userUid, $filters);
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,8 +14,29 @@ class Process extends Model
|
||||
{
|
||||
// Set our table name
|
||||
protected $table = 'PROCESS';
|
||||
// We do have a created at, but we don't store an updated at
|
||||
// Our custom timestamp columns
|
||||
const CREATED_AT = 'PRO_CREATE_DATE';
|
||||
const UPDATED_AT = null;
|
||||
const UPDATED_AT = 'PRO_UPDATE_DATE';
|
||||
/**
|
||||
* Retrieve all applications that belong to this process
|
||||
*/
|
||||
public function applications()
|
||||
{
|
||||
return $this->hasMany(Application::class, 'PRO_ID', 'PRO_ID');
|
||||
}
|
||||
|
||||
}
|
||||
public function tasks()
|
||||
{
|
||||
return $this->hasMany(Task::class, 'PRO_UID', 'PRO_UID');
|
||||
}
|
||||
|
||||
public function creator()
|
||||
{
|
||||
return $this->hasOne(User::class, 'PRO_CREATE_USER', 'USR_UID');
|
||||
}
|
||||
|
||||
public function category()
|
||||
{
|
||||
return $this->hasOne(ProcessCategory::class, 'PRO_CATEGORY', 'CATEGORY_UID');
|
||||
}
|
||||
}
|
||||
|
||||
19
workflow/engine/src/ProcessMaker/Model/ProcessCategory.php
Normal file
19
workflow/engine/src/ProcessMaker/Model/ProcessCategory.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class ProcessCategory
|
||||
* @package ProcessMaker\Model
|
||||
*
|
||||
* Represents a process category object in the system.
|
||||
*/
|
||||
class ProcessCategory extends Model
|
||||
{
|
||||
// Set our table name
|
||||
protected $table = 'PROCESS_CATEGORY';
|
||||
|
||||
public $timestamps = false;
|
||||
}
|
||||
19
workflow/engine/src/ProcessMaker/Model/Route.php
Normal file
19
workflow/engine/src/ProcessMaker/Model/Route.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Process
|
||||
* @package ProcessMaker\Model
|
||||
*
|
||||
* Represents a business process object in the system.
|
||||
*/
|
||||
class Route extends Model
|
||||
{
|
||||
// Set our table name
|
||||
protected $table = 'ROUTE';
|
||||
|
||||
public $timestamps = false;
|
||||
}
|
||||
23
workflow/engine/src/ProcessMaker/Model/Task.php
Normal file
23
workflow/engine/src/ProcessMaker/Model/Task.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Task extends Model
|
||||
{
|
||||
protected $table = 'TASK';
|
||||
protected $primaryKey = 'TAS_ID';
|
||||
// We do not have create/update timestamps for this table
|
||||
public $timestamps = false;
|
||||
|
||||
public function process()
|
||||
{
|
||||
return $this->belongsTo(Process::class, 'PRO_UID', 'PRO_UID');
|
||||
}
|
||||
|
||||
public function delegations()
|
||||
{
|
||||
return $this->hasMany(Delegation::class, 'TAS_ID', 'TAS_ID');
|
||||
}
|
||||
}
|
||||
12
workflow/engine/src/ProcessMaker/Model/TaskUser.php
Normal file
12
workflow/engine/src/ProcessMaker/Model/TaskUser.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TaskUser extends Model
|
||||
{
|
||||
protected $table = 'TASK_USER';
|
||||
|
||||
public $timestamps = false;
|
||||
}
|
||||
21
workflow/engine/src/ProcessMaker/Model/User.php
Normal file
21
workflow/engine/src/ProcessMaker/Model/User.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
protected $table = "USERS";
|
||||
// Our custom timestamp columns
|
||||
const CREATED_AT = 'USR_CREATE_DATE';
|
||||
const UPDATED_AT = 'USR_UPDATE_DATE';
|
||||
|
||||
/**
|
||||
* Returns the delegations this user has (all of them)
|
||||
*/
|
||||
public function delegations()
|
||||
{
|
||||
return $this->hasMany(Delegation::class, 'USR_ID', 'USR_ID');
|
||||
}
|
||||
}
|
||||
@@ -485,6 +485,33 @@ function csrfToken()
|
||||
return isset($_SESSION['USR_CSRF_TOKEN']) ? $_SESSION['USR_CSRF_TOKEN'] : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a string is a valid HTML code
|
||||
*
|
||||
* @param string $string
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @see G::replaceDataField()
|
||||
*/
|
||||
function stringIsValidHtml($string)
|
||||
{
|
||||
// To validate we use the DOMDocument class
|
||||
$doc = new DOMDocument('1.0', 'UTF-8');
|
||||
|
||||
// Clean previous errors
|
||||
libxml_clear_errors();
|
||||
|
||||
// This line have to be silenced because if the string is not an HTML a Warning is displayed
|
||||
@$doc->loadHTML($string);
|
||||
|
||||
// Get last error parsing the HTML
|
||||
$libXmlError = libxml_get_last_error();
|
||||
|
||||
// If the attribute "textContent" is empty or exists libxml errors, is not a valid HTML
|
||||
return $doc->textContent !== '' && empty($libXmlError);
|
||||
}
|
||||
|
||||
// Methods deleted in PHP 7.x, added in this file in order to keep compatibility with old libraries included/used in ProcessMaker
|
||||
if (!function_exists('set_magic_quotes_runtime')) {
|
||||
function set_magic_quotes_runtime($value) {
|
||||
|
||||
@@ -25,6 +25,12 @@ var textJump;
|
||||
var ids = '';
|
||||
var winReassignInCasesList;
|
||||
var casesNewTab;
|
||||
var mask;
|
||||
var loadingMessage;
|
||||
var timeoutMark = false;
|
||||
var processProxy;
|
||||
var processStore;
|
||||
var comboCategory;
|
||||
|
||||
function formatAMPM(date, initVal, calendarDate) {
|
||||
|
||||
@@ -855,25 +861,30 @@ Ext.onReady ( function() {
|
||||
this.setBaseParam(
|
||||
"openApplicationUid", (__OPEN_APPLICATION_UID__ !== null)? __OPEN_APPLICATION_UID__ : ""
|
||||
);
|
||||
timeoutMark = false;
|
||||
},
|
||||
load: function(response){
|
||||
|
||||
if (response.reader.jsonData.result === false) {
|
||||
PMExt.notify('ERROR', response.reader.jsonData.message);
|
||||
//PMExt.error
|
||||
if (action === "search" && loadingMessage) {
|
||||
loadingMessage.hide();
|
||||
timeoutMark = true;
|
||||
}
|
||||
},
|
||||
exception: function(dp, type, action, options, response, arg) {
|
||||
responseObject = Ext.util.JSON.decode(response.responseText);
|
||||
if (typeof(responseObject.error) != 'undefined') {
|
||||
Ext.Msg.show({
|
||||
title: _('ID_ERROR'),
|
||||
msg: responseObject.error,
|
||||
fn: function(){parent.parent.location = '../login/login';},
|
||||
animEl: 'elId',
|
||||
icon: Ext.MessageBox.ERROR,
|
||||
buttons: Ext.MessageBox.OK
|
||||
});
|
||||
exception: function(dp, type, action, options, response, arg) {
|
||||
if (response && typeof (response.status) !== 'undefined') {
|
||||
showErrorMessage(response.status);
|
||||
timeoutMark = true;
|
||||
} else {
|
||||
responseObject = Ext.util.JSON.decode(response.responseText);
|
||||
if (typeof(responseObject.error) !== 'undefined') {
|
||||
Ext.Msg.show({
|
||||
title: _('ID_ERROR'),
|
||||
msg: responseObject.error,
|
||||
fn: function(){parent.parent.location = '../login/login';},
|
||||
animEl: 'elId',
|
||||
icon: Ext.MessageBox.ERROR,
|
||||
buttons: Ext.MessageBox.OK
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -986,11 +997,13 @@ Ext.onReady ( function() {
|
||||
}
|
||||
});
|
||||
|
||||
var processStore = new Ext.data.Store( {
|
||||
proxy : new Ext.data.HttpProxy( {
|
||||
url : 'casesList_Ajax?actionAjax=processListExtJs&action='+action,
|
||||
method : 'POST'
|
||||
}),
|
||||
processProxy = new Ext.data.HttpProxy( {
|
||||
url : 'casesList_Ajax?actionAjax=processListExtJs&action='+action,
|
||||
method : 'POST'
|
||||
});
|
||||
|
||||
processStore = new Ext.data.Store( {
|
||||
proxy : processProxy,
|
||||
reader : new Ext.data.JsonReader( {
|
||||
fields : [ {
|
||||
name : 'PRO_UID'
|
||||
@@ -1064,11 +1077,10 @@ Ext.onReady ( function() {
|
||||
handler: function(){
|
||||
storeCases.setBaseParam('process', '');
|
||||
suggestProcess.setValue('');
|
||||
doSearch();
|
||||
}
|
||||
};
|
||||
|
||||
var comboCategory = new Ext.form.ComboBox({
|
||||
comboCategory = new Ext.form.ComboBox({
|
||||
width : 180,
|
||||
boxMaxWidth : 200,
|
||||
editable : false,
|
||||
@@ -1101,12 +1113,28 @@ Ext.onReady ( function() {
|
||||
action: action,
|
||||
CATEGORY_UID: filterCategory},
|
||||
success: function ( result, request ) {
|
||||
var data = Ext.util.JSON.decode(result.responseText);
|
||||
var data = Ext.util.JSON.decode(result.responseText),
|
||||
url = "";
|
||||
suggestProcess.getStore().removeAll();
|
||||
suggestProcess.getStore().loadData( data );
|
||||
suggestProcess.setValue('');
|
||||
// processStore proxy url must be updated every time when the category was changed
|
||||
url = 'casesList_Ajax?actionAjax=processListExtJs&action=' + action;
|
||||
url = comboCategory.value ? url + '&CATEGORY_UID=' + comboCategory.value : url;
|
||||
processProxy = new Ext.data.HttpProxy( {
|
||||
url : url,
|
||||
method : 'POST'
|
||||
});
|
||||
processStore.proxy = processProxy;
|
||||
},
|
||||
failure: function ( result, request) {
|
||||
// processStore will be restored to default value if something failed.
|
||||
var url = 'casesList_Ajax?actionAjax=processListExtJs&action=' + action;
|
||||
processProxy = new Ext.data.HttpProxy( {
|
||||
url : url,
|
||||
method : 'POST'
|
||||
});
|
||||
processStore.proxy = processProxy;
|
||||
if (typeof(result.responseText) != 'undefined') {
|
||||
Ext.MessageBox.alert(_('ID_FAILED'), result.responseText);
|
||||
}
|
||||
@@ -1323,7 +1351,6 @@ Ext.onReady ( function() {
|
||||
storeCases.setBaseParam( 'user', filterUser);
|
||||
storeCases.setBaseParam( 'start', 0);
|
||||
storeCases.setBaseParam( 'limit', pageSize);
|
||||
doSearch();
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1348,6 +1375,72 @@ Ext.onReady ( function() {
|
||||
//cls: 'x-form-toolbar-standardButton',
|
||||
handler: doSearch
|
||||
});
|
||||
|
||||
/**
|
||||
* Show loading Dialog
|
||||
*/
|
||||
function showLoadingDialog() {
|
||||
mask.hide();
|
||||
var commonSettings = {
|
||||
title: _('ID_SEARCHING'),
|
||||
width: 700,
|
||||
wait: true,
|
||||
waitConfig: {interval:200}
|
||||
};
|
||||
|
||||
loadingMessage = Ext.Msg.show(commonSettings);
|
||||
setTimeout(
|
||||
function() {
|
||||
if (!timeoutMark) {
|
||||
loadingMessage.hide();
|
||||
commonSettings['msg'] = _('ID_SEARCHING_CANCEL_MESSAGE'),
|
||||
commonSettings['buttons'] = Ext.Msg.CANCEL,
|
||||
commonSettings['fn'] = function (btn, text) {
|
||||
if (btn === 'cancel') {
|
||||
proxyCasesList.getConnection().abort();
|
||||
};
|
||||
}
|
||||
loadingMessage = Ext.Msg.show(commonSettings);
|
||||
timeoutMark = false;
|
||||
}
|
||||
}, 2000);
|
||||
};
|
||||
/**
|
||||
* Show the error code.
|
||||
* @param {*} errorCode
|
||||
*/
|
||||
function showErrorMessage(errorCode) {
|
||||
var message;
|
||||
switch (errorCode) {
|
||||
case 408:
|
||||
case 504:
|
||||
message = _('ID_SEARCHING_TIME_OUT');
|
||||
break;
|
||||
case 0:
|
||||
case -1:
|
||||
message = _('ID_SEARCHING_UNEXPECTED_ERROR_DEFAULT');
|
||||
break;
|
||||
default:
|
||||
message = _('ID_SEARCHING_UNEXPECTED_ERROR', [errorCode]);
|
||||
}
|
||||
|
||||
Ext.Msg.show({
|
||||
title:_('ID_ERROR'),
|
||||
msg: message,
|
||||
animEl: 'elId',
|
||||
icon: Ext.MessageBox.ERROR,
|
||||
buttons: Ext.MessageBox.OK
|
||||
});
|
||||
};
|
||||
function showTimeoutMessage() {
|
||||
Ext.Msg.show({
|
||||
title:_('ID_ERROR'),
|
||||
msg: _('ID_SEARCHING_TIME_OUT'),
|
||||
animEl: 'elId',
|
||||
icon: Ext.MessageBox.ERROR,
|
||||
buttons: Ext.MessageBox.OK
|
||||
});
|
||||
};
|
||||
|
||||
function doSearch(){
|
||||
//var viewText = Ext.getCmp('casesGrid').getView();
|
||||
@@ -1359,14 +1452,16 @@ Ext.onReady ( function() {
|
||||
storeCases.setBaseParam('dateTo', dateTo.getValue());
|
||||
storeCases.setBaseParam( 'search', searchText);
|
||||
storeCases.load({params:{ start : 0 , limit : pageSize }});
|
||||
}
|
||||
if ( action === 'search' ){
|
||||
showLoadingDialog();
|
||||
}
|
||||
};
|
||||
|
||||
var resetSearchButton = {
|
||||
text:'X',
|
||||
ctCls:"pm_search_x_button_des",
|
||||
handler: function(){
|
||||
textSearch.setValue('');
|
||||
doSearch();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1376,7 +1471,6 @@ Ext.onReady ( function() {
|
||||
handler: function(){
|
||||
suggestUser.setValue('');
|
||||
storeCases.setBaseParam('user', '');
|
||||
doSearch();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2219,7 +2313,7 @@ Ext.onReady ( function() {
|
||||
emptyMsg: _('ID_DISPLAY_EMPTY')
|
||||
})
|
||||
}
|
||||
var mask = new Ext.LoadMask(Ext.getBody(), {msg: _('ID_LOADING')});
|
||||
mask = new Ext.LoadMask(Ext.getBody(), {msg: _('ID_LOADING')});
|
||||
// create the editor grid
|
||||
grid = new Ext.grid.GridPanel({
|
||||
region: 'center',
|
||||
@@ -2227,7 +2321,6 @@ Ext.onReady ( function() {
|
||||
store: storeCases,
|
||||
cm: cm,
|
||||
loadMask: mask,
|
||||
|
||||
sm: new Ext.grid.RowSelectionModel({
|
||||
selectSingle: false,
|
||||
listeners:{
|
||||
|
||||
Reference in New Issue
Block a user