From c54513edf2e454829b8db3c756b3a9caceee9814 Mon Sep 17 00:00:00 2001 From: Ralph Soika Date: Mon, 21 Feb 2022 16:37:52 +0100 Subject: [PATCH] =?UTF-8?q?zahlungsziel=20verwaltung=20und=20=C3=BCbernahm?= =?UTF-8?q?e=20bei=20Bearbeitung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- office-alexander-logistics-app/pom.xml | 2 +- .../CargosoftController.java | 90 ++++++++++++------ .../layout/commandbox_admin_custom.xhtml | 1 + .../main/webapp/pages/admin/kreditor.xhtml | 93 +++++++++++++++++++ .../alexander/cargsoft-creditor-search.xhtml | 17 +++- .../parts/alexander/datumseingabe_tage.xhtml | 5 +- pom.xml | 2 +- 7 files changed, 176 insertions(+), 34 deletions(-) create mode 100644 office-alexander-logistics-app/src/main/webapp/pages/admin/kreditor.xhtml diff --git a/office-alexander-logistics-app/pom.xml b/office-alexander-logistics-app/pom.xml index 34d206b..2b02130 100644 --- a/office-alexander-logistics-app/pom.xml +++ b/office-alexander-logistics-app/pom.xml @@ -5,7 +5,7 @@ office-alexander-logistics com.alexander-logistics - 1.2.2 + 1.2.3 office-alexander-logistics-app war diff --git a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/CargosoftController.java b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/CargosoftController.java index b1f3b46..b83987a 100644 --- a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/CargosoftController.java +++ b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/CargosoftController.java @@ -15,7 +15,8 @@ import org.imixs.workflow.engine.DocumentService; import org.imixs.workflow.exceptions.QueryException; /** - * The CargosoftController CDI Bean provides Front-End methods for the cargosoft kreditore objects. + * The CargosoftController CDI Bean provides Front-End methods for the cargosoft + * kreditore objects. *

* The method search provides a suggest list searching a phrase within the * cargosoft creditor list (type=cargosoftkreditor). @@ -30,23 +31,26 @@ public class CargosoftController implements Serializable { private static final long serialVersionUID = 1L; private static Logger logger = Logger.getLogger(CargosoftController.class.getName()); - + public static final String TYPE_CARGOSOFTKREDITOR = "cargosoftkreditor"; + @Inject protected DocumentService documentService; - + private List searchResult = null; + private ItemCollection kreditor = null; // used for zahlungsziel (kreidtor.xhtml) /** - * This method searches a text phrase within the list of cargosoft kreditor objects (type=cargosoftkreditor). + * This method searches a text phrase within the list of cargosoft kreditor + * objects (type=cargosoftkreditor). *

* JSF Integration: * * {@code * * } + * "#{cargosoftController.search()}" rendered="#{cargosoftController!=null}" + * render= "cargosoft-results" /> } * *

* JavaScript Example: @@ -64,50 +68,46 @@ public class CargosoftController implements Serializable { // get the param from faces context.... FacesContext fc = FacesContext.getCurrentInstance(); String phrase = fc.getExternalContext().getRequestParameterMap().get("phrase"); - if (phrase==null) { + if (phrase == null) { return; } - + logger.fine("search prase '" + phrase + "'"); - // String input =workflowController.getWorkitem().getItemValueString(itemName); if (phrase == null || phrase.length() < 2) { return; } - // die cargosoft Kreditornummer beginnt seltsamerweise mit einem K + // die cargosoft Kreditornummer beginnt seltsamerweise mit einem K // und die Debitoren mit einem D..... - String query="(type:cargosoftkreditor) AND ( (name:K" + phrase + "*) OR (name:D" + phrase + "*) OR ("+phrase.toLowerCase() + "*) )"; - + String query = "(type:" + TYPE_CARGOSOFTKREDITOR + ") AND ( (name:K" + phrase + "*) OR (name:D" + phrase + + "*) OR (" + phrase.toLowerCase() + "*) )"; + try { List result = documentService.find(query, 20, 0); logger.info("found " + result.size() + " creditors..."); - if (result!=null) { - for (ItemCollection cdtr: result) { - - String cdtrNo=cdtr.getItemValueString("_VENDOR_NUM"); + if (result != null) { + for (ItemCollection cdtr : result) { + + String cdtrNo = cdtr.getItemValueString("_VENDOR_NUM"); // Aenderugn 22. Jun wir geben das K/D direkt witer - // if (cdtrNo.startsWith("K")) { - // wir entfernen das führende K - // cdtrNo=cdtrNo.substring(1); - // } - searchResult.add(cdtrNo + " - "+cdtr.getItemValueString("_VENDOR_Name")); - //logger.finest("...add: " + cdtr.getItemValueString("_VENDOR_NUM") + " - "+cdtr.getItemValueString("_VENDOR_Name")); + // if (cdtrNo.startsWith("K")) { + // wir entfernen das führende K + // cdtrNo=cdtrNo.substring(1); + // } + searchResult.add(cdtrNo + " - " + cdtr.getItemValueString("_VENDOR_Name") + " - " + + cdtr.getItemValueString("cdtr.creditperiod")); + // logger.finest("...add: " + cdtr.getItemValueString("_VENDOR_NUM") + " - + // "+cdtr.getItemValueString("_VENDOR_Name")); } } } catch (QueryException e) { e.printStackTrace(); } - - } - - - - public List getSearchResult() { return searchResult; } @@ -120,4 +120,38 @@ public class CargosoftController implements Serializable { logger.fine("reset"); } + public ItemCollection getKreditor() { + if (kreditor == null) { + kreditor = new ItemCollection(); + } + return kreditor; + } + + public void setKreditor(ItemCollection kreditor) { + this.kreditor = kreditor; + } + + public void updateZahlungsziel() { + + String cdtrNumber = kreditor.getItemValueString("cdtr.number"); + String period = kreditor.getItemValueString("cdtr.creditperiod"); + logger.info("Zahlungsziel = " + cdtrNumber + " / " + period); + + // search workitem + String query = "(type:" + TYPE_CARGOSOFTKREDITOR + ") AND (name:" + cdtrNumber + ")"; + + List result; + try { + result = documentService.find(query, 1, 0); + if (result.size() == 1) { + ItemCollection cargoCreditor = result.get(0); + cargoCreditor.setItemValue("cdtr.creditperiod", Integer.parseInt(period)); + documentService.save(cargoCreditor); + } + } catch (QueryException | NumberFormatException e) { + logger.severe("Unable to find cargosoft kreditor "+e.getMessage()); + } + + } + } diff --git a/office-alexander-logistics-app/src/main/webapp/layout/commandbox_admin_custom.xhtml b/office-alexander-logistics-app/src/main/webapp/layout/commandbox_admin_custom.xhtml index dd84a1e..87112bb 100644 --- a/office-alexander-logistics-app/src/main/webapp/layout/commandbox_admin_custom.xhtml +++ b/office-alexander-logistics-app/src/main/webapp/layout/commandbox_admin_custom.xhtml @@ -7,6 +7,7 @@

  • Dokument Import
  • SEPA
  • Analyse Rechnungseingang
  • +
  • Kreditoren Zahlungsziele
  • diff --git a/office-alexander-logistics-app/src/main/webapp/pages/admin/kreditor.xhtml b/office-alexander-logistics-app/src/main/webapp/pages/admin/kreditor.xhtml new file mode 100644 index 0000000..8bf5140 --- /dev/null +++ b/office-alexander-logistics-app/src/main/webapp/pages/admin/kreditor.xhtml @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + +
    +
    +

    + +

    +
    + + + + + +
    + +
    +
    + +
    +
    Kreditor:
    + +
    + +
    +
    + +
    + + +
    +
    Zahlungsziel:
    +
    Tage
    +
    + +
    +
    + + + +
    + + + + +
    +
    + + + + +
    +
    + + + +
    + diff --git a/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/cargsoft-creditor-search.xhtml b/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/cargsoft-creditor-search.xhtml index ee1346d..1881c63 100644 --- a/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/cargsoft-creditor-search.xhtml +++ b/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/cargsoft-creditor-search.xhtml @@ -23,7 +23,7 @@ --> - + diff --git a/office-alexander-logistics-app/src/main/webapp/pages/workitems/parts/alexander/datumseingabe_tage.xhtml b/office-alexander-logistics-app/src/main/webapp/pages/workitems/parts/alexander/datumseingabe_tage.xhtml index 0bdac7d..63be7e3 100644 --- a/office-alexander-logistics-app/src/main/webapp/pages/workitems/parts/alexander/datumseingabe_tage.xhtml +++ b/office-alexander-logistics-app/src/main/webapp/pages/workitems/parts/alexander/datumseingabe_tage.xhtml @@ -3,13 +3,14 @@ xmlns:f="http://xmlns.jcp.org/jsf/core" xmlns:c="http://xmlns.jcp.org/jsp/jstl/core" xmlns:h="http://xmlns.jcp.org/jsf/html" + xmlns:pt="http://xmlns.jcp.org/jsf/passthrough" xmlns:marty="http://xmlns.jcp.org/jsf/composite/marty"> - - + 4.0.0 com.alexander-logistics office-alexander-logistics - 1.2.2 + 1.2.3 pom Imixs Office Workflow - Custom Build