Skip to content

Commit

Permalink
Error when importing members #1556
Browse files Browse the repository at this point in the history
  • Loading branch information
Fasse committed Jan 19, 2024
1 parent 423967b commit 4279edf
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions adm_program/system/classes/TableMembers.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,12 @@ public function deleteMembership(int $roleId = 0, int $userId = 0): bool
/**
* Deletes the selected record of the table and optionally sends an admin notification if configured
* @return true Returns **true** if no error occurred
* @throws Exception
*/
public function delete(): bool
{
// Queue admin notification about membership deletion
global $gChangeNotification;
global $gChangeNotification, $gCurrentSession;

// If this is a new record that hasn't been written to the database, simply ignore it
if (!$this->newRecord && is_object($gChangeNotification)) {
Expand Down Expand Up @@ -157,7 +158,7 @@ public function delete(): bool
}

// renew user object of the affected user because of edited role assignment
$GLOBALS['gCurrentSession']->reload($this->getValue('mem_usr_id'));
$gCurrentSession->reload((int) $this->getValue('mem_usr_id'));

return parent::delete();
}
Expand All @@ -170,6 +171,7 @@ public function delete(): bool
* @param bool $updateFingerPrint Default **true**. Will update the creator or editor of the recordset if table has columns like **usr_id_create** or **usr_id_changed**
* @return bool If an update or insert into the database was done then return true, otherwise false.
* @throws AdmException
* @throws Exception
*/
public function save(bool $updateFingerPrint = true): bool
{
Expand All @@ -187,7 +189,7 @@ public function save(bool $updateFingerPrint = true): bool

if ($returnStatus && $gCurrentSession instanceof Session) {
// renew user object of the affected user because of edited role assignment
$gCurrentSession->reload($this->getValue('mem_usr_id'));
$gCurrentSession->reload((int) $this->getValue('mem_usr_id'));
}

if ($newRecord && is_object($gChangeNotification)) {
Expand Down

0 comments on commit 4279edf

Please sign in to comment.