diff --git a/adminlib.php b/adminlib.php
index 77cf55b5e2a0e62160ee45e4cf4ea9771f2a94c8..fa1aaaf6eef4395ef4bbe75e084c4ca890db5e29 100644
--- a/adminlib.php
+++ b/adminlib.php
@@ -647,7 +647,7 @@ class workflow_settings {
}
step_manager::insert_or_update($step);
// Save local subplugin settings.
- settings_manager::save_settings($step->id, settings_type::STEP, $form->subpluginname, $data);
+ settings_manager::save_settings($step->id, settings_type::STEP, $form->subpluginname, $data, true);
} else {
$this->view_step_instance_form($form);
return true;
diff --git a/classes/local/form/form_trigger_instance.php b/classes/local/form/form_trigger_instance.php
index 71653a7fc74f44b8b2a15512f367691f66fd182d..036e2567051e2bb89068a4eee3b26c9ac44822ac 100644
--- a/classes/local/form/form_trigger_instance.php
+++ b/classes/local/form/form_trigger_instance.php
@@ -186,7 +186,13 @@ class form_trigger_instance extends \moodleform {
// For active workflows, we do not want the form to be editable.
if ($this->workflowid && !workflow_manager::is_editable($this->workflowid)) {
// The group buttonar is the array of submit buttons. For inactive workflows this is only a cancel button.
- $mform->hardFreezeAllVisibleExcept(array('buttonar'));
+ $notfreeze = ['buttonar'];
+ foreach ($this->lib->instance_settings() as $setting) {
+ if ($setting->editable) {
+ $notfreeze[] = $setting->name;
+ }
+ }
+ $mform->hardFreezeAllVisibleExcept($notfreeze);
}
}
diff --git a/classes/local/manager/settings_manager.php b/classes/local/manager/settings_manager.php
index 2b6bf91e4c3192d72c3a784a7ea032301eb240f3..4db7be7e7e1605779d732a183593beeabf6a41fc 100644
--- a/classes/local/manager/settings_manager.php
+++ b/classes/local/manager/settings_manager.php
@@ -58,9 +58,11 @@ class settings_manager {
* @param 'step'|'trigger' $type type of the subplugin.
* @param string $subpluginname name of the subplugin.
* @param mixed $data submitted data of the form.
+ * @param bool $accessvalidation whether to do only change settings that are editable once the workflow has started.
+ * Then also calls the on_setting_changed listener. Defaults to false.
* @throws \moodle_exception
*/
- public static function save_settings($instanceid, $type, $subpluginname, $data) {
+ public static function save_settings($instanceid, $type, $subpluginname, $data, $accessvalidation = false) {
global $DB;
self::validate_type($type);
@@ -88,7 +90,7 @@ class settings_manager {
throw new \moodle_exception('id of the step instance has to be set!');
}
foreach ($settingsfields as $setting) {
- if (!$wfeditable && !$setting->editable) {
+ if ($accessvalidation && !$wfeditable && !$setting->editable) {
continue;
}
if (array_key_exists($setting->name, $data)) {
@@ -117,7 +119,7 @@ class settings_manager {
$oldvalue = $record->value;
$record->value = $cleanedvalue;
$DB->update_record('tool_lifecycle_settings', $record);
- if (!$wfeditable) {
+ if ($accessvalidation && !$wfeditable) {
$lib->on_setting_changed($setting->name, $cleanedvalue, $oldvalue);
}
}
diff --git a/lang/de/tool_lifecycle.php b/lang/de/tool_lifecycle.php
index 5ce7b49b0715151ca750421d97f4260c13bd8d4a..d4857f18b9e3884f79070c74fb1c8b2eaa6e1693 100644
--- a/lang/de/tool_lifecycle.php
+++ b/lang/de/tool_lifecycle.php
@@ -51,7 +51,7 @@ $string['general_settings_header'] = 'Allgemeine Einstellungen';
$string['followedby_none'] = 'Keine';
$string['invalid_workflow'] = 'Ungültige Workflowkonfiguration';
$string['invalid_workflow_details'] = 'Gehe zur Detailanzeige, um einen Trigger für diesen Workflow zu erstellen.';
-$string['active_workflow_not_changeable'] = 'Die Workflow-Instanz wurde bereits aktiviert. Es ist nicht mehr möglich, Schritte zu ändern.';
+$string['active_workflow_not_changeable'] = 'Die Workflow-Instanz wurde bereits aktiviert. Je nach Schritt-Typ können dessen Einstellungen eventuell noch geändert werden.';
$string['active_workflow_not_removeable'] = 'Die Workflow-Instanz ist aktiv. Es ist nicht möglich, sie zu entfernen.';
$string['workflow_not_removeable'] = 'Es ist nicht möglich, diese Workflow-Instanz zu entfernen. Vielleicht hat sie noch laufende Prozesse?';
$string['invalid_workflow_cannot_be_activated'] = 'Der Workflow kann nicht aktiviert werden, da die Workflowdefinition ungültig ist';
diff --git a/lang/en/tool_lifecycle.php b/lang/en/tool_lifecycle.php
index dcf69f46e01aea6dc83a4e46ed13eb963e59a36f..155f270f331b0cd27a8a5114da55bb28d517e2c9 100644
--- a/lang/en/tool_lifecycle.php
+++ b/lang/en/tool_lifecycle.php
@@ -54,7 +54,7 @@ $string['general_settings_header'] = 'General settings';
$string['followedby_none'] = 'None';
$string['invalid_workflow'] = 'Invalid workflow configuration';
$string['invalid_workflow_details'] = 'Go to details view, to create a trigger for this workflow';
-$string['active_workflow_not_changeable'] = 'The workflow instance was already activated. It is not possible to change any of its steps anymore.';
+$string['active_workflow_not_changeable'] = 'The workflow instance was already activated. Depending on the step type, some of its settings might be still editable.';
$string['active_workflow_not_removeable'] = 'The workflow instance is active. It is not possible to remove it.';
$string['workflow_not_removeable'] = 'It is not possible to remove this workflow instance. Maybe it still has running processes?';
$string['invalid_workflow_cannot_be_activated'] = 'The workflow definition is invalid, thus it cannot be activated.';
diff --git a/trigger/categories/lib.php b/trigger/categories/lib.php
index acb296188e24a8d638185e0ab0f5c7e59f47b53b..64381756146aaf8b921f90126654e3ccd98fd103 100644
--- a/trigger/categories/lib.php
+++ b/trigger/categories/lib.php
@@ -103,8 +103,8 @@ class categories extends base_automatic {
*/
public function instance_settings() {
return array(
- new instance_setting('categories', PARAM_SEQUENCE),
- new instance_setting('exclude', PARAM_BOOL),
+ new instance_setting('categories', PARAM_SEQUENCE, true),
+ new instance_setting('exclude', PARAM_BOOL, true),
);
}
diff --git a/trigger/startdatedelay/lib.php b/trigger/startdatedelay/lib.php
index 7d0cd6491ddc67b1cccc63336eb7af071e138039..01e3d0ed6c5c65e3d11f0715a480314c42e17afa 100644
--- a/trigger/startdatedelay/lib.php
+++ b/trigger/startdatedelay/lib.php
@@ -80,7 +80,7 @@ class startdatedelay extends base_automatic {
*/
public function instance_settings() {
return array(
- new instance_setting('delay', PARAM_INT)
+ new instance_setting('delay', PARAM_INT, true)
);
}