From 91dfad239d9c26f2fe03da5be233378bb41fed9d Mon Sep 17 00:00:00 2001
From: Friederike Schwager <friederike.schwager@rwth-aachen.de>
Date: Wed, 3 Feb 2021 09:46:57 +0100
Subject: [PATCH] don't change timestamp of comments when importing a
 pdfannotator

---
 backup/moodle2/restore_pdfannotator_stepslib.php | 12 +++---------
 version.php                                      |  2 +-
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/backup/moodle2/restore_pdfannotator_stepslib.php b/backup/moodle2/restore_pdfannotator_stepslib.php
index 45fcdab..c65e782 100644
--- a/backup/moodle2/restore_pdfannotator_stepslib.php
+++ b/backup/moodle2/restore_pdfannotator_stepslib.php
@@ -66,8 +66,8 @@ class restore_pdfannotator_activity_structure_step extends restore_activity_stru
         $data = (object)$data;
         $oldid = $data->id;
         $data->course = $this->get_courseid();
-        $data->timecreated = $this->apply_date_offset($data->timecreated);
-        $data->timemodified = $this->apply_date_offset($data->timemodified);
+        $data->timecreated = time();
+        $data->timemodified = time();
 
         $newitemid = $DB->insert_record('pdfannotator', $data); // Insert the pdfannotator record.
 
@@ -84,9 +84,6 @@ class restore_pdfannotator_activity_structure_step extends restore_activity_stru
         $data->pdfannotatorid = $this->get_new_parentid('pdfannotator');
         $data->userid = $this->get_mappingid('user', $data->userid);
 
-        $data->timecreated = $this->apply_date_offset($data->timecreated);
-        $data->timemodified = $this->apply_date_offset($data->timemodified);
-
         $newitemid = $DB->insert_record('pdfannotator_annotations', $data);
         $this->set_mapping('pdfannotator_annotation', $oldid, $newitemid);
 
@@ -116,9 +113,6 @@ class restore_pdfannotator_activity_structure_step extends restore_activity_stru
         $data->annotationid = $this->get_new_parentid('pdfannotator_annotation');
         $data->userid = $this->get_mappingid('user', $data->userid);
 
-        $data->timecreated = $this->apply_date_offset($data->timecreated);
-        $data->timemodified = $this->apply_date_offset($data->timemodified);
-
         $data->pdfannotatorid = $this->get_mappingid('pdfannotator', $data->pdfannotatorid);
 
         $newitemid = $DB->insert_record('pdfannotator_comments', $data);
@@ -149,7 +143,7 @@ class restore_pdfannotator_activity_structure_step extends restore_activity_stru
         $data->commentid = $this->get_new_parentid('pdfannotator_comment');
         $data->userid = $this->get_mappingid('user', $data->userid);
 
-        $data->timecreated = $this->apply_date_offset($data->timecreated);
+    //    $data->timecreated = $this->apply_date_offset($data->timecreated);
         $data->pdfannotatorid = $this->get_mappingid('pdfannotator', $data->pdfannotatorid); // Params: 1. Object class as defined in structure, 2. attribute&/column name.
 
         $newitemid = $DB->insert_record('pdfannotator_reports', $data);
diff --git a/version.php b/version.php
index 1cbc23d..ea0afee 100644
--- a/version.php
+++ b/version.php
@@ -25,6 +25,6 @@
 defined('MOODLE_INTERNAL') || die();
 
 $plugin->component = 'mod_pdfannotator'; // Full name of the plugin (used for diagnostics).
-$plugin->version   = 2021020201; // The current module version (Date: YYYYMMDDXX).
+$plugin->version   = 2021020300; // The current module version (Date: YYYYMMDDXX).
 $plugin->release  = 'PDF Annotator v1.4 release 5';
 $plugin->requires  = 2016112900; // Requires this Moodle version.
-- 
GitLab