Copying a collection with SmartEvidence throws errors

Bug #1997298 reported by Gold
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
22.10
Fix Released
High
Unassigned
23.04
Fix Released
High
Doris Tam

Bug Description

When copying a Collection with SmartEvidence the attached errors show up.

This appears to be from the foreach ($evidences as $evidence) loop when $newartefact does not appear as a key in $newblocks.

To replicate:

* Create a Collection
  * Add SmarteEvidence
  * Add an Annotation block
* Copy the Collection.

Revision history for this message
Gold (gold.catalyst) wrote :
Doris Tam (doristam)
Changed in mahara:
assignee: nobody → Doris Tam (doristam)
Revision history for this message
Robert Lyon (robertl-9) wrote :

Here are some testing instructions to replicate the issue:

1) Create site and login as admin
2) Turn on annotation blocktype in Extensions -> Plugin administration (if it's not active)
3) In Institutions -> Settings enable Smart Evidence for 'mahara' institution
Login as normal user
4) make a blank page (Create button)
5) make a collection (Create button) and choose a 'SmartEvidence framework' then save and add the page to it
6) Go to the collection an on the Smart Evidence page of collection click a spot
7) add annotation text AND embed an image by uploading a new image
8) go to the normal page of the collection
9) copy the collection via the 3 dots menu on right and choose 'collection'

Get the error!!!!

[WAR] 1a (lib/collection.php:711) Undefined offset: 184
[WAR] 1a (lib/collection.php:711) Trying to get property 'view' of non-object

The reason for this (I believe) is the SQL to match up the evidence finds not only the annotation artefact attached to the block (the block id found in the annotation column in framework_evidence table) but also the embedded image artefact associated with the block (vie view_artefact table) and it's trying to handle this artefact as an annotation artefact too and failing

Doris Tam (doristam)
Changed in mahara:
status: New → In Progress
Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review
summary: - Copying a Collection with SmartEvidence throws errors
+ Copying a collection with SmartEvidence throws errors
Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/c/mahara/+/13520
Committed: https://git.mahara.org/mahara/mahara/commit/9f31bb338a33441bf86ad6c93f113e073f7064da
Submitter: "Robert Lyon <email address hidden>"
Branch: main

commit 9f31bb338a33441bf86ad6c93f113e073f7064da
Author: Doris Tam <email address hidden>
Date: Fri Nov 25 17:38:58 2022 +1300

Bug 1997298: Error copying annotation embedded files

Only owners of a collection may copy over annoations.
As they will still own the collection, there is no need
to copy the files again as they are the owner and can
continue referencing it.

Change-Id: I59bffb4dd6c47c4d2e8c485c5c78fb6d5388eb23

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "22.10_DEV" branch: https://reviews.mahara.org/c/mahara/+/13561

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/c/mahara/+/13561
Committed: https://git.mahara.org/mahara/mahara/commit/dd3a3e790ebe05a48d1960068e3693141104d8e6
Submitter: "Robert Lyon <email address hidden>"
Branch: 22.10_DEV

commit dd3a3e790ebe05a48d1960068e3693141104d8e6
Author: Doris Tam <email address hidden>
Date: Fri Nov 25 17:38:58 2022 +1300

Bug 1997298: Error copying annotation embedded files

Only owners of a collection may copy over annoations.
As they will still own the collection, there is no need
to copy the files again as they are the owner and can
continue referencing it.

Change-Id: I59bffb4dd6c47c4d2e8c485c5c78fb6d5388eb23
(cherry picked from commit 9f31bb338a33441bf86ad6c93f113e073f7064da)

Robert Lyon (robertl-9)
Changed in mahara:
milestone: 23.04.0 → none
Robert Lyon (robertl-9)
Changed in mahara:
status: Fix Committed → Fix Released
no longer affects: mahara
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.