Skip to content
Snippets Groups Projects
Unverified Commit 8e08f2d0 authored by Nina Herrmann's avatar Nina Herrmann Committed by GitHub
Browse files

fix upload workflow (#185)

* fix upload workflow

* inserting feedback

* finally
parent 160bc686
Branches
No related tags found
No related merge requests found
...@@ -59,7 +59,6 @@ class restore_lifecycle_workflow { ...@@ -59,7 +59,6 @@ class restore_lifecycle_workflow {
public function __construct($xmldata) { public function __construct($xmldata) {
$this->reader = new \XMLReader(); $this->reader = new \XMLReader();
$this->reader->XML($xmldata); $this->reader->XML($xmldata);
} }
/** /**
...@@ -102,6 +101,7 @@ class restore_lifecycle_workflow { ...@@ -102,6 +101,7 @@ class restore_lifecycle_workflow {
$this->workflow->timeactive = null; $this->workflow->timeactive = null;
$this->workflow->timedeactive = null; $this->workflow->timedeactive = null;
$this->workflow->sortindex = null; $this->workflow->sortindex = null;
workflow_manager::insert_or_update($this->workflow);
} }
/** /**
......
...@@ -55,6 +55,7 @@ class workflow_manager { ...@@ -55,6 +55,7 @@ class workflow_manager {
$workflow->id = $DB->insert_record('tool_lifecycle_workflow', $workflow); $workflow->id = $DB->insert_record('tool_lifecycle_workflow', $workflow);
} }
$transaction->allow_commit(); $transaction->allow_commit();
return $workflow->id;
} }
/** /**
......
@tool @tool_lifecycle @tool @tool_lifecycle @manual_trigger
Feature: Add a manual trigger and test view and actions as a teacher Feature: Add a manual trigger and test view and actions as a teacher
Background: Background:
......
@tool @tool_lifecycle @_file_upload @upload_workflow
Feature: Upload a workflow definition
@javascript
Scenario: Upload a new workflow
Given I log in as "admin"
And I navigate to "Plugins > Admin tools > Life Cycle > Workflow drafts" in site administration
And I click on "Upload workflow" "link"
And I upload "admin/tool/lifecycle/tests/fixtures/simpleworkflow.xml" file to "File" filemanager
And I press "Upload"
Then I should see "A Workflow"
<workflow id="3" title="A Workflow" manual="" displaytitle="Delete old courses" rollbackdelay="15811200" finishdelay="15811200" delayforallworkflows="0">
<step id="1" instancename="Create Backup" workflowid="3" subpluginname="createbackup" sortindex="1">
<setting name="maximumbackupspercron" value="10"/>
</step>
<step id="2" instancename="Delete Course" workflowid="3" subpluginname="deletecourse" sortindex="2">
<setting name="maximumdeletionspercron" value="10"/>
</step>
<trigger id="3" instancename="Date to trigger" workflowid="3" subpluginname="specificdate" sortindex="1">
<setting name="dates" value="01.08"/>
<setting name="timelastrun" value="0"/>
</trigger>
<trigger id="4" instancename="Age of course" workflowid="3" subpluginname="startdatedelay" sortindex="2">
<setting name="delay" value="31536000"/>
</trigger>
</workflow>
...@@ -22,13 +22,9 @@ ...@@ -22,13 +22,9 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/ */
use tool_lifecycle\action;
use tool_lifecycle\local\backup\restore_lifecycle_workflow; use tool_lifecycle\local\backup\restore_lifecycle_workflow;
use tool_lifecycle\local\entity\workflow;
use tool_lifecycle\local\form\form_upload_workflow; use tool_lifecycle\local\form\form_upload_workflow;
use tool_lifecycle\local\form\form_workflow_instance; use tool_lifecycle\permission_and_navigation;
use tool_lifecycle\local\manager\workflow_manager;
use tool_lifecycle\local\table\workflow_definition_table;
use tool_lifecycle\urls; use tool_lifecycle\urls;
require_once(__DIR__ . '/../../../config.php'); require_once(__DIR__ . '/../../../config.php');
...@@ -36,7 +32,7 @@ require_once($CFG->libdir . '/adminlib.php'); ...@@ -36,7 +32,7 @@ require_once($CFG->libdir . '/adminlib.php');
require_login(); require_login();
global $OUTPUT, $PAGE, $DB; global $OUTPUT, $PAGE, $DB;
\tool_lifecycle\permission_and_navigation::setup_draft(); permission_and_navigation::setup_draft();
$PAGE->set_url(new \moodle_url(urls::UPLOAD_WORKFLOW)); $PAGE->set_url(new \moodle_url(urls::UPLOAD_WORKFLOW));
$title = get_string('upload_workflow', 'tool_lifecycle'); $title = get_string('upload_workflow', 'tool_lifecycle');
...@@ -63,7 +59,7 @@ if ($data = $form->get_data()) { ...@@ -63,7 +59,7 @@ if ($data = $form->get_data()) {
die(); die();
} else { } else {
// Redirect to workflow page. // Redirect to workflow page.
redirect(urls::WORKFLOW_DETAILS, ['wf' => $restore->get_workflow()->id]); redirect(new moodle_url(urls::WORKFLOW_DETAILS, ['wf' => $restore->get_workflow()->id]));
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment