diff --git a/archive/workflow/class_archiveTask.inc b/archive/workflow/class_archiveTask.inc index a27afd7d865714df0393400abf233c240b9993da..01f1b194263d2693aac3f968c1cfd805384ff171 100644 --- a/archive/workflow/class_archiveTask.inc +++ b/archive/workflow/class_archiveTask.inc @@ -79,6 +79,12 @@ class archiveTask extends simplePlugin // SupAnn Status management if (class_available('supannAccountStatus')) { $this->setSupannStates(); + } else { + msg_dialog::display( + _('Warning'), + _('The SupAnn Account Status plugin is not activated. This task cannot function properly without it.'), + WARNING_DIALOG + ); } } @@ -144,13 +150,23 @@ class archiveTask extends simplePlugin */ function save (): array { - // Verify if this task has to be executed upon saving. - $execTasks = $this->parent->getBaseObject()->fdSubTasksActivation ?? NULL; - - if ($execTasks) { - $this->generateSlaveTasks(); - } - - return parent::save(); + // Check if the SupAnn Account Status plugin is available (It should not happen as attributes verification will trigger errors before save) + if (!class_available('supannAccountStatus')) { + msg_dialog::display( + _('Error'), + _('The SupAnn Account Status plugin is not activated. This task cannot be saved or executed without it.'), + ERROR_DIALOG + ); + return []; // Return an empty array to indicate no action was taken + } + + // Verify if this task has to be executed upon saving + $execTasks = $this->parent->getBaseObject()->fdSubTasksActivation ?? NULL; + + if ($execTasks) { + $this->generateSlaveTasks(); + } + + return parent::save(); } } \ No newline at end of file