diff --git a/composer.json b/composer.json index 24a76e25a..bad0ec1fd 100644 --- a/composer.json +++ b/composer.json @@ -35,9 +35,9 @@ "laravel/framework": "5.7.*", "luracast/restler": "3.0", "bshaffer/oauth2-server-php": "v1.0", - "colosa/pmui": "release/3.7.0-dev", - "colosa/michelangelofe": "release/3.7.0-dev", - "colosa/pmdynaform": "release/3.7.0-dev", + "colosa/pmui": "release/3.7.2-dev", + "colosa/michelangelofe": "release/3.7.2-dev", + "colosa/pmdynaform": "release/3.7.2-dev", "colosa/taskscheduler": "release/1.0.2-dev", "google/apiclient": "1.1.6", "dapphp/securimage": "^3.6", diff --git a/database/factories/ProcessFactory.php b/database/factories/ProcessFactory.php index bb9d5467f..afdf407dc 100644 --- a/database/factories/ProcessFactory.php +++ b/database/factories/ProcessFactory.php @@ -26,6 +26,7 @@ $factory->define(\ProcessMaker\Model\Process::class, function (Faker $faker) { 'PRO_DYNAFORMS' => serialize([]), 'PRO_ITEE' => 1, 'PRO_ACTION_DONE' => serialize([]), + 'PRO_SUBPROCESS' => 0, 'PRO_CATEGORY' => function () { return factory(\ProcessMaker\Model\ProcessCategory::class)->create()->CATEGORY_UID; }, @@ -56,6 +57,7 @@ $factory->state(\ProcessMaker\Model\Process::class, 'foreign_keys', function (Fa 'PRO_DYNAFORMS' => serialize([]), 'PRO_ITEE' => 1, 'PRO_ACTION_DONE' => serialize([]), + 'PRO_SUBPROCESS' => 0, 'PRO_CATEGORY' => function () { return factory(\ProcessMaker\Model\ProcessCategory::class)->create()->CATEGORY_UID; }, diff --git a/resources/assets/js/components/search/CasesFilter.vue b/resources/assets/js/components/search/CasesFilter.vue index d0a16a1fb..bac411417 100644 --- a/resources/assets/js/components/search/CasesFilter.vue +++ b/resources/assets/js/components/search/CasesFilter.vue @@ -16,14 +16,6 @@ stacked > - - {{ $t("ID_BY_PROCESS_NAME") }} - {{ $t("ID_BY_PROCESS_CATEGORY") }} + + {{ $t("ID_BY_PROCESS_NAME") }} + diff --git a/resources/assets/js/components/search/MyCasesFilter.vue b/resources/assets/js/components/search/MyCasesFilter.vue index fee5726d1..e626db99e 100644 --- a/resources/assets/js/components/search/MyCasesFilter.vue +++ b/resources/assets/js/components/search/MyCasesFilter.vue @@ -17,14 +17,6 @@ stacked > - - {{$t('ID_BY_PROCESS_NAME') }} - {{$t('ID_BY_PROCESS_CATEGORY') }} - + + {{$t('ID_BY_PROCESS_NAME') }} + diff --git a/resources/assets/js/home/AdvancedSearch/AdvancedSearch.vue b/resources/assets/js/home/AdvancedSearch/AdvancedSearch.vue index 686d7fc46..77f73e302 100644 --- a/resources/assets/js/home/AdvancedSearch/AdvancedSearch.vue +++ b/resources/assets/js/home/AdvancedSearch/AdvancedSearch.vue @@ -49,12 +49,12 @@
{{ props.row.APP_STATUS }}
-
- {{ props.row.PROCESS_NAME }} -
{{ props.row.PROCESS_CATEGORY }}
+
+ {{ props.row.PROCESS_NAME }} +
@@ -145,8 +145,8 @@ export default { }, columns: [ "case_number", - "process_name", "process_category", + "process_name", "status", "thread_title", "task", @@ -161,8 +161,8 @@ export default { filterable: false, headings: { case_number: this.$i18n.t("ID_MYCASE_NUMBER"), - process_name: this.$i18n.t("ID_PROCESS_NAME"), process_category: this.$i18n.t("ID_CATEGORY_PROCESS"), + process_name: this.$i18n.t("ID_PROCESS_NAME"), status: this.$i18n.t("ID_STATUS"), thread_title: this.$i18n.t('ID_CASE_THREAD_TITLE'), task: this.$i18n.t("ID_TASK"), diff --git a/resources/assets/js/home/CustomCaseList/CustomCaseList.vue b/resources/assets/js/home/CustomCaseList/CustomCaseList.vue index ca59463f3..d69bc4ddf 100644 --- a/resources/assets/js/home/CustomCaseList/CustomCaseList.vue +++ b/resources/assets/js/home/CustomCaseList/CustomCaseList.vue @@ -55,12 +55,12 @@
{{ props.row.THREAD_TITLE }}
-
- {{ props.row.PROCESS_NAME }} -
{{ props.row.PROCESS_CATEGORY }}
+
+ {{ props.row.PROCESS_NAME }} +
@@ -130,12 +130,12 @@ {{ props["item"]["THREAD_TITLE"] }} - - {{ props["item"]["PROCESS_NAME"] }} - {{ props["item"]["PROCESS_CATEGORY"] }} + + {{ props["item"]["PROCESS_NAME"] }} + {{ props["item"]["DUE_DATE"] }} @@ -187,12 +187,12 @@ {{ props["item"]["THREAD_TITLE"] }} - - {{ props["item"]["PROCESS_NAME"] }} - {{ props["item"]["PROCESS_CATEGORY"] }} + + {{ props["item"]["PROCESS_NAME"] }} + {{ props["item"]["DUE_DATE"] }} @@ -565,28 +565,6 @@ export default { return `${this.tagPrefix}: ${data[0].label || ""}`; }, }, - processName: { - group: "checkbox", - type: "ProcessName", - id: "processName", - title: `${this.$i18n.t('ID_FILTER')}: ${this.$i18n.t('ID_BY_PROCESS_NAME')}`, - optionLabel: this.$i18n.t('ID_BY_PROCESS_NAME'), - detail: "", - tagText: "", - tagPrefix: this.$i18n.t('ID_SEARCH_BY_PROCESS_NAME'), - autoShow: false, - items:[ - { - id: "process", - value: "", - options: [], - placeholder: this.$i18n.t('ID_PROCESS_NAME') - } - ], - makeTagText: function (params, data) { - return `${this.tagPrefix} ${data[0].options && data[0].options.label || ''}`; - } - }, processCategory: { group: "checkbox", type: "ProcessCategory", @@ -609,6 +587,28 @@ export default { return `${this.tagPrefix} ${data[0].options && data[0].options.label || ''}`; } }, + processName: { + group: "checkbox", + type: "ProcessName", + id: "processName", + title: `${this.$i18n.t('ID_FILTER')}: ${this.$i18n.t('ID_BY_PROCESS_NAME')}`, + optionLabel: this.$i18n.t('ID_BY_PROCESS_NAME'), + detail: "", + tagText: "", + tagPrefix: this.$i18n.t('ID_SEARCH_BY_PROCESS_NAME'), + autoShow: false, + items:[ + { + id: "process", + value: "", + options: [], + placeholder: this.$i18n.t('ID_PROCESS_NAME') + } + ], + makeTagText: function (params, data) { + return `${this.tagPrefix} ${data[0].options && data[0].options.label || ''}`; + } + }, showUserTooltip: true } }; diff --git a/resources/assets/js/home/Draft/Draft.vue b/resources/assets/js/home/Draft/Draft.vue index acc8164d2..e992c045d 100644 --- a/resources/assets/js/home/Draft/Draft.vue +++ b/resources/assets/js/home/Draft/Draft.vue @@ -51,12 +51,12 @@
{{ props.row.THREAD_TITLE }}
-
- {{ props.row.PROCESS_NAME }} -
{{ props.row.PROCESS_CATEGORY }}
+
+ {{ props.row.PROCESS_NAME }} +
@@ -99,14 +99,6 @@ {{ props["item"]["THREAD_TITLE"] }} -
- {{ props["headings"][props.column] }} : - {{ props["item"]["PROCESS_NAME"] }} - -
{{ props["headings"][props.column] }} :{{ props["item"]["PROCESS_CATEGORY"] }}
+
+ {{ props["headings"][props.column] }} : + {{ props["item"]["PROCESS_NAME"] }} + +
{{ props["headings"][props.column] }} :
-
- {{ props["headings"][props.column] }} : - {{ props["item"]["PROCESS_NAME"] }} - -
{{ props["headings"][props.column] }} :{{ props["item"]["PROCESS_CATEGORY"] }}
+
+ {{ props["headings"][props.column] }} : + {{ props["item"]["PROCESS_NAME"] }} + +
{{ props["headings"][props.column] }} : {{ props.row.THREAD_TITLE }}
-
- {{ props.row.PROCESS_NAME }} -
{{ props.row.PROCESS_CATEGORY }}
+
+ {{ props.row.PROCESS_NAME }} +
@@ -106,14 +106,6 @@ {{ props["item"]["THREAD_TITLE"] }} -
- {{ props["headings"][props.column] }} : - {{ props["item"]["PROCESS_NAME"] }} - -
{{ props["headings"][props.column] }} :{{ props["item"]["PROCESS_CATEGORY"] }}
+
+ {{ props["headings"][props.column] }} : + {{ props["item"]["PROCESS_NAME"] }} + +
{{ props["headings"][props.column] }} :
-
- {{ props["headings"][props.column] }} : - {{ props["item"]["PROCESS_NAME"] }} - -
{{ props["headings"][props.column] }} :{{ props["item"]["PROCESS_CATEGORY"] }}
+
+ {{ props["headings"][props.column] }} : + {{ props["item"]["PROCESS_NAME"] }} + +
{{ props["headings"][props.column] }} :
-
- {{ props.row.PROCESS_NAME }} -
{{ props.row.PROCESS_CATEGORY }}
+
+ {{ props.row.PROCESS_NAME }} +
@@ -163,8 +163,8 @@ export default { filterable: false, headings: { case_number: this.$i18n.t("ID_MYCASE_NUMBER"), - process_name: this.$i18n.t("ID_PROCESS_NAME"), process_category: this.$i18n.t("ID_CATEGORY_PROCESS"), + process_name: this.$i18n.t("ID_PROCESS_NAME"), thread_title: this.$i18n.t('ID_CASE_THREAD_TITLE'), pending_taks: this.$i18n.t("ID_PENDING_TASKS"), status: this.$i18n.t("ID_CASESLIST_APP_STATUS"), diff --git a/resources/assets/js/home/Paused/Paused.vue b/resources/assets/js/home/Paused/Paused.vue index 8342e0b3e..1066cbbdc 100644 --- a/resources/assets/js/home/Paused/Paused.vue +++ b/resources/assets/js/home/Paused/Paused.vue @@ -45,12 +45,12 @@
{{ props.row.THREAD_TITLE }}
-
- {{ props.row.PROCESS_NAME }} -
{{ props.row.PROCESS_CATEGORY }}
+
+ {{ props.row.PROCESS_NAME }} +
@@ -105,14 +105,6 @@ {{ props["item"]["THREAD_TITLE"] }} -
- {{ props["headings"][props.column] }} : - {{ props["item"]["PROCESS_NAME"] }} - -
{{ props["headings"][props.column] }} :{{ props["item"]["PROCESS_CATEGORY"] }}
+
+ {{ props["headings"][props.column] }} : + {{ props["item"]["PROCESS_NAME"] }} + +
{{ props["headings"][props.column] }} :
-
- {{ props["headings"][props.column] }} : - {{ props["item"]["PROCESS_NAME"] }} - -
{{ props["headings"][props.column] }} :{{ props["item"]["PROCESS_CATEGORY"] }}
+
+ {{ props["headings"][props.column] }} : + {{ props["item"]["PROCESS_NAME"] }} + +
{{ props["headings"][props.column] }} : {{ props.row.THREAD_TITLE }}
-
- {{ props.row.PROCESS_NAME }} -
{{ props.row.PROCESS_CATEGORY }}
+
+ {{ props.row.PROCESS_NAME }} +
@@ -100,14 +100,6 @@ {{ props["item"]["THREAD_TITLE"] }} -
- {{ props["headings"][props.column] }} : - {{ props["item"]["PROCESS_NAME"] }} - -
{{ props["headings"][props.column] }} :{{ props["item"]["PROCESS_CATEGORY"] }}
+
+ {{ props["headings"][props.column] }} : + {{ props["item"]["PROCESS_NAME"] }} + +
{{ props["headings"][props.column] }} :
-
- {{ props["headings"][props.column] }} : - {{ props["item"]["PROCESS_NAME"] }} - -
{{ props["headings"][props.column] }} :{{ props["item"]["PROCESS_CATEGORY"] }}
+
+ {{ props["headings"][props.column] }} : + {{ props["item"]["PROCESS_NAME"] }} + +
{{ props["headings"][props.column] }} :create()->CATEGORY_UID; } ]); - $result = Process::getProcessesFilter( - $process->PRO_CATEGORY - ); + $result = Process::getProcessesFilter($process->PRO_CATEGORY); + // Assert with the specific category $this->assertEquals($process->PRO_CATEGORY, $result[0]['PRO_CATEGORY']); + + $process = factory(Process::class)->create(); + $result = Process::getProcessesFilter('NONE'); + // Assert when the category is empty + $this->assertEmpty($result); } /** * It tests the process list with specific process * * @covers \ProcessMaker\Model\Process::getProcessesFilter() + * @covers \ProcessMaker\Model\Process::getListColumns() + * @covers \ProcessMaker\Model\Process::scopeJoinUsers() + * @covers \ProcessMaker\Model\Process::scopeJoinCategory() * @covers \ProcessMaker\Model\Process::scopeProcess() * @test */ @@ -315,6 +328,9 @@ class ProcessTest extends TestCase * It tests the process list with specific process title * * @covers \ProcessMaker\Model\Process::getProcessesFilter() + * @covers \ProcessMaker\Model\Process::getListColumns() + * @covers \ProcessMaker\Model\Process::scopeJoinUsers() + * @covers \ProcessMaker\Model\Process::scopeJoinCategory() * @covers \ProcessMaker\Model\Process::scopeTitle() * @test */ @@ -329,10 +345,41 @@ class ProcessTest extends TestCase $this->assertEquals($process->PRO_TITLE, $result[0]['PRO_TITLE']); } + /** + * It tests the process list with suprocess filter + * + * @covers \ProcessMaker\Model\Process::getProcessesFilter() + * @covers \ProcessMaker\Model\Process::getListColumns() + * @covers \ProcessMaker\Model\Process::scopeJoinUsers() + * @covers \ProcessMaker\Model\Process::scopeJoinCategory() + * @covers \ProcessMaker\Model\Process::scopeSubProcess() + * @test + */ + public function it_should_test_process_subprocess_filter() + { + $process = factory(Process::class)->create([ + 'PRO_SUBPROCESS' => 1 + ]); + $result = Process::getProcessesFilter( + null, + null, + null, + $process->PRO_CREATE_USER, + 0, + 25, + 'ASC', + 'PRO_CREATE_DATE', + true, + true + ); + $this->assertEquals($process->PRO_CREATE_USER, $result[0]['USR_UID']); + } + /** * It tests the count process * * @covers \ProcessMaker\Model\Process::getCounter() + * @covers \ProcessMaker\Model\Process::scopePerUser() * @test */ public function it_should_test_count_process() @@ -346,6 +393,8 @@ class ProcessTest extends TestCase * It test get processes for the new home view * * @covers \ProcessMaker\Model\Process::getProcessesForHome() + * @covers \ProcessMaker\Model\Process::scopeCategoryId() + * @covers \ProcessMaker\Model\Process::scopeStatus() * @test */ public function it_should_test_get_processes_for_home() @@ -356,11 +405,13 @@ class ProcessTest extends TestCase // Create five processes (4 active, 1 inactive) factory(Process::class)->create([ 'PRO_TITLE' => 'My Process 1', - 'PRO_CATEGORY' => $processCategory->CATEGORY_UID + 'PRO_CATEGORY' => $processCategory->CATEGORY_UID, + 'CATEGORY_ID' => $processCategory->CATEGORY_ID ]); factory(Process::class)->create([ 'PRO_TITLE' => 'My Process 2', - 'PRO_CATEGORY' => $processCategory->CATEGORY_UID + 'PRO_CATEGORY' => $processCategory->CATEGORY_UID, + 'CATEGORY_ID' => $processCategory->CATEGORY_ID ]); factory(Process::class)->create([ 'PRO_TITLE' => 'My Process 3', @@ -376,8 +427,21 @@ class ProcessTest extends TestCase // Assertions $this->assertCount(4, Process::getProcessesForHome()); $this->assertCount(3, Process::getProcessesForHome('My Process')); - $this->assertCount(2, Process::getProcessesForHome(null, $processCategory->CATEGORY_UID)); + $this->assertCount(2, Process::getProcessesForHome(null, $processCategory->CATEGORY_ID)); $this->assertCount(4, Process::getProcessesForHome(null, null, null, 2)); - $this->assertCount(1, Process::getProcessesForHome(null, null, 2, 1)); + $this->assertCount(1, Process::getProcessesForHome(null, null, 2, 1, true)); + } + + /** + * It tests the isActive process + * + * @covers \ProcessMaker\Model\Process::isActive() + * @test + */ + public function it_should_test_is_active() + { + $process = factory(Process::class)->create(); + $total = Process::isActive($process->PRO_ID); + $this->assertEquals(1, $total); } } diff --git a/workflow/engine/classes/WorkspaceTools.php b/workflow/engine/classes/WorkspaceTools.php index 4eb0446e0..574077689 100644 --- a/workflow/engine/classes/WorkspaceTools.php +++ b/workflow/engine/classes/WorkspaceTools.php @@ -374,7 +374,8 @@ class WorkspaceTools $start = microtime(true); Bootstrap::setConstantsRelatedWs($workspace); Propel::init(PATH_CONFIG . 'databases.php'); - WebEntry::convertFromV1ToV2(); + $statement = Propel::getConnection('workflow')->createStatement(); + $statement->executeQuery(WebEntry::UPDATE_QUERY_V1_TO_V2); CLI::logging("* End converting Web Entries v1.0 to v2.0 for BPMN processes...(" . (microtime(true) - $start) . " seconds)\n"); CLI::logging("* Start migrating case title...\n"); diff --git a/workflow/engine/src/ProcessMaker/Model/CaseList.php b/workflow/engine/src/ProcessMaker/Model/CaseList.php index 01b2d6738..eacd4140a 100644 --- a/workflow/engine/src/ProcessMaker/Model/CaseList.php +++ b/workflow/engine/src/ProcessMaker/Model/CaseList.php @@ -383,8 +383,8 @@ class CaseList extends Model 'set' => true ], [ 'list' => ['inbox', 'draft', 'paused', 'unassigned'], - 'field' => 'process_name', - 'name' => G::LoadTranslation('ID_PROCESS_NAME'), + 'field' => 'process_category', + 'name' => G::LoadTranslation('ID_PROCESS_CATEGORY'), 'type' => 'string', 'source' => 'APPLICATION', 'typeSearch' => 'search text', @@ -392,8 +392,8 @@ class CaseList extends Model 'set' => true ], [ 'list' => ['inbox', 'draft', 'paused', 'unassigned'], - 'field' => 'process_category', - 'name' => G::LoadTranslation('ID_PROCESS_CATEGORY'), + 'field' => 'process_name', + 'name' => G::LoadTranslation('ID_PROCESS_NAME'), 'type' => 'string', 'source' => 'APPLICATION', 'typeSearch' => 'search text', diff --git a/workflow/engine/src/ProcessMaker/Model/Process.php b/workflow/engine/src/ProcessMaker/Model/Process.php index 1f8df3637..4fc7b8562 100644 --- a/workflow/engine/src/ProcessMaker/Model/Process.php +++ b/workflow/engine/src/ProcessMaker/Model/Process.php @@ -78,6 +78,7 @@ class Process extends Model * * @param \Illuminate\Database\Eloquent\Builder $query * @param string $proUid + * * @return \Illuminate\Database\Eloquent\Builder */ public function scopeProcess($query, $proUid) @@ -90,6 +91,7 @@ class Process extends Model * * @param \Illuminate\Database\Eloquent\Builder $query * @param string $title + * * @return \Illuminate\Database\Eloquent\Builder */ public function scopeTitle($query, $title) @@ -102,6 +104,7 @@ class Process extends Model * * @param \Illuminate\Database\Eloquent\Builder $query * @param string $status + * * @return \Illuminate\Database\Eloquent\Builder */ public function scopeNoStatus($query, $status = 'DISABLED') @@ -120,6 +123,19 @@ class Process extends Model return $query->where('PRO_SUBPROCESS', '=', 1); } + /** + * Scope a query to include a specific process categoryId + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param int $category + * + * @return \Illuminate\Database\Eloquent\Builder + */ + public function scopeCategoryId($query, $category) + { + return $query->where('PROCESS.CATEGORY_ID', $category); + } + /** * Scope a query to include a specific process category * @@ -407,14 +423,14 @@ class Process extends Model * Get all processes, paged optionally, can be sent a string to filter results by "PRO_TITLE" * * @param string $text - * @param string $category + * @param int $catId * @param int $offset * @param int $limit * @param bool $paged * * @return array */ - public static function getProcessesForHome($text = null, $category = null, $offset = null, $limit = null, $paged = true) + public static function getProcessesForHome($text = null, $catId = 0, $offset = null, $limit = null, $paged = true) { // Get base query $query = Process::query()->select(['PRO_ID', 'PRO_TITLE']); @@ -424,9 +440,9 @@ class Process extends Model $query->title($text); } - // Set "PRO_CATEGORY" condition if is sent - if (!is_null($category)) { - $query->category($category); + // Set "CATEGORY_ID" condition if is sent + if ($catId) { + $query->categoryId($catId); } // Set "PRO_STATUS" condition @@ -452,6 +468,7 @@ class Process extends Model * Return true if process is active, false otherwise. * @param int|string $proId * @param string $key + * * @return bool */ public static function isActive($proId, string $key = 'PRO_ID'): bool diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Home.php b/workflow/engine/src/ProcessMaker/Services/Api/Home.php index 9370c142b..a43a41bd2 100644 --- a/workflow/engine/src/ProcessMaker/Services/Api/Home.php +++ b/workflow/engine/src/ProcessMaker/Services/Api/Home.php @@ -889,7 +889,7 @@ class Home extends Api * @url GET /processes * * @param string $text - * @param string $category + * @param int $category * @param int $offset * @param int $limit * @param bool $paged @@ -901,7 +901,7 @@ class Home extends Api * @access protected * @class AccessControl {@permission PM_CASES} */ - public function getProcesses($text = null, $category = null, int $offset = 0, int $limit = 15, $paged = true) + public function getProcesses($text = null, $category = 0, int $offset = 0, int $limit = 15, $paged = true) { try { return Process::getProcessesForHome($text, $category, $offset, $limit, $paged);