Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
171 commits
Select commit Hold shift + click to select a range
8f3663e
fix adminapprove sql error single approve
bluetom May 28, 2025
99fc6f0
catch,prevent missing workflow error
bluetom Jun 3, 2025
c32ae4b
fix uploadworkflow redirect
bluetom Jun 3, 2025
c84ecf1
workflowoverview: show also delayed trigger courses but only when sti…
bluetom Jun 4, 2025
1b9c6d4
codechecker issue
bluetom Jun 4, 2025
a877bbc
shift showdetails icon to block trigger
bluetom Jun 5, 2025
911144b
activestep.php: make approval tab an active link
bluetom Jun 5, 2025
76ff4c8
codechecker issue
bluetom Jun 5, 2025
8fa492c
exclude trigger customfieldsemester from git
bluetom Jun 5, 2025
336f75b
mtrace processes without workflow and delete processes of removed cou…
bluetom Jun 5, 2025
c0faee4
codechecker issue
bluetom Jun 5, 2025
7a202e6
remove customfield_semester dependency
bluetom Jun 5, 2025
70581fb
codechecker issue
bluetom Jun 5, 2025
8cecd99
remove old showdetailicon
bluetom Jun 5, 2025
b32a04f
improve display of next run time
bluetom Jun 5, 2025
087929b
fix .gitignore syntax error
bluetom Jun 5, 2025
b36266c
remove trigger customfieldsemester from github
bluetom Jun 5, 2025
7eb4874
another fix in .gitignore
bluetom Jun 5, 2025
8c6f589
fix behat error after unintentionally deleting code lines
bluetom Jun 5, 2025
30d4fef
remove exceptions for external customfieldsemester plugin
bluetom Jun 5, 2025
933cd99
trigger byrole: introduce invert function
bluetom Jun 5, 2025
94a9c2d
prevent from deleting course 1
bluetom Jun 5, 2025
978abe5
add step movecategory
bluetom Jun 5, 2025
61a98dd
codechecker issues
bluetom Jun 5, 2025
985de87
codechecker issue
bluetom Jun 5, 2025
9f2c41e
add trigger lastaccess
bluetom Jun 6, 2025
fbe51ca
codechecker issues
bluetom Jun 6, 2025
cc0d6d4
codechecker issue
bluetom Jun 6, 2025
1cb01ac
overall workflow filter - part 1
bluetom Jun 10, 2025
41c6fa3
overall workflow filter - phpdoc issues
bluetom Jun 10, 2025
37acfd5
overall workflow filter - part 2
bluetom Jun 10, 2025
c4ef875
fix typo
bluetom Jun 10, 2025
e2086e6
fix lastaccess error when no courses found
bluetom Jun 10, 2025
04fceb0
fix lastaccess error when no courses found 2
bluetom Jun 10, 2025
a0b181d
overall workflow filter new start
bluetom Jun 11, 2025
dfaaa1d
workflow id instead of workflow object in processor
bluetom Jun 16, 2025
4bf3c08
fix triggered courses counting error
bluetom Jun 16, 2025
c30aaa5
codechecker issues
bluetom Jun 16, 2025
5bcf39b
add filter form to procerror page
bluetom Jun 17, 2025
f46007f
phpdoc issue
bluetom Jun 17, 2025
99c7053
codechecker issue
bluetom Jun 17, 2025
9ad097a
show proc error filter selects only if there are options
bluetom Jun 17, 2025
b8defd8
add step pushbackuptask
bluetom Jun 18, 2025
eca4b67
categories trigger: instance settings should not be editable
bluetom Jun 18, 2025
ab0127e
re-add step pushbackuptask to fix git submodule error
bluetom Jun 19, 2025
b9ece23
codechecker issues
bluetom Jun 19, 2025
1bf9bb9
shift subplugins list to own page
bluetom Jun 23, 2025
3dac675
change db field name manual to manually
bluetom Jun 23, 2025
a9e7c6b
fix phpunit test
bluetom Jun 23, 2025
b8891da
fix typos in comments
bluetom Jun 24, 2025
089b973
no get_course in process_courses anymore
bluetom Jun 24, 2025
170ceb6
display active workflow processes and errors - the counting
bluetom Jun 25, 2025
0f6bf43
trigger countings partial as tooltip and show courses already in work…
bluetom Jul 6, 2025
448d68c
debug messages in processor.php removed
bluetom Jul 6, 2025
fae6a3f
Sync with Learnweb's centralized pull request template
github-actions[bot] Jul 6, 2025
903aea0
get back erroneously removed function get_processes_by_workflow
bluetom Jul 6, 2025
9232de7
workflowoverview: show also 0 courses in exclude trigger. Make instan…
bluetom Jul 6, 2025
12e3159
proceed, rollback event: take course context when contex missing
bluetom Jul 11, 2025
4437a97
show amount of delays that would be deleted next to button
bluetom Jul 11, 2025
7d4f059
fix customfielddelay missing field error message
bluetom Jul 15, 2025
c7287d2
fix invert query in byrole trigger
bluetom Jul 15, 2025
38c17c5
exclude trigger: show excluded 0 as well
bluetom Jul 15, 2025
70bc14a
consider trigger setting invert as exclude
bluetom Jul 15, 2025
385bcbe
exclude trigger: show excluded 0 as well - part 2
bluetom Jul 15, 2025
9c46f87
exclude trigger: show excluded 0 as well - part 3
bluetom Jul 15, 2025
d7954e8
workflowoverview: show triggered 0 as well
bluetom Jul 15, 2025
a9dd0c6
repair sorting in triggered courses and step courses lists
bluetom Jul 15, 2025
fbb7593
codechecker issue
bluetom Jul 15, 2025
3beb41b
process_courses: no processing if there is no process workflowid
bluetom Jul 16, 2025
1f6ea63
restore version 4.5 of function process_courses
bluetom Jul 17, 2025
fdb876d
restore version 4.5 of function call_trigger
bluetom Jul 17, 2025
b1deea1
add run link to timetrigger row
bluetom Jul 17, 2025
c570347
add run string for plugin
bluetom Jul 17, 2025
d24a888
call_trigger: no debug messages when behat testing
bluetom Jul 17, 2025
e43980c
fix step email context course id
bluetom Jul 17, 2025
4f05744
echo run.php debug messages
bluetom Jul 17, 2025
a94ceac
call_trigger: mtrace only when called by cron
bluetom Jul 17, 2025
97c84e7
call_trigger: debug msg with timestamp
bluetom Jul 17, 2025
283a8eb
call_trigger: debug msg with timestamp 2
bluetom Jul 17, 2025
bdccc7c
call_trigger: debug msg with timestamp 3
bluetom Jul 17, 2025
4ec66e7
fix step email context course id 2
bluetom Jul 17, 2025
e32cc2f
call_trigger: debug msg with timestamp 4
bluetom Jul 17, 2025
397b88e
try to fix interaction.feature
bluetom Jul 17, 2025
f9e8521
codechecker issue
bluetom Jul 17, 2025
a045f65
fix unit test proc_error
bluetom Jul 17, 2025
f5b9031
fix deletecourse step
bluetom Jul 17, 2025
a3a600a
step libs function process_course: make sure course is of type stdClass
bluetom Jul 18, 2025
9770def
fix process_error_test
bluetom Jul 18, 2025
cadda91
add tests in ci config-file
bluetom Jul 18, 2025
8af9705
fixed manual->manually error when upgrading
bluetom Jul 23, 2025
29a0ef2
update changed.md
bluetom Jul 23, 2025
82e9a8e
fix upgrade.php to rename field manual before the field is used
bluetom Jul 24, 2025
96b36ec
upgrading from older versions: execute statements of last upgrade.php…
bluetom Jul 24, 2025
7fcb60e
no need to unset context when rollback and return if no workflow when…
bluetom Jul 31, 2025
32b2da9
Fix permissions (#247)
justusdieckmann Aug 4, 2025
8a2fc1e
Introduce trigger lib function check_course_code, new ci file (#2)
bluetom Aug 4, 2025
867d0f0
Subplugins both ways of describing following MDL-83705. (#250)
lucaboesch Aug 4, 2025
03e856a
reimplement trigger lib function course_check
bluetom Aug 5, 2025
e5d066e
refactor last access trigger: no single course ids in sql
bluetom Aug 7, 2025
695db87
process_courses: no need to catch workflow
bluetom Aug 7, 2025
126a950
processor.php: change countings to take check course code into account
bluetom Aug 8, 2025
23bbb2e
avoid parameter restriction errors on large moodle sites #249
bluetom Aug 13, 2025
420640d
introduce trigger api function multipleuse to allow multiple use per …
bluetom Aug 13, 2025
3874c60
use function multipleuse in workflowoverview
bluetom Aug 13, 2025
523a41d
trigger customfielddelay: better handling when no date fields present
bluetom Aug 13, 2025
cf27226
unique sql parameter for customfielddelay trigger, remove hardcoded t…
bluetom Aug 13, 2025
af00410
small cosmetics list courses window, fix semindependent counting
bluetom Aug 13, 2025
80a82e1
trigger selection sql: conjunction(AND) and disjunction(OR) now possible
bluetom Aug 15, 2025
14170c7
codechecker issues
bluetom Aug 15, 2025
147aa68
we call it download if we download a workflow definition
bluetom Aug 17, 2025
0cd8bcc
small phpdoc changes in process_manager
bluetom Aug 17, 2025
53af523
tiny fixes not important
bluetom Aug 18, 2025
770ffd6
remove debug statements
bluetom Aug 18, 2025
b5d0e93
new feature for every workflow step: to define to which step to rollb…
bluetom Aug 21, 2025
c619dcf
change tooltip mouseover icon to hand
bluetom Aug 21, 2025
1cc0a7e
course selection run: show run-link only when workflow is active
bluetom Aug 21, 2025
9b6a7b9
Minus for indicating exclude triggers, tiny css cosmetics, fix lastru…
bluetom Aug 22, 2025
95c46e1
codechecker issues
bluetom Aug 22, 2025
02168a5
codechecker issues
bluetom Aug 22, 2025
ace8531
fix unit test
bluetom Aug 22, 2025
633c110
fix behat tests
bluetom Aug 23, 2025
13a9b0f
ci: workflow run without config
bluetom Aug 23, 2025
d5ea54d
version.php, changelog, ci
bluetom Aug 23, 2025
395a683
very small and unimportant changes
bluetom Aug 25, 2025
c2dbaa3
new icons for proc_error_table col tools
bluetom Aug 25, 2025
eb1d57e
adminapprove button proceed class primary
bluetom Aug 25, 2025
6d1e3db
adminapprove button proceed class primary 2
bluetom Aug 25, 2025
2a8b483
adminapprove button proceed class primary 3
bluetom Aug 25, 2025
af1958a
Not the same IDs for table process and proc_error
bluetom Aug 26, 2025
7932bee
lean config.json for developing
bluetom Aug 26, 2025
a925588
display error time in errors table
bluetom Aug 27, 2025
0bcfcb3
provide possibility to delete invalid process error entries
bluetom Aug 28, 2025
73b350c
codechecker issues
bluetom Aug 28, 2025
e7fa54e
try to fix behat tests
bluetom Aug 29, 2025
35b9f94
codechecker issue
bluetom Aug 29, 2025
1473298
revert buggy last changes to workflow definitions table and dont show…
bluetom Aug 30, 2025
0b10304
trace course processing as well, categories trigger: improve cat list…
bluetom Sep 5, 2025
a233dad
list every course selection and process with run.php in debug mode
bluetom Sep 5, 2025
97a71f3
fix error with remaining courses in interaction table
bluetom Sep 7, 2025
2ce9840
small fixes regarding manual trigger
bluetom Sep 9, 2025
bfb9b6c
codechecker issue
bluetom Sep 10, 2025
3b3fc4e
codechecker issue 2
bluetom Sep 10, 2025
6d22e26
manual workflow:reintroduce remaining courses again
bluetom Sep 10, 2025
4d8edac
fix error when aborting processes after course deletion
bluetom Sep 11, 2025
f9d9cd5
interaction behat tests: increase waiting time when executing task
bluetom Sep 12, 2025
ddfc06d
interaction behat tests: increase waiting time when executing task 2
bluetom Sep 12, 2025
5d77191
update changes.md
bluetom Sep 12, 2025
3b7a0be
github workflow: change to the version of config.json for publishing
bluetom Sep 12, 2025
51e93de
fix unit test PR #230
bluetom Sep 12, 2025
2d217bf
Sync with Learnweb's centralized pull request template (#257)
github-actions[bot] Sep 12, 2025
a791fde
a lack of capability is now the only reason not to render the manage …
bluetom Sep 12, 2025
5793ed6
update changes.md
bluetom Sep 14, 2025
fd63455
edit page: make field elementname longer
bluetom Sep 16, 2025
6d70352
remove unused process_courses_table
bluetom Sep 16, 2025
f2b547c
correction of maturity level to BETA
bluetom Sep 19, 2025
e8e10c8
use USER-timezone in function userdate() to display correct dates
bluetom Sep 19, 2025
c215869
fix behat test
bluetom Sep 19, 2025
ac1414f
small fixes in display-courselist-tables and additional trigger descr…
bluetom Sep 28, 2025
a953c9f
codechecker issue
bluetom Sep 28, 2025
61f5582
change maturity level to stable
bluetom Sep 28, 2025
33ae8ca
triggered_courses_tables: optimize some columns and the display of co…
bluetom Sep 30, 2025
71e0414
return to beta in main, codechecker issues
bluetom Sep 30, 2025
8ffccf9
fix problems with check_course_code
bluetom Oct 2, 2025
c75e1f7
codechecker issue
bluetom Oct 2, 2025
528e801
erase test code
bluetom Oct 2, 2025
39ba470
update changes.md
bluetom Oct 2, 2025
cb46b60
update readme and make it maturity_stable again
bluetom Oct 2, 2025
2df5fe6
merge main 4.5.5(v4.5-r6)
bluetom Oct 5, 2025
78d4812
issue#178 refactor subplugins calls
nathan-catalystit Sep 4, 2023
1137f84
issue#178 refactor subplugins calls
nathan-catalystit Sep 4, 2023
52dd0e9
Reformat code to resolve CI errors
Sep 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
> **Note:** Please fill out all required sections and remove irrelevant ones.
> **Note:** Please fill out all relevant sections and remove irrelevant ones.
### 🔀 Purpose of this PR:

- [ ] Fixes a bug
Expand Down
29 changes: 23 additions & 6 deletions .github/workflows/config.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,33 @@
{
"moodle-plugin-ci": "4.5.6",
"main-moodle": "MOODLE_405_STABLE",
"main-php": "8.3",
"main-db": "pgsql",
"moodle-testmatrix": {
"MOODLE_401_STABLE": {
"php": ["8.0", "8.1"],
"db": ["pgsql", "mariadb", "mysqli"]
"php": [
"8.0",
"8.1"
]
},
"MOODLE_404_STABLE": {
"php": [
"8.1",
"8.2",
"8.3"
]
},
"MOODLE_405_STABLE": {
"php": ["8.1", "8.2", "8.3"],
"db": ["pgsql", "mariadb", "mysqli"]
"php": [
"8.1",
"8.2",
"8.3"
],
"db": [
"pgsql",
"mariadb",
"mysqli"
]
}
},
"moodle-plugin-ci": "4.4.5"
}
}
18 changes: 18 additions & 0 deletions .github/workflows/config_dev.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"moodle-plugin-ci": "4.5.6",
"main-moodle": "MOODLE_405_STABLE",
"main-php": "8.3",
"main-db": "pgsql",
"moodle-testmatrix": {
"MOODLE_405_STABLE": {
"php": [
"8.3"
],
"db": [
"pgsql",
"mariadb",
"mysqli"
]
}
}
}
33 changes: 33 additions & 0 deletions .github/workflows/config_publish.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"moodle-plugin-ci": "4.5.6",
"main-moodle": "MOODLE_405_STABLE",
"main-php": "8.3",
"main-db": "pgsql",
"moodle-testmatrix": {
"MOODLE_401_STABLE": {
"php": [
"8.0",
"8.1"
]
},
"MOODLE_404_STABLE": {
"php": [
"8.1",
"8.2",
"8.3"
]
},
"MOODLE_405_STABLE": {
"php": [
"8.1",
"8.2",
"8.3"
],
"db": [
"pgsql",
"mariadb",
"mysqli"
]
}
}
}
61 changes: 61 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,67 @@
CHANGELOG
=========

Further information to the latest changes can be found here: https://github.com/learnweb/moodle-tool_lifecycle/wiki/Changes-of-version-4.5.4-and-4.5.5
and here: https://github.com/learnweb/moodle-tool_lifecycle/wiki/Changes-of-version-4.5-in-detail

4.5.5 (2025-02-10)
------------------
* [FIXED] Problems with check_course_code
* [FIXED] Display time as usertime, not UTC (Issue #188)
* [FEATURE] A lack of capability is now the only reason not to render the manage courses sec nav link issue #198
* [FIXED] Fix unit test PR #230
* [FIXED] Workflowoverview Course selection: show run-link only when workflow is active
* [FEATURE] Display error time in errors table
* [FEATURE] Provide possibility to delete invalid/outdated process error entries
* [FEATURE] Lifecycle Task: trace course processing as well, Trigger categories: improve cat listing in frozen edit form
* [FIXED] Fix missing course error when aborting processes after course deletion
* [FEATURE] New lib function multiple_use() makes a trigger type choosable for a single workflow n-times
* [FEATURE] Introduce a step option to define an individual target step in case of rollback (issue #213)
* [FEATURE] EXPERIMENTAL: Trigger selection sql - conjunction(AND) and disjunction(OR) now possible (workflow option)
* [FEATURE] Refactor last access trigger: no single course ids in sql (issue #243)
* [FEATURE] Subplugins both ways of describing following MDL-83705 (issue #249)
* [FEATURE] Introduce new lib function check_course_code to force using function check_course for every course candidate (issue #243)
* [FIXED] Workflows with triggers which have more than 65.535 paramaters throw an error (issue #243)
* [FEATURE] Display trigger counting partial as tooltip; show courses already part of the workflow process or the process errors
* [FEATURE] Workflowoverview: show also '0' courses in exclude trigger. Make instancenames in supplugin form of active workflows static
* [FIXED] proceed, rollback event: take course context when context is missing
* [FIXED] Fix trigger customfielddelay's missing field error message
* [FEATURE] Delete all delays: show amount of delays that would be deleted next to button
* [FEATURE] Workflowoverview: exclude trigger: show excluded 0 as well
* [FIXED] prozessor.php: restore version 4.5 of function process_courses
* [FIXED] prozessor.php: restore version 4.5 of function call_trigger
* [FEATURE] Workflowoverview: place new link to run lifecycle task in timetrigger row
* [FIXED] Fix step email context course id error
* [FIXED] call_trigger: mtrace only when called by cron
* [FIXED] Fix behat tests interaction.feature and manual_trigger.feature
* [FIXED] Step libs' function process_course error: make sure course is of type stdClass
* [FIXED] Fix unit test process_error_test
* [FEATURE] Add additional jobs to run in ci-file
* [FIXED] Fixed error occurring when renaming field manual to manually during the upgrade

4.5.4 (2025-06-23)
------------------
* [FEATURE] No php notice if string plugindescription is missing
* [FIXED] Fix adminapprove sql error single approve
* [FIXED] catch/prevent missing workflow error
* [FIXED] Fix uploadworkflow wrong redirect
* [FEATURE] Workflowoverview: show also delayed trigger courses but only when still in delay
* [FEATURE] Shift showdetails icon to block trigger
* [FEATURE] activestep.php: make approval tab an active link
* [FEATURE] Exclude trigger customfieldsemester from git
* [FIXED] mtrace processes without workflow and delete processes of removed courses
* [FEATURE] Remove customfield_semester dependency
* [FIXED] Improve display of next run time
* [FEATURE] Trigger byrole: introduce invert function
* [FEATURE] Prevent deleting course 1
* [FEATURE] Add step movecategory
* [FEATURE] Add trigger lastaccess
* [FIXED] Fix lastaccess error when no courses found
* [FEATURE] Add filter form to procerror page
* [FEATURE] Categories trigger: instance settings should not be editable
* [FEATURE] Shift subplugins list to own page
* [FIXED] DB field 'manual' now reserved word in mysql version 8.4, change to 'manually'

4.5.0 (2025-05-04)
------------------
* [FEATURE] Workflowoverview: Added possibility to select single courses for process
Expand Down
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,19 @@ To be adaptable to the needs of different institutions the plugin provides two s

## Subplugins
Requirements that are specific to your institution can be added through additional subplugins.
A list of all subplugins and more information can be found in the [Wiki](https://github.com/learnweb/moodle-tool_lifecycle/wiki/List-of-Additional-Subplugins) ([subpluginslist](https://github.com/learnweb/moodle-tool_lifecycle/wiki/List-of-Additional-Subplugins)).
A list of all subplugins and more information can be found in the [Wiki](https://github.com/learnweb/moodle-tool_lifecycle/wiki) ([subpluginslist](https://github.com/learnweb/moodle-tool_lifecycle/wiki/List-of-Installed-Subplugins)).
It provides instructions for administrators as well as for developers to implement their own requirements into subplugins.

Installation
============
This is an admin plugin and should go into ``admin/tool/lifecycle``.

In the current Lifecycle version 4.5.5 (v4.5-r6), it may be necessary to delete the old directory admin/tool/lifecycle and
clone the new version with Git. This should be possible without any issues, as no user data is stored in that directory. ==> But be aware: If you are using the customfieldsemester trigger or other special triggers and steps, or if you have made local
changes to the included triggers or steps you would need to save them before installation and copy them into the new directory afterwards.

Obtain this plugin from https://moodle.org/plugins/view/tool_lifecycle.

Moodle version
==============
The plugin is continously tested with all moodle versions, which are security supported by the moodle headquarter.
Therefore, Travis uses the most current release to build a test instance and run the behat and unit tests on them.
In addition to all stable branches the version is tested against the master branch to support early adopters.

Changelog
=========
The changes for every release are listed here: https://github.com/learnweb/moodle-tool_lifecycle/wiki/Change-log.
The plugin is continuously tested with all moodle versions, which are security supported by the moodle headquarter.
7 changes: 4 additions & 3 deletions activeprocesses.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
require_once(__DIR__ . '/../../../config.php');
require_once($CFG->libdir . '/adminlib.php');

require_login();
require_capability('moodle/site:config', context_system::instance());
require_admin();

$syscontext = context_system::instance();
$PAGE->set_url(new \moodle_url(urls::ACTIVE_PROCESSES));
Expand Down Expand Up @@ -71,7 +70,9 @@

$heading = get_string('pluginname', 'tool_lifecycle')." / ".get_string('find_course_list_header', 'tool_lifecycle');
echo $renderer->header($heading);
$tabrow = tabs::get_tabrow(true);
$tabparams = new stdClass();
$tabparams->activelink = true;
$tabrow = tabs::get_tabrow($tabparams);
$id = 'activeworkflows';
$renderer->tabs($tabrow, $id);

Expand Down
3 changes: 1 addition & 2 deletions activeworkflows.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
require_once(__DIR__ . '/../../../config.php');
require_once($CFG->libdir . '/adminlib.php');

require_login();
require_capability('moodle/site:config', context_system::instance());
require_admin();

$syscontext = context_system::instance();
$PAGE->set_url(new \moodle_url(urls::ACTIVE_WORKFLOWS));
Expand Down
3 changes: 2 additions & 1 deletion classes/event/process_proceeded.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
namespace tool_lifecycle\event;

use context_course;
use moodle_url;
use tool_lifecycle\local\entity\process;

Expand Down Expand Up @@ -54,7 +55,7 @@ class process_proceeded extends \core\event\base {
public static function event_from_process($process) {
$data = [
'courseid' => $process->courseid,
'context' => $process->context,
'context' => $process->context ?? context_course::instance($process->courseid),
'other' => [
'processid' => $process->id,
'workflowid' => $process->workflowid,
Expand Down
6 changes: 4 additions & 2 deletions classes/event/process_rollback.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

namespace tool_lifecycle\event;

use context_course;
use moodle_url;
use tool_lifecycle\local\entity\process;

Expand All @@ -45,7 +46,7 @@
class process_rollback extends \core\event\base {

/**
* Creates an process_rollabck event from a process.
* Creates an process_rollback event from a process.
*
* @param process $process
* @return process_rollback
Expand All @@ -55,7 +56,7 @@ class process_rollback extends \core\event\base {
public static function event_from_process($process) {
$data = [
'courseid' => $process->courseid,
'context' => $process->context,
'context' => $process->context ?? context_course::instance($process->courseid),
'other' => [
'processid' => $process->id,
'workflowid' => $process->workflowid,
Expand Down Expand Up @@ -142,4 +143,5 @@ public static function get_other_mapping() {
// No backup and restore.
return false;
}

}
4 changes: 2 additions & 2 deletions classes/local/backup/restore_lifecycle_workflow.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ private function check_subplugin_validity() {
}

foreach ($this->trigger as $trigger) {
$steplib = lib_manager::get_trigger_lib($trigger->subpluginname);
$triggerlib = lib_manager::get_trigger_lib($trigger->subpluginname);
$filteredsettings = [];
foreach ($this->settings as $setting) {
if ($setting->pluginid === $trigger->id) {
Expand All @@ -212,7 +212,7 @@ private function check_subplugin_validity() {
}
$errors = array_map(
fn($x) => get_string('restore_error_in_trigger', 'tool_lifecycle', $trigger->instancename) . $x,
$steplib->ensure_validity($filteredsettings)
$triggerlib->ensure_validity($filteredsettings)
);
$this->errors = array_merge($this->errors, $errors);
}
Expand Down
11 changes: 8 additions & 3 deletions classes/local/entity/process.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,17 @@ private function __construct($id, $workflowid, $courseid, $context, $stepindex,
/**
* Creates a Life Cycle Process from a db record.
* @param object $record Data object.
* @param bool $coursedeleted If course is deleted no context can be fetched
* @return process
*/
public static function from_record($record) {
public static function from_record($record, $coursedeleted = false) {
if (!object_property_exists($record, 'id')) {
return null;
}
if (!object_property_exists($record, 'workflowid')) {
return null;
}
if (!object_property_exists($record, 'courseid')) {
if (!object_property_exists($record, 'courseid') || !is_numeric($record->courseid)) {
return null;
}
if (object_property_exists($record, 'waiting') && $record->waiting) {
Expand All @@ -104,7 +105,11 @@ public static function from_record($record) {
$stepindex = 0;
}

$context = \context_course::instance($record->courseid);
if (!$coursedeleted) {
$context = \context_course::instance($record->courseid);
} else {
$context = "";
}
$instance = new self($record->id,
$record->workflowid,
$record->courseid,
Expand Down
6 changes: 6 additions & 0 deletions classes/local/entity/step_subplugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
*/
class step_subplugin extends subplugin {

/** @var int $rollbacktosortindex the stepindex of the step to which the current step has to be rolled back */
public $rollbacktosortindex;

/**
* Creates a subplugin from a db record.
* @param object $record Data object.
Expand All @@ -55,6 +58,9 @@ public static function from_record($record) {
if (object_property_exists($record, 'sortindex') ) {
$instance->sortindex = $record->sortindex;
}
if (object_property_exists($record, 'rollbacktosortindex') ) {
$instance->rollbacktosortindex = $record->rollbacktosortindex;
}

return $instance;
}
Expand Down
Loading