Skip to content

Commit

Permalink
Merge pull request #252 from micromata/Release-8.1-SNAPSHOT
Browse files Browse the repository at this point in the history
Release 8.1 snapshot
* MonthlyEmployeeReport: show weekly net and gross hours.
* Fix select in AuftragDao.positionen.status
* Scripting: Add PFCaches as variable.
* GlobalDefaultExceptionHandling: Exception handling improved.
* DBFullTextResultIterator: block size 100 -> 10_000 for much better performance., QueryFilter limit is now 50_000 instead of 10_000.
* MailAttachments improved (effected BirthdayButler, Polls). E-Mail is sent automatically, if nightly sanity check has errors.
  • Loading branch information
kreinhard authored Jan 2, 2025
2 parents dfc418f + 4550ccc commit 656529e
Show file tree
Hide file tree
Showing 37 changed files with 300 additions and 308 deletions.
2 changes: 0 additions & 2 deletions ToDo.adoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
Aktuell:
- Scripting: Ergebnis Unresolved reference 'memo', 'todo'.: line 94 to 94 (add only activated plugins)
- Zeitberichte: kost2.nummer:4.* dauert sehr lang, auch für kurze Zeiträume.
- Healthcheck (daily) with mail notification on errors. Mit Registrierung von Services (jcr, orderbook snaphosts etc.)
- Groovy-scripts: remove or fix.
- AG-Grid: setColumnStates wird nicht in den UserPrefs gespeichert.
- Wicket: Auftragsbuch: org.apache.wicket.core.request.mapper.StalePageException: A request to page '[Page class = org.projectforge.web.fibu.AuftragEditPage, id = 9, render count = 3]' has been made with stale 'renderCount'. The page will be re-rendered.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ package org.projectforge.plugins.datatransfer

import jakarta.annotation.PostConstruct
import org.projectforge.business.jobs.CronSanityCheckJob
import org.projectforge.common.extensions.format
import org.projectforge.framework.jcr.AttachmentsService
import org.projectforge.jobs.AbstractJob
import org.projectforge.jobs.JobExecutionContext
Expand Down Expand Up @@ -55,6 +56,7 @@ class DataTransferSanityCheckJob : AbstractJob("Check data transfer files.") {
var areaCounter = 0
var missingInJcrCounter = 0
var orphanedCounter = 0
var fileCounter = 0
dataTransferAreaDao.selectAll(checkAccess = false).forEach { area ->
++areaCounter
val areaName = "'${area.displayName}'"
Expand All @@ -66,6 +68,7 @@ class DataTransferSanityCheckJob : AbstractJob("Check data transfer files.") {
checkAccess = false,
)
val attachmentsCounter = area.attachmentsCounter ?: 0
fileCounter += attachmentsCounter
if (attachmentsCounter == 0 && attachments.isNullOrEmpty()) {
// No attachments given/expected, nothing to check.
return@forEach
Expand Down Expand Up @@ -95,9 +98,13 @@ class DataTransferSanityCheckJob : AbstractJob("Check data transfer files.") {
jobContext.addWarning("Error while checking data transfer area $areaName: ${ex.message}")
}
}
if (missingInJcrCounter > 0 || orphanedCounter > 0) {
jobContext.addError("Checked $areaCounter data transfer areas: $missingInJcrCounter missed, $orphanedCounter orphaned attachments.")
val baseMsg = "Checked ${fileCounter.format()} files in ${areaCounter.format()} data transfer areas"
if (missingInJcrCounter > 0 ) {
jobContext.addError("$baseMsg: $missingInJcrCounter missed, $orphanedCounter orphaned attachments.")
} else if (orphanedCounter > 0) {
jobContext.addWarning("$baseMsg: $orphanedCounter orphaned attachments.")
} else {
jobContext.addMessage("$baseMsg.")
}
jobContext.addMessage("Checked $areaCounter data transfer areas.")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ public void calculate() {
taskTotal.addMillis(entry.getMillis());
}
totalGrossDuration += entry.getMillis();
totalNetDuration += entry.getMillis();
totalNetDuration += entry.getWorkFractionMillis();
}
}
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public class MonthlyEmployeeReportWeek implements Serializable {

private long totalDuration = 0;

private long totalGrossDuration = 0;

/**
* Key is kost2 id.
*/
Expand Down Expand Up @@ -110,19 +112,14 @@ void addEntry(TimesheetDO sheet, final boolean hasSelectAccess) {
}
long duration = sheet.getDuration();
entry.addMillis(duration);
totalDuration += duration;
totalDuration += entry.getWorkFractionMillis();
totalGrossDuration += duration;
}

/**
* @see StringHelper#format2DigitNumber(int)
*/
public String getFormattedFromDayOfMonth() {
return StringHelper.format2DigitNumber(fromDate.getDayOfMonth());
}

/**
* @see StringHelper#format2DigitNumber(int)
*/
public String getFormattedToDayOfMonth() {
return StringHelper.format2DigitNumber(toDate.getDayOfMonth());
}
Expand All @@ -138,6 +135,10 @@ public String getFormattedTotalDuration() {
return MonthlyEmployeeReport.getFormattedDuration(totalDuration);
}

public String getFormattedGrossDuration() {
return MonthlyEmployeeReport.getFormattedDuration(totalGrossDuration);
}

/**
* Return the hours assigned to the different Kost2's. The key of the map is the kost2 id.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
import org.projectforge.framework.persistence.database.DatabaseDao;
import org.projectforge.framework.persistence.database.DatabaseInitTestDataService;
import org.projectforge.framework.persistence.search.HibernateSearchReindexer;
import org.projectforge.jcr.JCRCheckSanityJob;
import org.projectforge.jcr.JCRCheckSanityCheckJob;
import org.projectforge.menu.builder.MenuCreator;
import org.projectforge.plugins.core.PluginAdminService;
import org.projectforge.sms.SmsSenderConfig;
Expand Down Expand Up @@ -186,7 +186,7 @@ private void registerBeans(ApplicationContext applicationContext) {
registerBean(applicationContext.getBean(EmployeeSalaryDao.class));
registerBean(applicationContext.getBean(GroupDao.class));
registerBean(applicationContext.getBean(HibernateSearchReindexer.class));
registerBean(applicationContext.getBean(JCRCheckSanityJob.class));
registerBean(applicationContext.getBean(JCRCheckSanityCheckJob.class));
registerBean(applicationContext.getBean(Kost1Dao.class));
registerBean(applicationContext.getBean(Kost2Dao.class));
registerBean(applicationContext.getBean(KostCache.class));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,7 @@ class BirthdayButlerService {
}
val word = response.wordDocument
if (word != null) {
val attachment = object : MailAttachment {
override fun getFilename(): String {
return createFilename(month, locale)
}

override fun getContent(): ByteArray {
return word
}
}
val attachment = MailAttachment(createFilename(month, locale), word)
val list = mutableListOf<MailAttachment>()
list.add(attachment)
sendMail(month, content = "birthdayButler.email.content", mailAttachments = list, locale = locale)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import org.projectforge.framework.DisplayNameCapable
import org.projectforge.framework.i18n.I18nHelper
import org.projectforge.framework.jcr.AttachmentsInfo
import org.projectforge.framework.json.IdOnlySerializer
import org.projectforge.framework.json.IdsOnlySerializer
import org.projectforge.framework.persistence.candh.CandHIgnore
import org.projectforge.framework.persistence.entities.DefaultBaseDO
import org.projectforge.framework.persistence.history.NoHistory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,6 @@ open class AuftragDao : BaseDao<AuftragDO>(AuftragDO::class.java) {
eq("paymentSchedules.reached", true)
)
)
} else {
addCriterionForAuftragsStatuses(myFilter, queryFilter)
positionStatusAlreadyFilterd = true
}

if (myFilter.user != null) {
Expand Down Expand Up @@ -271,30 +268,13 @@ open class AuftragDao : BaseDao<AuftragDO>(AuftragDO::class.java) {
// Don't use filter for orders to be invoiced.
list = list.toMutableList() // Make mutable list of Kotlin's immutable list.
filterPositionsArten(myFilter, list)
if (!positionStatusAlreadyFilterd) { // Don't filter position status' again.
filterPositionsStatus(myFilter, list)
}
list = filterPositionsStatus(myFilter, list)
filterPositionsPaymentTypes(myFilter, list)
}

return list
}

private fun addCriterionForAuftragsStatuses(myFilter: AuftragFilter, queryFilter: QueryFilter) {
val auftragsStatuses = myFilter.auftragsStatuses
if (auftragsStatuses.isNotEmpty()) {
val orCriterions: MutableList<DBPredicate> = ArrayList()
orCriterions.add(isIn<Any>("status", auftragsStatuses))
orCriterions.add(isIn<Any>("positionen.status", myFilter.auftragsStatuses))
queryFilter.add(or(*orCriterions.toTypedArray<DBPredicate>()))
}

// check deleted
if (!myFilter.ignoreDeleted) {
queryFilter.add(eq("positionen.deleted", myFilter.deleted))
}
}

private fun createCriterionForErfassungsDatum(myFilter: AuftragFilter): Optional<DBPredicate> {
val startDate = myFilter.startDate
val endDate = myFilter.endDate
Expand Down Expand Up @@ -335,19 +315,12 @@ open class AuftragDao : BaseDao<AuftragDO>(AuftragDO::class.java) {
}
}

private fun filterPositionsStatus(myFilter: AuftragFilter, list: List<AuftragDO>) {
if (CollectionUtils.isEmpty(myFilter.auftragsStatuses)) {
return
}
val statusFilter = AuftragsPositionsStatusFilter(myFilter.auftragsStatuses)
CollectionUtils.filter(
list
) { `object`: AuftragDO? ->
statusFilter.match(
list.toMutableList(),
`object`!!
)
private fun filterPositionsStatus(myFilter: AuftragFilter, list: List<AuftragDO>): List<AuftragDO> {
val auftragsStatuses: List<AuftragsStatus> = myFilter.auftragsStatuses
if (auftragsStatuses.isEmpty()) {
return list
}
return list.filter { auftrag -> auftrag.positionenExcludingDeleted.any { pos -> auftragsStatuses.contains(pos.status) } }
}

private fun filterPositionsPaymentTypes(myFilter: AuftragFilter, list: List<AuftragDO>) {
Expand Down
Loading

0 comments on commit 656529e

Please sign in to comment.