Skip to content

Commit 36eb3d0

Browse files
committed
No Category with the given id 0 was found in the database #1722
1 parent 278b5f6 commit 36eb3d0

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

adm_program/installation/db_scripts/update_4_3.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,5 +123,6 @@
123123
<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>
124124
<step id="1230" database="pgsql">UPDATE %PREFIX%_preferences SET prf_value = '24' WHERE prf_name = 'photo_thumbs_page' AND prf_value::int = 16</step>
125125
<step id="1240">UPDATE %PREFIX%_categories SET cat_type = 'EVT' WHERE cat_type = 'DAT'</step>
126+
<step id="1250">UPDATE %PREFIX%_categories SET cat_org_id = 1 WHERE cat_org_id IS NULL AND cat_name_intern = 'EVENTS'</step>
126127
<step>stop</step>
127128
</update>

adm_program/modules/events/events_function.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,11 +356,14 @@
356356
WHERE cat_name_intern = \'EVENTS\'
357357
AND cat_org_id = ?';
358358
$pdoStatement = $gDb->queryPrepared($sql, array($gCurrentOrgId));
359+
if(!$row = $pdoStatement->fetch()) {
360+
throw new AdmException('No category found for event participation');
361+
}
359362
$role = new TableRoles($gDb);
360363
$role->setType(TableRoles::ROLE_EVENT);
361364

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

0 commit comments

Comments
 (0)