Skip to content

Commit

Permalink
BirthdayButler: activeUsers fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
kreinhard committed Aug 15, 2023
1 parent c549e00 commit 90cd3fa
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import org.projectforge.business.configuration.ConfigurationService
import org.projectforge.business.user.UserDao
import org.projectforge.common.StringHelper
import org.projectforge.framework.i18n.translate
import org.projectforge.framework.persistence.api.QueryFilter
import org.projectforge.framework.persistence.user.api.ThreadLocalUserContext
import org.projectforge.framework.time.PFDateTime
import org.projectforge.mail.Mail
Expand Down Expand Up @@ -203,8 +202,7 @@ class BirthdayButlerService {
* return list of users with birthday in selected month. Null, if no address with matching company found or empty, if no address with birthday in selected month found.
*/
private fun getBirthdayList(month: Month): MutableList<AddressDO>? {
val queryFilter = QueryFilter()
var addressList = addressDao.internalGetList(queryFilter).filter {
var addressList = addressDao.internalLoadAllNotDeleted().filter {
it.organization?.contains(
birthdayButlerConfiguration.organization,
ignoreCase = true
Expand All @@ -218,15 +216,16 @@ class BirthdayButlerService {
address.birthday?.month == Month.values()[month.ordinal]
}
val activeUsers = userDao.internalLoadAll().filter { it.hasSystemAccess() }
val foundUser = mutableListOf<AddressDO>()
val foundUsers = mutableListOf<AddressDO>()
addressList.forEach { address ->
activeUsers.firstOrNull { user ->
address.firstName?.trim().equals(user.firstname?.trim(), ignoreCase = true) &&
address.name?.trim().equals(user.lastname?.trim(), ignoreCase = true)
foundUser.add(address)
}?.let {
foundUsers.add(address)
}
}
return foundUser
return foundUsers
}

private fun getEMailAddressesFromConfig(): MutableList<String>? {
Expand Down

0 comments on commit 90cd3fa

Please sign in to comment.