bp workflow update

This commit is contained in:
Ralph Soika 2025-09-04 11:29:45 +02:00
parent 8b463d3acb
commit 75ef221181
5 changed files with 2301 additions and 14 deletions

View file

@ -287,6 +287,7 @@ public class BusinessPartnerService {
// phrase = LuceneSearchService.escapeSearchTerm(phrase);
phrase = schemaService.normalizeSearchTerm(phrase);
String sQuery = "(type:\"workitem\" OR type:\"workitemarchive\") AND ($modelversion:businesspartner-*)";
sQuery += " AND NOT ($taskid:1800) ";
// ist nur eine Zahl eingegeben worden?
if (isCargosoftNumber(phrase)) {

View file

@ -158,7 +158,7 @@ public class CargosoftMigrationRestService implements Serializable {
for (ItemCollection cargosoftItemCol : cargosoftDataList) {
totalObjects++;
if (businessPartnerImportService.syncCargosoftCreditorBusinessPartner(cargosoftItemCol) == true) {
if (businessPartnerImportService.syncCargosoftBusinessPartner(cargosoftItemCol) == true) {
updateService.updateIndex();
syncs++;
if (syncs >= maxcount)

View file

@ -122,22 +122,39 @@ public class BusinessPartnerImportService {
if (event == null || event.getDocument() == null) {
return;
}
// run only if we have the model 'businesspartner-*';
if (modelService.findVersionsByRegEx("(businesspartner*)").size() == 0) {
// no business partner workflow found
return;
}
// check source
if (event.getEventType() == DocumentEvent.ON_DOCUMENT_SAVE
&& "cargosoftkreditor".equals(event.getDocument().getType())) {
if ("cargosoftkreditor".equals(event.getDocument().getType())) {
// set NOSNAPSHOT=true fro cargosoft item (migration)
event.getDocument().setItemValue(SnapshotService.NOSNAPSHOT, true);
// run only if we have the model 'businesspartner-*';
if (modelService.findVersionsByRegEx("(businesspartner*)").size() == 0) {
// no business partner workflow found
return;
if (event.getEventType() == DocumentEvent.ON_DOCUMENT_SAVE) {
// set NOSNAPSHOT=true fro cargosoft item (migration)
event.getDocument().setItemValue(SnapshotService.NOSNAPSHOT, true);
logger.fine("Verify business partner object....");
ItemCollection importDoc = event.getDocument();
syncCargosoftBusinessPartner(importDoc);
}
logger.fine("Verify business partner object....");
ItemCollection importDoc = event.getDocument();
syncCargosoftCreditorBusinessPartner(importDoc);
if (event.getEventType() == DocumentEvent.ON_DOCUMENT_DELETE) {
ItemCollection importDoc = event.getDocument();
String cargosoftID = importDoc.getItemValueString("name");
String partnerID = InvoiceUtil.buildBPID(cargosoftID);
ItemCollection businesspartner = lookupBusinessPartner(partnerID);
if (businesspartner != null) {
logger.info("lock business partner object....");
try {
businesspartner.setEventID(80);
workflowService.processWorkItemByNewTransaction(businesspartner);
} catch (AccessDeniedException | ProcessingErrorException | PluginException | ModelException e) {
logger.warning(
"Failed to lock Business Partner Object " + cargosoftID + " - " + e.getMessage());
}
}
}
}
}
@ -156,7 +173,7 @@ public class BusinessPartnerImportService {
*
* @param creditor
*/
public boolean syncCargosoftCreditorBusinessPartner(ItemCollection importDoc) {
public boolean syncCargosoftBusinessPartner(ItemCollection importDoc) {
String cargosoftID = importDoc.getItemValueString("name");
// K bedeutet Kreditor D bedeutet Debitor - beides kann vorkommen
boolean isCreditor = cargosoftID.toUpperCase().startsWith("K");

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff