Merge branch 'master' of bitbucket.org:colosa/processmaker
This commit is contained in:
@@ -1597,8 +1597,8 @@ class Processes
|
||||
try {
|
||||
$aOutput = array ();
|
||||
$oCriteria = new Criteria( 'workflow' );
|
||||
$oCriteria->add( OutputdocumentPeer::PRO_UID, $sProUid );
|
||||
$oDataset = OutputdocumentPeer::doSelectRS( $oCriteria );
|
||||
$oCriteria->add( OutputDocumentPeer::PRO_UID, $sProUid );
|
||||
$oDataset = OutputDocumentPeer::doSelectRS( $oCriteria );
|
||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
|
||||
@@ -54,5 +54,11 @@ class ProcessCategory extends BaseProcessCategory
|
||||
$aRow = $dataset->getRow();
|
||||
return $aRow;
|
||||
}
|
||||
|
||||
public function exists ($catUid)
|
||||
{
|
||||
$oProCat = ProcessCategoryPeer::retrieveByPk( $catUid );
|
||||
return (is_object( $oProCat ) && get_class( $oProCat ) == 'ProcessCategory');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class Cases
|
||||
$dir = isset( $dataList["dir"] ) ? $dataList["dir"] : "DESC";
|
||||
$sort = isset( $dataList["sort"] ) ? $dataList["sort"] : "APP_CACHE_VIEW.APP_NUMBER";
|
||||
$start = isset( $dataList["start"] ) ? $dataList["start"] : "0";
|
||||
$limit = isset( $dataList["limit"] ) ? $dataList["limit"] : "25";
|
||||
$limit = isset( $dataList["limit"] ) ? $dataList["limit"] : "config";
|
||||
$filter = isset( $dataList["filter"] ) ? $dataList["filter"] : "";
|
||||
$process = isset( $dataList["process"] ) ? $dataList["process"] : "";
|
||||
$category = isset( $dataList["category"] ) ? $dataList["category"] : "";
|
||||
@@ -47,8 +47,8 @@ class Cases
|
||||
$action = isset( $dataList["action"] ) ? $dataList["action"] : "todo";
|
||||
$paged = isset( $dataList["paged"] ) ? $dataList["paged"] : true;
|
||||
$type = "extjs";
|
||||
$dateFrom = isset( $dataList["dateFrom"] ) ? substr( $dataList["dateFrom"], 0, 10 ) : "";
|
||||
$dateTo = isset( $dataList["dateTo"] ) ? substr( $dataList["dateTo"], 0, 10 ) : "";
|
||||
$dateFrom = (!empty( $dataList["dateFrom"] )) ? substr( $dataList["dateFrom"], 0, 10 ) : "";
|
||||
$dateTo = (!empty( $dataList["dateTo"] )) ? substr( $dataList["dateTo"], 0, 10 ) : "";
|
||||
$first = isset( $dataList["first"] ) ? true :false;
|
||||
|
||||
$valuesCorrect = array('todo', 'draft', 'paused', 'sent', 'selfservice', 'unassigned', 'search');
|
||||
@@ -56,6 +56,55 @@ class Cases
|
||||
throw (new \Exception('The value for $action is incorrect.'));
|
||||
}
|
||||
|
||||
$start = (int)$start;
|
||||
$start = abs($start);
|
||||
if ($start != 0) {
|
||||
$start--;
|
||||
}
|
||||
if ($limit == 'config') {
|
||||
G::LoadClass("configuration");
|
||||
$conf = new \Configurations();
|
||||
$generalConfCasesList = $conf->getConfiguration('ENVIRONMENT_SETTINGS', '');
|
||||
if (isset($generalConfCasesList['casesListRowNumber'])) {
|
||||
$limit = (int)$generalConfCasesList['casesListRowNumber'];
|
||||
} else {
|
||||
$limit = 25;
|
||||
}
|
||||
} else {
|
||||
$limit = (int)$limit;
|
||||
}
|
||||
if ($sort != 'APP_CACHE_VIEW.APP_NUMBER') {
|
||||
$sort = G::toUpper($sort);
|
||||
$columnsAppCacheView = \AppCacheViewPeer::getFieldNames(\BasePeer::TYPE_FIELDNAME);
|
||||
if (!(in_array($sort, $columnsAppCacheView))) {
|
||||
$sort = 'APP_CACHE_VIEW.APP_NUMBER';
|
||||
}
|
||||
}
|
||||
$dir = G::toUpper($dir);
|
||||
if (!($dir == 'DESC' || $dir == 'ASC')) {
|
||||
$dir = 'DESC';
|
||||
}
|
||||
if ($process != '') {
|
||||
Validator::proUid($process, '$pro_uid');
|
||||
}
|
||||
if ($category != '') {
|
||||
Validator::catUid($category, '$cat_uid');
|
||||
}
|
||||
$status = G::toUpper($status);
|
||||
$listStatus = array('TODO', 'DRAFT', 'COMPLETED', 'CANCEL', 'OPEN', 'CLOSE');
|
||||
if (!(in_array($status, $listStatus))) {
|
||||
$status = '';
|
||||
}
|
||||
if ($user != '') {
|
||||
Validator::usrUid($user, '$usr_uid');
|
||||
}
|
||||
if ($dateFrom != '') {
|
||||
Validator::isDate($dateFrom, 'Y-m-d', '$date_from');
|
||||
}
|
||||
if ($dateTo != '') {
|
||||
Validator::isDate($dateTo, 'Y-m-d', '$date_to');
|
||||
}
|
||||
|
||||
if ($action == 'search' || $action == 'to_reassign') {
|
||||
$userUid = ($user == "CURRENT_USER") ? $userUid : $user;
|
||||
if ($first) {
|
||||
@@ -139,13 +188,19 @@ class Cases
|
||||
} else {
|
||||
$result['total'] = $result['totalCount'];
|
||||
unset($result['totalCount']);
|
||||
|
||||
$result['start'] = $start;
|
||||
$result['start'] = $start+1;
|
||||
$result['limit'] = $limit;
|
||||
$result['sort'] = $sort;
|
||||
$result['category'] = $category;
|
||||
$result['process'] = $process;
|
||||
$result['sort'] = G::toLower($sort);
|
||||
$result['dir'] = G::toLower($dir);
|
||||
$result['cat_uid'] = $category;
|
||||
$result['pro_uid'] = $process;
|
||||
$result['search'] = $search;
|
||||
if ($action == 'search') {
|
||||
$result['app_status'] = G::toLower($status);
|
||||
$result['usr_uid'] = $user;
|
||||
$result['date_from'] = $dateFrom;
|
||||
$result['date_to'] = $dateTo;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
@@ -511,6 +566,8 @@ class Cases
|
||||
$ws = new \wsBase();
|
||||
if ($variables) {
|
||||
$variables = array_shift($variables);
|
||||
} elseif ($variables == null) {
|
||||
$variables = array(array());
|
||||
}
|
||||
$fields = $ws->newCaseImpersonate($processUid, $userUid, $variables, $taskUid);
|
||||
$array = json_decode(json_encode($fields), true);
|
||||
|
||||
@@ -171,6 +171,56 @@ class Validator{
|
||||
return $tri_uid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate pro_uid
|
||||
*
|
||||
* @param string $pro_uid, Uid for process
|
||||
* @param string $nameField . Name of field for message
|
||||
*
|
||||
* @access public
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
static public function proUid($pro_uid, $nameField = 'pro_uid')
|
||||
{
|
||||
$pro_uid = trim($pro_uid);
|
||||
if ($pro_uid == '') {
|
||||
throw (new \Exception("The process with $nameField: '' does not exist."));
|
||||
}
|
||||
$oProcess = new \Process();
|
||||
if (!($oProcess->exists($pro_uid))) {
|
||||
throw (new \Exception("The process with $nameField: '$pro_uid' does not exist."));
|
||||
}
|
||||
return $pro_uid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate cat_uid
|
||||
*
|
||||
* @param string $cat_uid, Uid for category
|
||||
* @param string $nameField . Name of field for message
|
||||
*
|
||||
* @access public
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
static public function catUid($cat_uid, $nameField = 'cat_uid')
|
||||
{
|
||||
$cat_uid = trim($cat_uid);
|
||||
if ($cat_uid == '') {
|
||||
throw (new \Exception("The category with $nameField: '' does not exist."));
|
||||
}
|
||||
$oCategory = new \ProcessCategory();
|
||||
if (!($oCategory->exists($cat_uid))) {
|
||||
throw (new \Exception("The category with $nameField: '$cat_uid' does not exist."));
|
||||
}
|
||||
return $cat_uid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate date
|
||||
*
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -228,7 +228,7 @@ class CasesTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testUpdateReassignCase(array $aResponse)
|
||||
{
|
||||
$response = $this->oCases->updateReassignCase($aResponse['app_uid'], '00000000000000000000000000000001', null, '00000000000000000000000000000001', '23063198853206b666e2bd0085065170');
|
||||
$response = $this->oCases->updateReassignCase($aResponse['app_uid'], '00000000000000000000000000000001', null, '00000000000000000000000000000001', '73005191052d56727901138030694610');
|
||||
$this->assertTrue(empty($response));
|
||||
}
|
||||
|
||||
@@ -263,7 +263,7 @@ class CasesTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* Test add Case impersonate to test route case
|
||||
* Test add Case impersonate
|
||||
*
|
||||
* @covers \BusinessModel\Cases::addCaseImpersonate
|
||||
*
|
||||
@@ -271,9 +271,8 @@ class CasesTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testAddCaseImpersonate()
|
||||
{
|
||||
$response = $this->oCases->addCaseImpersonate('1265557095225ff5c688f46031700471', '23063198853206b666e2bd0085065170', '46941969352af5be2ab3f39001216717', array('name' => 'John', 'lastname' => 'Petersson'));
|
||||
$response = $this->oCases->addCaseImpersonate('1265557095225ff5c688f46031700471', '73005191052d56727901138030694610', '46941969352af5be2ab3f39001216717', array(array('name' => 'John', 'lastname' => 'Petersson')));
|
||||
$this->assertTrue(is_object($response));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -449,7 +449,7 @@ EditPMTable = function(){
|
||||
if (row.data.TYPE != 'CLASSIC') {
|
||||
tableType = row.data.PRO_UID ? 'report' : 'table';
|
||||
proParam = PRO_UID !== false ? '&PRO_UID='+PRO_UID : '';
|
||||
location.href = 'pmTables/edit?id='+row.data.ADD_TAB_UID+'&tableType=' + tableType + proParam;
|
||||
location.href = 'pmTables/edit?id='+row.data.ADD_TAB_UID+'&flagProcessmap='+flagProcessmap+'&tableType=' + tableType + proParam;
|
||||
}
|
||||
else { //edit old report table
|
||||
location.href = 'reportTables/reportTables_Edit?REP_TAB_UID='+row.data.ADD_TAB_UID
|
||||
@@ -498,6 +498,10 @@ DeletePMTable = function() {
|
||||
Ext.Msg.alert( _('ID_ERROR'), resp.result.message);
|
||||
}
|
||||
});
|
||||
editButton.disable();
|
||||
deleteButton.disable();
|
||||
exportButton.disable();
|
||||
dataButton.disable();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user