Skip to content

Commit

Permalink
Merge pull request #274 from micromata/Release-8.1-SNAPSHOT
Browse files Browse the repository at this point in the history
- AdminPage refreshes now also AuftragsRechnungCache. 
- Visitorbook: unused field contactPerson removed.
- ForecastExportInvoices: cache access for order positions changed (fix of missing invoices)
  • Loading branch information
kreinhard authored Jan 30, 2025
2 parents 3da2add + c75d202 commit 40c240d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,10 @@ internal class ForecastExportInvoices { // open needed by Wicket.
continue // Ignoriere stornierte oder geplante Rechnungen.
}
rechnungCache.getRechnungInfo(invoice.id)?.positions?.forEach { pos ->
// for (pos in rechnungCache.getRechnungsPositionVOSetByRechnungId(invoice.id) ?: continue) {
val orderPosId = pos.auftragsPositionId
val orderPosInfo = rechnungCache.getOrderPositionInfoOfInvoicePos(pos.id)
val orderPosId = orderPosInfo?.id
val orderPositionFound = orderPosId != null && ctx.orderPositionMap.containsKey(orderPosId)
// val invoiceProjektId = invoice.projektId
// val orderProjectId = orderPos?.auftrag?.projektId // may differ from invoiceProjektId
// val projectFound = invoiceProjektId != null && ctx.projectIds.contains(invoiceProjektId) ||
// orderProjectId != null && ctx.projectIds.contains(orderProjectId)
if (!ctx.showAll && !orderPositionFound) { // !projectFound && !orderPositionFound) {
if (!ctx.showAll && !orderPositionFound) {
return@forEach // Ignore invoices referring an order position or project which isn't part of the order list filtered by the user.
}
var order = if (orderPosId != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class RechnungCache(rechnungJdbcService: RechnungJdbcService) :
RechnungCalculator.auftragsCache = auftragsCache
}

fun getOrderPositionInfos(rechnungId: Long?): Set<OrderPositionInfo>? {
fun getOrderPositionInfosOfInvoice(rechnungId: Long?): Set<OrderPositionInfo>? {
rechnungId ?: return null
val info = getRechnungInfo(rechnungId) ?: return null
val set = mutableSetOf<OrderPositionInfo>()
Expand All @@ -66,6 +66,12 @@ class RechnungCache(rechnungJdbcService: RechnungJdbcService) :
return set
}

fun getOrderPositionInfoOfInvoicePos(rechnungPosId: Long?): OrderPositionInfo? {
rechnungPosId ?: return null
val posInfo = getRechnungPosInfo(rechnungPosId) ?: return null
return auftragsCache.getOrderPositionInfo(posInfo.auftragsPositionId)
}

fun getRechnungsPosInfosByAuftragId(auftragId: Long?): List<RechnungPosInfo>? {
auftragId ?: return null
return auftragsRechnungCache.getRechnungsPosInfoByAuftragId(auftragId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import mu.KotlinLogging
import org.apache.commons.io.FileUtils
import org.projectforge.business.address.BirthdayCache.Companion.instance
import org.projectforge.business.fibu.AuftragsCache
import org.projectforge.business.fibu.AuftragsRechnungCache
import org.projectforge.business.fibu.KontoCache
import org.projectforge.business.fibu.RechnungCache
import org.projectforge.business.fibu.kost.KostCache
Expand Down Expand Up @@ -62,6 +63,9 @@ class SystemService {
@Autowired
private lateinit var auftragsCache: AuftragsCache

@Autowired
private lateinit var auftragsRechnungCache: AuftragsRechnungCache

@Autowired
private lateinit var cronSanityCheckJob: CronSanityCheckJob

Expand Down Expand Up @@ -173,8 +177,9 @@ class SystemService {
kostCache.forceReload()
rechnungCache.forceReload()
auftragsCache.forceReload()
auftragsRechnungCache.forceReload()
systemInfoCache.forceReload()
instance.forceReload()
return "UserGroupCache, TaskTree, KontoCache, KostCache, RechnungCache, AuftragsCache, SystemInfoCache, BirthdayCache"
return "UserGroupCache, TaskTree, KontoCache, KostCache, RechnungCache, AuftragsCache, AuftragsRechnungCache, SystemInfoCache, BirthdayCache"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class VisitorbookEntryPageRest : AbstractDynamicPageRest() {
}
val lc = LayoutContext(VisitorbookEntryDO::class.java)
val layout = UILayout("orga.visitorbook.timeofvisit")
layout.add(lc, "dateOfVisit", "arrived", "departed", "contactPerson", "comment")
layout.add(lc, "dateOfVisit", "arrived", "departed", "comment")
layout.addAction(UIButton.createCancelButton(responseAction = ResponseAction(targetType = TargetType.CLOSE_MODAL)))
if (id < 0) {
// New entry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public void populateItem(final Item<ICellPopulator<RechnungDO>> item, final Stri
public void populateItem(final Item<ICellPopulator<RechnungDO>> item, final String componentId,
final IModel<RechnungDO> rowModel) {
RechnungDO invoice = rowModel.getObject();
final Set<OrderPositionInfo> orderPositions = RechnungCache.getInstance().getOrderPositionInfos(invoice.getId());
final Set<OrderPositionInfo> orderPositions = RechnungCache.getInstance().getOrderPositionInfosOfInvoice(invoice.getId());
if (CollectionUtils.isEmpty(orderPositions) == true) {
item.add(AbstractUnsecureBasePage.createInvisibleDummyComponent(componentId));
} else {
Expand Down

0 comments on commit 40c240d

Please sign in to comment.