Skip to content

Commit

Permalink
Intervall für aktive Konten konfigurierbar (#176)
Browse files Browse the repository at this point in the history
* Intervall für aktive Konten konfigurierbar

* Wegen anderer Lösung KontoAuswahlDialog entfernt
  • Loading branch information
JohannMaierhofer committed Mar 10, 2024
1 parent b26c899 commit 1236964
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 10 deletions.
15 changes: 14 additions & 1 deletion src/de/jost_net/JVerein/gui/control/EinstellungControl.java
Expand Up @@ -175,6 +175,8 @@ public class EinstellungControl extends AbstractControl
private CheckboxInput kontonummer_in_buchungsliste;

private IntegerInput unterdrueckunglaenge;

private IntegerInput unterdrueckungkonten;

private CheckboxInput automatische_buchungskorrektur_hibiscus;

Expand Down Expand Up @@ -958,6 +960,16 @@ public IntegerInput getUnterdrueckungLaenge() throws RemoteException
Einstellungen.getEinstellung().getUnterdrueckungLaenge());
}
return unterdrueckunglaenge;
}

public IntegerInput getUnterdrueckungKonten() throws RemoteException
{
if (null == unterdrueckungkonten)
{
unterdrueckungkonten = new IntegerInput(
Einstellungen.getEinstellung().getUnterdrueckungKonten());
}
return unterdrueckungkonten;
}

public CheckboxInput getKontonummerInBuchungsliste() throws RemoteException
Expand All @@ -971,7 +983,6 @@ public CheckboxInput getKontonummerInBuchungsliste() throws RemoteException
return kontonummer_in_buchungsliste;
}


public CheckboxInput getAutomatischeBuchungskorrekturHibiscus() throws RemoteException
{
if (automatische_buchungskorrektur_hibiscus != null)
Expand Down Expand Up @@ -1977,6 +1988,8 @@ public void handleStoreBuchfuehrung()
.getValue());
Integer ulength = (Integer) unterdrueckunglaenge.getValue();
e.setUnterdrueckungLaenge(ulength);
Integer klength = (Integer) unterdrueckungkonten.getValue();
e.setUnterdrueckungKonten(klength);
e.setKontonummerInBuchungsliste((Boolean) kontonummer_in_buchungsliste.getValue());
e.setOptiert((Boolean) getOptiert().getValue());
e.store();
Expand Down
19 changes: 10 additions & 9 deletions src/de/jost_net/JVerein/gui/parts/KontoList.java
Expand Up @@ -20,12 +20,13 @@

import java.rmi.RemoteException;
import java.util.Calendar;
import java.util.List;

import org.eclipse.swt.widgets.Composite;

import de.jost_net.JVerein.Einstellungen;
import de.jost_net.JVerein.rmi.Konto;
import de.willuhn.datasource.GenericIterator;
import de.willuhn.datasource.pseudo.PseudoIterator;
import de.willuhn.datasource.rmi.DBIterator;
import de.willuhn.jameica.gui.Action;
import de.willuhn.jameica.gui.Part;
Expand All @@ -36,14 +37,13 @@
*/
public class KontoList extends TablePart implements Part
{

public KontoList(Action action, boolean onlyHibiscus,
boolean nurAktuelleKonten) throws RemoteException
{
this(init(onlyHibiscus, nurAktuelleKonten), action);
}

public KontoList(GenericIterator konten, Action action)
public KontoList(List<Konto> konten, Action action)
{
super(konten, action);

Expand Down Expand Up @@ -73,10 +73,10 @@ public synchronized void update(boolean onlyHibiscus,
boolean nurAktuelleKonten) throws RemoteException
{
super.removeAll();
DBIterator<Konto> i = init(onlyHibiscus, nurAktuelleKonten);
while (i.hasNext())
List<Konto> list = init(onlyHibiscus, nurAktuelleKonten);
for (Konto kto: list)
{
super.addItem(i.next());
super.addItem(kto);
}
}

Expand All @@ -86,7 +86,8 @@ public synchronized void update(boolean onlyHibiscus,
* @return Liste der Konten.
* @throws RemoteException
*/
private static DBIterator<Konto> init(boolean onlyHibiscus,
@SuppressWarnings("unchecked")
private static List<Konto> init(boolean onlyHibiscus,
boolean nurAktuelleKonten) throws RemoteException
{
DBIterator<Konto> i = Einstellungen.getDBService().createList(Konto.class);
Expand All @@ -98,10 +99,10 @@ private static DBIterator<Konto> init(boolean onlyHibiscus,
{
Calendar cal = Calendar.getInstance();
int year = cal.get(Calendar.YEAR);
year = year - 2;
year = year - Einstellungen.getEinstellung().getUnterdrueckungKonten();
i.addFilter("(aufloesung is null or year(aufloesung) >= ?)", year);
}
i.setOrder("ORDER BY nummer, bezeichnung");
return i;
return PseudoIterator.asList(i);
}
}
Expand Up @@ -38,6 +38,8 @@ public void bind() throws Exception

cont.addLabelPair("Beginn Geschäftsjahr (TT.MM.)",
control.getBeginnGeschaeftsjahr());
cont.addLabelPair("Intervall für aktive Konten (Jahre)",
control.getUnterdrueckungKonten());
cont.addLabelPair("Buchungsarten die seit x Monaten nicht benutzt werden unterdrücken",
control.getUnterdrueckungLaenge());
cont.addInput(control.getAutoBuchunguebernahme());
Expand Down
5 changes: 5 additions & 0 deletions src/de/jost_net/JVerein/rmi/Einstellung.java
Expand Up @@ -271,6 +271,11 @@ public void setUnterdrueckungOhneBuchung(Boolean unterdrueckungohnebuchung)

public void setUnterdrueckungLaenge(int unterdrueckunglaenge)
throws RemoteException;

public int getUnterdrueckungKonten() throws RemoteException;

public void setUnterdrueckungKonten(int unterdrueckungkonten)
throws RemoteException;

public Boolean getKontonummerInBuchungsliste() throws RemoteException;

Expand Down
36 changes: 36 additions & 0 deletions src/de/jost_net/JVerein/server/DDLTool/Updates/Update0433.java
@@ -0,0 +1,36 @@
/**********************************************************************
* 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/>.
*
**********************************************************************/
package de.jost_net.JVerein.server.DDLTool.Updates;

import de.jost_net.JVerein.server.DDLTool.AbstractDDLUpdate;
import de.jost_net.JVerein.server.DDLTool.Column;
import de.willuhn.util.ApplicationException;
import de.willuhn.util.ProgressMonitor;

import java.sql.Connection;

public class Update0433 extends AbstractDDLUpdate
{
public Update0433(String driver, ProgressMonitor monitor, Connection conn)
{
super(driver, monitor, conn);
}

@Override
public void run() throws ApplicationException
{
execute(addColumn("einstellung", new Column("unterdrueckungkonten",
COLTYPE.INTEGER, 0, null, false, false)));
}
}
17 changes: 17 additions & 0 deletions src/de/jost_net/JVerein/server/EinstellungImpl.java
Expand Up @@ -1677,6 +1677,23 @@ public void setUnterdrueckungLaenge(int unterdrueckunglaenge) throws RemoteExcep
{
setAttribute("unterdrueckunglaenge", unterdrueckunglaenge);
}

@Override
public int getUnterdrueckungKonten() throws RemoteException
{
try {
return (int) getAttribute("unterdrueckungkonten");
} catch (NullPointerException e) {
return 2;
}
}

@Override
public void setUnterdrueckungKonten(int unterdrueckungkonten) throws RemoteException
{
setAttribute("unterdrueckungkonten", unterdrueckungkonten);
}


@Override
public Boolean getKontonummerInBuchungsliste() throws RemoteException
Expand Down

0 comments on commit 1236964

Please sign in to comment.