Skip to content

Commit

Permalink
Buchung geprüft Markieren. Buchungsliste teilweise aktualisieren
Browse files Browse the repository at this point in the history
  • Loading branch information
lenilsas committed Feb 2, 2025
1 parent 8cb6228 commit 0c8a830
Show file tree
Hide file tree
Showing 28 changed files with 582 additions and 383 deletions.
4 changes: 4 additions & 0 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
class="de.jost_net.JVerein.server.JVereinDBServiceImpl" />
</services>

<messaging>
<consumer queue="hibiscus.umsatz.markchecked" class="de.jost_net.JVerein.Messaging.HibscusUmsatzMessageConsumer" />
</messaging>

<requires jameica="2.8+">
<import plugin="hibiscus" version="2.8.7+"/>
</requires>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import com.schlevoigt.JVerein.util.Misc;

import de.jost_net.JVerein.DBTools.DBTransaction;
import de.jost_net.JVerein.Messaging.BuchungMessage;
import de.jost_net.JVerein.gui.action.BuchungAction;
import de.jost_net.JVerein.rmi.Buchung;
import de.jost_net.JVerein.rmi.Konto;
Expand All @@ -36,9 +35,6 @@
import de.willuhn.jameica.gui.formatter.Formatter;
import de.willuhn.jameica.gui.parts.Button;
import de.willuhn.jameica.gui.parts.TablePart;
import de.willuhn.jameica.messaging.Message;
import de.willuhn.jameica.messaging.MessageConsumer;
import de.willuhn.jameica.system.Application;
import de.willuhn.logging.Logger;
import de.willuhn.util.ApplicationException;

Expand All @@ -48,8 +44,6 @@ public class BuchungsTextKorrekturControl extends AbstractControl {

private BuchungsKorrekturQuery query;

private BuchungMessageConsumer mc = null;

public BuchungsTextKorrekturControl(AbstractView view) {
super(view);
}
Expand Down Expand Up @@ -121,17 +115,7 @@ public String format(Object value) {
buchungsList.setRememberColWidths(true);
buchungsList.setRememberOrder(true);
buchungsList.setRememberState(true);
this.mc = new BuchungMessageConsumer();
Application.getMessagingFactory().registerMessageConsumer(this.mc);
} else {
buchungsList.removeAll();

for (Buchung bu : query.get()) {
buchungsList.addItem(bu);
}
buchungsList.sort();
}

return buchungsList;
}

Expand Down Expand Up @@ -175,53 +159,4 @@ private void starteKorrektur() {
GUI.getStatusBar().setErrorText(e.getLocalizedMessage());
}
}

/**
* Wird benachrichtigt um die Anzeige zu aktualisieren.
*/
private class BuchungMessageConsumer implements MessageConsumer {

/**
* @see de.willuhn.jameica.messaging.MessageConsumer#autoRegister()
*/
@Override
public boolean autoRegister() {
return false;
}

/**
* @see de.willuhn.jameica.messaging.MessageConsumer#getExpectedMessageTypes()
*/
@Override
public Class<?>[] getExpectedMessageTypes() {
return new Class[] { BuchungMessage.class };
}

/**
* @see de.willuhn.jameica.messaging.MessageConsumer#handleMessage(de.willuhn.jameica.messaging.Message)
*/
@Override
public void handleMessage(final Message message) throws Exception {
GUI.getDisplay().syncExec(new Runnable() {

@Override
public void run() {
try {
if (buchungsList == null) {
// Eingabe-Feld existiert nicht. Also abmelden
Application.getMessagingFactory().unRegisterMessageConsumer(BuchungMessageConsumer.this);
return;
}
refreshBuchungen();
} catch (Exception e) {
// Wenn hier ein Fehler auftrat, deregistrieren wir uns
// wieder
Logger.error("unable to refresh Splitbuchungen", e);
Application.getMessagingFactory().unRegisterMessageConsumer(BuchungMessageConsumer.this);
}
}
});
}

}
}
32 changes: 0 additions & 32 deletions src/de/jost_net/JVerein/Messaging/BuchungMessage.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/**********************************************************************
*
* Copyright (c) 2004 Olaf Willuhn
* All right/**********************************************************************
* Copyright (c) by Heiner Jostkleigrewe
* This program is free software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
* the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program. If not,
* see <http://www.gnu.org/licenses/>.
*
* [email protected]
* www.jverein.de
**********************************************************************/

package de.jost_net.JVerein.Messaging;

import de.jost_net.JVerein.Einstellungen;
import de.jost_net.JVerein.rmi.Buchung;
import de.willuhn.datasource.GenericObject;
import de.willuhn.datasource.rmi.DBIterator;
import de.willuhn.jameica.messaging.Message;
import de.willuhn.jameica.messaging.MessageConsumer;
import de.willuhn.jameica.messaging.QueryMessage;

/**
* Wird benachrichtigt, wenn eine Buchung aus Hibiscus als geprueft/ungeprueft
* markiert wurde. Insofern wir eine Buchung haben, die aus diesem Umsatz
* erzeugt wurde, uebernehmen wir den Status dann auch gleich in JVerein.
*/
public class HibscusUmsatzMessageConsumer implements MessageConsumer
{
/**
* @see de.willuhn.jameica.messaging.MessageConsumer#getExpectedMessageTypes()
*/
@SuppressWarnings("rawtypes")
@Override
public Class[] getExpectedMessageTypes()
{
return new Class[] { QueryMessage.class };
}

/**
* @see de.willuhn.jameica.messaging.MessageConsumer#handleMessage(de.willuhn.jameica.messaging.Message)
*/
@Override
public void handleMessage(Message message) throws Exception
{
if (!Einstellungen.getEinstellung().getGeprueftSynchronisieren())
return;

final QueryMessage m = (QueryMessage) message;
final String name = m.getName();
final Object data = m.getData();

if (name == null || data == null)
return;

final boolean state = Boolean.valueOf(name);

// Wir muessen hier nichtmal auf Umsatz casten - uns genuegt die ID des
// Datensatzes
if (!(data instanceof GenericObject))
return;

final GenericObject o = (GenericObject) data;
final String id = o.getID();
if (id == null || id.length() == 0)
return;

DBIterator<Buchung> list = Einstellungen.getDBService()
.createList(Buchung.class);
list.addFilter("umsatzid = ?", id);
if (!list.hasNext())
return;

Buchung b = list.next();
b.setGeprueft(state);
b.store();
}

/**
* @see de.willuhn.jameica.messaging.MessageConsumer#autoRegister()
*/
@Override
public boolean autoRegister()
{
// Per plugin.xml registriert.
return false;
}

}

10 changes: 9 additions & 1 deletion src/de/jost_net/JVerein/Queries/BuchungQuery.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,12 @@ private void SortHashMap() {

private SplitFilter split;

private boolean ungeprueft;

public BuchungQuery(Date datumvon, Date datumbis, Konto konto,
Buchungsart buchungsart, Projekt projekt, String text, String betrag,
Boolean hasMitglied, String mitglied, boolean geldkonto,
SplitFilter split)
SplitFilter split, boolean ungeprueft)
{
this.datumvon = datumvon;
this.datumbis = datumbis;
Expand All @@ -97,6 +99,7 @@ public BuchungQuery(Date datumvon, Date datumbis, Konto konto,
this.geldkonto = geldkonto;
this.mitglied = mitglied;
this.split = split;
this.ungeprueft = ungeprueft;
}

public String getOrder(String value) {
Expand Down Expand Up @@ -242,6 +245,11 @@ else if (buchungart.getNummer() >= 0)
break;
}

if (ungeprueft)
{
it.addFilter("geprueft = 0");
}

if (betrag != null && betrag.length() > 0)
{
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package de.jost_net.JVerein.gui.action;

import de.jost_net.JVerein.gui.control.BuchungsControl;
import de.jost_net.JVerein.gui.dialogs.BuchungsartZuordnungDialog;
import de.jost_net.JVerein.rmi.Buchung;
import de.jost_net.JVerein.rmi.Buchungsart;
Expand All @@ -33,12 +32,6 @@
*/
public class BuchungBuchungsartZuordnungAction implements Action
{
private BuchungsControl control;

public BuchungBuchungsartZuordnungAction(BuchungsControl control)
{
this.control = control;
}

@Override
public void handleAction(Object context) throws ApplicationException
Expand Down Expand Up @@ -111,7 +104,6 @@ public void handleAction(Object context) throws ApplicationException
}
}
}
control.getBuchungsList();
if (ba == null)
{
GUI.getStatusBar().setSuccessText("Buchungsarten gelöscht");
Expand Down
13 changes: 1 addition & 12 deletions src/de/jost_net/JVerein/gui/action/BuchungDeleteAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

import java.rmi.RemoteException;

import de.jost_net.JVerein.Messaging.BuchungMessage;
import de.jost_net.JVerein.gui.control.BuchungsControl;
import de.jost_net.JVerein.io.SplitbuchungsContainer;
import de.jost_net.JVerein.rmi.Buchung;
import de.jost_net.JVerein.rmi.Jahresabschluss;
Expand All @@ -28,7 +26,6 @@
import de.willuhn.jameica.gui.Action;
import de.willuhn.jameica.gui.GUI;
import de.willuhn.jameica.gui.dialogs.YesNoDialog;
import de.willuhn.jameica.system.Application;
import de.willuhn.logging.Logger;
import de.willuhn.util.ApplicationException;

Expand All @@ -39,12 +36,9 @@ public class BuchungDeleteAction implements Action
{
private boolean splitbuchung;

private BuchungsControl control;

public BuchungDeleteAction(BuchungsControl control, boolean splitbuchung)
public BuchungDeleteAction(boolean splitbuchung)
{
this.splitbuchung = splitbuchung;
this.control = control;
}

@Override
Expand Down Expand Up @@ -153,15 +147,12 @@ else if (context instanceof Buchung[])
bu.getSpendenbescheinigung().delete();
bu.delete();
count++;
control.getBuchungsList();
}
else if (splitbuchung)
{
if (bu.getDependencyId() == -1)
{
bu.setDelete(true);
Application.getMessagingFactory()
.sendMessage(new BuchungMessage(bu));
count++;
}
else
Expand All @@ -171,8 +162,6 @@ else if (splitbuchung)
if (buchung_tmp.getDependencyId() == bu.getDependencyId())
{
buchung_tmp.setDelete(true);
Application.getMessagingFactory()
.sendMessage(new BuchungMessage(buchung_tmp));
count++;
}
}
Expand Down
Loading

0 comments on commit 0c8a830

Please sign in to comment.