Merge branch 'master' of bitbucket.org:colosa/processmaker
This commit is contained in:
@@ -296,7 +296,7 @@ class DynaForm
|
||||
$processUid = $arrayDataUid["PRO_UID"];
|
||||
|
||||
//Verify data
|
||||
if (!$this->dynaFormAssignedStep($dynaFormUid, $processUid)) {
|
||||
if ($this->dynaFormAssignedStep($dynaFormUid, $processUid)) {
|
||||
throw (new \Exception("You cannot delete this Dynaform while it is assigned to a step"));
|
||||
}
|
||||
|
||||
|
||||
@@ -186,7 +186,7 @@ class OutputDocument
|
||||
$aRow['OUT_DOC_TITLE'] = $outputDocumentObj['OUT_DOC_TITLE'];
|
||||
$aRow['OUT_DOC_DESCRIPTION'] = $outputDocumentObj['OUT_DOC_DESCRIPTION'];
|
||||
} else {
|
||||
$outputDocArray[] = array('out_doc_uid' => $aRow['OUT_DOC_UID'],
|
||||
$outputDocArray = array('out_doc_uid' => $aRow['OUT_DOC_UID'],
|
||||
'out_doc_title' => $aRow['OUT_DOC_TITLE'],
|
||||
'out_doc_description' => $aRow['OUT_DOC_DESCRIPTION'],
|
||||
'out_doc_filename' => $aRow['OUT_DOC_FILENAME'],
|
||||
|
||||
@@ -296,5 +296,44 @@ class ProcessSupervisor
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign a supervisor of a process
|
||||
*
|
||||
* @param string $sProcessUID
|
||||
* @param string $sUsrUID
|
||||
* @param string $sTypeUID
|
||||
* @access public
|
||||
*/
|
||||
public function addSupervisor($sProcessUID, $sUsrUID, $sTypeUID)
|
||||
{
|
||||
$oProcessUser = new \ProcessUser ( );
|
||||
$puType = 'SUPERVISOR';
|
||||
if ($sTypeUID == 'Group') {
|
||||
$puType = 'GROUP_SUPERVISOR';
|
||||
}
|
||||
|
||||
$oTypeAssigneeG = \GroupwfPeer::retrieveByPK( $sUsrUID );
|
||||
$oTypeAssigneeU = \UsersPeer::retrieveByPK( $sUsrUID );
|
||||
|
||||
if (is_null( $oTypeAssigneeG ) && is_null( $oTypeAssigneeU ) ) {
|
||||
throw (new \Exception( 'This id: '. $sUsrUID .' do not correspond to a registered ' .$sTypeUID ));
|
||||
}
|
||||
if (is_null( $oTypeAssigneeG ) && ! is_null( $oTypeAssigneeU) ) {
|
||||
$type = "user";
|
||||
if ( $type != $assType ) {
|
||||
throw (new \Exception( 'This id: '. $sUsrUID .' do not correspond to a registered ' .$sTypeUID ));
|
||||
}
|
||||
}
|
||||
if (! is_null( $oTypeAssigneeG ) && is_null( $oTypeAssigneeU ) ) {
|
||||
$type = "group";
|
||||
if ( $type != $assType ) {
|
||||
throw (new \Exception( 'This id: '. $sUsrUID .' do not correspond to a registered ' .$sTypeUID ));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$oProcessUser->create(array('PU_UID' => \G::generateUniqueID(), 'PRO_UID' => $sProcessUID, 'USR_UID' => $sUsrUID, 'PU_TYPE' => $puType));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ class ProcessSupervisors extends Api
|
||||
*
|
||||
* @url GET /:prjUid/supervisors
|
||||
*/
|
||||
public function doGetProjectSupervisors($prjUid, $filter = '', $start = null, $limit = null)
|
||||
public function doGetSupervisors($prjUid, $filter = '', $start = null, $limit = null)
|
||||
{
|
||||
try {
|
||||
$supervisor = new \BusinessModel\ProcessSupervisor();
|
||||
@@ -38,7 +38,7 @@ class ProcessSupervisors extends Api
|
||||
*
|
||||
* @url GET /:prjUid/inputdocument-supervisor
|
||||
*/
|
||||
public function doGetProjectInputDocumentSupervisor($prjUid)
|
||||
public function doGetInputDocumentSupervisor($prjUid)
|
||||
{
|
||||
try {
|
||||
$supervisor = new \BusinessModel\ProcessSupervisor();
|
||||
@@ -57,7 +57,7 @@ class ProcessSupervisors extends Api
|
||||
*
|
||||
* @url GET /:prjUid/dynaform-supervisor
|
||||
*/
|
||||
public function doGetProjectDynaformSupervisor($prjUid)
|
||||
public function doGetDynaformSupervisor($prjUid)
|
||||
{
|
||||
try {
|
||||
$supervisor = new \BusinessModel\ProcessSupervisor();
|
||||
@@ -128,4 +128,28 @@ class ProcessSupervisors extends Api
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @url POST /:prjUid/supervisor
|
||||
*
|
||||
* @param string $prjUid
|
||||
* @param string $sup_uid
|
||||
* @param string $sup_type {@choice user,group}
|
||||
*
|
||||
* @status 201
|
||||
*/
|
||||
public function doPostSupervisors($prjUid, $sup_uid, $sup_type)
|
||||
{
|
||||
try {
|
||||
$supervisor = new \BusinessModel\ProcessSupervisor();
|
||||
$sup_type=ucwords($sup_type);
|
||||
$arrayData = $supervisor->addSupervisor($prjUid, $sup_uid, $sup_type);
|
||||
} catch (\Exception $e) {
|
||||
//Response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user