Unable to copy pages or collections into group

Bug #1990981 reported by Stefan Bäcker
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Mahara
22.04
Fix Released
High
Unassigned
22.10
Fix Released
High
Unassigned
23.04
Fix Released
High
Unassigned

Bug Description

When trying to copy a page or collection into a group, the group information gets lost when moving away from the first page of candidates. Collections will be copied, but into the personal area, not into the desired group.

Debugging shows line 6504 in lib/view.php to be the culprit. Adding params only when there are none makes no sense. Removing the negation seems to solve the problem. Please find patch included.

First part of patch solves a type mismatch error related to copying pages with certain artefacts.
Second part solves this actual bug.

Mahara version 22.04.2
Ubuntu 20.04
MariaDB 10.3

Reproducible on current demo.mahara.org

Revision history for this message
Stefan Bäcker (stefan-baecker-29) wrote :
Revision history for this message
Gold (gold.catalyst) wrote (last edit ):

Hello Stefan,

Thanks for the report and especially for the patch. Just so we can verify things in a detailed manner, could you provide a detailed breakdown of the issue. A step by step description would be best.

While I work on the codebase a lot the system is quite large and I'm unable to replicate what you are seeing from your current description and I need to do that before testing/adding the patch.

Cheers,
Gold

Changed in mahara:
status: New → Incomplete
Revision history for this message
Stefan Bäcker (stefan-baecker-29) wrote :

Steps to reproduce the "missing group info" (part 2 of the patch)

1) Log in as student on demo.mahara.org
2) Go to "Engage" / "Groups"
3) Select "Human Computer Interaction 101"
4) Go to "Pages and collections"
5) Click "Copy"
6) Go to page 2 of the listing
7) Note that the group-banner on top is already gone and every "copy" will go to "student"s private area, not the group
8) Add "&group=2" to the URL on page 2 and hit enter. The group-banner reappears and "Copy" will actually copy to the group.

Steps to reproduce the integer group type (part 1 of the patch)

I'm not sure which artefact-type triggers this error, but I found this in our logfiles:

2022/09/26 11:17:30 [error] 3183590#3183590: *446305 FastCGI sent in stderr: "PHP message: [WAR] 37 (lib/view.php:3841) get_class() expects parameter 1 to be object, int givenPHP message: Call stack (most recent first):PHP message: * log_message(string(size 55), integer, true, true, string(size 21), integer) at /var/www/lib/errors.php:515PHP message: * error(integer, string(size 55), string(size 21), integer, array(size 19)) at /var/www/lib/view.php:3841PHP message: * View::get_artefactchooser_artefacts(array(size 2), null, integer, null, true) at /var/www/blocktype/lib.php:2336PHP message: * BlockInstance->rebuild_artefact_list() at /var/www/blocktype/lib.php:2275PHP message: * BlockInstance->commit() at /var/www/blocktype/lib.php:1468PHP message: * BlockInstance->instance_config_store(object(Pieform), array(size 4)) at /var/www/lib/pieforms/pieform.php:577PHP message: * Pieform->__construct(array(size 15)) at /var/www/lib/mahara.php:5733PHP message: * pieform_instance(array(size 15)) at /var/www/blocktype/lib.php:2015PHP message: * BlockInstance->build_configure_form() at /var/www/view/blocks.php:84PHP message: PHP message: [WAR] 37 (lib/errors.php:853) Failed to get a recordset: mysqli error: [0: ] in EXECUTE("SELECT DISTINCT agg.* FROM (SELECT a.id, a.id AS b FROM "artefact" a LEFT JOIN "tag" t ON t.resourcetype = 'artefact' AND a.id = t.resourceid PHP message: [WAR] 37 (lib/errors.php:853) LEFT OUTER JOIN (PHP message: [WAR] 37 (lib/errors.php:853) SELECTPHP message: [WAR] 37 (lib/errors.php:853) r.artefact, r.can_view, r.can_edit, m.groupPHP message: [WAR] 37 (lib/errors.php:853) FROMPHP message: [WAR] 37 (lib/errors.php:853) "group_member" mPHP message: [WAR] 37 (lib/errors.php:853) JOIN "artefact" aa ON aa.group = m.groupPHP message: [WAR] 37 (lib/errors.php:853) JOIN "artefact_access_role" r ON aa.id = r.artefact AND r.role = m.rolePHP message: [WAR] 37 (lib/erro

There's also another patch in the current development-version of mahara that adresses this problem. Even more elegant than my solution. See bug #1979921

Changed in mahara:
status: Incomplete → New
Revision history for this message
Robert Lyon (robertl-9) wrote :

Hi Stefan,

Looking at the error you get I do believe it is the same error as bug #1979921 - where the group id is actually and integer and not a string.

This fix will be released shortly (before end of the month)

Cheers
Robert

Revision history for this message
Stefan Bäcker (stefan-baecker-29) wrote :

Hi Robert,

This bug report and this patch have two parts.

Part 1 (integer group type) is duplicate of bug #1979921. Agreed on that.

Part 2 (missing group info) is not taken care of in bug #1979921.

Cheers
Stefan

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review
Robert Lyon (robertl-9)
Changed in mahara:
status: New → In Progress
importance: Undecided → High
milestone: none → 23.04.0
Revision history for this message
Kristina Hoeppner (kris-hoeppner) wrote :

Hi Stefan,

Can you please check out the patch that Robert made at https://reviews.mahara.org/c/mahara/+/13461 ? It's a bit different from your initial one.

Thank you
Kristina

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

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

commit b8762df369d815ee6eefac14e72d149f5ad1e70b
Author: Stefan Bäcker <unknown>
Date: Thu Nov 10 14:25:19 2022 +1300

Bug 1990981: Appending parameters correctly again to copy portfolios into group

There was an error in commit c830632494ef914ae26a07142e7ee35cb8074483
on line 6453 (now line 6516)

Before:

!empty($params)

After

!$params

Should be

$params

Change-Id: I61779f9b3bd65ae802362e7c839b8e6a5c55b0bc
Signed-off-by: Robert Lyon <email address hidden>

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/+/13503

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Patch for "22.04_DEV" branch: https://reviews.mahara.org/c/mahara/+/13504

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

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

commit 6ccbfc1f0d55da182b2888f59c46bed045725980
Author: Stefan Bäcker <unknown>
Date: Thu Nov 10 14:25:19 2022 +1300

Bug 1990981: Appending parameters correctly again to copy portfolios into group

There was an error in commit c830632494ef914ae26a07142e7ee35cb8074483
on line 6453 (now line 6516)

Before:

!empty($params)

After

!$params

Should be

$params

Change-Id: I61779f9b3bd65ae802362e7c839b8e6a5c55b0bc
Signed-off-by: Robert Lyon <email address hidden>
(cherry picked from commit b8762df369d815ee6eefac14e72d149f5ad1e70b)

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/c/mahara/+/13504
Committed: https://git.mahara.org/mahara/mahara/commit/157f59979d14a361ba03562223ce91a6d5df72b4
Submitter: "Robert Lyon <email address hidden>"
Branch: 22.04_DEV

commit 157f59979d14a361ba03562223ce91a6d5df72b4
Author: Stefan Bäcker <unknown>
Date: Thu Nov 10 14:25:19 2022 +1300

Bug 1990981: Appending parameters correctly again to copy portfolios into group

There was an error in commit c830632494ef914ae26a07142e7ee35cb8074483
on line 6453 (now line 6516)

Before:

!empty($params)

After

!$params

Should be

$params

Change-Id: I61779f9b3bd65ae802362e7c839b8e6a5c55b0bc
Signed-off-by: Robert Lyon <email address hidden>
(cherry picked from commit b8762df369d815ee6eefac14e72d149f5ad1e70b)

Robert Lyon (robertl-9)
Changed in mahara:
milestone: 22.10.1 → 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.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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