Merge branch 'master' of bitbucket.org:colosa/processmaker

This commit is contained in:
Daniel Rojas
2014-06-25 11:39:01 -04:00
9 changed files with 46 additions and 48 deletions

View File

@@ -33,7 +33,7 @@ Feature: Output Documents Negative Tests
| test_description | sch_del_user_name | tas_uid | sch_name | sch_option | sch_start_date | sch_end_date | sch_start_time | sch_week_days | sch_start_day | sch_start_day_opt_1 | sch_months | sch_start_day_opt_2 | sch_repeat_every | error_code | error_message |
| Invalid sch_option | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Daily 123@#$ 21 | 20 | 2014-01-30 | 2014-02-20 | 12:00 | | | | | | | 400 | sch_option |
| Invalid sch_del_user_name | sample | 46941969352af5be2ab3f39001216717 | Case Scheduler-Weekly monday 345%$# | 2 | 2014-02-20 | 2014-03-20 | 08:00 | 1 | | | | | | 400 | User |
| Invalid sch_del_user_name | sample | 46941969352af5be2ab3f39001216717 | Case Scheduler-Weekly monday 345%$# | 2 | 2014-02-20 | 2014-03-20 | 08:00 | 1 | | | | | | 400 | user |
| Invalid tas_uid | admin | 00000000000005be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 1 | 3 | 2014-03-21 | 2014-04-18 | 18:00 | | 1 | 15 | 3\|4 | | | 400 | Task not found |
| Invalid sch_start_time | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 2 | 3 | 2014-03-21 | 2014-04-18 | 39:00:99 | | 1 | 15 | 1\|2\|5\|6\|7\|8\|9\|10\|11\|12 | | | 400 | sch_start_time |
| Invalid sch_start_date | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 3 | 3 | 2014-20-35 | 2014-04-18 | 18:00 | | 2 | | 3\|4\|5 | 1\|7 | | 400 | sch_start_date |
@@ -46,7 +46,7 @@ Feature: Output Documents Negative Tests
| Invalid sch_repeat_every | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Every 987&%@ 10 | 5 | | | | | | | | | 43:30 | 400 | sch_repeat_every |
| Field requered sch_option | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Daily 123@#$ 11 | | 2014-01-30 | 2014-02-20 | 12:00 | | | | | | | 400 | sch_option |
| Field requered sch_name | admin | 46941969352af5be2ab3f39001216717 | | 2 | 2014-02-20 | 2014-03-20 | 08:00 | 1 | | | | | | 400 | sch_name |
| Field requered sch_del_user_name | | 46941969352af5be2ab3f39001216717 | Case Scheduler-Weekly 345%$# 12 | 2 | 2014-02-20 | 2014-03-20 | 08:00 | 2\|3\|4\|5\|6\|7 | | | | | | 400 | User |
| Field requered sch_del_user_name | | 46941969352af5be2ab3f39001216717 | Case Scheduler-Weekly 345%$# 12 | 2 | 2014-02-20 | 2014-03-20 | 08:00 | 2\|3\|4\|5\|6\|7 | | | | | | 400 | user |
| Field requered tas_uid | admin | | Case Scheduler-Monthly 567&^% 14 | 3 | 2014-03-21 | 2014-04-18 | 39:00:99 | | 1 | 15 | 1\|2\|5\|6\|7\|8\|9\|10\|11\|12 | | | 400 | tas_uid |
| Field requered sch_start_time | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 15 | 3 | 2014-20-35 | 2014-04-18 | | | 2 | | 3\|4\|5 | 1\|7 | | 400 | sch_start_time |
| Field requered sch_start_date | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 16 | 3 | | 2014-04-18 | 18:00 | 8\|9\|10 | 2 | | 3\|4\|5 | 2\|6 | | 400 | sch_start_date |

View File

@@ -44,9 +44,9 @@ Feature: Files Manager Resources
Examples:
| test_description | file_name | path | content | http_code | type | i |
| into public folder | testbehat1.txt | public/ | test | 200 | object | 0 |
| into mailtemplates folder | testbehat1.txt | templates/ | test | 200 | object | 1 |
| into mailtemplates folder | testbehat1.html | templates/ | test | 200 | object | 1 |
| into public subfolder | testbehat1.txt | public/test_folder | test | 200 | object | 2 |
| into mailtemplates subfolder | testbehat1.txt | templates/test_folder | test | 200 | object | 3 |
| into mailtemplates subfolder | testbehat1.html | templates/test_folder | test | 200 | object | 3 |
Scenario Outline: Post files
Given PUT this data:

View File

@@ -13,8 +13,7 @@ Scenario Outline: Import a process negative tests
Examples:
| Description | project_file | import_option | error_code | error_message |
| Import process when the process alredy exists | /home/wendy/uploadfiles/Process_Complete_BPMN.pmx | create | 400 | already exists |
| Field Required project_file | | create | 400 | project_file |
Scenario Outline: Import a process with wrong "option"
Given POST upload a project file "<project_file>" to "project/import?option=<option>&option_group=<option_group>"

View File

@@ -441,6 +441,10 @@ abstract class ResultSetCommon {
if (!array_key_exists($idx, $this->fields)) { throw new SQLException("Invalid resultset column: " . $column); }
if ($this->fields[$idx] === null) { return null; }
if ($this->fields[$idx] . "" == "") {
return "";
}
if (($this->fields[$idx] == '0000-00-00 00:00:00') || ($this->fields[$idx] == '0000-00-00')) {
$ts = '0';
}
@@ -459,4 +463,5 @@ abstract class ResultSetCommon {
return date($format, $ts);
}
}
}
}

View File

@@ -266,6 +266,12 @@ class Group
//Verify data
$this->throwExceptionIfNotExistsGroup($groupUid, $this->arrayFieldNameForException["groupUid"]);
$arrayTotalTasksByGroup = $this->getTotalTasksByGroup($groupUid);
if (isset($arrayTotalTasksByGroup[$groupUid]) && $arrayTotalTasksByGroup[$groupUid] > 0) {
throw new \Exception(\G::LoadTranslation("ID_GROUP_CANNOT_DELETE_WHILE_ASSIGNED_TO_TASK"));
}
//Delete
$group = new \Groupwf();
@@ -343,7 +349,7 @@ class Group
$criteria = new \Criteria("workflow");
$criteria->addSelectColumn(\GroupUserPeer::GRP_UID);
$criteria->addSelectColumn("COUNT(" . \GroupUserPeer::GRP_UID . ") AS NUM_REC");
$criteria->addAsColumn("NUM_REC", "COUNT(" . \GroupUserPeer::GRP_UID . ")");
$criteria->addJoin(\GroupUserPeer::USR_UID, \UsersPeer::USR_UID, \Criteria::INNER_JOIN);
if ($groupUid != "") {
@@ -359,7 +365,7 @@ class Group
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
$arrayData[$row["GRP_UID"]] = $row["NUM_REC"];
$arrayData[$row["GRP_UID"]] = (int)($row["NUM_REC"]);
}
//Return
@@ -390,7 +396,7 @@ class Group
$criteria = new \Criteria("workflow");
$criteria->addAsColumn("GRP_UID", \TaskUserPeer::USR_UID);
$criteria->addSelectColumn("COUNT(" . \TaskUserPeer::USR_UID . ") AS NUM_REC");
$criteria->addAsColumn("NUM_REC", "COUNT(" . \TaskUserPeer::USR_UID . ")");
if ($groupUid != "") {
$criteria->add(\TaskUserPeer::USR_UID, $groupUid, \Criteria::EQUAL);
@@ -406,7 +412,7 @@ class Group
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
$arrayData[$row["GRP_UID"]] = $row["NUM_REC"];
$arrayData[$row["GRP_UID"]] = (int)($row["NUM_REC"]);
}
//Return
@@ -430,8 +436,8 @@ class Group
$this->getFieldNameByFormatFieldName("GRP_UID") => $record["GRP_UID"],
$this->getFieldNameByFormatFieldName("GRP_TITLE") => $record["GRP_TITLE"],
$this->getFieldNameByFormatFieldName("GRP_STATUS") => $record["GRP_STATUS"],
$this->getFieldNameByFormatFieldName("GRP_USERS") => (int)($record["GRP_USERS"]),
$this->getFieldNameByFormatFieldName("GRP_TASKS") => (int)($record["GRP_TASKS"])
$this->getFieldNameByFormatFieldName("GRP_USERS") => $record["GRP_USERS"],
$this->getFieldNameByFormatFieldName("GRP_TASKS") => $record["GRP_TASKS"]
);
} catch (\Exception $e) {
throw $e;
@@ -478,7 +484,7 @@ class Group
$criteriaCount = clone $criteria;
$criteriaCount->clearSelectColumns();
$criteriaCount->addSelectColumn("COUNT(" . \GroupwfPeer::GRP_UID . ") AS NUM_REC");
$criteriaCount->addAsColumn("NUM_REC", "COUNT(" . \GroupwfPeer::GRP_UID . ")");
$rsCriteriaCount = \GroupwfPeer::doSelectRS($criteriaCount);
$rsCriteriaCount->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
@@ -486,22 +492,16 @@ class Group
$rsCriteriaCount->next();
$row = $rsCriteriaCount->getRow();
$numRecTotal = $row["NUM_REC"];
$numRecTotal = (int)($row["NUM_REC"]);
//SQL
if (!is_null($sortField) && trim($sortField) != "") {
$sortField = strtoupper($sortField);
switch ($sortField) {
case "GRP_UID":
case "GRP_STATUS":
case "GRP_LDAP_DN":
case "GRP_UX":
$sortField = \GroupwfPeer::TABLE_NAME . "." . $sortField;
break;
default:
$sortField = "GRP_TITLE";
break;
if (in_array($sortField, array("GRP_UID", "GRP_STATUS", "GRP_LDAP_DN", "GRP_UX"))) {
$sortField = \GroupwfPeer::TABLE_NAME . "." . $sortField;
} else {
$sortField = "GRP_TITLE";
}
} else {
$sortField = "GRP_TITLE";
@@ -708,7 +708,7 @@ class Group
$criteriaCount = clone $criteria;
$criteriaCount->clearSelectColumns();
$criteriaCount->addSelectColumn("COUNT(" . \UsersPeer::USR_UID . ") AS NUM_REC");
$criteriaCount->addAsColumn("NUM_REC", "COUNT(" . \UsersPeer::USR_UID . ")");
$rsCriteriaCount = \UsersPeer::doSelectRS($criteriaCount);
$rsCriteriaCount->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
@@ -716,24 +716,16 @@ class Group
$rsCriteriaCount->next();
$row = $rsCriteriaCount->getRow();
$numRecTotal = $row["NUM_REC"];
$numRecTotal = (int)($row["NUM_REC"]);
//SQL
if (!is_null($sortField) && trim($sortField) != "") {
$sortField = strtoupper($sortField);
switch ($sortField) {
case "USR_UID":
case "USR_USERNAME":
case "USR_FIRSTNAME":
case "USR_LASTNAME":
case "USR_EMAIL":
case "USR_STATUS":
$sortField = \UsersPeer::TABLE_NAME . "." . $sortField;
break;
default:
$sortField = \UsersPeer::USR_USERNAME;
break;
if (in_array($sortField, array("USR_UID", "USR_USERNAME", "USR_FIRSTNAME", "USR_LASTNAME", "USR_EMAIL", "USR_STATUS"))) {
$sortField = \UsersPeer::TABLE_NAME . "." . $sortField;
} else {
$sortField = \UsersPeer::USR_USERNAME;
}
} else {
$sortField = \UsersPeer::USR_USERNAME;

View File

@@ -302,7 +302,7 @@ class ProcessCategory
$arrayTotalProcessesByCategory = $process->getAllProcessesByCategory();
if (isset($arrayTotalProcessesByCategory[$categoryUid])) {
if (isset($arrayTotalProcessesByCategory[$categoryUid]) && (int)($arrayTotalProcessesByCategory[$categoryUid])> 0) {
throw new \Exception(\G::LoadTranslation("ID_MSG_CANNOT_DELETE_CATEGORY"));
}
@@ -351,7 +351,7 @@ class ProcessCategory
return array(
$this->getFieldNameByFormatFieldName("CAT_UID") => $record["CATEGORY_UID"],
$this->getFieldNameByFormatFieldName("CAT_NAME") => $record["CATEGORY_NAME"],
$this->getFieldNameByFormatFieldName("CAT_TOTAL_PROCESSES") => (int)($record["CATEGORY_TOTAL_PROCESSES"])
$this->getFieldNameByFormatFieldName("CAT_TOTAL_PROCESSES") => $record["CATEGORY_TOTAL_PROCESSES"]
);
} catch (\Exception $e) {
throw $e;
@@ -408,7 +408,7 @@ class ProcessCategory
$rsCriteriaCount->next();
$row = $rsCriteriaCount->getRow();
$numRecTotal = $row["NUM_REC"];
$numRecTotal = (int)($row["NUM_REC"]);
//SQL
if (!is_null($sortField) && trim($sortField) != "") {
@@ -444,7 +444,7 @@ class ProcessCategory
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
$row["CATEGORY_TOTAL_PROCESSES"] = (isset($arrayTotalProcessesByCategory[$row["CATEGORY_UID"]]))? $arrayTotalProcessesByCategory[$row["CATEGORY_UID"]] : 0;
$row["CATEGORY_TOTAL_PROCESSES"] = (isset($arrayTotalProcessesByCategory[$row["CATEGORY_UID"]]))? (int)($arrayTotalProcessesByCategory[$row["CATEGORY_UID"]]) : 0;
$arrayCategory[] = $this->getCategoryDataFromRecord($row);
}
@@ -491,7 +491,7 @@ class ProcessCategory
$row = $rsCriteria->getRow();
if (!$flagGetRecord) {
$row["CATEGORY_TOTAL_PROCESSES"] = (isset($arrayTotalProcessesByCategory[$row["CATEGORY_UID"]]))? $arrayTotalProcessesByCategory[$row["CATEGORY_UID"]] : 0;
$row["CATEGORY_TOTAL_PROCESSES"] = (isset($arrayTotalProcessesByCategory[$row["CATEGORY_UID"]]))? (int)($arrayTotalProcessesByCategory[$row["CATEGORY_UID"]]) : 0;
}
//Return

View File

@@ -530,7 +530,7 @@ class Role
$rsCriteriaCount->next();
$row = $rsCriteriaCount->getRow();
$numRecTotal = $row["NUM_REC"];
$numRecTotal = (int)($row["NUM_REC"]);
//SQL
if (!is_null($sortField) && trim($sortField) != "") {

View File

@@ -105,8 +105,6 @@ class Bpmn extends Handler
// setting defaults
$data['PRJ_UID'] = array_key_exists('PRJ_UID', $data) ? $data['PRJ_UID'] : Common::generateUID();
unset($data["PRJ_UPDATE_DATE"]);
self::log("Create Project with data: ", $data);
$this->project = new Project();
$this->project->fromArray($data, BasePeer::TYPE_FIELDNAME);

View File

@@ -44,7 +44,11 @@ class Workflow extends Handler
$process = new Process();
$processData = $process->load($proUid);
} catch (\Exception $e) {
throw $e;
if (is_null(\ProcessPeer::retrieveByPK($proUid))) {
throw new Exception\ProjectNotFound($me, $proUid);
} else {
throw $e;
}
}
$me->process = $processData;