diff --git a/tests/automated/workflow/engine/classes/classwsBaseTest.php b/tests/automated/workflow/engine/classes/classwsBaseTest.php index c136540ae..427f60f76 100644 --- a/tests/automated/workflow/engine/classes/classwsBaseTest.php +++ b/tests/automated/workflow/engine/classes/classwsBaseTest.php @@ -665,37 +665,6 @@ class classwsBaseTest extends PHPUnit_Framework_TestCase $params = $r->getParameters(); } - /** - * @covers wsBase::importProcessFromLibrary - * @todo Implement testimportProcessFromLibrary(). - */ - public function testimportProcessFromLibrary() - { - $methods = get_class_methods($this->object); - $this->assertTrue( in_array('importProcessFromLibrary', $methods ), 'exists method importProcessFromLibrary' ); - $r = new ReflectionMethod('wsBase', 'importProcessFromLibrary'); - $params = $r->getParameters(); - $this->assertTrue( $params[0]->getName() == 'processId'); - $this->assertTrue( $params[0]->isArray() == false); - $this->assertTrue( $params[0]->isOptional () == false); - $this->assertTrue( $params[1]->getName() == 'version'); - $this->assertTrue( $params[1]->isArray() == false); - $this->assertTrue( $params[1]->isOptional () == true); - $this->assertTrue( $params[1]->getDefaultValue() == ''); - $this->assertTrue( $params[2]->getName() == 'importOption'); - $this->assertTrue( $params[2]->isArray() == false); - $this->assertTrue( $params[2]->isOptional () == true); - $this->assertTrue( $params[2]->getDefaultValue() == ''); - $this->assertTrue( $params[3]->getName() == 'usernameLibrary'); - $this->assertTrue( $params[3]->isArray() == false); - $this->assertTrue( $params[3]->isOptional () == true); - $this->assertTrue( $params[3]->getDefaultValue() == ''); - $this->assertTrue( $params[4]->getName() == 'passwordLibrary'); - $this->assertTrue( $params[4]->isArray() == false); - $this->assertTrue( $params[4]->isOptional () == true); - $this->assertTrue( $params[4]->getDefaultValue() == ''); - } - /** * @covers wsBase::getCaseNotes * @todo Implement testgetCaseNotes(). diff --git a/workflow/engine/classes/class.wsBase.php b/workflow/engine/classes/class.wsBase.php index 8d5d91048..eea3faf7f 100755 --- a/workflow/engine/classes/class.wsBase.php +++ b/workflow/engine/classes/class.wsBase.php @@ -2940,137 +2940,6 @@ class wsBase * @param string passwordLibrary : The password to obtain access to the ProcessMaker library. * @return $eturns will return an object */ - public function importProcessFromLibrary ($processId, $version = '', $importOption = '', $usernameLibrary = '', $passwordLibrary = '') - { - try { - G::LoadClass( 'processes' ); - //$versionReq = $_GET['v']; - //. (isset($_GET['s']) ? '&s=' . $_GET['s'] : '') - $ipaddress = $_SERVER['REMOTE_ADDR']; - $oProcesses = new Processes(); - $oProcesses->ws_open_public(); - $oProcess = $oProcesses->ws_processGetData( $processId ); - - if ($oProcess->status_code != 0) { - throw (new Exception( $oProcess->message )); - } - - $privacy = $oProcess->privacy; - - $strSession = ''; - - if ($privacy != 'FREE') { - global $sessionId; - $antSession = $sessionId; - $oProcesses->ws_open( $usernameLibrary, $passwordLibrary ); - $strSession = "&s=" . $sessionId; - $sessionId = $antSession; - } - - //downloading the file - $localPath = PATH_DOCUMENT . 'input' . PATH_SEP; - G::mk_dir( $localPath ); - $newfilename = G::GenerateUniqueId() . '.pm'; - - $downloadUrl = PML_DOWNLOAD_URL . '?id=' . $processId . $strSession; - - $oProcess = new Processes(); - $oProcess->downloadFile( $downloadUrl, $localPath, $newfilename ); - - //getting the ProUid from the file recently downloaded - $oData = $oProcess->getProcessData( $localPath . $newfilename ); - - if (is_null( $oData )) { - $data['DOWNLOAD_URL'] = $downloadUrl; - $data['LOCAL_PATH'] = $localPath; - $data['NEW_FILENAME'] = $newfilename; - - throw new Exception( G::loadTranslation( 'ID_ERROR_URL_PROCESS_INVALID', SYS_LANG, $data ) ); - } - - $sProUid = $oData->process['PRO_UID']; - $oData->process['PRO_UID_OLD'] = $sProUid; - - //if the process exists, we need to check the $importOption to and re-import if the user wants, - if ($oProcess->processExists( $sProUid )) { - //Update the current Process, overwriting all tasks and steps - if ($importOption == 1) { - $oProcess->updateProcessFromData( $oData, $localPath . $newfilename ); - //delete the xmlform cache - - - if (file_exists( PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid )) { - $oDirectory = dir( PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid ); - - while ($sObjectName = $oDirectory->read()) { - if (($sObjectName != '.') && ($sObjectName != '..')) { - $strAux = PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP; - $strAux = $strAux . $sProUid . PATH_SEP . $sObjectName; - - unlink( $strAux ); - } - } - - $oDirectory->close(); - } - - $sNewProUid = $sProUid; - } - - //Disable current Process and create a new version of the Process - if ($importOption == 2) { - $oProcess->disablePreviousProcesses( $sProUid ); - $sNewProUid = $oProcess->getUnusedProcessGUID(); - $oProcess->setProcessGuid( $oData, $sNewProUid ); - $oProcess->setProcessParent( $oData, $sProUid ); - $oData->process['PRO_TITLE'] = "New - " . $oData->process['PRO_TITLE'] . ' - ' . date( 'M d, H:i' ); - $oProcess->renewAll( $oData ); - $oProcess->createProcessFromData( $oData, $localPath . $newfilename ); - } - - //Create a completely new Process without change the current Process - if ($importOption == 3) { - //krumo ($oData); die; - $sNewProUid = $oProcess->getUnusedProcessGUID(); - $oProcess->setProcessGuid( $oData, $sNewProUid ); - - $strAux = "Copy of - " . $oData->process['PRO_TITLE'] . ' - ' . date( 'M d, H:i' ); - - $oData->process['PRO_TITLE'] = $strAux; - $oProcess->renewAll( $oData ); - $oProcess->createProcessFromData( $oData, $localPath . $newfilename ); - } - - if ($importOption != 1 && $importOption != 2 && $importOption != 3) { - throw new Exception( G::loadTranslation( 'ID_PROCESS_ALREADY_IN_SYSTEM' ) ); - } - } - - //finally, creating the process if the process doesn't exist - if (! $oProcess->processExists( $processId )) { - $oProcess->createProcessFromData( $oData, $localPath . $newfilename ); - } - - //show the info after the imported process - $oProcess = new Processes(); - $oProcess->ws_open_public(); - $processData = $oProcess->ws_processGetData( $processId ); - - $result->status_code = 0; - $result->message = G::loadTranslation( 'ID_COMMAND_EXECUTED_SUCCESSFULLY' ); - $result->timestamp = date( 'Y-m-d H:i:s' ); - $result->processId = $processId; - $result->processTitle = $processData->title; - $result->category = (isset( $processData->category ) ? $processData->category : ''); - $result->version = $processData->version; - - return $result; - } catch (Exception $e) { - $result = new wsResponse( 100, $e->getMessage() ); - - return $result; - } - } public function getCaseNotes ($applicationID, $userUid = '') { diff --git a/workflow/engine/methods/services/pmos2.wsdl b/workflow/engine/methods/services/pmos2.wsdl index cf3a11a89..00da67108 100755 --- a/workflow/engine/methods/services/pmos2.wsdl +++ b/workflow/engine/methods/services/pmos2.wsdl @@ -740,30 +740,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - + @@ -1085,12 +1062,6 @@ - - - - - - @@ -1264,10 +1235,6 @@ - - - - @@ -1597,15 +1564,6 @@ - - - - - - - - - diff --git a/workflow/engine/methods/services/soap2.php b/workflow/engine/methods/services/soap2.php index 4891ee915..2f4c827c7 100755 --- a/workflow/engine/methods/services/soap2.php +++ b/workflow/engine/methods/services/soap2.php @@ -1026,20 +1026,6 @@ function systemInformation ($params) return $res; } -function importProcessFromLibrary ($params) -{ - $vsResult = isValidSession( $params->sessionId ); - - if ($vsResult->status_code !== 0) { - return $vsResult; - } - - $ws = new wsBase(); - $res = $ws->importProcessFromLibrary( $params->processId, $params->version, $params->importOption, $params->usernameLibrary, $params->passwordLibrary ); - - return $res; -} - function getCaseNotes ($params) { $vsResult = isValidSession( $params->sessionId ); @@ -1258,7 +1244,6 @@ $server->addFunction("TaskList"); $server->addFunction("TaskCase"); $server->addFunction("ReassignCase"); $server->addFunction("systemInformation"); -$server->addFunction("importProcessFromLibrary"); $server->addFunction("removeUserFromGroup"); $server->addFunction("getCaseNotes"); $server->addFunction("deleteCase"); diff --git a/workflow/engine/test/unit/ws/basicMethodsTest.php b/workflow/engine/test/unit/ws/basicMethodsTest.php index 9d07a9326..5a73946ef 100755 --- a/workflow/engine/test/unit/ws/basicMethodsTest.php +++ b/workflow/engine/test/unit/ws/basicMethodsTest.php @@ -103,7 +103,6 @@ $t->is( $methods[18] , 'taskCaseResponse taskCase(taskCaseRequest $parameters)' , 'taskCase'); $t->is( $methods[19] , 'systemInformationResponse systemInformation(systemInformationRequest $parameters)', 'systemInformation'); $t->is( $methods[20] , 'triggerListResponse triggerList(triggerListRequest $parameters)' , 'triggerList'); - $t->is( $methods[21] , 'importProcessFromLibraryResponse importProcessFromLibrary(importProcessFromLibraryRequest $parameters)' , 'importProcessFromLibraryRequest'); $t->diag('--------------- defined WSDL types --------------------' ); @@ -159,8 +158,6 @@ $type47 = "struct triggerListRequest {\n string sessionId;\n}"; $type48 = "struct triggerListStruct {\n string guid;\n string name;\n string processId;\n}"; $type49 = "struct triggerListResponse {\n triggerListStruct triggers;\n}"; - $type50 = "struct importProcessFromLibraryRequest {\n string sessionId;\n string processId;\n string version;\n string importOption;\n string usernameLibrary;\n string passwordLibrary;\n}"; - $type51 = "struct importProcessFromLibraryResponse {\n integer status_code;\n string message;\n string processId;\n string processTitle;\n string category;\n string version;\n}"; $t->is( $types[0 ] , $type0 , 'login ' ); $t->is( $types[1 ] , $type1 , 'loginResponse ' ); @@ -256,17 +253,6 @@ if ( $foundProcess ) { $t->is( $foundProcess, true, 'Sequential Process is present in this Workspace'); } - else { - $res = ws_importProcessFromLibrary ( PROCESS_UID_LIBRARY , '' ); - if ( $res->status_code == 0 ) { - $t->is( $res->status_code, 0, 'Process imported from Library successfully'); - $t->diag( ' processTitle ' . $res->processTitle ); - $t->diag( ' category ' . $res->category ); - $t->diag( ' version ' . $res->version ); - } - else - throw ( new Exception ( $res->message . ". Process '". PROCESS_UID ."' ") ); - } //checking the groupList $groups = ws_groupList() ; @@ -504,9 +490,3 @@ $res = ws_getCaseInfo ($caseId, $delIndex); $t->is( $res->status_code , 0 , 'ws_getCaseInfo status_code = 0'); $t->is( $res->caseStatus , 'COMPLETED' , 'ws_getCaseInfo caseStatus = ' . $res->caseStatus ); - - - - - - diff --git a/workflow/engine/test/unit/ws/bugRelease09Test.php b/workflow/engine/test/unit/ws/bugRelease09Test.php index eaa1ebaf1..03fff991f 100755 --- a/workflow/engine/test/unit/ws/bugRelease09Test.php +++ b/workflow/engine/test/unit/ws/bugRelease09Test.php @@ -46,17 +46,6 @@ if ( $foundProcess ) { $t->is( $foundProcess, true, 'Process for' .$uidName[1]. 'is present in this Workspace'); } - else { - $res = ws_importProcessFromLibrary ( $process_uid_library , '' , 3, PML_USER_ID, PML_USER_PASS ); - if ( $res->status_code == 0 ) { - $t->is( $res->status_code, 0, 'Process imported from Library successfully'); - $t->diag( ' processTitle ' . $res->processTitle ); - $t->diag( ' category ' . $res->category ); - $t->diag( ' version ' . $res->version ); - } - else - throw ( new Exception ( $res->message . ". Process '". $uid_Process ."' ") ); - } } //creating an user, if this user exists just skip this lines @@ -343,4 +332,3 @@ $t->is( $foundUser2, true, 'user2 is present in Group employees'); $t->is( $foundUser3, true, 'user3 is present in Group finance'); - \ No newline at end of file diff --git a/workflow/engine/test/unit/ws/wsClient.php b/workflow/engine/test/unit/ws/wsClient.php index e4ed68247..9247e5131 100755 --- a/workflow/engine/test/unit/ws/wsClient.php +++ b/workflow/engine/test/unit/ws/wsClient.php @@ -616,24 +616,6 @@ function ws_systemInformation() { return $result; } -function ws_importProcessFromLibrary($processId, $version = '', $importOption = '', $usernameLibrary = '', $passwordLibrary = '') { - global $sessionId; - global $client; - - $params = array ( - 'sessionId' => $sessionId, - 'processId' => $processId, - 'version' => $version, - 'importOption' => $importOption, - 'usernameLibrary' => $usernameLibrary, - 'passwordLibrary' => $passwordLibrary - ); - $result = $client->__SoapCall('importProcessFromLibrary', array ( - $params - )); - return $result; -} - function ws_InputDocumentList($caseId) { global $sessionId; global $client;