public function afterRemove() { foreach (erLhcoreClassModelDepartamentGroupUser::getList(array('limit' => false, 'filter' => array('dep_group_id' => $this->id))) as $groupUser) { $groupUser->removeThis(); } foreach (erLhcoreClassModelDepartamentGroupMember::getList(array('limit' => false, 'filter' => array('dep_group_id' => $this->id))) as $groupMember) { $groupMember->removeThis(); } }
} $Errors = erLhcoreClassUserValidator::validateUserNew($UserData, $userParams); if (count($Errors) == 0) { try { $db = ezcDbInstance::get(); $db->beginTransaction(); erLhcoreClassUser::getSession()->save($UserData); if (count($userParams['global_departament']) > 0) { erLhcoreClassUserDep::addUserDepartaments($userParams['global_departament'], $UserData->id, $UserData); } $UserData->setUserGroups(); $userPhotoErrors = erLhcoreClassUserValidator::validateUserPhoto($UserData); if ($userPhotoErrors !== false && count($userPhotoErrors) == 0) { $UserData->saveThis(); } erLhcoreClassModelDepartamentGroupUser::addUserDepartmentGroups($UserData, erLhcoreClassUserValidator::validateDepartmentsGroup($UserData)); erLhcoreClassModelUserSetting::setSetting('show_all_pending', $userParams['show_all_pending'], $UserData->id); erLhcoreClassChatEventDispatcher::getInstance()->dispatch('user.user_created', array('userData' => &$UserData, 'password' => $UserData->password_front)); $db->commit(); erLhcoreClassModule::redirect('user/userlist'); exit; } catch (Exception $e) { $tpl->set('errors', array($e->getMessage())); $UserData->removeFile(); $db->rollback(); } } else { $tpl->set('errors', $Errors); } } $tpl->set('user', $UserData);
</h5> <?php if (isset($account_updated_departaments) && $account_updated_departaments == 'done') { $msg = erTranslationClassLhTranslation::getInstance()->getTranslation('user/account', 'Account updated'); ?> <?php include erLhcoreClassDesign::designtpl('lhkernel/alert_success.tpl.php'); ?> <?php } ?> <?php $userDepartaments = erLhcoreClassUserDep::getUserDepartamentsIndividual($user->id); $userDepartamentsGroup = erLhcoreClassModelDepartamentGroupUser::getUserGroupsIds($user->id); ?> <form action="<?php echo erLhcoreClassDesign::baseurl('user/edit'); ?> /<?php echo $user->id; ?> #departments" method="post"> <?php include erLhcoreClassDesign::designtpl('lhuser/account/departments_assignment.tpl.php'); ?> <input type="submit" class="btn btn-default" name="UpdateDepartaments_account" value="<?php