kreditorenverwaltung mit multi IBAN
This commit is contained in:
parent
90beebd5c0
commit
d7a570ac3e
4 changed files with 515 additions and 307 deletions
|
|
@ -1,7 +1,13 @@
|
|||
# Versionen
|
||||
|
||||
### 1.2.7 (Development)
|
||||
|
||||
### 1.2.6 (Development)
|
||||
Erweiterte Kreditoren Verwaltung. Es können bis zu 4 IBAN/BIC Kombinationen pro Kreditor erfasst werden.
|
||||
|
||||
Wenn vom Benutezr bei der Rechnungserfassugn eine Kombination eingegeben wird die noch nicht gespeichert war,
|
||||
wird diese aufgenomen und die anderen rutschen nach unten.
|
||||
|
||||
### 1.2.6
|
||||
|
||||
Übernahme von IBAN BIC aus kreditoren verwaltung
|
||||
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ public class CargosoftController implements Serializable {
|
|||
searchResult.add(new KreditorSearchEntry(cdtrNo, display, buildJsonData(cdtr,
|
||||
cdtr.getItemValueString("cdtr.iban"), cdtr.getItemValueString("cdtr.bic"))));
|
||||
// haben wir noch weitere IBAN/BIC kombis?
|
||||
for (int j = 1; j < 4; j++) {
|
||||
for (int j = 1; j <=4 ; j++) {
|
||||
if (!cdtr.getItemValueString("cdtr.iban" + j).isEmpty()) {
|
||||
// Dublette mit alternativer IBAN erzeugen
|
||||
display = cdtrNo + " - " + cdtr.getItemValueString("_VENDOR_Name");
|
||||
|
|
@ -187,6 +187,7 @@ public class CargosoftController implements Serializable {
|
|||
add("iban", cdtr.getItemValueString("cdtr.iban")). //
|
||||
add("bic", cdtr.getItemValueString("cdtr.bic")). //
|
||||
// add ibans für kreditoren verwaltung
|
||||
add("iban2", cdtr.getItemValueString("cdtr.iban2")). //
|
||||
add("iban3", cdtr.getItemValueString("cdtr.iban3")). //
|
||||
add("iban4", cdtr.getItemValueString("cdtr.iban4")). //
|
||||
add("bic2", cdtr.getItemValueString("cdtr.bic2")). //
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.imixs.workflow.ItemCollection;
|
||||
import org.imixs.workflow.engine.plugins.AbstractPlugin;
|
||||
import org.imixs.workflow.exceptions.PluginException;
|
||||
|
|
@ -44,12 +46,16 @@ public class InvoicePlugin extends AbstractPlugin {
|
|||
public static final String CHILD_ITEM_PROPERTY = "_ChildItems";
|
||||
public static final String ERROR_MISSING_DATA = "MISSING_DATA";
|
||||
public static final String ERROR_DUPPLICATE_INVOICE_NUMBER = "DUPPLICATE_INVOICE_NUMBER";
|
||||
public static final String ERROR_NEW_IBANBIC = "NEW_IBANBIC";
|
||||
|
||||
// XX-YYY-####-###
|
||||
public static final String REGEX_POSNUMER = "([A-Z]{2}-[A-Z]{3}-[0-9]{4}-[0-9]{3})";
|
||||
|
||||
private static Logger logger = Logger.getLogger(InvoicePlugin.class.getName());
|
||||
|
||||
@Inject
|
||||
KreditorService kreditorService;
|
||||
|
||||
/**
|
||||
* Test childworkitems for empty lines
|
||||
*
|
||||
|
|
@ -83,6 +89,9 @@ public class InvoicePlugin extends AbstractPlugin {
|
|||
// doppelte Rechnungsnummer prüfen
|
||||
if (workitem.getTaskID() == TASK_ERFASSUNG) {
|
||||
validateInvoiceNumber(workitem);
|
||||
|
||||
checkIBANNumber(workitem);
|
||||
|
||||
}
|
||||
|
||||
if (workitem.getTaskID() == TASK_ERFASSUNG || ((workitem.getTaskID() == TASK_SACHPRUEFUNG
|
||||
|
|
@ -175,9 +184,6 @@ public class InvoicePlugin extends AbstractPlugin {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return workitem;
|
||||
}
|
||||
|
||||
|
|
@ -187,48 +193,37 @@ public class InvoicePlugin extends AbstractPlugin {
|
|||
private void updateImg(ItemCollection workitem) {
|
||||
|
||||
// Update _img icon list
|
||||
String img=workitem.getItemValueString("_img");
|
||||
String img = workitem.getItemValueString("_img");
|
||||
// 031=ablehnen
|
||||
// 100=sofortüberweichung
|
||||
// 074=mahnen
|
||||
// sofortüberweisung
|
||||
if (workitem.getEventID()==96 && !img.contains("100.png")) {
|
||||
img=img+"<img title='Sofortüberweisung' src=\"/layout/icons/icon100.png\">";
|
||||
if (workitem.getEventID() == 96 && !img.contains("100.png")) {
|
||||
img = img + "<img title='Sofortüberweisung' src=\"/layout/icons/icon100.png\">";
|
||||
}
|
||||
// mahnen
|
||||
if (workitem.getEventID()==95 && !img.contains("103.png")) {
|
||||
img=img+"<img title='Mahnen' src=\"/layout/icons/icon103.png\">";
|
||||
if (workitem.getEventID() == 95 && !img.contains("103.png")) {
|
||||
img = img + "<img title='Mahnen' src=\"/layout/icons/icon103.png\">";
|
||||
|
||||
}
|
||||
// ablehnen
|
||||
if (workitem.getTaskID()==5100 && workitem.getEventID()==90 && !img.contains("028.png")) {
|
||||
img=img+"<img title='Abgelehnt' src=\"/layout/icons/icon028.png\">";
|
||||
if (workitem.getTaskID() == 5100 && workitem.getEventID() == 90 && !img.contains("028.png")) {
|
||||
img = img + "<img title='Abgelehnt' src=\"/layout/icons/icon028.png\">";
|
||||
}
|
||||
if (workitem.getTaskID()==5200 && workitem.getEventID()==90 && !img.contains("028.png")) {
|
||||
img=img+"<img title='Abgelehnt' src=\"/layout/icons/icon028.png\">";
|
||||
if (workitem.getTaskID() == 5200 && workitem.getEventID() == 90 && !img.contains("028.png")) {
|
||||
img = img + "<img title='Abgelehnt' src=\"/layout/icons/icon028.png\">";
|
||||
}
|
||||
workitem.setItemValue("_img", img);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
for (String entry: eventLog) {
|
||||
// sofortüberweisung
|
||||
if (entry.contains(".96") && !img.contains("100.png")) {
|
||||
img=img+"<img src=\"/layout/icons/icon100.png\">";
|
||||
}
|
||||
// mahnen
|
||||
if (entry.contains(".95") && !img.contains("074.png")) {
|
||||
img=img+"<img src=\"/layout/icons/icon074.png\">";
|
||||
}
|
||||
// ablehnen
|
||||
if (entry.contains("5100.90") && !img.contains("031.png")) {
|
||||
img=img+"<img src=\"/layout/icons/icon031.png\">";
|
||||
}
|
||||
}
|
||||
workitem.setItemValue("_img", img);
|
||||
* for (String entry: eventLog) { // sofortüberweisung if (entry.contains(".96")
|
||||
* && !img.contains("100.png")) {
|
||||
* img=img+"<img src=\"/layout/icons/icon100.png\">"; } // mahnen if
|
||||
* (entry.contains(".95") && !img.contains("074.png")) {
|
||||
* img=img+"<img src=\"/layout/icons/icon074.png\">"; } // ablehnen if
|
||||
* (entry.contains("5100.90") && !img.contains("031.png")) {
|
||||
* img=img+"<img src=\"/layout/icons/icon031.png\">"; } }
|
||||
* workitem.setItemValue("_img", img);
|
||||
*/
|
||||
}
|
||||
|
||||
|
|
@ -282,7 +277,7 @@ public class InvoicePlugin extends AbstractPlugin {
|
|||
|
||||
String invoiceNumber = workitem.getItemValueString("invoice.number");
|
||||
// strip
|
||||
String invoiceNumberStripped=invoiceNumber.replace(" ","");
|
||||
String invoiceNumberStripped = invoiceNumber.replace(" ", "");
|
||||
workitem.setItemValue("invoice.number.stripped", invoiceNumberStripped);
|
||||
String invoiceNumberDuplicate = workitem.getItemValueString("invoice.number.duplicate");
|
||||
|
||||
|
|
@ -294,7 +289,8 @@ public class InvoicePlugin extends AbstractPlugin {
|
|||
// rechnungseingang only workitems...
|
||||
// Change 11.4.22 - we have now an additional field: invoice.number.stripped
|
||||
String query = "(type:workitem OR type:workitemarchive) AND ($modelversion:rechnungseingang*) AND NOT ($uniqueid:\""
|
||||
+ workitem.getUniqueID() + "\") AND ((invoice.number:\"" + invoiceNumberStripped + "\") OR (invoice.number.stripped:\"" + invoiceNumberStripped + "\"))";
|
||||
+ workitem.getUniqueID() + "\") AND ((invoice.number:\"" + invoiceNumberStripped
|
||||
+ "\") OR (invoice.number.stripped:\"" + invoiceNumberStripped + "\"))";
|
||||
try {
|
||||
int result = this.getWorkflowService().getDocumentService().count(query, 1);
|
||||
if (result > 0) {
|
||||
|
|
@ -321,6 +317,67 @@ public class InvoicePlugin extends AbstractPlugin {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Diese Method prüft ob die eingegebene IBAN nummer bereits in dem ausgewälten
|
||||
* Kreditor bekannt ist. Fallst nicht wird diese schnell mal in den Kreditoren
|
||||
* Datensatz übertragen. Dadurch muss man nicht extra die Kreditoren Verwaltung
|
||||
* aufrufen. Es ist ein art selbst-lernendes System.
|
||||
* <p>
|
||||
* Die Mehtode ruft eine Plugin Exception aus um den User zu fragen ob er das
|
||||
* möchte.
|
||||
*
|
||||
* @throws PluginException
|
||||
* @throws QueryException
|
||||
*
|
||||
*/
|
||||
private void checkIBANNumber(ItemCollection workitem) throws PluginException {
|
||||
|
||||
String cdtrNumber = workitem.getItemValueString("cdtr.number");
|
||||
String iban = workitem.getItemValueString("cdtr.iban");
|
||||
String bic = workitem.getItemValueString("cdtr.bic");
|
||||
String overtakeIBAN = workitem.getItemValueString("ibanbic.overtake");
|
||||
|
||||
if (cdtrNumber.isEmpty() || iban.isEmpty() || bic.isEmpty()) {
|
||||
// no op
|
||||
return;
|
||||
}
|
||||
|
||||
// wenn bereits eine Überneahme angedroht wurde dann übernehemen!
|
||||
if (!overtakeIBAN.isEmpty()) {
|
||||
kreditorService.addNewIBANBIC(cdtrNumber, iban, bic);
|
||||
workitem.setItemValue("ibanbic.overtake","");
|
||||
return;
|
||||
}
|
||||
|
||||
// search the kreditor
|
||||
ItemCollection cdtr = kreditorService.findCreditor(cdtrNumber);
|
||||
if (cdtr != null) {
|
||||
// Prüfen ob wir die IBAN schon kennen
|
||||
if (iban.equals(cdtr.getItemValueString("cdtr.iban")) && bic.equals(cdtr.getItemValueString("cdtr.bic"))) {
|
||||
return;
|
||||
}
|
||||
if (iban.equals(cdtr.getItemValueString("cdtr.iban2"))
|
||||
&& bic.equals(cdtr.getItemValueString("cdtr.bic2"))) {
|
||||
return;
|
||||
}
|
||||
if (iban.equals(cdtr.getItemValueString("cdtr.iban3"))
|
||||
&& bic.equals(cdtr.getItemValueString("cdtr.bic3"))) {
|
||||
return;
|
||||
}
|
||||
if (iban.equals(cdtr.getItemValueString("cdtr.iban4"))
|
||||
&& bic.equals(cdtr.getItemValueString("cdtr.bic4"))) {
|
||||
return;
|
||||
}
|
||||
// OK - scheinbar ist diese IBAN/BIC nicht bekannt. Also fragen wir mal nach....
|
||||
workitem.setItemValue("ibanbic.overtake", iban + bic);
|
||||
throw new PluginException(InvoicePlugin.class.getName(), ERROR_NEW_IBANBIC,
|
||||
"Die von Ihnen erfasste IBAN/BIC ist noch nicht bekannt. Sollte die Eingabe korrekt sein, wiederholen Sie die Aktion.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Hilfsmethod prüft ob die cdtr.nummer mit einer nummer aus der Cargosoft
|
||||
* Import Datei übereinstimmt.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,144 @@
|
|||
/*******************************************************************************
|
||||
* Imixs Workflow
|
||||
* Copyright (C) 2001, 2011 Imixs Software Solutions GmbH,
|
||||
* http://www.imixs.com
|
||||
*
|
||||
* 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 2
|
||||
* 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 can receive a copy of the GNU General Public
|
||||
* License at http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* Project:
|
||||
* http://www.imixs.org
|
||||
* http://java.net/projects/imixs-workflow
|
||||
*
|
||||
* Contributors:
|
||||
* Imixs Software Solutions GmbH - initial API and implementation
|
||||
* Ralph Soika - Software Developer
|
||||
*******************************************************************************/
|
||||
|
||||
package com.alexanderlogistics;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.annotation.security.DeclareRoles;
|
||||
import javax.annotation.security.RolesAllowed;
|
||||
import javax.annotation.security.RunAs;
|
||||
import javax.ejb.EJB;
|
||||
import javax.ejb.Singleton;
|
||||
|
||||
import org.imixs.workflow.ItemCollection;
|
||||
import org.imixs.workflow.engine.DocumentService;
|
||||
import org.imixs.workflow.exceptions.PluginException;
|
||||
import org.imixs.workflow.exceptions.QueryException;
|
||||
|
||||
/**
|
||||
* Der KreditorService wird verwendet um einen Kreditor zu finden oder neue
|
||||
* IBAN/BIC kombinationen aufzunehmen.
|
||||
*
|
||||
* @author rsoika
|
||||
*
|
||||
*/
|
||||
|
||||
@DeclareRoles({ "org.imixs.ACCESSLEVEL.NOACCESS", "org.imixs.ACCESSLEVEL.READERACCESS",
|
||||
"org.imixs.ACCESSLEVEL.AUTHORACCESS", "org.imixs.ACCESSLEVEL.EDITORACCESS",
|
||||
"org.imixs.ACCESSLEVEL.MANAGERACCESS" })
|
||||
@RolesAllowed({ "org.imixs.ACCESSLEVEL.NOACCESS", "org.imixs.ACCESSLEVEL.READERACCESS",
|
||||
"org.imixs.ACCESSLEVEL.AUTHORACCESS", "org.imixs.ACCESSLEVEL.EDITORACCESS",
|
||||
"org.imixs.ACCESSLEVEL.MANAGERACCESS" })
|
||||
@Singleton
|
||||
@RunAs("org.imixs.ACCESSLEVEL.MANAGERACCESS")
|
||||
public class KreditorService {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static Logger logger = Logger.getLogger(KreditorService.class.getName());
|
||||
|
||||
@EJB
|
||||
DocumentService documentService;
|
||||
|
||||
/**
|
||||
* sucht einen Kreditor
|
||||
*
|
||||
*
|
||||
* @throws PluginException
|
||||
*/
|
||||
public ItemCollection findCreditor(String cdtrNumber) throws PluginException {
|
||||
|
||||
try {
|
||||
String query = "(type:" + CargosoftController.TYPE_CARGOSOFTKREDITOR + ") AND (name:" + cdtrNumber + ")";
|
||||
List<ItemCollection> result = documentService.find(query, 1, 0, "$modified", true);
|
||||
if (result.size() > 0) {
|
||||
return result.get(0);
|
||||
|
||||
}
|
||||
} catch (QueryException e) {
|
||||
throw new PluginException(PluginException.class.getName(), "QUERY ERROR", e.getMessage(), e);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Diese Methode übertragt neue IBAN/BIC kombis in den kreditor
|
||||
*
|
||||
* @param cdtrNumber
|
||||
* @param iban
|
||||
* @param bic
|
||||
* @throws PluginException
|
||||
*/
|
||||
public void addNewIBANBIC(String cdtrNumber, String iban, String bic) throws PluginException {
|
||||
ItemCollection cdtr = findCreditor(cdtrNumber);
|
||||
|
||||
if (cdtr != null) {
|
||||
|
||||
// Wir rotieren die nummern nach unten
|
||||
cdtr.setItemValue("cdtr.iban4", cdtr.getItemValue("cdtr.iban3"));
|
||||
cdtr.setItemValue("cdtr.bic4", cdtr.getItemValue("cdtr.bic3"));
|
||||
cdtr.setItemValue("cdtr.iban3", cdtr.getItemValue("cdtr.iban2"));
|
||||
cdtr.setItemValue("cdtr.bic3", cdtr.getItemValue("cdtr.bic2"));
|
||||
cdtr.setItemValue("cdtr.iban2", cdtr.getItemValue("cdtr.iban"));
|
||||
cdtr.setItemValue("cdtr.bic2", cdtr.getItemValue("cdtr.bic"));
|
||||
// clear slot 0
|
||||
cdtr.setItemValue("cdtr.iban", "");
|
||||
cdtr.setItemValue("cdtr.bic", "");
|
||||
|
||||
// nun können wir die neue IBAN/BIC in die erste frei park position legen
|
||||
if (cdtr.getItemValueString("cdtr.iban").isEmpty()) {
|
||||
cdtr.setItemValue("cdtr.iban", iban);
|
||||
cdtr.setItemValue("cdtr.bic", bic);
|
||||
documentService.save(cdtr);
|
||||
return;
|
||||
}
|
||||
if (cdtr.getItemValueString("cdtr.iban2").isEmpty()) {
|
||||
cdtr.setItemValue("cdtr.iban2", iban);
|
||||
cdtr.setItemValue("cdtr.bic2", bic);
|
||||
documentService.save(cdtr);
|
||||
return;
|
||||
}
|
||||
if (cdtr.getItemValueString("cdtr.iban3").isEmpty()) {
|
||||
cdtr.setItemValue("cdtr.iban3", iban);
|
||||
cdtr.setItemValue("cdtr.bic3", bic);
|
||||
documentService.save(cdtr);
|
||||
return;
|
||||
}
|
||||
if (cdtr.getItemValueString("cdtr.iban4").isEmpty()) {
|
||||
cdtr.setItemValue("cdtr.iban4", iban);
|
||||
cdtr.setItemValue("cdtr.bic4", bic);
|
||||
documentService.save(cdtr);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in a new issue