Skip to content

Commit

Permalink
Merge pull request #255 from micromata/Release-8.1-SNAPSHOT
Browse files Browse the repository at this point in the history
Release 8.1 snapshot
Improvements: Forecasts, snapshots, html creation, descriptions for script parameters added.
  • Loading branch information
kreinhard authored Jan 13, 2025
2 parents 05f4214 + 78a38ca commit c4ffcb1
Show file tree
Hide file tree
Showing 47 changed files with 792 additions and 474 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class DataTransferSanityCheckJob : AbstractJob("Check data transfer files.") {
cronSanityCheckJob.registerJob(this)
}

override fun execute(jobContext: JobExecutionContext) {
override fun executeJob() {
var areaCounter = 0
var missingInJcrCounter = 0
var orphanedCounter = 0
Expand All @@ -73,38 +73,38 @@ class DataTransferSanityCheckJob : AbstractJob("Check data transfer files.") {
// No attachments given/expected, nothing to check.
return@forEach
}
jobContext.addMessage("Checking data transfer area $areaName with ${attachmentsCounter} attachments.")
jobExecutionContext.addMessage("Checking data transfer area $areaName with ${attachmentsCounter} attachments.")
attachments?.forEach { attachment ->
if (attachment.size == 0L) {
jobContext.addWarning("Empty attachment ${attachment.name} in area $areaName.")
jobExecutionContext.addWarning("Empty attachment ${attachment.name} in area $areaName.")
}
}
if (attachmentsCounter != attachments?.size) {
jobContext.addWarning("Attachments counter in area $areaName is ${attachmentsCounter}, but found ${attachments?.size} attachments.")
jobExecutionContext.addWarning("Attachments counter in area $areaName is ${attachmentsCounter}, but found ${attachments?.size} attachments.")
}
val areaAttachmentIds = area.attachmentsIds?.split(" ")?.filter { it.isNotBlank() } ?: emptyList()
val jcrAttachmentIds = attachments?.map { it.fileId.toString() } ?: emptyList()
val missingInJcr = areaAttachmentIds - jcrAttachmentIds
val unknown = jcrAttachmentIds - areaAttachmentIds
if (missingInJcr.isNotEmpty()) {
jobContext.addError("${missingInJcr.size}/$attachmentsCounter attachments missing in JCR for area $areaName: ${missingInJcr.joinToString()}")
jobExecutionContext.addError("${missingInJcr.size}/$attachmentsCounter attachments missing in JCR for area $areaName: ${missingInJcr.joinToString()}")
missingInJcrCounter += missingInJcr.size
}
if (unknown.isNotEmpty()) {
jobContext.addWarning("${unknown.size} unknown (orphaned) attachments in JCR for area $areaName: ${unknown.joinToString()}")
jobExecutionContext.addWarning("${unknown.size} unknown (orphaned) attachments in JCR for area $areaName: ${unknown.joinToString()}")
orphanedCounter += unknown.size
}
} catch (ex: Exception) {
jobContext.addWarning("Error while checking data transfer area $areaName: ${ex.message}")
jobExecutionContext.addWarning("Error while checking data transfer area $areaName: ${ex.message}")
}
}
val baseMsg = "Checked ${fileCounter.format()} files in ${areaCounter.format()} data transfer areas"
if (missingInJcrCounter > 0 ) {
jobContext.addError("$baseMsg: $missingInJcrCounter missed, $orphanedCounter orphaned attachments.")
jobExecutionContext.addError("$baseMsg: $missingInJcrCounter missed, $orphanedCounter orphaned attachments.")
} else if (orphanedCounter > 0) {
jobContext.addWarning("$baseMsg: $orphanedCounter orphaned attachments.")
jobExecutionContext.addWarning("$baseMsg: $orphanedCounter orphaned attachments.")
} else {
jobContext.addMessage("$baseMsg.")
jobExecutionContext.addMessage("$baseMsg.")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,16 @@ package org.projectforge.plugins.datatransfer

import jakarta.annotation.PostConstruct
import mu.KotlinLogging
import org.projectforge.business.configuration.DomainService
import org.projectforge.common.extensions.formatBytes
import org.projectforge.datatransfer.DataTransferBridge
import org.projectforge.datatransfer.DataTransferInterface
import org.projectforge.framework.jcr.AttachmentsService
import org.projectforge.framework.persistence.user.entities.PFUserDO
import org.projectforge.jcr.FileInfo
import org.projectforge.plugins.datatransfer.rest.DataTransferAreaPagesRest
import org.projectforge.plugins.datatransfer.rest.DataTransferPageRest
import org.projectforge.rest.core.PagesResolver
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Service

Expand All @@ -51,13 +54,31 @@ class DataTransferService : DataTransferInterface {
@Autowired
private lateinit var dataTransferBridge: DataTransferBridge

@Autowired
private lateinit var domainService: DomainService

val jcrPath: String by lazy { dataTransferAreaPagesRest.jcrPath!! }

@PostConstruct
private fun postConstruct() {
dataTransferBridge.register(this)
}

override fun getPersonalBoxOfUserLink(userId: Long): String {
val personalBox = dataTransferAreaDao.ensurePersonalBox(userId)
?: throw IllegalStateException("Personal box not found for user with ID $userId.")
return getDataTransferAreaLink(personalBox.id)
}

fun getDataTransferAreaLink(areaId: Long?): String {
return domainService.getDomain(
PagesResolver.getDynamicPageUrl(
DataTransferPageRest::class.java,
id = areaId ?: 0
)
)
}

override fun putFileInUsersInBox(
receiver: PFUserDO,
filename: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ open class MerlinRunner {
ExcelUtils.registerColumn(sheet, LoggingEventData::class.java, "level", 6)
ExcelUtils.registerColumn(sheet, LoggingEventData::class.java, "message", 100)
ExcelUtils.registerColumn(sheet, LoggingEventData::class.java, "loggerName", 60)
val boldFont = workbook.createOrGetFont("bold", bold = true)
val boldFont = ExcelUtils.createFont(workbook, "bold", bold = true)
val boldStyle = workbook.createOrGetCellStyle("hr", font = boldFont)
val headRow = sheet.createRow() // second row as head row.
sheet.columnDefinitions.forEachIndexed { index, it ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ package org.projectforge.plugins.skillmatrix
import de.micromata.merlin.excel.ExcelCellType
import de.micromata.merlin.excel.ExcelWorkbook
import mu.KotlinLogging
import org.projectforge.excel.ExcelUtils
import org.projectforge.framework.i18n.translate
import org.projectforge.framework.persistence.user.api.ThreadLocalUserContext
import org.projectforge.framework.time.DateHelper
Expand Down Expand Up @@ -72,12 +73,12 @@ class SkillMatrixServicesRest {

ExcelWorkbook.createEmptyWorkbook(ThreadLocalUserContext.locale!!).use { workbook ->
val sheet = workbook.createOrGetSheet(translate("plugins.skillmatrix.title.list"))
val boldFont = workbook.createOrGetFont("bold", bold = true)
val boldFont = ExcelUtils.createFont(workbook, "bold", bold = true)
val boldStyle = workbook.createOrGetCellStyle("hr", font = boldFont)
val decimalStyle = workbook.createOrGetCellStyle("decimal")
decimalStyle.dataFormat = workbook.createDataFormat().getFormat("0.0")
val headRow = sheet.createRow()
ExcelCol.values().forEach {
ExcelCol.entries.forEach {
headRow.getCell(it.ordinal, ExcelCellType.STRING)
.setCellValue(
if (it.header != "#") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ package org.projectforge.i18n

import de.micromata.merlin.excel.ExcelWorkbook
import org.apache.poi.ss.usermodel.IndexedColors
import org.projectforge.excel.ExcelUtils
import org.projectforge.framework.i18n.I18nKeysUsageInterface
import org.springframework.stereotype.Service
import java.io.File
Expand Down Expand Up @@ -67,11 +68,9 @@ class I18nKeysUsage(runmode: RUN_MODE? = null, useTmpFile: Boolean = false) : I1

override fun createExcelFile(): I18nKeysUsageInterface.ExcelFile {
val workbook = ExcelWorkbook.createEmptyWorkbook()
val boldFont = workbook.createOrGetFont("bold", bold = true)
val boldFont = ExcelUtils.createFont(workbook, "bold", bold = true)
val boldStyle = workbook.createOrGetCellStyle("hr", font = boldFont)
val redFont = workbook.createOrGetFont("error-font")
redFont.fontName = "Arial"
redFont.color = IndexedColors.RED.index
val redFont = ExcelUtils.createFont(workbook, "error-font", color = IndexedColors.RED.index)
val redStyle = workbook.createOrGetCellStyle("red", redFont)
redStyle.fillForegroundColor
val sheet = workbook.createOrGetSheet("I18n keys")
Expand Down
5 changes: 3 additions & 2 deletions projectforge-application/src/main/resources/i18nKeys.json
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@
{"i18nKey":"edit","bundleName":"I18nResources","translation":"Edit","translationDE":"Bearbeiten","usedInClasses":["org.projectforge.model.rest.RestPaths","org.projectforge.plugins.ihk.IHKForm","org.projectforge.plugins.merlin.rest.MerlinPagesRest","org.projectforge.web.fibu.AbstractRechnungEditForm","org.projectforge.web.fibu.AuftragEditForm","org.projectforge.web.wicket.flowlayout.IconType"],"usedInFiles":[]},
{"i18nKey":"email","bundleName":"I18nResources","translation":"E-mail","translationDE":"E-Mail","usedInClasses":["org.projectforge.business.address.AddressDO","org.projectforge.business.address.AddressExport","org.projectforge.business.ldap.PFUserDOConverter","org.projectforge.framework.persistence.user.entities.PFUserDO","org.projectforge.plugins.marketing.AddressCampaignValueListPage","org.projectforge.plugins.merlin.rest.MerlinExecutionPageRest","org.projectforge.rest.AddressPagesRest","org.projectforge.rest.AddressViewPageRest","org.projectforge.rest.UserPagesRest","org.projectforge.web.address.AddressListPage","org.projectforge.web.address.AddressPageSupport","org.projectforge.web.admin.SetupForm","org.projectforge.web.fibu.AuftragEditForm","org.projectforge.web.user.UserSelectPanel"],"usedInFiles":[]},
{"i18nKey":"ended","bundleName":"I18nResources","translation":"ended","translationDE":"beendet","usedInClasses":["org.projectforge.business.fibu.KundeStatus","org.projectforge.business.fibu.ProjektFilter","org.projectforge.business.fibu.ProjektStatus","org.projectforge.business.fibu.kost.KostFilter","org.projectforge.business.fibu.kost.KostentraegerStatus","org.projectforge.web.fibu.Kost1ListForm","org.projectforge.web.fibu.Kost2ListForm","org.projectforge.web.fibu.ProjektListForm"],"usedInFiles":[]},
{"i18nKey":"error","bundleName":"I18nResources","translation":"An error occurs: {0}","translationDE":"Ein Fehler trat auf: {0}","usedInClasses":["org.projectforge.business.fibu.SEPATransferGenerator","org.projectforge.common.html.CssClass","org.projectforge.common.logging.LogLevel","org.projectforge.framework.utils.ResultHolderStatus","org.projectforge.plugins.ihk.IHKExporter","org.projectforge.rest.importer.AbstractImportPageRest","org.projectforge.web.fibu.AuftragListPage","org.projectforge.web.fibu.EingangsrechnungEditPage","org.projectforge.web.registry.WebRegistry"],"usedInFiles":[]},
{"i18nKey":"error","bundleName":"I18nResources","translation":"An error occurs: {0}","translationDE":"Ein Fehler trat auf: {0}","usedInClasses":["org.projectforge.business.fibu.ForecastExport","org.projectforge.business.fibu.SEPATransferGenerator","org.projectforge.common.html.CssClass","org.projectforge.common.logging.LogLevel","org.projectforge.framework.utils.ResultHolderStatus","org.projectforge.plugins.ihk.IHKExporter","org.projectforge.rest.importer.AbstractImportPageRest","org.projectforge.web.fibu.AuftragListPage","org.projectforge.web.fibu.EingangsrechnungEditPage","org.projectforge.web.registry.WebRegistry"],"usedInFiles":[]},
{"i18nKey":"error.date.yearOutOfRange","bundleName":"I18nResources","translation":"The year of the date is out of range: ${minimumYear} - ${maximumYear}.","translationDE":"Das Jahr liegt außerhalb des zulässigen Bereichs: ${minimumYear} - ${maximumYear}.","usedInClasses":["org.projectforge.web.wicket.components.DatePanel","org.projectforge.web.wicket.components.LocalDatePanel"],"usedInFiles":[]},
{"i18nKey":"error.dateInFuture","bundleName":"I18nResources","translation":"Date is in future.","translationDE":"Datum darf nicht in der Zukunft liegen.","usedInClasses":["org.projectforge.rest.orga.ContractPagesRest","org.projectforge.rest.orga.PostausgangPagesRest","org.projectforge.rest.orga.PosteingangPagesRest"],"usedInFiles":[]},
{"i18nKey":"error.endDateBeforeBeginDate","bundleName":"I18nResources","translation":"End date can't be before begin date.","translationDE":"Das Endedatum darf nicht vor dem Anfangsdatum liegen.","usedInClasses":["org.projectforge.web.fibu.PeriodOfPerformanceHelper"],"usedInFiles":[]},
Expand Down Expand Up @@ -812,12 +812,13 @@
{"i18nKey":"fibu.auftrag.error.nurAbgeschlosseneAuftragsPositionenKoennenVollstaendigFakturiertSein","bundleName":"I18nResources","translation":"Only finished orders can be completely invoiced.","translationDE":"Nur abgeschlossene Auftragspositionen können vollständig fakturiert sein.","usedInClasses":["org.projectforge.business.fibu.AuftragsPositionDO"],"usedInFiles":[]},
{"i18nKey":"fibu.auftrag.error.vollstaendigFakturiertProtection","bundleName":"I18nResources","translation":"The flag 'completely invoiced' can only be modified by the account staff.","translationDE":"Das Flag \"vollständig fakturiert\" darf nur durch die Buchhaltung manipuliert werden.","usedInClasses":["org.projectforge.business.fibu.AuftragRight"],"usedInFiles":[]},
{"i18nKey":"fibu.auftrag.ersetzen","bundleName":"I18nResources","translation":"Replaced","translationDE":"Ersetzen","usedInClasses":[],"usedInFiles":[]},
{"i18nKey":"fibu.auftrag.exportAnalysis","bundleName":"I18nResources","translation":"Export analysis data","translationDE":"Analyse exportieren","usedInClasses":["org.projectforge.web.fibu.AuftragEditPage"],"usedInFiles":[]},
{"i18nKey":"fibu.auftrag.exportAnalysis","bundleName":"I18nResources","translation":"Analysis data","translationDE":"Analyse","usedInClasses":["org.projectforge.web.fibu.AuftragEditPage"],"usedInFiles":[]},
{"i18nKey":"fibu.auftrag.filter.type.all","bundleName":"I18nResources","translation":"all","translationDE":"alle","usedInClasses":["org.projectforge.business.fibu.AuftragFakturiertFilterStatus"],"usedInFiles":[]},
{"i18nKey":"fibu.auftrag.filter.type.nochNichtVollstaendigFakturiert","bundleName":"I18nResources","translation":"not completely invoiced","translationDE":"noch nicht vollständig fakturiert","usedInClasses":["org.projectforge.business.fibu.AuftragFakturiertFilterStatus"],"usedInFiles":[]},
{"i18nKey":"fibu.auftrag.filter.type.vollstaendigFakturiert","bundleName":"I18nResources","translation":"completely invoiced","translationDE":"vollständig fakturiert","usedInClasses":["org.projectforge.business.fibu.AuftragFakturiertFilterStatus"],"usedInFiles":[]},
{"i18nKey":"fibu.auftrag.filter.type.zuFakturieren","bundleName":"I18nResources","translation":"to be invoiced","translationDE":"zu fakturieren","usedInClasses":["org.projectforge.business.fibu.AuftragFakturiertFilterStatus"],"usedInFiles":[]},
{"i18nKey":"fibu.auftrag.forecast","bundleName":"I18nResources","translation":"Forecast","translationDE":"Forecast","usedInClasses":["org.projectforge.business.fibu.ForecastOrderAnalysis"],"usedInFiles":[]},
{"i18nKey":"fibu.auftrag.forecast.lostBudgetWarning","bundleName":"I18nResources","translation":"Budget Loss Warning: The budget is expected to be undershot by more than {0}%: {1}. For analysis details see the order editing page.","translationDE":"Budget-Verlust-Warnung: Das Budget wird um voraussichtlich mehr als {0} % unterschritten: {1}. Für Analysedetails siehe Auftrageditierseite.","usedInClasses":["org.projectforge.business.fibu.ForecastExport"],"usedInFiles":[]},
{"i18nKey":"fibu.auftrag.forecastExportAsXls","bundleName":"I18nResources","translation":"Forecast","translationDE":"Forecast","usedInClasses":["org.projectforge.web.fibu.AuftragListPage"],"usedInFiles":[]},
{"i18nKey":"fibu.auftrag.forecastExportAsXls.tooltip","bundleName":"I18nResources","translation":"Forecast export for actual orderbook list. The start date will be taken from the period of performance begin. If not present it uses 01/01/[actual year].","translationDE":"Export des Forecasts für die aktuelle Auftragsliste. Das Startdatum wird aus dem Leistungszeitraum Start Filter verwendet. Wenn nicht angegeben wird der 01.01.[aktuelles Jahr] verwendet.","usedInClasses":["org.projectforge.web.fibu.AuftragListPage"],"usedInFiles":[]},
{"i18nKey":"fibu.auftrag.hint.kannVonProjektKundenAbweichen","bundleName":"I18nResources","translation":"Customer can be different to the customer of the project.","translationDE":"Kunde kann vom Projektkunden abweichen.","usedInClasses":["org.projectforge.web.fibu.AuftragEditForm"],"usedInFiles":[]},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
package org.projectforge.business.scripting;

import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
import com.thoughtworks.xstream.annotations.XStreamOmitField;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.projectforge.business.task.TaskDO;
import org.projectforge.framework.persistence.user.entities.PFUserDO;
Expand All @@ -44,6 +45,9 @@ public class ScriptParameter implements Serializable
@XStreamAsAttribute
protected String parameterName;

@XStreamOmitField
protected String parameterDescription;

protected String stringValue;

/**
Expand Down Expand Up @@ -77,6 +81,12 @@ public ScriptParameter(final String parameterName, final ScriptParameterType typ
this.type = type;
}

public ScriptParameter(final String parameterName, final ScriptParameterType type, final String description)
{
this(parameterName, type);
this.parameterDescription = description;
}

public Object getValue()
{
if (type == null) {
Expand Down Expand Up @@ -154,6 +164,10 @@ public String getParameterName()
return parameterName;
}

public String getParameterDescription() {
return parameterDescription;
}

public String getStringValue()
{
return stringValue;
Expand Down Expand Up @@ -240,6 +254,10 @@ public void setParameterName(String parameterName)
this.parameterName = parameterName;
}

public void setParameterDescription(String parameterDescription) {
this.parameterDescription = parameterDescription;
}

public TaskDO getTask()
{
return task;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ open class AddressExport {
val sheet = workbook.createOrGetSheet(translate(sheetTitle))
sheet.enableMultipleColumns = true

val boldFont = workbook.createOrGetFont("bold", bold = true)
val boldFont = ExcelUtils.createFont(workbook, "bold", bold = true)
val boldStyle = workbook.createOrGetCellStyle("hr", font = boldFont)
registerCols(sheet)
sheet.createRow() // title row
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class ExtractPFTradingPartners {

private fun createTradingPartnersSheet(workbook: ExcelWorkbook, name: String, tradingPartners: List<TradingPartner>) {
val sheet = workbook.createOrGetSheet(name)
val boldFont = workbook.createOrGetFont("bold", bold = true)
val boldFont = ExcelUtils.createFont(workbook, "bold", bold = true)
val boldStyle = workbook.createOrGetCellStyle("boldStyle")
boldStyle.setFont(boldFont)
val wrapStyle = workbook.createOrGetCellStyle("wrapText")
Expand Down
Loading

0 comments on commit c4ffcb1

Please sign in to comment.