Skip to content

Commit

Permalink
Bugfix: search for numbers (e. g. invoices), monthlyEmployeeReportPag…
Browse files Browse the repository at this point in the history
…e -> Timesheets.
  • Loading branch information
kreinhard committed Dec 16, 2024
1 parent a9af421 commit 98555d5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class KostFormatter {
formatType: FormatType = FormatType.FORMATTED_NUMBER,
abbreviationLength: Int = ABBREVIATION_LENGTH,
): String {
var useKost2 = kostCache.getKost2IfNotInitialized(kost2)
val useKost2 = kostCache.getKost2IfNotInitialized(kost2)
?: return if (formatType == FormatType.NUMBER) "????????" else "?.???.??.??"
val delimiter = if ((formatType == FormatType.NUMBER)) "" else "."
val sb = StringBuilder()
Expand All @@ -171,7 +171,7 @@ class KostFormatter {
} else {
sb.append("--")
}
var useProjekt = projektCache.getProjektIfNotInitialized(useKost2.projekt)
val useProjekt = projektCache.getProjektIfNotInitialized(useKost2.projekt)
if (formatType == FormatType.LONG || formatType == FormatType.TEXT) {
sb.append(": ")
useProjekt.let { projekt ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ open class Kost2DO : DefaultBaseDO(), Comparable<Kost2DO>, DisplayNameCapable {
*/
@get:PropertyInfo(i18nKey = "fibu.kost2")
@get:Transient
@get:GenericField
@get:GenericField(name = "nummer")
@get:IndexingDependency(derivedFrom = [ObjectPath(PropertyValue(propertyName = "id"))])
val formattedNumber: String
get() = KostFormatter.instance.formatKost2(this, KostFormatter.FormatType.FORMATTED_NUMBER)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -521,9 +521,10 @@ abstract class DBPredicate(
logDebugFunCall(log) { it.mtd("FullSearch.handledByFullTextQuery(...)") }
val useSearchFields =
if (fulltextSearchFields.isNullOrEmpty()) searchClassInfo.stringFieldNames else fulltextSearchFields
if (fulltextSearchFields.isNullOrEmpty() && NumberUtils.isCreatable(queryString)) {
val plainQueryString = queryString.removeSuffix("*").removeSuffix("%")
if (fulltextSearchFields.isNullOrEmpty() && NumberUtils.isCreatable(plainQueryString)) {
// query string is number, so search in number search fields as well as in text search fields.
val number = NumberUtils.createNumber(queryString)
val number = NumberUtils.createNumber(plainQueryString)
search(
searchPredicateFactory,
boolCollector,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ private void addReport() {
}
final Kost2Row kost2Row = rowEntry.getValue();
final Kost2DO cost2 = kost2Row.getKost2();
addLabelCols(row, cost2, null, "kost2.nummer:" + cost2.getFormattedNumber(), report.getUser(),
addLabelCols(row, cost2, null, "kost2.nummer:" + cost2.getFormattedNumber() + "*", report.getUser(),
report.getFromDate().getTime(), report
.getToDate().getTime());
final RepeatingView colWeekRepeater = new RepeatingView("colWeekRepeater");
Expand Down

0 comments on commit 98555d5

Please sign in to comment.