Skip to content

FOUR-13983: Ensure "Uncategorized" process category exists during import#6165

Merged
ryancooley merged 1 commit intonextfrom
bugfix/FOUR-13983
Feb 8, 2024
Merged

FOUR-13983: Ensure "Uncategorized" process category exists during import#6165
ryancooley merged 1 commit intonextfrom
bugfix/FOUR-13983

Conversation

@runyan-co
Copy link
Copy Markdown
Contributor

@runyan-co runyan-co commented Feb 6, 2024

Issue

In certain circumstances, running the php artisan package-pm-blocks:sync-pm-blocks artisan command would fail by throwing an uncaught exception (see output below). This was not consistent across instances as it would work for most, but a handful threw this exception.

  Illuminate\Database\Eloquent\ModelNotFoundException 

  No query results for model [ProcessMaker\Models\ProcessCategory].

  at vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:619
    615▕         if (! is_null($model = $this->first($columns))) {
    616▕             return $model;
    617▕         }
    618▕ 
  ➜ 619▕         throw (new ModelNotFoundException)->setModel(get_class($this->model));
    620▕     }
    621▕ 
    622▕     /**
    623▕      * Execute the query and get the first result or call a callback.

  1   ProcessMaker/ImportExport/Exporters/ExporterBase.php:526
      Illuminate\Database\Eloquent\Builder::firstOrFail()
...

Reproduction Steps

  1. Navigate to the "Process Categories" tab on the "Processes" page in the "Designer" section of the admin dashboard.
  2. Find the "Uncategorized" default category and rename it to anything different (e.g. "Example Category")
  3. Try to run the php artisan package-pm-blocks:sync-pm-blocks command
  4. Notice it fails because it cannot find the default "Uncategorized" process category by name for one of the PM Block's internal subprocesses.

Solution

Recreate the default "Uncategorized" process category if it does not exist during the import.

How to Test

Run through the reproduction steps but there should be no failure and you should see the "Uncategorized" process category have a count of 3 on the "Process Categories" page.

CICD

ci:deploy
ci:next

Related Tickets & Packages

Code Review Checklist

  • I have pulled this code locally and tested it on my instance, along with any associated packages.
  • This code adheres to ProcessMaker Coding Guidelines.
  • This code includes a unit test or an E2E test that tests its functionality, or is covered by an existing test.
  • This solution fixes the bug reported in the original ticket.
  • This solution does not alter the expected output of a component in a way that would break existing Processes.
  • This solution does not implement any breaking changes that would invalidate documentation or cause existing Processes to fail.
  • This solution has been tested with enterprise packages that rely on its functionality and does not introduce bugs in those packages.
  • This code does not duplicate functionality that already exists in the framework or in ProcessMaker.
  • This ticket conforms to the PRD associated with this part of ProcessMaker.

@gitguardian
Copy link
Copy Markdown

gitguardian bot commented Feb 6, 2024

️✅ There are no secrets present in this pull request anymore.

If these secrets were true positive and are still valid, we highly recommend you to revoke them.
Once a secret has been leaked into a git repository, you should consider it compromised, even if it was deleted immediately.
Find here more information about risks.


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Our GitHub checks need improvements? Share your feedbacks!

@runyan-co runyan-co changed the base branch from develop to next February 6, 2024 18:43
@tokensPM
Copy link
Copy Markdown

tokensPM commented Feb 6, 2024

QA server K8S was successfully deployed https://ci-ddf48e979a.engk8s.processmaker.net

@runyan-co runyan-co self-assigned this Feb 8, 2024
@ryancooley ryancooley merged commit aa655fd into next Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants