HOR-3670-RG Files review:

workflow/engine/classes/BpmnEngine_Services_SearchIndex.php
workflow/engine/classes/Bzip_File.php
workflow/engine/classes/CLI.php
workflow/engine/classes/Cases.php
workflow/engine/classes/Configurations.php
This commit is contained in:
Roly Rudy Gutierrez Pinto
2017-08-11 12:18:45 -04:00
parent 07f0a36aef
commit 63716c1358
9 changed files with 653 additions and 774 deletions

View File

@@ -77,7 +77,7 @@ require_once "classes/model/AppSolrQueue.php";
*/ */
public function isSolrEnabled() public function isSolrEnabled()
{ {
$searchIndex = new BpmnEngine_Services_SearchIndex ($this->_solrIsEnabled, $this->_solrHost); $searchIndex = new BpmnEngineServicesSearchIndex ($this->_solrIsEnabled, $this->_solrHost);
// execute query // execute query
$solrStatusResult = $searchIndex->isEnabled ($this->_solrInstance); $solrStatusResult = $searchIndex->isEnabled ($this->_solrInstance);
return $solrStatusResult; return $solrStatusResult;
@@ -409,7 +409,7 @@ require_once "classes/model/AppSolrQueue.php";
); );
$solrRequestData = Entity_SolrRequestData::createForRequestPagination ($data); $solrRequestData = Entity_SolrRequestData::createForRequestPagination ($data);
// use search index to return list of cases // use search index to return list of cases
$searchIndex = new BpmnEngine_Services_SearchIndex ($this->_solrIsEnabled, $this->_solrHost); $searchIndex = new BpmnEngineServicesSearchIndex ($this->_solrIsEnabled, $this->_solrHost);
// execute query // execute query
$solrQueryResult = $searchIndex->getDataTablePaginatedList ($solrRequestData); $solrQueryResult = $searchIndex->getDataTablePaginatedList ($solrRequestData);
if($this->debug) if($this->debug)
@@ -946,7 +946,7 @@ require_once "classes/model/AppSolrQueue.php";
// search the first // search the first
$searchIndex = new BpmnEngine_Services_SearchIndex ($this->_solrIsEnabled, $this->_solrHost); $searchIndex = new BpmnEngineServicesSearchIndex ($this->_solrIsEnabled, $this->_solrHost);
// execute query // execute query
$ListFieldsInfo = $searchIndex->getIndexFields ($this->_solrInstance); $ListFieldsInfo = $searchIndex->getIndexFields ($this->_solrInstance);
@@ -1240,7 +1240,7 @@ require_once "classes/model/AppSolrQueue.php";
); );
$oSolrUpdateDocument = Entity_SolrUpdateDocument::createForRequest ($data); $oSolrUpdateDocument = Entity_SolrUpdateDocument::createForRequest ($data);
$oSearchIndex = new BpmnEngine_Services_SearchIndex ($this->_solrIsEnabled, $this->_solrHost); $oSearchIndex = new BpmnEngineServicesSearchIndex ($this->_solrIsEnabled, $this->_solrHost);
$oSearchIndex->updateIndexDocument ($oSolrUpdateDocument); $oSearchIndex->updateIndexDocument ($oSolrUpdateDocument);
@@ -1350,7 +1350,7 @@ require_once "classes/model/AppSolrQueue.php";
try{ try{
$oSearchIndex = new BpmnEngine_Services_SearchIndex ($this->_solrIsEnabled, $this->_solrHost); $oSearchIndex = new BpmnEngineServicesSearchIndex ($this->_solrIsEnabled, $this->_solrHost);
foreach ($aaAPPUIDs as $aAPPUID) { foreach ($aaAPPUIDs as $aAPPUID) {
$idQuery = "APP_UID:" . $aAPPUID ['APP_UID']; $idQuery = "APP_UID:" . $aAPPUID ['APP_UID'];
@@ -2889,7 +2889,7 @@ require_once "classes/model/AppSolrQueue.php";
*/ */
public function getCountApplicationsSearchIndex() public function getCountApplicationsSearchIndex()
{ {
$searchIndex = new BpmnEngine_Services_SearchIndex ($this->_solrIsEnabled, $this->_solrHost); $searchIndex = new BpmnEngineServicesSearchIndex ($this->_solrIsEnabled, $this->_solrHost);
// execute query // execute query
$count = $searchIndex->getNumberDocuments ($this->_solrInstance); $count = $searchIndex->getNumberDocuments ($this->_solrInstance);
@@ -2903,7 +2903,7 @@ require_once "classes/model/AppSolrQueue.php";
*/ */
public function optimizeSearchIndex() public function optimizeSearchIndex()
{ {
$searchIndex = new BpmnEngine_Services_SearchIndex ($this->_solrIsEnabled, $this->_solrHost); $searchIndex = new BpmnEngineServicesSearchIndex ($this->_solrIsEnabled, $this->_solrHost);
// execute query // execute query
$searchIndex->optimizeIndexChanges ($this->_solrInstance); $searchIndex->optimizeIndexChanges ($this->_solrInstance);
} }

View File

@@ -0,0 +1,418 @@
<?php
/**
* Class used as interface to have access to the search index services
*
* @author Herbert Saal Gutierrez
*
*/
class BpmnEngineServicesSearchIndex
{
private $_solrIsEnabled = false;
private $_solrHost = "";
public function __construct($solrIsEnabled = false, $solrHost = "")
{
// check if Zend Library is available
// if(class_exists("Zend_Registry")){
// $registry = Zend_Registry::getInstance();
// //check if configuration is enabled
// $this->solrIsEnabled = $registry->isRegistered('solrEnabled') &&
// $registry->get('solrEnabled') == 1;
// $this->solrHost =
// $registry->isRegistered('solrHost')?$registry->get('solrHost'):"";
// }
// else{
// //use the parameters to initialize class
$this->_solrIsEnabled = $solrIsEnabled;
$this->_solrHost = $solrHost;
// }
}
/**
* Verify if the Solr service is available
* @gearman = false
* @rest = false
* @background = false
*
* no input parameters @param[in]
*
* @param
* [out] bool true if index service is enabled false in other case
*/
public function isEnabled($workspace)
{
// require_once (ROOT_PATH .
// '/businessLogic/modules/SearchIndexAccess/Solr.php');
require_once('class.solr.php');
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost);
return $solr->isEnabled($workspace);
}
/**
* Get the list of facets in base to the specified query and filter
* @gearman = true
* @rest = false
* @background = false
*
* @param
* [in] Entity_FacetRequest facetRequestEntity Facet request entity
* @param
* [out] array FacetGroup
*/
public function getFacetsList($facetRequestEntity)
{
require_once('class.solr.php');
// require_once (ROOT_PATH .
// '/businessLogic/modules/SearchIndexAccess/Solr.php');
require_once('entities/FacetGroup.php');
require_once('entities/FacetItem.php');
require_once('entities/SelectedFacetGroupItem.php');
require_once('entities/FacetResult.php');
/**
* ***************************************************************
*/
// get array of selected facet groups
$facetRequestEntity->selectedFacetsString = str_replace(',,', ',', $facetRequestEntity->selectedFacetsString);
// remove descriptions of selected facet groups
$aGroups = explode(',', $facetRequestEntity->selectedFacetsString);
$aGroups = array_filter($aGroups); // remove empty items
$aSelectedFacetGroups = array();
foreach ($aGroups as $i => $value) {
$gi = explode(':::', $value);
$gr = explode('::', $gi [0]);
$it = explode('::', $gi [1]);
// create string for remove condition
$count = 0;
$removeCondition = str_replace($value . ',', '', $facetRequestEntity->selectedFacetsString, $count);
if ($count == 0) {
$removeCondition = str_replace($value, '', $facetRequestEntity->selectedFacetsString, $count);
}
$selectedFacetGroupData = array(
'selectedFacetGroupName' => $gr [0],
'selectedFacetGroupPrintName' => $gr [1],
'selectedFacetItemName' => $it [0],
'selectedFacetItemPrintName' => $it [1],
'selectedFacetRemoveCondition' => $removeCondition
);
$aSelectedFacetGroups [] = Entity_SelectedFacetGroupItem::createForRequest($selectedFacetGroupData);
}
/**
* ***************************************************************
*/
// convert request to index request
// create filters
$filters = array();
if (!empty($aSelectedFacetGroups)) {
// exclude facetFields and facetDates included in filter from the next
// list of facets
foreach ($aSelectedFacetGroups as $value) {
$facetRequestEntity->facetFields = array_diff($facetRequestEntity->facetFields, array(
$value->selectedFacetGroupName
));
$facetRequestEntity->facetDates = array_diff($facetRequestEntity->facetDates, array(
$value->selectedFacetGroupName
));
}
// $facetFields = array_diff($facetFields,
// $facetInterfaceRequestEntity->selectedFacetGroups);
// $facetDates = array_diff($facetDates,
// $facetInterfaceRequestEntity->selectedFacetGroups);
foreach ($aSelectedFacetGroups as $group) {
$filters [] = $group->selectedFacetGroupName . ':' . urlencode($group->selectedFacetItemName);
}
}
$facetRequestEntity->filters = $filters;
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost);
// create list of facets
$facetsList = $solr->getFacetsList($facetRequestEntity);
$numFound = $facetsList->response->numFound;
$facetCounts = $facetsList->facet_counts;
$facetGroups = array();
// convert facet fields result to objects
/**
* *********************************************************************
*/
// include facet field results
$facetFieldsResult = $facetsList->facet_counts->facet_fields;
if (!empty($facetFieldsResult)) {
foreach ($facetFieldsResult as $facetGroup => $facetvalues) {
if (count($facetvalues) > 0) { // if the group have facets included
$data = array(
'facetGroupName' => $facetGroup
);
$data ['facetGroupPrintName'] = $facetGroup;
$data ['facetGroupType'] = 'field';
$facetItems = array();
for ($i = 0; $i < count($facetvalues); $i += 2) {
$dataItem = array();
$dataItem ['facetName'] = $facetvalues [$i];
$dataItem ['facetPrintName'] = $facetvalues [$i];
$dataItem ['facetCount'] = $facetvalues [$i + 1];
$dataItem ['facetSelectCondition'] = $facetRequestEntity->selectedFacetsString . (empty($facetRequestEntity->selectedFacetsString) ? '' : ',') . $data ['facetGroupName'] . '::' . $data ['facetGroupPrintName'] . ':::' . $dataItem ['facetName'] . '::' . $dataItem ['facetPrintName'];
$newFacetItem = Entity_FacetItem::createForInsert($dataItem);
$facetItems [] = $newFacetItem;
}
$data ['facetItems'] = $facetItems;
$newFacetGroup = Entity_FacetGroup::createForInsert($data);
$facetGroups [] = $newFacetGroup;
}
}
}
/**
* *********************************************************************
*/
// include facet date ranges results
$facetDatesResult = $facetsList->facet_counts->facet_dates;
if (!empty($facetDatesResult)) {
foreach ($facetDatesResult as $facetGroup => $facetvalues) {
if (count((array) $facetvalues) > 3) { // if the group have any facets included
// besides start, end and gap
$data = array(
'facetGroupName' => $facetGroup
);
$data ['facetGroupPrintName'] = $facetGroup;
$data ['facetGroupType'] = 'daterange';
$facetItems = array();
$facetvalueskeys = array_keys((array) $facetvalues);
foreach ($facetvalueskeys as $i => $k) {
if ($k != 'gap' && $k != 'start' && $k != 'end') {
$dataItem = array();
if ($i < count($facetvalueskeys) - 4) {
$dataItem ['facetName'] = '[' . $k . '%20TO%20' . $facetvalueskeys [$i + 1] . ']';
$dataItem ['facetPrintName'] = '[' . $k . '%20TO%20' . $facetvalueskeys [$i + 1] . ']';
} else {
// the last group
$dataItem ['facetName'] = '[' . $k . '%20TO%20' . $facetvalues->end . ']';
$dataItem ['facetPrintName'] = '[' . $k . '%20TO%20' . $facetvalues->end . ']';
}
$dataItem ['facetCount'] = $facetvalues->$k;
$dataItem ['facetSelectCondition'] = $facetRequestEntity->selectedFacetsString . (empty($facetRequestEntity->selectedFacetsString) ? '' : ',') . $data ['facetGroupName'] . '::' . $data ['facetGroupPrintName'] . ':::' . $dataItem ['facetName'] . '::' . $dataItem ['facetPrintName'];
$newFacetItem = Entity_FacetItem::createForInsert($dataItem);
$facetItems [] = $newFacetItem;
}
}
$data ['facetItems'] = $facetItems;
$newFacetGroup = Entity_FacetGroup::createForInsert($data);
$facetGroups [] = $newFacetGroup;
}
}
}
// TODO:convert facet queries
// -----
/**
* ***************************************************************
*/
// Create a filter string used in the filter of results of a datatable
$filterText = ''; // the list of selected filters used for filtering result,
// send in ajax
foreach ($aSelectedFacetGroups as $selectedFacetGroup) {
$filterText .= $selectedFacetGroup->selectedFacetGroupName . ':' . urlencode($selectedFacetGroup->selectedFacetItemName) . ',';
}
$filterText = substr_replace($filterText, '', - 1);
// $filterText = ($filterText == '')?'':'&filterText='.$filterText;
/**
* ***************************************************************
*/
// Create result
$dataFacetResult = array(
'aFacetGroups' => $facetGroups,
'aSelectedFacetGroups' => $aSelectedFacetGroups,
'sFilterText' => $filterText
);
$facetResult = Entity_FacetResult::createForRequest($dataFacetResult);
return $facetResult;
}
/**
* Get the total number of documents in search server
* @param string $workspace
* @return integer number of documents
*
*/
public function getNumberDocuments($workspace)
{
require_once('class.solr.php');
// require_once (ROOT_PATH .
// '/businessLogic/modules/SearchIndexAccess/Solr.php');
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost);
// create list of facets
$numberDocuments = $solr->getNumberDocuments($workspace);
return $numberDocuments;
}
/**
* Update document Index
* @param SolrUpdateDocumentEntity $solrUpdateDocumentEntity
*/
public function updateIndexDocument($solrUpdateDocumentEntity)
{
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost);
// create list of facets
$solr->updateDocument($solrUpdateDocumentEntity);
}
/**
* Delete document from index
* @param string $workspace
* @param string $idQuery
*/
public function deleteDocumentFromIndex($workspace, $idQuery)
{
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost);
// create list of facets
$solr->deleteDocument($workspace, $idQuery);
}
/**
* Commit index changes
* @param string $workspace
*/
public function commitIndexChanges($workspace)
{
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost);
// commit
$solr->commitChanges($workspace);
}
/**
* Optimize index changes
* @param string $workspace
*/
public function optimizeIndexChanges($workspace)
{
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost);
// commit
$solr->optimizeChanges($workspace);
}
/**
* Call Solr server to return the list of paginated pages.
* @param FacetRequest $solrRequestData
* @return Entity_SolrQueryResult
*/
public function getDataTablePaginatedList($solrRequestData)
{
require_once('class.solr.php');
require_once('entities/SolrRequestData.php');
require_once('entities/SolrQueryResult.php');
// prepare the list of sorted columns
// verify if the data of sorting is available
//if (isset ($solrRequestData->sortCols [0])) {
// for ($i = 0; $i < $solrRequestData->numSortingCols; $i ++) {
// verify if column is sortable
//if ($solrRequestData->includeCols [$solrRequestData->sortCols [$i]] != '' && $solrRequestData->sortableCols [$i] == "true") {
// change sorting column index to column names
//$solrRequestData->sortCols [$i] = $solrRequestData->includeCols [$solrRequestData->sortCols [$i]];
// define the direction of the sorting columns
//$solrRequestData->sortDir [$i] = $solrRequestData->sortDir [$i];
//}
// }
//}
// remove placeholder fields
// the placeholder doesn't affect the the solr's response
// $solrRequestData->includeCols = array_diff($solrRequestData->includeCols,
// array(''));
// execute query
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost);
$solrPaginatedResult = $solr->executeQuery($solrRequestData);
// get total number of documents in index
$numTotalDocs = $solr->getNumberDocuments($solrRequestData->workspace);
// create the Datatable response of the query
$numFound = $solrPaginatedResult->response->numFound;
$docs = $solrPaginatedResult->response->docs;
// print_r($docs);
// insert list of names in docs result
$data = array(
"sEcho" => '', // must be completed in response
"iTotalRecords" => intval($numTotalDocs), // we must get the
// total number of
// documents
"iTotalDisplayRecords" => $numFound,
"aaData" => array()
);
// copy result document or add placeholders to result
foreach ($docs as $i => $doc) {
$data ['aaData'] [$i] = array();
foreach ($solrRequestData->includeCols as $columnName) {
if ($columnName == '') {
$data ['aaData'] [$i] [] = ''; // placeholder
} else {
if (isset($doc->$columnName)) {
$data ['aaData'] [$i] [$columnName] = $doc->$columnName;
} else {
$data ['aaData'] [$i] [$columnName] = '';
}
}
}
}
$solrQueryResponse = Entity_SolrQueryResult::createForRequest($data);
//
return $solrQueryResponse;
}
/**
* Return the list of stored fields in the index.
* @param string $workspace
* @return array of index fields
*/
public function getIndexFields($workspace)
{
require_once('class.solr.php');
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->_solrIsEnabled, $this->_solrHost);
// print "SearchIndex!!!!";
// create list of facets
$solrFieldsData = $solr->getListIndexedStoredFields($workspace);
// copy list of arrays
$listFields = array();
foreach ($solrFieldsData->fields as $key => $fieldData) {
if (array_key_exists('dynamicBase', $fieldData)) {
$originalFieldName = substr($key, 0, - strlen($fieldData->dynamicBase) + 1);
// $listFields[strtolower($originalFieldName)] = $key; //in case of case insentive strings
// Maintain case sensitive variable names
$listFields [$originalFieldName] = $key;
} else {
// $listFields[strtolower($key)] = $key;
// Maintain case sensitive variable names
$listFields [$key] = $key;
}
}
return $listFields;
}
}

View File

@@ -1,453 +0,0 @@
<?php
/**
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2012 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 5304 Ventura Drive,
* Delray Beach, FL, 33484, USA, or email info@colosa.com.
*
*/
/**
* Class used as interface to have access to the search index services
*
* @author Herbert Saal Gutierrez
*
*/
/**
* Class used as interface to have access to the search index services
*
* @author Herbert Saal Gutierrez
*
*/class BpmnEngine_Services_SearchIndex
{
private $_solrIsEnabled = false;
private $_solrHost = "";
function __construct($solrIsEnabled = false, $solrHost = "")
{
// check if Zend Library is available
// if(class_exists("Zend_Registry")){
// $registry = Zend_Registry::getInstance();
// //check if configuration is enabled
// $this->solrIsEnabled = $registry->isRegistered('solrEnabled') &&
// $registry->get('solrEnabled') == 1;
// $this->solrHost =
// $registry->isRegistered('solrHost')?$registry->get('solrHost'):"";
// }
// else{
// //use the parameters to initialize class
$this->_solrIsEnabled = $solrIsEnabled;
$this->_solrHost = $solrHost;
// }
}
/**
* Verify if the Solr service is available
* @gearman = false
* @rest = false
* @background = false
*
* no input parameters @param[in]
*
* @param
* [out] bool true if index service is enabled false in other case
*/
public function isEnabled($workspace)
{
// require_once (ROOT_PATH .
// '/businessLogic/modules/SearchIndexAccess/Solr.php');
require_once ('class.solr.php');
$solr = new BpmnEngine_SearchIndexAccess_Solr ($this->_solrIsEnabled, $this->_solrHost);
return $solr->isEnabled ($workspace);
}
/**
* Get the list of facets in base to the specified query and filter
* @gearman = true
* @rest = false
* @background = false
*
* @param
* [in] Entity_FacetRequest facetRequestEntity Facet request entity
* @param
* [out] array FacetGroup
*/
public function getFacetsList($facetRequestEntity)
{
require_once ('class.solr.php');
// require_once (ROOT_PATH .
// '/businessLogic/modules/SearchIndexAccess/Solr.php');
require_once ('entities/FacetGroup.php');
require_once ('entities/FacetItem.php');
require_once ('entities/SelectedFacetGroupItem.php');
require_once ('entities/FacetResult.php');
/**
* ***************************************************************
*/
// get array of selected facet groups
$facetRequestEntity->selectedFacetsString = str_replace (',,', ',', $facetRequestEntity->selectedFacetsString);
// remove descriptions of selected facet groups
$aGroups = explode (',', $facetRequestEntity->selectedFacetsString);
$aGroups = array_filter ($aGroups); // remove empty items
$aSelectedFacetGroups = array ();
foreach ($aGroups as $i => $value) {
$gi = explode (':::', $value);
$gr = explode ('::', $gi [0]);
$it = explode ('::', $gi [1]);
// create string for remove condition
$count = 0;
$removeCondition = str_replace ($value . ',', '', $facetRequestEntity->selectedFacetsString, $count);
if ($count == 0) {
$removeCondition = str_replace ($value, '', $facetRequestEntity->selectedFacetsString, $count);
}
$selectedFacetGroupData = array (
'selectedFacetGroupName' => $gr [0],
'selectedFacetGroupPrintName' => $gr [1],
'selectedFacetItemName' => $it [0],
'selectedFacetItemPrintName' => $it [1],
'selectedFacetRemoveCondition' => $removeCondition
);
$aSelectedFacetGroups [] = Entity_SelectedFacetGroupItem::createForRequest ($selectedFacetGroupData);
}
/**
* ***************************************************************
*/
// convert request to index request
// create filters
$filters = array ();
if (! empty ($aSelectedFacetGroups)) {
// exclude facetFields and facetDates included in filter from the next
// list of facets
foreach ($aSelectedFacetGroups as $value) {
$facetRequestEntity->facetFields = array_diff ($facetRequestEntity->facetFields, array (
$value->selectedFacetGroupName
));
$facetRequestEntity->facetDates = array_diff ($facetRequestEntity->facetDates, array (
$value->selectedFacetGroupName
));
}
// $facetFields = array_diff($facetFields,
// $facetInterfaceRequestEntity->selectedFacetGroups);
// $facetDates = array_diff($facetDates,
// $facetInterfaceRequestEntity->selectedFacetGroups);
foreach ($aSelectedFacetGroups as $group) {
$filters [] = $group->selectedFacetGroupName . ':' . urlencode ($group->selectedFacetItemName);
}
}
$facetRequestEntity->filters = $filters;
$solr = new BpmnEngine_SearchIndexAccess_Solr ($this->_solrIsEnabled, $this->_solrHost);
// create list of facets
$facetsList = $solr->getFacetsList ($facetRequestEntity);
$numFound = $facetsList->response->numFound;
$facetCounts = $facetsList->facet_counts;
$facetGroups = array ();
// convert facet fields result to objects
/**
* *********************************************************************
*/
// include facet field results
$facetFieldsResult = $facetsList->facet_counts->facet_fields;
if (! empty ($facetFieldsResult)) {
foreach ($facetFieldsResult as $facetGroup => $facetvalues) {
if (count ($facetvalues) > 0) // if the group have facets included
{
$data = array (
'facetGroupName' => $facetGroup
);
$data ['facetGroupPrintName'] = $facetGroup;
$data ['facetGroupType'] = 'field';
$facetItems = array ();
for ($i = 0; $i < count ($facetvalues); $i += 2) {
$dataItem = array ();
$dataItem ['facetName'] = $facetvalues [$i];
$dataItem ['facetPrintName'] = $facetvalues [$i];
$dataItem ['facetCount'] = $facetvalues [$i + 1];
$dataItem ['facetSelectCondition'] = $facetRequestEntity->selectedFacetsString . (empty ($facetRequestEntity->selectedFacetsString) ? '' : ',') . $data ['facetGroupName'] . '::' . $data ['facetGroupPrintName'] . ':::' . $dataItem ['facetName'] . '::' . $dataItem ['facetPrintName'];
$newFacetItem = Entity_FacetItem::createForInsert ($dataItem);
$facetItems [] = $newFacetItem;
}
$data ['facetItems'] = $facetItems;
$newFacetGroup = Entity_FacetGroup::createForInsert ($data);
$facetGroups [] = $newFacetGroup;
}
}
}
/**
* *********************************************************************
*/
// include facet date ranges results
$facetDatesResult = $facetsList->facet_counts->facet_dates;
if (! empty ($facetDatesResult)) {
foreach ($facetDatesResult as $facetGroup => $facetvalues) {
if (count ((array)$facetvalues) > 3) // if the group have any facets included
// besides start, end and gap
{
$data = array (
'facetGroupName' => $facetGroup
);
$data ['facetGroupPrintName'] = $facetGroup;
$data ['facetGroupType'] = 'daterange';
$facetItems = array ();
$facetvalueskeys = array_keys ((array)$facetvalues);
foreach ($facetvalueskeys as $i => $k) {
if ($k != 'gap' && $k != 'start' && $k != 'end') {
$dataItem = array ();
if ($i < count ($facetvalueskeys) - 4) {
$dataItem ['facetName'] = '[' . $k . '%20TO%20' . $facetvalueskeys [$i + 1] . ']';
$dataItem ['facetPrintName'] = '[' . $k . '%20TO%20' . $facetvalueskeys [$i + 1] . ']';
}
else {
// the last group
$dataItem ['facetName'] = '[' . $k . '%20TO%20' . $facetvalues->end . ']';
$dataItem ['facetPrintName'] = '[' . $k . '%20TO%20' . $facetvalues->end . ']';
}
$dataItem ['facetCount'] = $facetvalues->$k;
$dataItem ['facetSelectCondition'] = $facetRequestEntity->selectedFacetsString . (empty ($facetRequestEntity->selectedFacetsString) ? '' : ',') . $data ['facetGroupName'] . '::' . $data ['facetGroupPrintName'] . ':::' . $dataItem ['facetName'] . '::' . $dataItem ['facetPrintName'];
$newFacetItem = Entity_FacetItem::createForInsert ($dataItem);
$facetItems [] = $newFacetItem;
}
}
$data ['facetItems'] = $facetItems;
$newFacetGroup = Entity_FacetGroup::createForInsert ($data);
$facetGroups [] = $newFacetGroup;
}
}
}
// TODO:convert facet queries
// -----
/**
* ***************************************************************
*/
// Create a filter string used in the filter of results of a datatable
$filterText = ''; // the list of selected filters used for filtering result,
// send in ajax
foreach ($aSelectedFacetGroups as $selectedFacetGroup) {
$filterText .= $selectedFacetGroup->selectedFacetGroupName . ':' . urlencode ($selectedFacetGroup->selectedFacetItemName) . ',';
}
$filterText = substr_replace ($filterText, '', - 1);
// $filterText = ($filterText == '')?'':'&filterText='.$filterText;
/**
* ***************************************************************
*/
// Create result
$dataFacetResult = array (
'aFacetGroups' => $facetGroups,
'aSelectedFacetGroups' => $aSelectedFacetGroups,
'sFilterText' => $filterText
);
$facetResult = Entity_FacetResult::createForRequest ($dataFacetResult);
return $facetResult;
}
/**
* Get the total number of documents in search server
* @param string $workspace
* @return integer number of documents
*
*/
public function getNumberDocuments($workspace)
{
require_once ('class.solr.php');
// require_once (ROOT_PATH .
// '/businessLogic/modules/SearchIndexAccess/Solr.php');
$solr = new BpmnEngine_SearchIndexAccess_Solr ($this->_solrIsEnabled, $this->_solrHost);
// create list of facets
$numberDocuments = $solr->getNumberDocuments ($workspace);
return $numberDocuments;
}
/**
* Update document Index
* @param SolrUpdateDocumentEntity $solrUpdateDocumentEntity
*/
public function updateIndexDocument($solrUpdateDocumentEntity)
{
$solr = new BpmnEngine_SearchIndexAccess_Solr ($this->_solrIsEnabled, $this->_solrHost);
// create list of facets
$solr->updateDocument ($solrUpdateDocumentEntity);
}
/**
* Delete document from index
* @param string $workspace
* @param string $idQuery
*/
public function deleteDocumentFromIndex($workspace, $idQuery)
{
$solr = new BpmnEngine_SearchIndexAccess_Solr ($this->_solrIsEnabled, $this->_solrHost);
// create list of facets
$solr->deleteDocument ($workspace, $idQuery);
}
/**
* Commit index changes
* @param string $workspace
*/
public function commitIndexChanges($workspace)
{
$solr = new BpmnEngine_SearchIndexAccess_Solr ($this->_solrIsEnabled, $this->_solrHost);
// commit
$solr->commitChanges ($workspace);
}
/**
* Optimize index changes
* @param string $workspace
*/
public function optimizeIndexChanges($workspace)
{
$solr = new BpmnEngine_SearchIndexAccess_Solr ($this->_solrIsEnabled, $this->_solrHost);
// commit
$solr->optimizeChanges ($workspace);
}
/**
* Call Solr server to return the list of paginated pages.
* @param FacetRequest $solrRequestData
* @return Entity_SolrQueryResult
*/
public function getDataTablePaginatedList($solrRequestData)
{
require_once ('class.solr.php');
require_once ('entities/SolrRequestData.php');
require_once ('entities/SolrQueryResult.php');
// prepare the list of sorted columns
// verify if the data of sorting is available
//if (isset ($solrRequestData->sortCols [0])) {
// for ($i = 0; $i < $solrRequestData->numSortingCols; $i ++) {
// verify if column is sortable
//if ($solrRequestData->includeCols [$solrRequestData->sortCols [$i]] != '' && $solrRequestData->sortableCols [$i] == "true") {
// change sorting column index to column names
//$solrRequestData->sortCols [$i] = $solrRequestData->includeCols [$solrRequestData->sortCols [$i]];
// define the direction of the sorting columns
//$solrRequestData->sortDir [$i] = $solrRequestData->sortDir [$i];
//}
// }
//}
// remove placeholder fields
// the placeholder doesn't affect the the solr's response
// $solrRequestData->includeCols = array_diff($solrRequestData->includeCols,
// array(''));
// execute query
$solr = new BpmnEngine_SearchIndexAccess_Solr ($this->_solrIsEnabled, $this->_solrHost);
$solrPaginatedResult = $solr->executeQuery ($solrRequestData);
// get total number of documents in index
$numTotalDocs = $solr->getNumberDocuments ($solrRequestData->workspace);
// create the Datatable response of the query
$numFound = $solrPaginatedResult->response->numFound;
$docs = $solrPaginatedResult->response->docs;
// print_r($docs);
// insert list of names in docs result
$data = array (
"sEcho" => '', // must be completed in response
"iTotalRecords" => intval ($numTotalDocs), // we must get the
// total number of
// documents
"iTotalDisplayRecords" => $numFound,
"aaData" => array ()
);
// copy result document or add placeholders to result
foreach ($docs as $i => $doc) {
$data ['aaData'] [$i] = array ();
foreach ($solrRequestData->includeCols as $columnName) {
if ($columnName == '') {
$data ['aaData'] [$i] [] = ''; // placeholder
}
else {
if (isset ($doc->$columnName)) {
$data ['aaData'] [$i] [$columnName] = $doc->$columnName;
}
else {
$data ['aaData'] [$i] [$columnName] = '';
}
}
}
}
$solrQueryResponse = Entity_SolrQueryResult::createForRequest ($data);
//
return $solrQueryResponse;
}
/**
* Return the list of stored fields in the index.
* @param string $workspace
* @return array of index fields
*/
public function getIndexFields($workspace)
{
require_once ('class.solr.php');
$solr = new BpmnEngine_SearchIndexAccess_Solr ($this->_solrIsEnabled, $this->_solrHost);
// print "SearchIndex!!!!";
// create list of facets
$solrFieldsData = $solr->getListIndexedStoredFields ($workspace);
// copy list of arrays
$listFields = array ();
foreach ($solrFieldsData->fields as $key => $fieldData) {
if (array_key_exists ('dynamicBase', $fieldData)) {
$originalFieldName = substr ($key, 0, - strlen ($fieldData->dynamicBase) + 1);
// $listFields[strtolower($originalFieldName)] = $key; //in case of case insentive strings
// Maintain case sensitive variable names
$listFields [$originalFieldName] = $key;
}
else {
// $listFields[strtolower($key)] = $key;
// Maintain case sensitive variable names
$listFields [$key] = $key;
}
}
return $listFields;
}
}

View File

@@ -0,0 +1,63 @@
<?php
/**
*
* This class is derived from the class archive, is employed to use files .bzip
*
* @package workflow.engine.classes
*
*/class BzipFile extends tar_file
{
/**
* This function is the constructor of the class bzip_file
*
* @param string $name
* @return void
*/
public function BzipFile($name)
{
$this->tar_file($name);
$this->options['type'] = "bzip";
}
/**
* This function is employed to create files .
* bzip
*
* @return boolean
*/
public function create_bzip()
{
if ($this->options['inmemory'] == 0) {
$pwd = getcwd();
chdir($this->options['basedir']);
if ($fp = bzopen($this->options['name'], "wb")) {
fseek($this->archive, 0);
while ($temp = fread($this->archive, 1048576)) {
bzwrite($fp, $temp);
}
bzclose($fp);
chdir($pwd);
} else {
$this->error[] = "Could not open {$this->options['name']} for writing.";
chdir($pwd);
return 0;
}
} else {
$this->archive = bzcompress($this->archive, $this->options['level']);
}
return 1;
}
/**
* This function open a archive of the class bzip_file
*
* @return void
*/
public function open_archive()
{
return @bzopen($this->options['name'], "rb");
}
}

View File

@@ -1,80 +0,0 @@
<?php
/*--------------------------------------------------
* TAR/GZIP/BZIP2/ZIP ARCHIVE CLASSES 2.1
* By Devin Doucette
* Copyright (c) 2005 Devin Doucette
* Email: darksnoopy@shaw.ca
*--------------------------------------------------
* Email bugs/suggestions to darksnoopy@shaw.ca
*--------------------------------------------------
* This script has been created and released under
* the GNU GPL and is free to use and redistribute
* only if this copyright statement is not removed
*--------------------------------------------------*/
/**
*
* @package workflow.engine.classes
*/
/**
*
*
* This class is derived from the class archive, is employed to use files .bzip
*
* @package workflow.engine.classes
*
*/class bzip_file extends tar_file
{
/**
* This function is the constructor of the class bzip_file
*
* @param string $name
* @return void
*/
public function bzip_file ($name)
{
$this->tar_file( $name );
$this->options['type'] = "bzip";
}
/**
* This function is employed to create files .
* bzip
*
* @return boolean
*/
public function create_bzip ()
{
if ($this->options['inmemory'] == 0) {
$pwd = getcwd();
chdir( $this->options['basedir'] );
if ($fp = bzopen( $this->options['name'], "wb" )) {
fseek( $this->archive, 0 );
while ($temp = fread( $this->archive, 1048576 )) {
bzwrite( $fp, $temp );
}
bzclose( $fp );
chdir( $pwd );
} else {
$this->error[] = "Could not open {$this->options['name']} for writing.";
chdir( $pwd );
return 0;
}
} else {
$this->archive = bzcompress( $this->archive, $this->options['level'] );
}
return 1;
}
/**
* This function open a archive of the class bzip_file
*
* @return void
*/
public function open_archive ()
{
return @bzopen( $this->options['name'], "rb" );
}
}

View File

@@ -1,32 +1,6 @@
<?php <?php
use \ProcessMaker\BusinessModel\WebEntryEvent; use \ProcessMaker\BusinessModel\WebEntryEvent;
/**
* class.case.php
* @package workflow.engine.classes
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
use ProcessMaker\Plugins\PluginRegistry; use ProcessMaker\Plugins\PluginRegistry;
/** /**
@@ -34,14 +8,8 @@ use ProcessMaker\Plugins\PluginRegistry;
* This object is applied to Task * This object is applied to Task
* @package workflow.engine.classes * @package workflow.engine.classes
*/ */
class Cases
/**
* A Cases object where you can do start, load, update, refresh about cases
* This object is applied to Task
* @package workflow.engine.classes
*/class Cases
{ {
private $appSolr = null; private $appSolr = null;
public $dir = 'ASC'; public $dir = 'ASC';
public $sort = 'APP_MSG_DATE'; public $sort = 'APP_MSG_DATE';
@@ -172,7 +140,7 @@ use ProcessMaker\Plugins\PluginRegistry;
$c->addSelectColumn(TaskPeer::TAS_TITLE); $c->addSelectColumn(TaskPeer::TAS_TITLE);
$c->addSelectColumn(TaskPeer::PRO_UID); $c->addSelectColumn(TaskPeer::PRO_UID);
$c->addSelectColumn(ProcessPeer::PRO_TITLE); $c->addSelectColumn(ProcessPeer::PRO_TITLE);
$c->addJoin (TaskPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN); $c->addJoin(TaskPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN);
$c->add(TaskPeer::TAS_UID, $tasks, Criteria::IN); $c->add(TaskPeer::TAS_UID, $tasks, Criteria::IN);
$c->addAscendingOrderByColumn(ProcessPeer::PRO_TITLE); $c->addAscendingOrderByColumn(ProcessPeer::PRO_TITLE);
$c->addAscendingOrderByColumn(TaskPeer::TAS_TITLE); $c->addAscendingOrderByColumn(TaskPeer::TAS_TITLE);
@@ -283,7 +251,7 @@ use ProcessMaker\Plugins\PluginRegistry;
$aConditions[] = array('PCS.PRO_CATEGORY', 'PCSCAT.CATEGORY_UID'); $aConditions[] = array('PCS.PRO_CATEGORY', 'PCSCAT.CATEGORY_UID');
$c->addJoinMC($aConditions, Criteria::LEFT_JOIN); $c->addJoinMC($aConditions, Criteria::LEFT_JOIN);
} }
$c->addJoin (TaskPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN); $c->addJoin(TaskPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN);
$c->add(TaskPeer::TAS_UID, $tasks, Criteria::IN); $c->add(TaskPeer::TAS_UID, $tasks, Criteria::IN);
$c->add(ProcessPeer::PRO_SUBPROCESS, '0'); $c->add(ProcessPeer::PRO_SUBPROCESS, '0');
$c->addAscendingOrderByColumn(ProcessPeer::PRO_TITLE); $c->addAscendingOrderByColumn(ProcessPeer::PRO_TITLE);
@@ -390,7 +358,7 @@ use ProcessMaker\Plugins\PluginRegistry;
$c->addSelectColumn(TaskPeer::TAS_TITLE); $c->addSelectColumn(TaskPeer::TAS_TITLE);
$c->addSelectColumn(TaskPeer::PRO_UID); $c->addSelectColumn(TaskPeer::PRO_UID);
$c->addSelectColumn(ProcessPeer::PRO_TITLE); $c->addSelectColumn(ProcessPeer::PRO_TITLE);
$c->addJoin (TaskPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN); $c->addJoin(TaskPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN);
$c->add(TaskPeer::TAS_UID, $tasks, Criteria::IN); $c->add(TaskPeer::TAS_UID, $tasks, Criteria::IN);
$c->addAscendingOrderByColumn(ProcessPeer::PRO_TITLE); $c->addAscendingOrderByColumn(ProcessPeer::PRO_TITLE);
$c->addAscendingOrderByColumn(TaskPeer::TAS_TITLE); $c->addAscendingOrderByColumn(TaskPeer::TAS_TITLE);
@@ -543,14 +511,13 @@ use ProcessMaker\Plugins\PluginRegistry;
$aFields['CURRENT_USER'] = implode(" - ", array_values($aFields['CURRENT_USER'])); $aFields['CURRENT_USER'] = implode(" - ", array_values($aFields['CURRENT_USER']));
$tasksArray = array_filter(explode('|', $aFields['TAS_UID'])); $tasksArray = array_filter(explode('|', $aFields['TAS_UID']));
if(count($tasksArray) == 1) { if (count($tasksArray) == 1) {
$aFields['TAS_UID'] = $tasksArray[0]; $aFields['TAS_UID'] = $tasksArray[0];
} }
} else { } else {
$oCurUser->load($aAppDel['USR_UID']); $oCurUser->load($aAppDel['USR_UID']);
$aFields['CURRENT_USER'] = $oCurUser->getUsrFirstname() . ' ' . $oCurUser->getUsrLastname(); $aFields['CURRENT_USER'] = $oCurUser->getUsrFirstname() . ' ' . $oCurUser->getUsrLastname();
} }
} catch (Exception $oError) { } catch (Exception $oError) {
$aFields['CURRENT_USER'] = ''; $aFields['CURRENT_USER'] = '';
} }
@@ -719,7 +686,7 @@ use ProcessMaker\Plugins\PluginRegistry;
$cri->addSelectColumn(AppDelegationPeer::TAS_UID); $cri->addSelectColumn(AppDelegationPeer::TAS_UID);
$cri->add(AppDelegationPeer::APP_UID, $sAppUid); $cri->add(AppDelegationPeer::APP_UID, $sAppUid);
$cri->add(AppDelegationPeer::DEL_THREAD_STATUS, "OPEN"); $cri->add(AppDelegationPeer::DEL_THREAD_STATUS, "OPEN");
if(isset($fields['DEL_INDEX'])){ if (isset($fields['DEL_INDEX'])) {
$cri->add(AppDelegationPeer::DEL_INDEX, $fields['DEL_INDEX']); $cri->add(AppDelegationPeer::DEL_INDEX, $fields['DEL_INDEX']);
} }
$rsCri = AppDelegationPeer::doSelectRS($cri); $rsCri = AppDelegationPeer::doSelectRS($cri);
@@ -848,7 +815,8 @@ use ProcessMaker\Plugins\PluginRegistry;
return $aReturn; return $aReturn;
} }
public function array_key_intersect(&$a, &$b) { public function array_key_intersect(&$a, &$b)
{
$array = array(); $array = array();
while (list($key, $value) = each($a)) { while (list($key, $value) = each($a)) {
if (isset($b[$key])) { if (isset($b[$key])) {
@@ -898,7 +866,7 @@ use ProcessMaker\Plugins\PluginRegistry;
if (isset($Fields['APP_DESCRIPTION'])) { if (isset($Fields['APP_DESCRIPTION'])) {
$appFields['APP_DESCRIPTION'] = $Fields['APP_DESCRIPTION']; $appFields['APP_DESCRIPTION'] = $Fields['APP_DESCRIPTION'];
} }
if(isset($Fields['DEL_INDEX'])){ if (isset($Fields['DEL_INDEX'])) {
$appFields['DEL_INDEX'] = $Fields['DEL_INDEX']; $appFields['DEL_INDEX'] = $Fields['DEL_INDEX'];
} }
@@ -913,9 +881,9 @@ use ProcessMaker\Plugins\PluginRegistry;
//Add fields that weren't in previous version //Add fields that weren't in previous version
foreach ($aApplicationFields as $key => $value) { foreach ($aApplicationFields as $key => $value) {
if (is_array($value) && isset($fieldsOnBoth[$key]) && is_array($fieldsOnBoth[$key])) { if (is_array($value) && isset($fieldsOnBoth[$key]) && is_array($fieldsOnBoth[$key])) {
$afieldDifference = $this->arrayRecursiveDiff($value,$fieldsOnBoth[$key]); $afieldDifference = $this->arrayRecursiveDiff($value, $fieldsOnBoth[$key]);
$dfieldDifference = $this->arrayRecursiveDiff($fieldsOnBoth[$key],$value); $dfieldDifference = $this->arrayRecursiveDiff($fieldsOnBoth[$key], $value);
if ($afieldDifference || $dfieldDifference){ if ($afieldDifference || $dfieldDifference) {
$FieldsDifference[$key] = $value; $FieldsDifference[$key] = $value;
} }
} else { } else {
@@ -1020,8 +988,8 @@ use ProcessMaker\Plugins\PluginRegistry;
} }
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/
if(!isset($Fields['DEL_INDEX'])){ if (!isset($Fields['DEL_INDEX'])) {
$Fields['DEL_INDEX'] = 1; $Fields['DEL_INDEX'] = 1;
} }
$inbox = new ListInbox(); $inbox = new ListInbox();
unset($Fields['DEL_INIT_DATE']); unset($Fields['DEL_INIT_DATE']);
@@ -1051,7 +1019,7 @@ use ProcessMaker\Plugins\PluginRegistry;
$oAppDocument = new AppDocument(); $oAppDocument = new AppDocument();
if($deleteDelegation) { if ($deleteDelegation) {
//Delete the delegations of a application //Delete the delegations of a application
$this->deleteDelegation($sAppUid); $this->deleteDelegation($sAppUid);
} }
@@ -1108,7 +1076,7 @@ use ProcessMaker\Plugins\PluginRegistry;
$oDerivation = new Derivation(); $oDerivation = new Derivation();
$oDerivation->verifyIsCaseChild($sAppUid); $oDerivation->verifyIsCaseChild($sAppUid);
} }
} catch(Exception $e) { } catch (Exception $e) {
Bootstrap::registerMonolog('DeleteCases', 200, 'Error in sub-process when trying to route a child case related to the case', ['application_uid' => $sAppUid, 'error' => $e->getMessage()], SYS_SYS, 'processmaker.log'); Bootstrap::registerMonolog('DeleteCases', 200, 'Error in sub-process when trying to route a child case related to the case', ['application_uid' => $sAppUid, 'error' => $e->getMessage()], SYS_SYS, 'processmaker.log');
} }
@@ -1251,13 +1219,13 @@ use ProcessMaker\Plugins\PluginRegistry;
} }
/* /*
* Determines if the all threads of a multiinstance task are closed * Determines if the all threads of a multiinstance task are closed
* *
* @$appUid string appUid of the instance to be tested * @$appUid string appUid of the instance to be tested
* @$tasUid string task uid of the multiinstance task * @$tasUid string task uid of the multiinstance task
* @$previousDelIndex int previous del index of the instance corresponding to the multiinstance task * @$previousDelIndex int previous del index of the instance corresponding to the multiinstance task
*/ */
public function multiInstanceIsCompleted($appUid, $tasUid, $previousDelIndex) public function multiInstanceIsCompleted($appUid, $tasUid, $previousDelIndex)
{ {
@@ -1272,15 +1240,14 @@ use ProcessMaker\Plugins\PluginRegistry;
$rs = AppDelegationPeer::doSelectRs($c); $rs = AppDelegationPeer::doSelectRs($c);
if ($rs->next()) { if ($rs->next()) {
$result = false; $result = false;
} else { } else {
$result = true; $result = true;
} }
} catch (exception $e) { } catch (exception $e) {
throw ($e); throw ($e);
} finally { } finally {
return $result; return $result;
} }
} }
@@ -1439,7 +1406,8 @@ use ProcessMaker\Plugins\PluginRegistry;
* @param array $previousTasks * @param array $previousTasks
* @return array $taskReviewed * @return array $taskReviewed
*/ */
public function getReviewedTasksRecursive($taskUid, $appUid, $previousTasks) { public function getReviewedTasksRecursive($taskUid, $appUid, $previousTasks)
{
$taskReviewed = array(); $taskReviewed = array();
$oCriteria = new Criteria('workflow'); $oCriteria = new Criteria('workflow');
$oCriteria->add(RoutePeer::ROU_NEXT_TASK, $taskUid); $oCriteria->add(RoutePeer::ROU_NEXT_TASK, $taskUid);
@@ -1499,11 +1467,11 @@ use ProcessMaker\Plugins\PluginRegistry;
//If exist paused cases //If exist paused cases
$closedTasks[] = $row; $closedTasks[] = $row;
$aIndex[] = $row['DEL_INDEX']; $aIndex[] = $row['DEL_INDEX'];
$res = $this->GetAllOpenDelegation( array('APP_UID'=>$sAppUid, 'APP_THREAD_PARENT'=>$row['DEL_PREVIOUS']), 'NONE' ); $res = $this->GetAllOpenDelegation(array('APP_UID'=>$sAppUid, 'APP_THREAD_PARENT'=>$row['DEL_PREVIOUS']), 'NONE');
foreach ($res as $in) { foreach ($res as $in) {
$aIndex[] = $in['DEL_INDEX']; $aIndex[] = $in['DEL_INDEX'];
} }
$pausedTasks = $this->getReviewedTasksPaused($sAppUid,$aIndex); $pausedTasks = $this->getReviewedTasksPaused($sAppUid, $aIndex);
} }
} }
@@ -1521,7 +1489,7 @@ use ProcessMaker\Plugins\PluginRegistry;
* @return array within the paused tasks * @return array within the paused tasks
* false -> when has not any delegation started for that task * false -> when has not any delegation started for that task
*/ */
public function getReviewedTasksPaused($sAppUid,$aDelIndex) public function getReviewedTasksPaused($sAppUid, $aDelIndex)
{ {
$oCriteria = new Criteria('workflow'); $oCriteria = new Criteria('workflow');
$oCriteria->add(AppDelayPeer::APP_UID, $sAppUid); $oCriteria->add(AppDelayPeer::APP_UID, $sAppUid);
@@ -2162,19 +2130,19 @@ use ProcessMaker\Plugins\PluginRegistry;
$aUserFields = array(); $aUserFields = array();
$taskAssignType = $task->getTasAssignType(); $taskAssignType = $task->getTasAssignType();
$nextTaskAssignVariable = $task->getTasAssignVariable(); $nextTaskAssignVariable = $task->getTasAssignVariable();
if($taskAssignType == "MULTIPLE_INSTANCE" || $taskAssignType == "MULTIPLE_INSTANCE_VALUE_BASED"){ if ($taskAssignType == "MULTIPLE_INSTANCE" || $taskAssignType == "MULTIPLE_INSTANCE_VALUE_BASED") {
switch ($taskAssignType) { switch ($taskAssignType) {
case 'MULTIPLE_INSTANCE': case 'MULTIPLE_INSTANCE':
$userFields = $oDerivation->getUsersFullNameFromArray($oDerivation->getAllUsersFromAnyTask($sTasUid)); $userFields = $oDerivation->getUsersFullNameFromArray($oDerivation->getAllUsersFromAnyTask($sTasUid));
break; break;
default: default:
throw (new Exception( 'Invalid Task Assignment method' )); throw (new Exception('Invalid Task Assignment method'));
break; break;
} }
$userFields = $oDerivation->getUsersFullNameFromArray($oDerivation->getAllUsersFromAnyTask($sTasUid)); $userFields = $oDerivation->getUsersFullNameFromArray($oDerivation->getAllUsersFromAnyTask($sTasUid));
$count = 0; $count = 0;
foreach($userFields as $rowUser){ foreach ($userFields as $rowUser) {
if($rowUser["USR_UID"] != $sUsrUid){ if ($rowUser["USR_UID"] != $sUsrUid) {
//appDelegation //appDelegation
$AppDelegation = new AppDelegation; $AppDelegation = new AppDelegation;
$iAppThreadIndex ++; // Start Thread $iAppThreadIndex ++; // Start Thread
@@ -2198,13 +2166,13 @@ use ProcessMaker\Plugins\PluginRegistry;
(empty($user)) ? 0 : $user->getUsrId(), (empty($user)) ? 0 : $user->getUsrId(),
$this->Process->getProId() $this->Process->getProId()
); );
//appThread //appThread
$AppThread = new AppThread; $AppThread = new AppThread;
$iAppThreadIndex = $AppThread->createAppThread($sAppUid, $iDelIndex1, 0); $iAppThreadIndex = $AppThread->createAppThread($sAppUid, $iDelIndex1, 0);
//Save Information //Save Information
$aUserFields[$count] = $rowUser; $aUserFields[$count] = $rowUser;
$aUserFields[$count]["DEL_INDEX"] = $iDelIndex1; $aUserFields[$count]["DEL_INDEX"] = $iDelIndex1;
$count++; $count++;
} }
} }
} }
@@ -2348,7 +2316,6 @@ use ProcessMaker\Plugins\PluginRegistry;
$iPosition += 1; $iPosition += 1;
$aNextStep = null; $aNextStep = null;
if ($iPosition <= $iLastStep) { if ($iPosition <= $iLastStep) {
while ($iPosition <= $iLastStep) { while ($iPosition <= $iLastStep) {
$bAccessStep = false; $bAccessStep = false;
//step //step
@@ -2379,25 +2346,25 @@ use ProcessMaker\Plugins\PluginRegistry;
$sAction = ''; $sAction = '';
break; break;
} }
if(array_key_exists('gmail',$_SESSION) || (array_key_exists('gmail',$_GET) && $_GET['gmail'] == 1)){ if (array_key_exists('gmail', $_SESSION) || (array_key_exists('gmail', $_GET) && $_GET['gmail'] == 1)) {
$aNextStep = array( $aNextStep = array(
'TYPE' => $oStep->getStepTypeObj(), 'TYPE' => $oStep->getStepTypeObj(),
'UID' => $oStep->getStepUidObj(), 'UID' => $oStep->getStepUidObj(),
'POSITION' => $oStep->getStepPosition(), 'POSITION' => $oStep->getStepPosition(),
'PAGE' => 'cases_Step?TYPE=' . $oStep->getStepTypeObj() . '&UID=' . 'PAGE' => 'cases_Step?TYPE=' . $oStep->getStepTypeObj() . '&UID=' .
$oStep->getStepUidObj() . '&POSITION=' . $oStep->getStepPosition() . $oStep->getStepUidObj() . '&POSITION=' . $oStep->getStepPosition() .
'&ACTION=' . $sAction . '&ACTION=' . $sAction .
'&gmail=1' '&gmail=1'
); );
} else{ } else {
$aNextStep = array( $aNextStep = array(
'TYPE' => $oStep->getStepTypeObj(), 'TYPE' => $oStep->getStepTypeObj(),
'UID' => $oStep->getStepUidObj(), 'UID' => $oStep->getStepUidObj(),
'POSITION' => $oStep->getStepPosition(), 'POSITION' => $oStep->getStepPosition(),
'PAGE' => 'cases_Step?TYPE=' . $oStep->getStepTypeObj() . '&UID=' . 'PAGE' => 'cases_Step?TYPE=' . $oStep->getStepTypeObj() . '&UID=' .
$oStep->getStepUidObj() . '&POSITION=' . $oStep->getStepPosition() . $oStep->getStepUidObj() . '&POSITION=' . $oStep->getStepPosition() .
'&ACTION=' . $sAction '&ACTION=' . $sAction
); );
} }
$iPosition = $iLastStep; $iPosition = $iLastStep;
} }
@@ -2406,21 +2373,21 @@ use ProcessMaker\Plugins\PluginRegistry;
} }
} }
if (!$aNextStep) { if (!$aNextStep) {
if(array_key_exists('gmail',$_SESSION) || (array_key_exists('gmail',$_GET) && $_GET['gmail'] == 1)){ if (array_key_exists('gmail', $_SESSION) || (array_key_exists('gmail', $_GET) && $_GET['gmail'] == 1)) {
$aNextStep = array( $aNextStep = array(
'TYPE' => 'DERIVATION', 'TYPE' => 'DERIVATION',
'UID' => -1, 'UID' => -1,
'POSITION' => ($iLastStep + 1), 'POSITION' => ($iLastStep + 1),
'PAGE' => 'cases_Step?TYPE=ASSIGN_TASK&UID=-1&POSITION=10000&ACTION=ASSIGN&gmail=1' 'PAGE' => 'cases_Step?TYPE=ASSIGN_TASK&UID=-1&POSITION=10000&ACTION=ASSIGN&gmail=1'
); );
}else { } else {
$aNextStep = array( $aNextStep = array(
'TYPE' => 'DERIVATION', 'TYPE' => 'DERIVATION',
'UID' => -1, 'UID' => -1,
'POSITION' => ($iLastStep + 1), 'POSITION' => ($iLastStep + 1),
'PAGE' => 'cases_Step?TYPE=ASSIGN_TASK&UID=-1&POSITION=10000&ACTION=ASSIGN' 'PAGE' => 'cases_Step?TYPE=ASSIGN_TASK&UID=-1&POSITION=10000&ACTION=ASSIGN'
); );
} }
} }
return $aNextStep; return $aNextStep;
} catch (exception $e) { } catch (exception $e) {
@@ -2626,7 +2593,6 @@ use ProcessMaker\Plugins\PluginRegistry;
///-- $c->addAsColumn('USR_NAME', "CONCAT(USR_LASTNAME, ' ', USR_FIRSTNAME)"); ///-- $c->addAsColumn('USR_NAME', "CONCAT(USR_LASTNAME, ' ', USR_FIRSTNAME)");
$sDataBase = 'database_' . strtolower(DB_ADAPTER); $sDataBase = 'database_' . strtolower(DB_ADAPTER);
if (G::LoadSystemExist($sDataBase)) { if (G::LoadSystemExist($sDataBase)) {
$oDataBase = new database(); $oDataBase = new database();
$c->addAsColumn('USR_NAME', $oDataBase->concatString("USR_LASTNAME", "' '", "USR_FIRSTNAME")); $c->addAsColumn('USR_NAME', $oDataBase->concatString("USR_LASTNAME", "' '", "USR_FIRSTNAME"));
$c->addAsColumn( $c->addAsColumn(
@@ -3378,7 +3344,7 @@ use ProcessMaker\Plugins\PluginRegistry;
if (!is_null($oApplication)) { if (!is_null($oApplication)) {
return $oApplication->getDelIndex(); return $oApplication->getDelIndex();
} }
throw ( new Exception('This case has 0 current delegations') ); throw (new Exception('This case has 0 current delegations'));
} }
/* /*
@@ -4016,11 +3982,12 @@ use ProcessMaker\Plugins\PluginRegistry;
* @param string $iDelegation * @param string $iDelegation
* @return boolean * @return boolean
*/ */
public static function isUnassignedPauseCase($sAppUid, $iDelegation){ public static function isUnassignedPauseCase($sAppUid, $iDelegation)
{
$oAppDelegation = new AppDelegation(); $oAppDelegation = new AppDelegation();
$aFieldsDel = $oAppDelegation->Load($sAppUid, $iDelegation); $aFieldsDel = $oAppDelegation->Load($sAppUid, $iDelegation);
$usrUid = $aFieldsDel['USR_UID']; $usrUid = $aFieldsDel['USR_UID'];
if($usrUid === ''){ if ($usrUid === '') {
return true; return true;
} else { } else {
return false; return false;
@@ -4041,8 +4008,8 @@ use ProcessMaker\Plugins\PluginRegistry;
public function pauseCase($sApplicationUID, $iDelegation, $sUserUID, $sUnpauseDate = null, $appTitle = null) public function pauseCase($sApplicationUID, $iDelegation, $sUserUID, $sUnpauseDate = null, $appTitle = null)
{ {
// Check if the case is unassigned // Check if the case is unassigned
if($this->isUnassignedPauseCase($sApplicationUID, $iDelegation)){ if ($this->isUnassignedPauseCase($sApplicationUID, $iDelegation)) {
throw new Exception( G::LoadTranslation("ID_CASE_NOT_PAUSED", array(G::LoadTranslation("ID_UNASSIGNED_STATUS"))) ); throw new Exception(G::LoadTranslation("ID_CASE_NOT_PAUSED", array(G::LoadTranslation("ID_UNASSIGNED_STATUS"))));
} }
$oApplication = new Application(); $oApplication = new Application();
@@ -4300,7 +4267,7 @@ use ProcessMaker\Plugins\PluginRegistry;
$this->appSolr->updateApplicationSearchIndex($sApplicationUID); $this->appSolr->updateApplicationSearchIndex($sApplicationUID);
} }
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/
$data = array ( $data = array(
'APP_UID' => $sApplicationUID, 'APP_UID' => $sApplicationUID,
'DEL_INDEX' => $iIndex, 'DEL_INDEX' => $iIndex,
'USR_UID' => $user_logged, 'USR_UID' => $user_logged,
@@ -5604,10 +5571,10 @@ use ProcessMaker\Plugins\PluginRegistry;
{ {
$sTo = null; $sTo = null;
$sCc = null; $sCc = null;
$arrayResp = array (); $arrayResp = array();
$tasks = new Tasks(); $tasks = new Tasks();
$group = new Groups (); $group = new Groups();
$oUser = new Users (); $oUser = new Users();
$task = TaskPeer::retrieveByPK($taskUid); $task = TaskPeer::retrieveByPK($taskUid);
@@ -5698,14 +5665,14 @@ use ProcessMaker\Plugins\PluginRegistry;
$arrayResp['to'] = $to; $arrayResp['to'] = $to;
$arrayResp['cc'] = $cc; $arrayResp['cc'] = $cc;
break; break;
case "MULTIPLE_INSTANCE" : case "MULTIPLE_INSTANCE":
$to = null; $to = null;
$cc = null; $cc = null;
$sw = 1; $sw = 1;
$oDerivation = new Derivation (); $oDerivation = new Derivation();
$userFields = $oDerivation->getUsersFullNameFromArray ( $oDerivation->getAllUsersFromAnyTask ( $taskUid ) ); $userFields = $oDerivation->getUsersFullNameFromArray($oDerivation->getAllUsersFromAnyTask($taskUid));
if (isset ( $userFields )) { if (isset($userFields)) {
foreach ( $userFields as $row ) { foreach ($userFields as $row) {
$toAux = ((($row ["USR_FIRSTNAME"] != "") || ($row ["USR_LASTNAME"] != "")) ? $row ["USR_FIRSTNAME"] . " " . $row ["USR_LASTNAME"] . " " : "") . "<" . $row ["USR_EMAIL"] . ">"; $toAux = ((($row ["USR_FIRSTNAME"] != "") || ($row ["USR_LASTNAME"] != "")) ? $row ["USR_FIRSTNAME"] . " " . $row ["USR_LASTNAME"] . " " : "") . "<" . $row ["USR_EMAIL"] . ">";
if ($sw == 1) { if ($sw == 1) {
$to = $toAux; $to = $toAux;
@@ -5718,19 +5685,19 @@ use ProcessMaker\Plugins\PluginRegistry;
$arrayResp ['cc'] = $cc; $arrayResp ['cc'] = $cc;
} }
break; break;
case "MULTIPLE_INSTANCE_VALUE_BASED" : case "MULTIPLE_INSTANCE_VALUE_BASED":
$oTask = new Task (); $oTask = new Task();
$aTaskNext = $oTask->load ( $taskUid ); $aTaskNext = $oTask->load($taskUid);
if (isset ( $aTaskNext ["TAS_ASSIGN_VARIABLE"] ) && ! empty ( $aTaskNext ["TAS_ASSIGN_VARIABLE"] )) { if (isset($aTaskNext ["TAS_ASSIGN_VARIABLE"]) && ! empty($aTaskNext ["TAS_ASSIGN_VARIABLE"])) {
$to = null; $to = null;
$cc = null; $cc = null;
$sw = 1; $sw = 1;
$nextTaskAssignVariable = trim ( $aTaskNext ["TAS_ASSIGN_VARIABLE"], " @#" ); $nextTaskAssignVariable = trim($aTaskNext ["TAS_ASSIGN_VARIABLE"], " @#");
$arrayUsers = $arrayData [$nextTaskAssignVariable]; $arrayUsers = $arrayData [$nextTaskAssignVariable];
$oDerivation = new Derivation (); $oDerivation = new Derivation();
$userFields = $oDerivation->getUsersFullNameFromArray ( $arrayUsers ); $userFields = $oDerivation->getUsersFullNameFromArray($arrayUsers);
foreach ( $userFields as $row ) { foreach ($userFields as $row) {
$toAux = ((($row ["USR_FIRSTNAME"] != "") || ($row ["USR_LASTNAME"] != "")) ? $row ["USR_FIRSTNAME"] . " " . $row ["USR_LASTNAME"] . " " : "") . "<" . $row ["USR_EMAIL"] . ">"; $toAux = ((($row ["USR_FIRSTNAME"] != "") || ($row ["USR_LASTNAME"] != "")) ? $row ["USR_FIRSTNAME"] . " " . $row ["USR_LASTNAME"] . " " : "") . "<" . $row ["USR_EMAIL"] . ">";
if ($sw == 1) { if ($sw == 1) {
$to = $toAux; $to = $toAux;
@@ -5743,7 +5710,7 @@ use ProcessMaker\Plugins\PluginRegistry;
$arrayResp ['cc'] = $cc; $arrayResp ['cc'] = $cc;
} }
break; break;
default : default:
if (isset($userUid) && !empty($userUid)) { if (isset($userUid) && !empty($userUid)) {
$aUser = $oUser->load($userUid); $aUser = $oUser->load($userUid);
@@ -5767,9 +5734,9 @@ use ProcessMaker\Plugins\PluginRegistry;
*/ */
public function getAllObjects($PRO_UID, $APP_UID, $TAS_UID = '', $USR_UID = '', $delIndex = 0) public function getAllObjects($PRO_UID, $APP_UID, $TAS_UID = '', $USR_UID = '', $delIndex = 0)
{ {
$ACTIONS = Array('VIEW', 'BLOCK', 'DELETE'); //TO COMPLETE $ACTIONS = array('VIEW', 'BLOCK', 'DELETE'); //TO COMPLETE
$MAIN_OBJECTS = Array(); $MAIN_OBJECTS = array();
$RESULT_OBJECTS = Array(); $RESULT_OBJECTS = array();
foreach ($ACTIONS as $action) { foreach ($ACTIONS as $action) {
$MAIN_OBJECTS[$action] = $this->getAllObjectsFrom($PRO_UID, $APP_UID, $TAS_UID, $USR_UID, $action, $delIndex); $MAIN_OBJECTS[$action] = $this->getAllObjectsFrom($PRO_UID, $APP_UID, $TAS_UID, $USR_UID, $action, $delIndex);
@@ -5993,9 +5960,9 @@ use ProcessMaker\Plugins\PluginRegistry;
"OUTPUT_DOCUMENTS" => $result['OUTPUT'], "OUTPUT_DOCUMENTS" => $result['OUTPUT'],
"CASES_NOTES" => $result['CASES_NOTES'], "CASES_NOTES" => $result['CASES_NOTES'],
"MSGS_HISTORY" => $result['MSGS_HISTORY'] "MSGS_HISTORY" => $result['MSGS_HISTORY']
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/
,"SUMMARY_FORM" => $result['SUMMARY_FORM'] ,"SUMMARY_FORM" => $result['SUMMARY_FORM']
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/
); );
} }
@@ -6421,7 +6388,7 @@ use ProcessMaker\Plugins\PluginRegistry;
$oCriteria = new Criteria('dbarray'); $oCriteria = new Criteria('dbarray');
$oCriteria->setDBArrayTable('messages'); $oCriteria->setDBArrayTable('messages');
usort( $aMessages, array($this, "ordProcess") ); usort($aMessages, array($this, "ordProcess"));
return $aMessages; return $aMessages;
} }
@@ -6460,7 +6427,7 @@ use ProcessMaker\Plugins\PluginRegistry;
public function getAllObjectsFromProcess($PRO_UID, $OBJ_TYPE = '%') public function getAllObjectsFromProcess($PRO_UID, $OBJ_TYPE = '%')
{ {
$RESULT = Array(); $RESULT = array();
$oCriteria = new Criteria('workflow'); $oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(AppDocumentPeer::APP_DOC_UID); $oCriteria->addSelectColumn(AppDocumentPeer::APP_DOC_UID);
$oCriteria->addSelectColumn(AppDocumentPeer::APP_UID); $oCriteria->addSelectColumn(AppDocumentPeer::APP_UID);
@@ -6758,7 +6725,7 @@ use ProcessMaker\Plugins\PluginRegistry;
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
if (isset($sumary) && $sumary === true) { if (isset($sumary) && $sumary === true) {
$sumary = Array(); $sumary = array();
while ($rs->next()) { while ($rs->next()) {
$nCount++; $nCount++;
$row = $rs->getRow(); $row = $rs->getRow();
@@ -6769,7 +6736,7 @@ use ProcessMaker\Plugins\PluginRegistry;
$sumary[$row['PRO_UID']]['name'] = $row['APP_PRO_TITLE']; $sumary[$row['PRO_UID']]['name'] = $row['APP_PRO_TITLE'];
} }
} }
return Array('count' => $nCount, 'sumary' => $sumary); return array('count' => $nCount, 'sumary' => $sumary);
} else { } else {
while ($rs->next()) { while ($rs->next()) {
$nCount++; $nCount++;
@@ -6788,7 +6755,7 @@ use ProcessMaker\Plugins\PluginRegistry;
*/ */
public function getAllConditionCasesCount($types, $sumary = null) public function getAllConditionCasesCount($types, $sumary = null)
{ {
$aResult = Array(); $aResult = array();
foreach ($types as $type) { foreach ($types as $type) {
$aResult[$type] = $this->getConditionCasesCount($type, $sumary); $aResult[$type] = $this->getConditionCasesCount($type, $sumary);
} }
@@ -6895,7 +6862,7 @@ use ProcessMaker\Plugins\PluginRegistry;
$c = new Criteria(); $c = new Criteria();
$c->add(AppDelegationPeer::APP_UID, $aData['APP_UID']); $c->add(AppDelegationPeer::APP_UID, $aData['APP_UID']);
$c->add(AppDelegationPeer::DEL_PREVIOUS, $aData['APP_THREAD_PARENT']); $c->add(AppDelegationPeer::DEL_PREVIOUS, $aData['APP_THREAD_PARENT']);
if($status === 'OPEN'){ if ($status === 'OPEN') {
$c->add(AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN'); $c->add(AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN');
} }
$rs = AppDelegationPeer::doSelectRs($c); $rs = AppDelegationPeer::doSelectRs($c);
@@ -6959,7 +6926,7 @@ use ProcessMaker\Plugins\PluginRegistry;
global $RBAC; global $RBAC;
//Adding the actual user if this has the PM_SUPERVISOR permission assigned. //Adding the actual user if this has the PM_SUPERVISOR permission assigned.
if ($RBAC->userCanAccess('PM_SUPERVISOR') == 1) { if ($RBAC->userCanAccess('PM_SUPERVISOR') == 1) {
if(!in_array($RBAC->aUserInfo['USER_INFO']['USR_UID'], $row)) { if (!in_array($RBAC->aUserInfo['USER_INFO']['USR_UID'], $row)) {
$row[] = $RBAC->aUserInfo['USER_INFO']['USR_UID']; $row[] = $RBAC->aUserInfo['USER_INFO']['USR_UID'];
} }
} }
@@ -6974,7 +6941,7 @@ use ProcessMaker\Plugins\PluginRegistry;
$rs = UsersPeer::doSelectRs($c); $rs = UsersPeer::doSelectRs($c);
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$rows = Array(); $rows = array();
while ($rs->next()) { while ($rs->next()) {
$rows[] = $rs->getRow(); $rows[] = $rs->getRow();
} }
@@ -7000,8 +6967,8 @@ use ProcessMaker\Plugins\PluginRegistry;
$flagSupervisors = false; $flagSupervisors = false;
if ($oDataset->next()) { if ($oDataset->next()) {
if (!in_array($USR_UID,$row)) { if (!in_array($USR_UID, $row)) {
$rows[] = $oDataset->getRow(); $rows[] = $oDataset->getRow();
} }
$flagSupervisors = true; $flagSupervisors = true;
} }
@@ -7030,7 +6997,7 @@ use ProcessMaker\Plugins\PluginRegistry;
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
if ($oDataset->next()) { if ($oDataset->next()) {
if (!in_array($USR_UID,$row)) { if (!in_array($USR_UID, $row)) {
$rows[] = $oDataset->getRow(); $rows[] = $oDataset->getRow();
} }
} }
@@ -7056,7 +7023,7 @@ use ProcessMaker\Plugins\PluginRegistry;
$c->addSelectColumn(UsersPeer::USR_USERNAME); $c->addSelectColumn(UsersPeer::USR_USERNAME);
$c->addSelectColumn(UsersPeer::USR_EMAIL); $c->addSelectColumn(UsersPeer::USR_EMAIL);
if($usrStatus != '') { if ($usrStatus != '') {
$c->add(UsersPeer::USR_STATUS, $usrStatus, CRITERIA::EQUAL); $c->add(UsersPeer::USR_STATUS, $usrStatus, CRITERIA::EQUAL);
} }
@@ -7069,7 +7036,7 @@ use ProcessMaker\Plugins\PluginRegistry;
$rs->next(); $rs->next();
while ($row = $rs->getRow()) { while ($row = $rs->getRow()) {
//In some cases the thread does not have a User Script task, Itee //In some cases the thread does not have a User Script task, Itee
if($row['USR_UID'] !== ''){ if ($row['USR_UID'] !== '') {
$rows[$row['USR_UID']] = $row; $rows[$row['USR_UID']] = $row;
} }
$rs->next(); $rs->next();
@@ -7081,7 +7048,7 @@ use ProcessMaker\Plugins\PluginRegistry;
public function getCaseNotes($applicationID, $type = 'array', $userUid = '') public function getCaseNotes($applicationID, $type = 'array', $userUid = '')
{ {
require_once ( "classes/model/AppNotes.php" ); require_once("classes/model/AppNotes.php");
$appNotes = new AppNotes(); $appNotes = new AppNotes();
$appNotes = $appNotes->getNotesList($applicationID, $userUid); $appNotes = $appNotes->getNotesList($applicationID, $userUid);
$response = ''; $response = '';
@@ -7206,27 +7173,26 @@ use ProcessMaker\Plugins\PluginRegistry;
$pmTableName = $pmTable->toCamelCase($tableName); $pmTableName = $pmTable->toCamelCase($tableName);
//DELETE //DELETE
require_once (PATH_WORKSPACE . "classes" . PATH_SEP . "$pmTableName.php"); require_once(PATH_WORKSPACE . "classes" . PATH_SEP . "$pmTableName.php");
$criteria3 = new Criteria("workflow"); $criteria3 = new Criteria("workflow");
eval("\$criteria3->add(" . $pmTableName . "Peer::APP_UID, \$applicationUid);"); eval("\$criteria3->add(" . $pmTableName . "Peer::APP_UID, \$applicationUid);");
eval($pmTableName . "Peer::doDelete(\$criteria3);"); eval($pmTableName . "Peer::doDelete(\$criteria3);");
} catch (Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }
} }
public function ordProcess ($a, $b) public function ordProcess($a, $b)
{ {
if ($this->sort == '') { if ($this->sort == '') {
$this->sort = 'APP_MSG_DATE'; $this->sort = 'APP_MSG_DATE';
} }
if ($this->dir=='ASC') { if ($this->dir=='ASC') {
if ($a[$this->sort] > $b[$this->sort]) { if ($a[$this->sort] > $b[$this->sort]) {
return 1; return 1;
} elseif ($a[$this->sort] < $b[$this->sort]) { } elseif ($a[$this->sort] < $b[$this->sort]) {
return - 1; return - 1;
} else { } else {
@@ -7234,16 +7200,17 @@ use ProcessMaker\Plugins\PluginRegistry;
} }
} else { } else {
if ($a[$this->sort] > $b[$this->sort]) { if ($a[$this->sort] > $b[$this->sort]) {
return - 1; return - 1;
} elseif ($a[$this->sort] < $b[$this->sort]) { } elseif ($a[$this->sort] < $b[$this->sort]) {
return 1; return 1;
} else { } else {
return 0; return 0;
} }
} }
} }
public function unserializeData($data) { public function unserializeData($data)
{
$unserializedData = @unserialize($data); $unserializedData = @unserialize($data);
// BUG 8134, FIX!// for single/double quote troubles // Unserialize with utf8 content get trouble // BUG 8134, FIX!// for single/double quote troubles // Unserialize with utf8 content get trouble
@@ -7315,26 +7282,27 @@ use ProcessMaker\Plugins\PluginRegistry;
} }
} }
private function orderStartCasesByCategoryAndName ($rows) { private function orderStartCasesByCategoryAndName($rows)
{
//now we order in category, proces_name order: //now we order in category, proces_name order:
$comparatorSequence = array( $comparatorSequence = array(
function($a, $b) { function ($a, $b) {
$retval = 0; $retval = 0;
if(array_key_exists('catname', $a) && array_key_exists('catname', $b)) { if (array_key_exists('catname', $a) && array_key_exists('catname', $b)) {
$retval = strcmp($a['catname'], $b['catname']); $retval = strcmp($a['catname'], $b['catname']);
} }
return $retval; return $retval;
} }
, function($a, $b) { , function ($a, $b) {
$retval = 0; $retval = 0;
if(array_key_exists('value', $a) && array_key_exists('value', $b)) { if (array_key_exists('value', $a) && array_key_exists('value', $b)) {
$retval = strcmp($a['value'], $b['value']); $retval = strcmp($a['value'], $b['value']);
}
return $retval;
} }
return $retval;
}
); );
usort($rows, function($a, $b) use ($comparatorSequence) { usort($rows, function ($a, $b) use ($comparatorSequence) {
foreach ($comparatorSequence as $cmpFn) { foreach ($comparatorSequence as $cmpFn) {
$diff = call_user_func($cmpFn, $a, $b); $diff = call_user_func($cmpFn, $a, $b);
if ($diff !== 0) { if ($diff !== 0) {

View File

@@ -1,50 +1,14 @@
<?php <?php
/**
* class.configuration.php
*
* @package workflow.engine.ProcessMaker
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
//
// It works with the table CONFIGURATION in a WF dataBase
// Copyright (C) 2007 COLOSA
// License: LGPL, see LICENSE
////////////////////////////////////////////////////
/** /**
* ProcessConfiguration - ProcessConfiguration * ProcessConfiguration - ProcessConfiguration
/**
* Extends Configuration * Extends Configuration
* *
*
* @copyright 2007 COLOSA
* @version Release: @package_version@ * @version Release: @package_version@
* @package workflow.engine.ProcessMaker * @package workflow.engine.ProcessMaker
*/class Configurations // extends Configuration */
class Configurations // extends Configuration
{ {
public $aConfig = array(); public $aConfig = array();
private $Configuration = null; private $Configuration = null;
private $UserConfig = null; private $UserConfig = null;
@@ -74,16 +38,16 @@
$this->arrayClone($object[$k], $cloneObject[$k]); $this->arrayClone($object[$k], $cloneObject[$k]);
} }
} else { } else {
if (is_object( $object )) { if (is_object($object)) {
} else { } else {
$cloneObject = null; $cloneObject = null;
} }
} }
} }
public function exists($cfgID,$objID='') public function exists($cfgID, $objID='')
{ {
return $this->Configuration->exists($cfgID,$objID,'','',''); return $this->Configuration->exists($cfgID, $objID, '', '', '');
} }
/** /**
@@ -162,7 +126,6 @@
try { try {
$this->Fields = $this->Configuration->load($cfg, $obj, $pro, $usr, $app); $this->Fields = $this->Configuration->load($cfg, $obj, $pro, $usr, $app);
} catch (Exception $e) { } catch (Exception $e) {
} // the configuration does not exist } // the configuration does not exist
@@ -171,7 +134,7 @@
} }
if (!is_array($this->aConfig)) { if (!is_array($this->aConfig)) {
$this->aConfig = Array(); $this->aConfig = array();
} }
return $this->aConfig; return $this->aConfig;
@@ -318,8 +281,8 @@
$theFormat = $this->UserConfig['format']; $theFormat = $this->UserConfig['format'];
$fname = $oUser->getUsrFirstname(); $fname = $oUser->getUsrFirstname();
$lname = $oUser->getUsrLastname(); $lname = $oUser->getUsrLastname();
if (strpos($theFormat, ',') !== false && ( trim($fname) == '' || trim($lname) == '')) { if (strpos($theFormat, ',') !== false && (trim($fname) == '' || trim($lname) == '')) {
$theFormat = str_replace(',', '', $theFormat); $theFormat = str_replace(',', '', $theFormat);
} }
$aux = str_replace('@userName', trim($username), $theFormat); $aux = str_replace('@userName', trim($username), $theFormat);
@@ -530,15 +493,15 @@
public function getUserNameFormats() public function getUserNameFormats()
{ {
$formats[] = Array('id' => '@firstName @lastName', //the id , don't translate $formats[] = array('id' => '@firstName @lastName', //the id , don't translate
'name' => G::loadTranslation('ID_USERNAME_FORMAT_1') //label displayed, can be translated 'name' => G::loadTranslation('ID_USERNAME_FORMAT_1') //label displayed, can be translated
); );
$formats[] = Array('id' => '@firstName @lastName (@userName)', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_2')); $formats[] = array('id' => '@firstName @lastName (@userName)', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_2'));
$formats[] = Array('id' => '@userName', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_3')); $formats[] = array('id' => '@userName', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_3'));
$formats[] = Array('id' => '@userName (@firstName @lastName)', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_4')); $formats[] = array('id' => '@userName (@firstName @lastName)', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_4'));
$formats[] = Array('id' => '@lastName @firstName', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_5')); $formats[] = array('id' => '@lastName @firstName', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_5'));
$formats[] = Array('id' => '@lastName, @firstName', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_6')); $formats[] = array('id' => '@lastName, @firstName', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_6'));
$formats[] = Array('id' => '@lastName, @firstName (@userName)', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_7')); $formats[] = array('id' => '@lastName, @firstName (@userName)', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_7'));
return $formats; return $formats;
} }
@@ -553,9 +516,9 @@
$creationDateMask = ($creationDateMask == '') ? $dateFormat : $creationDateMask; $creationDateMask = ($creationDateMask == '') ? $dateFormat : $creationDateMask;
if ($creationDateMask != '') { if ($creationDateMask != '') {
if (strpos($dateTime, ' ') !== false) { if (strpos($dateTime, ' ') !== false) {
list ($date, $time) = explode(' ', $dateTime); list($date, $time) = explode(' ', $dateTime);
list ($y, $m, $d) = explode('-', $date); list($y, $m, $d) = explode('-', $date);
list ($h, $i, $s) = explode(':', $time); list($h, $i, $s) = explode(':', $time);
$newCreation = ''; $newCreation = '';
$maskTime = array('d' => '%d', 'D' => '%A', 'j' => '%d', 'l' => '%A', 'G' => '%I', 'g' => '%i', 'N' => '%u', 'S' => '%d', 'w' => '%w', 'z' => '%j', 'W' => '%W', 'F' => '%B', 'm' => '%m', 'M' => '%B', 'n' => '%m', 'o' => '%Y', 'Y' => '%Y', 'y' => '%g', 'a' => '%p', 'A' => '%p', 'g' => '%I', 'G' => '%H', 'h' => '%I', 'H' => '%H', 'i' => '%M', 's' => '%S'); $maskTime = array('d' => '%d', 'D' => '%A', 'j' => '%d', 'l' => '%A', 'G' => '%I', 'g' => '%i', 'N' => '%u', 'S' => '%d', 'w' => '%w', 'z' => '%j', 'W' => '%W', 'F' => '%B', 'm' => '%m', 'M' => '%B', 'n' => '%m', 'o' => '%Y', 'Y' => '%Y', 'y' => '%g', 'a' => '%p', 'A' => '%p', 'g' => '%I', 'G' => '%H', 'h' => '%I', 'H' => '%H', 'i' => '%M', 's' => '%S');
$creationDateMask = trim($creationDateMask); $creationDateMask = trim($creationDateMask);
@@ -582,9 +545,9 @@
if (G::toLower(PHP_OS) == 'linux' || G::toLower(PHP_OS) == 'darwin') { if (G::toLower(PHP_OS) == 'linux' || G::toLower(PHP_OS) == 'darwin') {
if (SYS_LANG == 'es') { if (SYS_LANG == 'es') {
$langLocate = 'es_ES'; $langLocate = 'es_ES';
} else if (strlen(SYS_LANG) > 2) { } elseif (strlen(SYS_LANG) > 2) {
$langLocate = str_replace('-', '_', SYS_LANG); $langLocate = str_replace('-', '_', SYS_LANG);
} else if ($location != '') { } elseif ($location != '') {
$langLocate = SYS_LANG.'_'.$location; $langLocate = SYS_LANG.'_'.$location;
} else { } else {
$langLocate = 'en_US'; $langLocate = 'en_US';

View File

@@ -352,7 +352,7 @@
); );
//Use search index to return list of cases //Use search index to return list of cases
$searchIndex = new BpmnEngine_Services_SearchIndex($appSolr->isSolrEnabled(), $solrEnv["solr_host"]); $searchIndex = new BpmnEngineServicesSearchIndex($appSolr->isSolrEnabled(), $solrEnv["solr_host"]);
//Execute query //Execute query
$solrQueryResult = $searchIndex->getDataTablePaginatedList($solrRequestData); $solrQueryResult = $searchIndex->getDataTablePaginatedList($solrRequestData);

View File

@@ -419,7 +419,7 @@ class Cases
) )
); );
//Use search index to return list of cases //Use search index to return list of cases
$searchIndex = new \BpmnEngine_Services_SearchIndex($appSolr->isSolrEnabled(), $solrEnv["solr_host"]); $searchIndex = new \BpmnEngineServicesSearchIndex($appSolr->isSolrEnabled(), $solrEnv["solr_host"]);
//Execute query //Execute query
$solrQueryResult = $searchIndex->getDataTablePaginatedList($solrRequestData); $solrQueryResult = $searchIndex->getDataTablePaginatedList($solrRequestData);
//Get the missing data from database //Get the missing data from database