Commit 8c4be782 authored by Robert Lyon's avatar Robert Lyon
Browse files

Bug 1964268: Copied signoff blocks to self need db row



When copying a signoff block from another owners page it sets up a row
in view_signoff_verify as expected. But when copying own page it
doesn't

So fixed that and have upgrade step to fix existing data

Change-Id: Id372a5da29aaaf53884ffee60ae8b9d9b4738992
Signed-off-by: default avatarRobert Lyon <robertl@catalyst.net.nz>
parent 5cb888d8
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -61,6 +61,10 @@ class PluginBlocktypeSignoff extends MaharaCoreBlocktype {
        return true;
    }

    public static function default_copy_type(BlockInstance $instance, View $view) {
        return 'fullinclself';
    }

    public static function render_instance(BlockInstance $instance, $editing=false, $versioning=false) {
        global $USER;

+15 −0
Original line number Diff line number Diff line
@@ -2401,5 +2401,20 @@ function xmldb_core_upgrade($oldversion=0) {
        }
    }

    if ($oldversion < 2022030900) {
        log_debug("Fix up signoff blocks that are missing their db entry");
        if ($results = get_records_sql_array("
                SELECT DISTINCT(v.id) FROM {view} v
                JOIN {block_instance} bi ON bi.view = v.id
                LEFT JOIN {view_signoff_verify} vsv ON vsv.view = v.id
                WHERE bi.blocktype = ?
                AND vsv.view IS NULL", array('signoff')
            )) {
            foreach ($results as $result) {
                ensure_record_exists('view_signoff_verify', (object) array('view' => $result->id), (object) array('view' => $result->id), 'id', true);
            }
        }
    }

    return $status;
}
+1 −1
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@ $config = new stdClass();
// See https://wiki.mahara.org/wiki/Developer_Area/Version_Numbering_Policy
// For upgrades on dev branches, increment the version by one. On main, use the date.

$config->version = 2022030400;
$config->version = 2022030900;
$config->series = '22.04';
$config->release = '22.04dev';
$config->minupgradefrom = 2017031605;