Skip to content

Commit

Permalink
fix update to events that had a active registration but no roles assi…
Browse files Browse the repository at this point in the history
…gned
  • Loading branch information
Fasse committed Mar 11, 2018
1 parent 68dbcea commit b29ff6f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions adm_program/system/classes/ComponentUpdateSteps.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,22 @@ public static function updateStepMigrateDatesRightsToFolderRights()
FROM '.TABLE_PREFIX.'_date_role
WHERE dtr_rol_id IS NOT NULL';
self::$db->queryPrepared($sql, array((int) $gCurrentUser->getValue('usr_id'), DATETIME_NOW));

// if no roles were set than we must assign all default registration roles because now we need at least 1 role
// so that someone could register to the event
$sql = 'INSERT INTO '.TBL_ROLES_RIGHTS_DATA.'
(rrd_ror_id, rrd_rol_id, rrd_object_id, rrd_usr_id_create, rrd_timestamp_create)
SELECT '.$rolesRightId.', rol_id, dat_id, ?, ? -- $gCurrentUser->getValue(\'usr_id\'), DATETIME_NOW
FROM '.TABLE_PREFIX.'_dates
INNER JOIN '.TABLE_PREFIX.'_categories cdat ON cdat.cat_id = dat_cat_id
INNER JOIN '.TABLE_PREFIX.'_date_role ON dtr_dat_id = dat_id
INNER JOIN '.TABLE_PREFIX.'_categories rdat ON rdat.cat_org_id = cdat.cat_org_id
INNER JOIN '.TABLE_PREFIX.'_roles ON rol_cat_id = rdat.cat_id
WHERE dat_rol_id is not null
AND dtr_rol_id is null
AND rdat.cat_type = \'ROL\'
AND rol_default_registration = 1';
self::$db->queryPrepared($sql, array((int) $gCurrentUser->getValue('usr_id'), DATETIME_NOW));
}

/**
Expand Down

0 comments on commit b29ff6f

Please sign in to comment.