Skip to content

Commit

Permalink
Display only unique errors when Workflows causes multiple errors
Browse files Browse the repository at this point in the history
  • Loading branch information
NinaHerrmann committed Apr 24, 2024
1 parent 9933487 commit ee6b410
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions uploadworkflow.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

use core\notification;
use tool_lifecycle\local\backup\restore_lifecycle_workflow;
use tool_lifecycle\local\form\form_upload_workflow;
use tool_lifecycle\permission_and_navigation;
Expand Down Expand Up @@ -54,9 +55,9 @@
$force = $data->force ?? false;
$errors = $restore->execute($force);
if (count($errors) != 0) {
\core\notification::add(get_string('workflow_was_not_imported', 'tool_lifecycle'), \core\notification::ERROR);
foreach ($errors as $error) {
\core\notification::add($error, \core\notification::ERROR);
notification::add(get_string('workflow_was_not_imported', 'tool_lifecycle'), notification::ERROR);
foreach (array_unique($errors) as $error) {
notification::add($error, notification::ERROR);
}
$form = new form_upload_workflow(null, ['showforce' => true]);

Expand Down

0 comments on commit ee6b410

Please sign in to comment.