forked from jverein/jverein
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix Buchungskorrektur * Remove Gesamtbetrag in Table Summary * Check Jahresabschluss auf null
- Loading branch information
1 parent
f37b4ac
commit 95d8b77
Showing
3 changed files
with
107 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,89 +1,97 @@ | ||
package com.schlevoigt.JVerein.util; | ||
|
||
import java.util.ArrayList; | ||
import java.rmi.RemoteException; | ||
|
||
import org.apache.commons.lang.StringUtils; | ||
|
||
import de.willuhn.jameica.hbci.rmi.Transfer; | ||
import de.willuhn.jameica.hbci.server.VerwendungszweckUtil; | ||
import de.willuhn.jameica.hbci.server.VerwendungszweckUtil.Tag; | ||
|
||
public class Misc { | ||
|
||
public static String getBuchungsZweckKorrektur(String value, boolean withRealLineBreak) { | ||
String result = ""; | ||
if (value == null) | ||
{ | ||
return result; | ||
} | ||
if (value.length() < 5) | ||
{ | ||
return value.replace("SVWZ+", ""); | ||
} | ||
value = value.replaceAll("\r\n", "|"); | ||
value = value.replaceAll("\r", "|"); | ||
value = value.replaceAll("\n", "|"); | ||
if (value == null) { | ||
return null; | ||
} | ||
try | ||
{ | ||
Transfer t = new Verwendungszweck(value); | ||
String s = StringUtils.trimToNull(VerwendungszweckUtil.getTag(t, Tag.SVWZ)); | ||
if (!withRealLineBreak) | ||
{ | ||
s = s.replaceAll("\r\n", "|"); | ||
s = s.replaceAll("\r", "|"); | ||
s = s.replaceAll("\n", "|"); | ||
} | ||
return s; | ||
} | ||
catch (RemoteException ex) | ||
{ | ||
return null; | ||
} | ||
} | ||
} | ||
|
||
String[] zeilen = value.split("\\|"); | ||
ArrayList<String> zeilenNeu = new ArrayList<String>(); | ||
// Dummy Klasse um die Methode "VerwendungszweckUtil.getTag(t, Tag.SVWZ)" | ||
// verwenden zu können | ||
final class Verwendungszweck implements Transfer | ||
{ | ||
String zweck = null; | ||
|
||
String currentKey = ""; | ||
String currentLine = ""; | ||
public Verwendungszweck(String zweck) | ||
{ | ||
this.zweck = zweck; | ||
} | ||
|
||
for (int i = 0; i < zeilen.length; i++) { | ||
String zeile = zeilen[i]; | ||
if (zeile.length() > 4 && zeile.substring(4, 5).equals("+")) { | ||
if (currentLine.trim().length() > 0) { | ||
if (currentKey.trim().isEmpty()) { | ||
zeilenNeu.add(currentLine); | ||
} else { | ||
zeilenNeu.add(currentKey + "+" + currentLine); | ||
} | ||
} | ||
currentKey = zeile.substring(0, 4); | ||
currentLine = zeile.substring(5); | ||
} else { | ||
currentLine = currentLine + zeile; | ||
} | ||
if (currentKey.equals("SVWZ")) { | ||
zeilenNeu.add(currentKey + "+" + currentLine); | ||
currentLine = ""; | ||
} | ||
} | ||
if (!currentLine.trim().isEmpty()) { | ||
if (currentKey.trim().isEmpty()) { | ||
zeilenNeu.add(currentLine); | ||
} else { | ||
zeilenNeu.add(currentKey + "+" + currentLine); | ||
} | ||
} | ||
@Override | ||
public String getGegenkontoNummer() throws RemoteException | ||
{ | ||
// TODO Auto-generated method stub | ||
return null; | ||
} | ||
|
||
String lineBreakAfter = null; | ||
String lineBreakBefore = null; | ||
for (int i = 0; i < zeilenNeu.size(); i++) { | ||
String zeile = zeilenNeu.get(i); | ||
if (zeile.startsWith("KREF+") || zeile.startsWith("EREF+") || zeile.startsWith("MREF+") || zeile.startsWith("CRED+") | ||
|| zeile.startsWith("PURP+OTHR") || zeile.startsWith("SVWZ+Datum:") || zeile.startsWith("SVWZ+BIC:") || zeile.startsWith("SVWZ+BLZ:") | ||
|| zeile.startsWith("SVWZ+IBAN:") || (zeile.contains("UFT ") && zeile.contains("TAN ")) | ||
|| (zeile.contains("KD ") && zeile.contains("TAN "))) { | ||
continue; | ||
} | ||
if ((i == zeilenNeu.size() - 1) || (zeile.startsWith("SVWZ+"))) { | ||
lineBreakAfter = ""; | ||
} else { | ||
lineBreakAfter = "|"; | ||
} | ||
zeile = zeile.replaceAll("PURP\\+RINP ", "").replaceAll("PURP\\+ELEC ", "").replaceAll("SVWZ\\+", ""); | ||
if (zeile.startsWith("Dauerauftrag:")) { | ||
lineBreakBefore = "|"; | ||
} else { | ||
lineBreakBefore = ""; | ||
} | ||
result = result + lineBreakBefore + zeile + lineBreakAfter; | ||
} | ||
@Override | ||
public String getGegenkontoBLZ() throws RemoteException | ||
{ | ||
// TODO Auto-generated method stub | ||
return null; | ||
} | ||
|
||
if (result.endsWith("|")) { | ||
result = result.substring(1, result.length() - 1); | ||
} | ||
if (withRealLineBreak) { | ||
result = result.replaceAll("\\|", "\r\n"); | ||
} | ||
@Override | ||
public String getGegenkontoName() throws RemoteException | ||
{ | ||
// TODO Auto-generated method stub | ||
return null; | ||
} | ||
|
||
return result; | ||
} | ||
@Override | ||
public double getBetrag() throws RemoteException | ||
{ | ||
// TODO Auto-generated method stub | ||
return 0; | ||
} | ||
|
||
@Override | ||
public String getZweck() throws RemoteException | ||
{ | ||
// TODO Auto-generated method stub | ||
return zweck; | ||
} | ||
|
||
@Override | ||
public String getZweck2() throws RemoteException | ||
{ | ||
// TODO Auto-generated method stub | ||
return null; | ||
} | ||
|
||
@Override | ||
public String[] getWeitereVerwendungszwecke() throws RemoteException | ||
{ | ||
// TODO Auto-generated method stub | ||
return null; | ||
} | ||
|
||
} | ||
|