diff --git a/features/backend/step/main_tests_step.feature b/features/backend/step/main_tests_step.feature index 028bc80b6..167cc08f4 100644 --- a/features/backend/step/main_tests_step.feature +++ b/features/backend/step/main_tests_step.feature @@ -112,7 +112,7 @@ Feature: Project Properties - Step Resources Main Tests | test_description | project | activity | records | step_type_obj | step_uid_obj | | 3 steps in task 1 - verify that the first record is the first position | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | DYNAFORM | 50332332752cd9b9a7cc989003652905 | - | 2 steps in task 2 - verify that the first record is the first position | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 2 | DYNAFORM | 63293140052cd61b29e21a9056770986 | + | 2 steps in task 2 - verify that the first record is the first position | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 3 | DYNAFORM | 63293140052cd61b29e21a9056770986 | #STEP TRIGGERS @@ -174,24 +174,24 @@ Feature: Project Properties - Step Resources Main Tests Examples: | test_description | project | activity | step_number | tri_uid_number | tri_uid | st_type | st_condition | st_position | - | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 1 | 1 | 81919273152cd636c665080083928728 | BEFORE | | 1 | - | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 1 | 2 | 56359776552cd6378b38e47080912028 | BEFORE | | 2 | - | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 1 | 3 | 57401970252cd6393531551040242546 | BEFORE | | 3 | - | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 1 | 4 | 81919273152cd636c665080083928728 | AFTER | | 1 | - | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 1 | 5 | 56359776552cd6378b38e47080912028 | AFTER | | 2 | - | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 1 | 6 | 57401970252cd6393531551040242546 | AFTER | | 3 | - | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 2 | 7 | 81919273152cd636c665080083928728 | BEFORE | | 1 | - | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 2 | 8 | 56359776552cd6378b38e47080912028 | BEFORE | | 2 | - | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 2 | 9 | 57401970252cd6393531551040242546 | BEFORE | | 3 | - | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 2 | 10 | 81919273152cd636c665080083928728 | AFTER | | 1 | - | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 2 | 11 | 56359776552cd6378b38e47080912028 | AFTER | | 2 | - | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 2 | 12 | 57401970252cd6393531551040242546 | AFTER | | 3 | - | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 13 | 81919273152cd636c665080083928728 | BEFORE | | 1 | - | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 14 | 56359776552cd6378b38e47080912028 | BEFORE | | 2 | - | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 15 | 57401970252cd6393531551040242546 | BEFORE | | 3 | - | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 16 | 81919273152cd636c665080083928728 | AFTER | | 1 | - | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 17 | 56359776552cd6378b38e47080912028 | AFTER | | 2 | - | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 18 | 57401970252cd6393531551040242546 | AFTER | | 3 | + | Trigger assigned to Task 1 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 1 | 1 | 81919273152cd636c665080083928728 | BEFORE | | 1 | + | Trigger assigned to Task 1 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 1 | 2 | 56359776552cd6378b38e47080912028 | BEFORE | | 2 | + | Trigger assigned to Task 1 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 1 | 3 | 57401970252cd6393531551040242546 | BEFORE | | 3 | + | Trigger assigned to Task 1 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 1 | 4 | 81919273152cd636c665080083928728 | AFTER | | 1 | + | Trigger assigned to Task 1 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 1 | 5 | 56359776552cd6378b38e47080912028 | AFTER | | 2 | + | Trigger assigned to Task 1 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 1 | 6 | 57401970252cd6393531551040242546 | AFTER | | 3 | + | Trigger assigned to Task 1 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 2 | 7 | 81919273152cd636c665080083928728 | BEFORE | | 1 | + | Trigger assigned to Task 1 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 2 | 8 | 56359776552cd6378b38e47080912028 | BEFORE | | 2 | + | Trigger assigned to Task 1 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 2 | 9 | 57401970252cd6393531551040242546 | BEFORE | | 3 | + | Trigger assigned to Task 1 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 2 | 10 | 81919273152cd636c665080083928728 | AFTER | | 1 | + | Trigger assigned to Task 1 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 2 | 11 | 56359776552cd6378b38e47080912028 | AFTER | | 2 | + | Trigger assigned to Task 1 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 2 | 12 | 57401970252cd6393531551040242546 | AFTER | | 3 | + | Trigger assigned to Task 1 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 13 | 81919273152cd636c665080083928728 | BEFORE | | 1 | + | Trigger assigned to Task 1 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 14 | 56359776552cd6378b38e47080912028 | BEFORE | | 2 | + | Trigger assigned to Task 1 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 15 | 57401970252cd6393531551040242546 | BEFORE | | 3 | + | Trigger assigned to Task 1 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 16 | 81919273152cd636c665080083928728 | AFTER | | 1 | + | Trigger assigned to Task 1 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 17 | 56359776552cd6378b38e47080912028 | AFTER | | 2 | + | Trigger assigned to Task 1 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 18 | 57401970252cd6393531551040242546 | AFTER | | 3 | | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 4 | 19 | 81919273152cd636c665080083928728 | BEFORE | | 1 | | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 4 | 20 | 56359776552cd6378b38e47080912028 | BEFORE | | 2 | | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 4 | 21 | 57401970252cd6393531551040242546 | BEFORE | | 3 | @@ -200,6 +200,21 @@ Feature: Project Properties - Step Resources Main Tests | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 4 | 24 | 57401970252cd6393531551040242546 | AFTER | | 3 | + +Scenario Outline: Delete all Triggers created previously in this script + Given that I want to delete a "trigger" + And I request "project//trigger/" + Then the response status code should be 400 + And the response charset is "UTF-8" + And the type is "object" + + Examples: + + | project | tri_uid | + | 16062437052cd6141881e06088349078 | 81919273152cd636c665080083928728 | + | 16062437052cd6141881e06088349078 | 57401970252cd6393531551040242546 | + + Scenario Outline: List available Triggers for each assigned step Given I request "project//activity//step/step_uid/available-triggers/before" with the key "step_uid" stored in session array as variable "step_uid_" And the content type is "application/json" diff --git a/features/backend/trigger_wizard/main_tests_trigger_wizards.feature b/features/backend/trigger_wizard/main_tests_trigger_wizards.feature index 793c52409..153ab1e5a 100644 --- a/features/backend/trigger_wizard/main_tests_trigger_wizards.feature +++ b/features/backend/trigger_wizard/main_tests_trigger_wizards.feature @@ -22,13 +22,13 @@ Feature: Group Examples: | i | lib_name | lib_title | lib_class_name | | 0 | pmFunctions | ProcessMaker Functions | class.pmFunctions.php | - | 1 | pmTrSharepoint | Sharepoint DWS Triggers v. 0.1 | class.pmTrSharepoint.pmFunctions.php | - | 2 | pmSugar | Sugar CRM Triggers | class.pmSugar.pmFunctions.php | - | 3 | pmTalend | Talend ETL Integration | class.pmTalend.pmFunctions.php | - | 4 | pmZimbra | Zimbra Triggers v. 0.1 | class.pmZimbra.pmFunctions.php | - | 5 | pmTrAlfresco | Alfresco DM Triggers v. 0.1 | class.pmTrAlfresco.pmFunctions.php | + | 1 | pmTrSharepoint | Sharepoint DWS Triggers v. 0.1 | class.pmTrSharepoint.pmFunctions.php | + | 2 | pmTrAlfresco | Alfresco DM Triggers v. 0.1 | class.pmTrAlfresco.pmFunctions.php | + | 3 | pmZimbra | Zimbra Triggers v. 0.1 | class.pmZimbra.pmFunctions.php | + | 4 | pmSugar | Sugar CRM Triggers | class.pmSugar.pmFunctions.php | + | 5 | pmTalend | Talend ETL Integration | class.pmTalend.pmFunctions.php | - + Scenario Outline: Get a single Library And I request "project/14414793652a5d718b65590036026581/trigger-wizard/" And the content type is "application/json" @@ -144,6 +144,43 @@ Scenario Outline: Create new Trigger: createDWS Examples: | i | lib_name | fn_name | tri_title | tri_description | tri_type | tri_params.input.sharepointServer | tri_params.input.auth | tri_params.input.name | tri_params.input.users | tri_params.input.title | tri_params.input.documents | tri_params.output.tri_answer | | 1 | pmTrSharepoint | createDWS | Sharepoint 1 | | SCRIPT | @@SERVER | username:password | Test DWS | @@users | Test DWS | /files/test.doc | $respuesta | + + +Scenario Outline: Create new Trigger: createDWS (no enviar campos no requeridos) + Given POST this data: + """ + { + "tri_title": "", + "tri_description": "", + "tri_type": "", + "tri_params": { + "input": { + + "sharepointServer": "", + "auth": "", + "name": "", + "users": "", + "title": "", + "documents": "" + + }, + "output": { + "tri_answer": "" + } + } + } + """ + And I request "project/14414793652a5d718b65590036026581/trigger-wizard//" + And the content type is "application/json" + Then the response status code should be 201 + And the response charset is "UTF-8" + And the type is "object" + And store "tri_uid" in session array as variable "tri_uid" + + Examples: + | i | lib_name | fn_name | tri_title | tri_description | tri_type | tri_params.input.sharepointServer | tri_params.input.auth | tri_params.input.name | tri_params.input.users | tri_params.input.title | tri_params.input.documents | tri_params.output.tri_answer | + | 2 | pmTrSharepoint | createDWS | Sharepoint 1 | | SCRIPT | @@SERVER | username:password | Test DWS | @@users | Test DWS | /files/test.doc | $respuesta | + Scenario Outline: Update Trigger Given PUT this data: diff --git a/workflow/engine/src/BusinessModel/FilesManager.php b/workflow/engine/src/BusinessModel/FilesManager.php index d2cd7a0e2..dcc719f6a 100644 --- a/workflow/engine/src/BusinessModel/FilesManager.php +++ b/workflow/engine/src/BusinessModel/FilesManager.php @@ -480,11 +480,9 @@ class FilesManager $sSubDirectory = substr(str_replace($sMainDirectory,'',$sSubDirectory),1); switch ($sMainDirectory) { case 'templates': - $sMainDirectory = 'mailTemplates'; $sDirectory = PATH_DATA_MAILTEMPLATES . $sProcessUID . PATH_SEP . ($sSubDirectory != '' ? $sSubDirectory . PATH_SEP : ''); break; case 'public': - $sMainDirectory = 'public'; $sDirectory = PATH_DATA_PUBLIC . $sProcessUID . PATH_SEP . ($sSubDirectory != '' ? $sSubDirectory . PATH_SEP : ''); break; default: @@ -505,5 +503,44 @@ class FilesManager throw $e; } } + + /** + * + * @param string $sProcessUID {@min 32} {@max 32} + * @param string $prfUid {@min 32} {@max 32} + * + * + * @access public + */ + public function getProcessFileManager($sProcessUID, $prfUid) + { + try { + $oProcessFiles = \ProcessFilesPeer::retrieveByPK($prfUid); + $fcontent = file_get_contents($oProcessFiles->getPrfPath()); + $sFile = end(explode("/",$oProcessFiles->getPrfPath())); + $path = $oProcessFiles->getPrfPath(); + $sPath = str_replace($sFile,'',$path); + $sSubDirectory = substr(str_replace($sProcessUID,'',substr($sPath,(strpos($sPath, $sProcessUID)))),0,-1); + $sMainDirectory = str_replace(substr($sPath, strpos($sPath, $sProcessUID)),'', $sPath); + if ($sMainDirectory == PATH_DATA_MAILTEMPLATES) { + $sMainDirectory = 'templates'; + } else { + $sMainDirectory = 'public'; + } + $oProcessFile = array('prf_uid' => $oProcessFiles->getPrfUid(), + 'prf_filename' => $sFile, + 'usr_uid' => $oProcessFiles->getUsrUid(), + 'prf_update_usr_uid' => $oProcessFiles->getPrfUpdateUsrUid(), + 'prf_path' => $sMainDirectory.$sSubDirectory, + 'prf_type' => $oProcessFiles->getPrfType(), + 'prf_editable' => $oProcessFiles->getPrfEditable(), + 'prf_create_date' => $oProcessFiles->getPrfCreateDate(), + 'prf_update_date' => $oProcessFiles->getPrfUpdateDate(), + 'prf_content' => $fcontent); + return $oProcessFile; + } catch (Exception $e) { + throw $e; + } + } } diff --git a/workflow/engine/src/BusinessModel/ProcessSupervisor.php b/workflow/engine/src/BusinessModel/ProcessSupervisor.php index 86a212075..a50039f45 100644 --- a/workflow/engine/src/BusinessModel/ProcessSupervisor.php +++ b/workflow/engine/src/BusinessModel/ProcessSupervisor.php @@ -848,7 +848,6 @@ class ProcessSupervisor */ public function removeInputDocumentSupervisor($sProcessUID, $sPuiUID) { - $oConnection = \Propel::getConnection(\StepSupervisorPeer::DATABASE_NAME); try { $oInputDocumentSupervidor = \StepSupervisorPeer::retrieveByPK($sPuiUID); if (!is_null($oInputDocumentSupervidor)) { @@ -858,7 +857,6 @@ class ProcessSupervisor throw (new \Exception('This row does not exist!')); } } catch (Exception $oError) { - $oConnection->rollback(); throw ($oError); } } diff --git a/workflow/engine/src/Services/Api/ProcessMaker/Project/FilesManager.php b/workflow/engine/src/Services/Api/ProcessMaker/Project/FilesManager.php index 351af84be..bb36189d5 100644 --- a/workflow/engine/src/Services/Api/ProcessMaker/Project/FilesManager.php +++ b/workflow/engine/src/Services/Api/ProcessMaker/Project/FilesManager.php @@ -151,6 +151,26 @@ class FilesManager extends Api throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); } } + + /** + * @param string $prj_uid {@min 32} {@max 32} + * @param string $prf_uid {@min 32} {@max 32} + * + * @url GET /:prj_uid/file-manager/:prf_uid + * + */ + public function doGetProcessFileManager($prj_uid, $prf_uid) + { + try { + $filesManager = new \BusinessModel\FilesManager(); + $response = $filesManager->getProcessFileManager($prj_uid, $prf_uid); + //response + return $response; + } catch (\Exception $e) { + //response + throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); + } + } } class ProcessFilesManagerStructurePost diff --git a/workflow/engine/src/Services/Api/ProcessMaker/Project/ProcessSupervisors.php b/workflow/engine/src/Services/Api/ProcessMaker/Project/ProcessSupervisors.php index 3dff5185e..d6bddfaec 100644 --- a/workflow/engine/src/Services/Api/ProcessMaker/Project/ProcessSupervisors.php +++ b/workflow/engine/src/Services/Api/ProcessMaker/Project/ProcessSupervisors.php @@ -286,6 +286,7 @@ class ProcessSupervisors extends Api try { $supervisor = new \BusinessModel\ProcessSupervisor(); $supervisor->removeDynaformSupervisor($prjUid, $pudUid); + ob_end_clean(); } catch (\Exception $e) { //response throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); @@ -304,6 +305,7 @@ class ProcessSupervisors extends Api try { $supervisor = new \BusinessModel\ProcessSupervisor(); $supervisor->removeInputDocumentSupervisor($prjUid, $puiUid); + ob_end_clean(); } catch (\Exception $e) { //response throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());