Skip to content

Commit

Permalink
Merge pull request #193 from jrfinc/fix/gltransaction-reverse
Browse files Browse the repository at this point in the history
If detail is null, don't add () to reverse's detail
  • Loading branch information
ar authored Dec 4, 2020
2 parents 49a021b + 589aed5 commit 575a0c3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion modules/minigl/src/main/java/org/jpos/gl/GLTransaction.java
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ public GLTransaction createReverse() {
* @return a reversal transaction
*/
public GLTransaction createReverse(boolean keepEntryTags) {
GLTransaction glt = new GLTransaction ("(" + getDetail() + ")");
GLTransaction glt = new GLTransaction (negate(getDetail()));
glt.setJournal (getJournal());
for (GLEntry e : getEntries()) {
GLEntry reversalEntry = glt.createGLEntry(
Expand Down Expand Up @@ -489,6 +489,13 @@ private BigDecimal negate (BigDecimal bd) {
return bd != null ? bd.negate() : null;
}

private String negate (String s) {
if (s == null)
return s;
else
return "(" + s + ")";
}

@Override
public GLTransaction clone() throws CloneNotSupportedException {
GLTransaction glt = (GLTransaction)super.clone();
Expand Down

0 comments on commit 575a0c3

Please sign in to comment.