ubernahme IBAN/BIC bei Partner auswahl

This commit is contained in:
Ralph Soika 2025-08-20 18:58:14 +02:00
parent 03e0ac275f
commit fce3559463
6 changed files with 54 additions and 20 deletions

View file

@ -38,6 +38,7 @@ import org.imixs.workflow.engine.DocumentService;
import org.imixs.workflow.exceptions.AccessDeniedException; import org.imixs.workflow.exceptions.AccessDeniedException;
import org.imixs.workflow.exceptions.QueryException; import org.imixs.workflow.exceptions.QueryException;
import org.imixs.workflow.faces.data.WorkflowEvent; import org.imixs.workflow.faces.data.WorkflowEvent;
import org.imixs.workflow.office.forms.ValidationController;
import jakarta.enterprise.context.ConversationScoped; import jakarta.enterprise.context.ConversationScoped;
import jakarta.enterprise.event.Observes; import jakarta.enterprise.event.Observes;
@ -73,6 +74,9 @@ public class BusinessPartnerController implements Serializable {
@Inject @Inject
BusinessPartnerService businessPartnerService; BusinessPartnerService businessPartnerService;
@Inject
ValidationController validationController;
private List<BusinessPartnerSearchEntry> searchResult = null; private List<BusinessPartnerSearchEntry> searchResult = null;
private static Logger logger = Logger.getLogger(BusinessPartnerController.class.getName()); private static Logger logger = Logger.getLogger(BusinessPartnerController.class.getName());
@ -181,6 +185,14 @@ public class BusinessPartnerController implements Serializable {
return partner; return partner;
} }
/**
* Helper method to disable the form validation during a metadata update
*/
public void disableValidation() {
logger.info("Disable Validation");
validationController.setRequired(false);
}
/** /**
* WorkflowEvent listener resolved additional data. * WorkflowEvent listener resolved additional data.
* *
@ -319,7 +331,7 @@ public class BusinessPartnerController implements Serializable {
} }
/** /**
* This JSF backing method is called by businesspartner_serach.xhtml after the * This JSF backing method is called by businesspartner_search.xhtml after the
* user has selected a new businesspartner. * user has selected a new businesspartner.
* <p> * <p>
* The method lookups the given BusinessPartner and updates the metadata for * The method lookups the given BusinessPartner and updates the metadata for
@ -341,6 +353,18 @@ public class BusinessPartnerController implements Serializable {
workitem.setItemValue("cdtr.name", workitem.setItemValue("cdtr.name",
businessPartner.getItemValueString("partner.name")); businessPartner.getItemValueString("partner.name"));
workitem.setItemValue("cdtr.mail", businessPartner.getItemValue("cdtr.mail")); workitem.setItemValue("cdtr.mail", businessPartner.getItemValue("cdtr.mail"));
// Anforderung Frau Kück vom 20.8.2025
// bei Auswahl eines Kreditors sollen IBAN/BIC mit dem ersten vorhandenen
// IBAN/BIC Kombination
// im Business Partner überschreiben werden falls möglich!
List<ItemCollection> bankList = BusinessPartnerService.getBanks(businessPartner);
if (bankList != null && bankList.size() > 0) {
ItemCollection bank = bankList.get(0);
workitem.setItemValue("cdtr.iban", bank.getItemValueString("iban"));
workitem.setItemValue("cdtr.bic", bank.getItemValueString("bic"));
}
} else } else
// Ausgangsrechnung // Ausgangsrechnung
if (InvoiceUtil.isDebitorInvoice(workitem)) { if (InvoiceUtil.isDebitorInvoice(workitem)) {

View file

@ -8,7 +8,7 @@
This subform provides a search feature for business partners and This subform provides a search feature for business partners and
automatically updates partner.id and partner.name automatically updates partner.id and partner.name
When 'options=rerender' the full form will be refreshed after selection. This is usefull for DebitorAanaylye When 'options=rerender' the full form will be refreshed after selection. This is useful for DebitorAnalyse
Optional the options can also include a regex pattern Optional the options can also include a regex pattern
@ -23,11 +23,12 @@
render="#{businessPartnerController.isRerenderMode(options)?customFormComponents.clientId:''}" /> render="#{businessPartnerController.isRerenderMode(options)?customFormComponents.clientId:''}" />
<h:commandScript name="businsspartnerSearch" action="#{businessPartnerController.search(options)}" <h:commandScript name="businsspartnerSearch" action="#{businessPartnerController.search(options)}"
render="autocomplete-resultlist-businsspartner" onevent="autocompleteShowResult" /> render="autocomplete-resultlist-businsspartner" onevent="autocompleteShowResult" />
<h:commandScript name="disableValidation" action="#{businessPartnerController.disableValidation()}"
immediate="true" />
<h:inputText value="#{workitem.item['partner.id']}" pt:data-item="partner.id" /> <h:inputText value="#{workitem.item['partner.id']}" pt:data-item="partner.id" />
<h:inputHidden value="#{workitem.item['partner.name']}" pt:data-item="partner.name" /> <h:inputHidden value="#{workitem.item['partner.name']}" pt:data-item="partner.name" />
<br /> <br />
<span id='businsspartner-konto-id' class='small'>#{workitem.item['partner.name']}</span> <span id='businsspartner-konto-id' class='small'>#{workitem.item['partner.name']}</span>
<script type="text/javascript"> <script type="text/javascript">
/*<![CDATA[*/ /*<![CDATA[*/
@ -59,6 +60,7 @@
// finally we do a trick and trigger the commandScript updateBPForm which // finally we do a trick and trigger the commandScript updateBPForm which
// refreshes the op section // refreshes the op section
disableValidation();
updateBPForm({ partnerID: kontoData.name }); updateBPForm({ partnerID: kontoData.name });
} }

View file

@ -0,0 +1,8 @@
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
xmlns:marty="http://xmlns.jcp.org/jsf/composite/marty" xmlns:i="http://xmlns.jcp.org/jsf/composite/imixs">
<strong>deprecated input</strong>
</ui:composition>

View file

@ -13,7 +13,6 @@
--> -->
</ui:remove> </ui:remove>
<f:subview id="spacerefinput-view"> <f:subview id="spacerefinput-view">
<ui:param name="default_selection" value="#{options.indexOf('default-selection') ge 0}"></ui:param> <ui:param name="default_selection" value="#{options.indexOf('default-selection') ge 0}"></ui:param>
<ui:param name="space_ref" <ui:param name="space_ref"
@ -28,6 +27,7 @@
<f:selectItem itemLabel="#{space.item['name']}" itemValue="#{space.item['$UniqueID']}"> <f:selectItem itemLabel="#{space.item['name']}" itemValue="#{space.item['$UniqueID']}">
</f:selectItem> </f:selectItem>
</c:forEach> </c:forEach>
<f:ajax render="#{formComponents.clientId}" />
</h:selectOneMenu> </h:selectOneMenu>
</ui:fragment> </ui:fragment>
<ui:fragment rendered="#{readonly}"> <ui:fragment rendered="#{readonly}">

View file

@ -169,10 +169,10 @@ th { font-weight: bold;}
<bpmn2:sequenceFlow id="SequenceFlow_4" sourceRef="StartEvent_1" targetRef="Task_1"> <bpmn2:sequenceFlow id="SequenceFlow_4" sourceRef="StartEvent_1" targetRef="Task_1">
<bpmn2:documentation id="documentation_p6trwA"/> <bpmn2:documentation id="documentation_p6trwA"/>
</bpmn2:sequenceFlow> </bpmn2:sequenceFlow>
<bpmn2:dataObject id="DataObject_1" name="Form"> <bpmn2:dataObject id="DataObject_1" imixs:datatype="form-data" name="Form">
<bpmn2:documentation id="Documentation_17"><![CDATA[<imixs-form> <bpmn2:documentation id="Documentation_17"><![CDATA[<imixs-form>
<imixs-form-section columns="2"> <imixs-form-section columns="2">
<item name="dbtr.number" type="custom" path="alexander/businesspartner_search" required="true" label="Debtor:" options="rerender" /> <item name="partner.id" type="custom" path="alexander/businesspartner_search" required="true" label="Debtor:" options="rerender" />
</imixs-form-section> </imixs-form-section>
<imixs-form-section columns="4" label="Invoices"> <imixs-form-section columns="4" label="Invoices">
@ -339,7 +339,7 @@ th { font-weight: bold;}
<bpmn2:outgoing>sequenceFlow_1K0l0g</bpmn2:outgoing> <bpmn2:outgoing>sequenceFlow_1K0l0g</bpmn2:outgoing>
<bpmn2:incoming>sequenceFlow_LhcuMQ</bpmn2:incoming> <bpmn2:incoming>sequenceFlow_LhcuMQ</bpmn2:incoming>
</bpmn2:intermediateCatchEvent> </bpmn2:intermediateCatchEvent>
<bpmn2:dataObject id="dataObject_00mX6w" name="Form"> <bpmn2:dataObject id="dataObject_00mX6w" imixs:datatype="form-data" name="Form">
<bpmn2:documentation id="documentation_lUG0qw"><![CDATA[<imixs-form> <bpmn2:documentation id="documentation_lUG0qw"><![CDATA[<imixs-form>
<imixs-form-section columns="2"> <imixs-form-section columns="2">
<item name="dbtr.number" type="custom" path="alexander/businesspartner_search" readonly="true" label="Debtor:" /> <item name="dbtr.number" type="custom" path="alexander/businesspartner_search" readonly="true" label="Debtor:" />

View file

@ -358,17 +358,17 @@ Bei Fragen wenden Sie sich bitte an info@imixs.com
</imixs:item> </imixs:item>
<imixs:item name="txtbusinessrule" type="xs:string"> <imixs:item name="txtbusinessrule" type="xs:string">
<imixs:value><![CDATA[var result={}; <imixs:value><![CDATA[var result={};
var refField="space.ref";
result.isValid=true; result.isValid=true;
result.errorMessage=''; result.errorMessage='';
// SEPA ? // SEPA ?
if (workitem['payment.type'][0]!="direct_debit" && workitem['payment.type'][0]!="no_sepa" && workitem['payment.type'][0]!="credit" ) { if (workitem.getItemValueString('payment.type')!="direct_debit" && workitem.getItemValueString('payment.type')!="no_sepa"
if ( workitem['cdtr.iban'][0]=='' || workitem['cdtr.bic'][0]=='' ) { && workitem.getItemValueString('payment.type')!="credit" ) {
if ( workitem.getItemValueString('cdtr.iban')=='' || workitem.getItemValueString('cdtr.bic')=='' ) {
result.isValid=false; result.isValid=false;
result.errorMessage='Please enter a valid IBAN/BIC. '; result.errorMessage='Please enter a valid IBAN/BIC. ';
} }
} }
if ( ( workitem.get(refField) == null || '-'==workitem.get(refField)[0]) ) { if (workitem.getItemValueString('space.ref')==='-') {
result.isValid=false; result.isValid=false;
result.errorMessage=result.errorMessage + 'Please choose a section.'; result.errorMessage=result.errorMessage + 'Please choose a section.';
}]]></imixs:value> }]]></imixs:value>
@ -4078,7 +4078,7 @@ result.isValid=true;
<imixs-form> <imixs-form>
<imixs-form-section columns="2" label="Invoice data"> <imixs-form-section columns="2" label="Invoice data">
<item name="cdtr.name" type="text" readonly="true" label="Vendor:"/> <item name="cdtr.name" type="text" readonly="true" label="Vendor:"/>
<item name="partner.id" type="custom" path="alexander/businesspartner_search" requred="true" label="Vendor number:"/> <item name="partner.id" type="custom" path="alexander/businesspartner_search" requred="true" label="Vendor number1:" options="rerender"/>
</imixs-form-section> </imixs-form-section>
<imixs-form-section columns="3"> <imixs-form-section columns="3">
<item name="invoice.number" type="text" label="Invoice number:" /> <item name="invoice.number" type="text" label="Invoice number:" />
@ -4096,7 +4096,7 @@ result.isValid=true;
<imixs-form-section columns="2"> <imixs-form-section columns="2">
<item name="invoice.period" type="text" required="false" label="Posting period (yyyymm):" /> <item name="invoice.period" type="text" required="false" label="Posting period (yyyymm):" />
<item name="" type="custom" path="alexander/zahlungsart" label="Payment type:"/> <item name="" type="custom" path="alexander/zahlungsart" label="Payment type:"/>
<item name="" type="custom" path="spaceref" label="Section:" required="true" /> <item name="" type="custom" path="alexander/spaceref" label="Section:" required="true" />
<item name="" type="custom" path="alexander/sachbearbeiter" label="Person in charge:" <item name="" type="custom" path="alexander/sachbearbeiter" label="Person in charge:"
hide="#{!teamController.isManagerOf(workflowController.workitem.item['process.ref'])}" /> hide="#{!teamController.isManagerOf(workflowController.workitem.item['process.ref'])}" />
</imixs-form-section> </imixs-form-section>
@ -5764,8 +5764,8 @@ Export erfolgt über eine asynchrone Verarbeitung im Modell 'invoice-export']]><
<bpmndi:BPMNLabel id="BPMNLabel_124"/> <bpmndi:BPMNLabel id="BPMNLabel_124"/>
<di:waypoint x="704.0" y="320.0"/> <di:waypoint x="704.0" y="320.0"/>
<di:waypoint x="704.0" y="359.0"/> <di:waypoint x="704.0" y="359.0"/>
<di:waypoint x="720.0" y="359.0"/> <di:waypoint x="715.0" y="359.0"/>
<di:waypoint x="720.0" y="398.0"/> <di:waypoint x="715.0" y="397.0"/>
</bpmndi:BPMNEdge> </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="SequenceFlow_48" id="BPMNEdge_SequenceFlow_49" sourceElement="BPMNShape_IntermediateCatchEvent_22" targetElement="BPMNShape_IntermediateThrowEvent_3"> <bpmndi:BPMNEdge bpmnElement="SequenceFlow_48" id="BPMNEdge_SequenceFlow_49" sourceElement="BPMNShape_IntermediateCatchEvent_22" targetElement="BPMNShape_IntermediateThrowEvent_3">
<bpmndi:BPMNLabel id="BPMNLabel_127"/> <bpmndi:BPMNLabel id="BPMNLabel_127"/>
@ -6059,8 +6059,8 @@ Export erfolgt über eine asynchrone Verarbeitung im Modell 'invoice-export']]><
</bpmndi:BPMNEdge> </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="Association_8" id="BPMNEdge_Association_8" sourceElement="BPMNShape_DataObject_4" targetElement="BPMNShape_Task_16"> <bpmndi:BPMNEdge bpmnElement="Association_8" id="BPMNEdge_Association_8" sourceElement="BPMNShape_DataObject_4" targetElement="BPMNShape_Task_16">
<bpmndi:BPMNLabel id="BPMNLabel_243"/> <bpmndi:BPMNLabel id="BPMNLabel_243"/>
<di:waypoint x="780.0" y="385.0"/> <di:waypoint x="780.0" y="383.0"/>
<di:waypoint x="749.0" y="385.0"/> <di:waypoint x="749.0" y="383.0"/>
<di:waypoint x="749.0" y="320.0"/> <di:waypoint x="749.0" y="320.0"/>
</bpmndi:BPMNEdge> </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="SequenceFlow_104" id="BPMNEdge_SequenceFlow_105" sourceElement="BPMNShape_IntermediateCatchEvent_60" targetElement="BPMNShape_Task_2"> <bpmndi:BPMNEdge bpmnElement="SequenceFlow_104" id="BPMNEdge_SequenceFlow_105" sourceElement="BPMNShape_IntermediateCatchEvent_60" targetElement="BPMNShape_Task_2">
@ -6087,8 +6087,8 @@ Export erfolgt über eine asynchrone Verarbeitung im Modell 'invoice-export']]><
</bpmndi:BPMNEdge> </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="SequenceFlow_126" id="BPMNEdge_SequenceFlow_127" sourceElement="BPMNShape_IntermediateCatchEvent_5" targetElement="BPMNShape_Task_16"> <bpmndi:BPMNEdge bpmnElement="SequenceFlow_126" id="BPMNEdge_SequenceFlow_127" sourceElement="BPMNShape_IntermediateCatchEvent_5" targetElement="BPMNShape_Task_16">
<bpmndi:BPMNLabel id="BPMNLabel_261"/> <bpmndi:BPMNLabel id="BPMNLabel_261"/>
<di:waypoint x="487.0" y="357.0"/> <di:waypoint x="485.0" y="357.0"/>
<di:waypoint x="487.0" y="337.0"/> <di:waypoint x="485.0" y="337.0"/>
<di:waypoint x="660.0" y="337.0"/> <di:waypoint x="660.0" y="337.0"/>
<di:waypoint x="660.0" y="320.0"/> <di:waypoint x="660.0" y="320.0"/>
</bpmndi:BPMNEdge> </bpmndi:BPMNEdge>