Skip to content

Commit

Permalink
No Category with the given id 0 was found in the database #1722
Browse files Browse the repository at this point in the history
  • Loading branch information
Fasse committed Dec 29, 2024
1 parent 278b5f6 commit 36eb3d0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions adm_program/installation/db_scripts/update_4_3.xml
Original file line number Diff line number Diff line change
Expand Up @@ -123,5 +123,6 @@
<step id="1220" database="mysql">UPDATE %PREFIX%_preferences SET prf_value = '24' WHERE prf_name = 'photo_thumbs_page' AND CAST(prf_value AS unsigned) = 16</step>
<step id="1230" database="pgsql">UPDATE %PREFIX%_preferences SET prf_value = '24' WHERE prf_name = 'photo_thumbs_page' AND prf_value::int = 16</step>
<step id="1240">UPDATE %PREFIX%_categories SET cat_type = 'EVT' WHERE cat_type = 'DAT'</step>
<step id="1250">UPDATE %PREFIX%_categories SET cat_org_id = 1 WHERE cat_org_id IS NULL AND cat_name_intern = 'EVENTS'</step>
<step>stop</step>
</update>
5 changes: 4 additions & 1 deletion adm_program/modules/events/events_function.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,11 +356,14 @@
WHERE cat_name_intern = \'EVENTS\'
AND cat_org_id = ?';
$pdoStatement = $gDb->queryPrepared($sql, array($gCurrentOrgId));
if(!$row = $pdoStatement->fetch()) {
throw new AdmException('No category found for event participation');
}
$role = new TableRoles($gDb);
$role->setType(TableRoles::ROLE_EVENT);

// these are the default settings for a event role
$role->setValue('rol_cat_id', (int)$pdoStatement->fetchColumn());
$role->setValue('rol_cat_id', (int) $row['cat_id']);
// role members are allowed to view lists
$role->setValue('rol_view_memberships', isset($_POST['event_right_list_view']) ? 1 : 3);
// role members are allowed to send mail to this role
Expand Down

0 comments on commit 36eb3d0

Please sign in to comment.