validierung cargosoft creditoren nummer
This commit is contained in:
parent
4fabeed395
commit
8a04c2fa81
2 changed files with 41 additions and 3 deletions
|
|
@ -64,10 +64,10 @@ public class InvoicePlugin extends AbstractPlugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean isPublicEvent = !("0".equals(event.getItemValueString("keypublicresult")));
|
||||||
|
|
||||||
// Payment.type muss immer eingetragne werden!
|
// Payment.type muss immer eingetragne werden!
|
||||||
if (workitem.getTaskID() >= TASK_ERFASSUNG && workitem.getEventID()<900) {
|
if (isPublicEvent && workitem.getTaskID() >= TASK_ERFASSUNG && workitem.getEventID() < 900) {
|
||||||
if (workitem.getItemValueString("payment.type").trim().isEmpty()) {
|
if (workitem.getItemValueString("payment.type").trim().isEmpty()) {
|
||||||
// throw a plugin exception!
|
// throw a plugin exception!
|
||||||
throw new PluginException(InvoicePlugin.class.getName(), ERROR_MISSING_DATA,
|
throw new PluginException(InvoicePlugin.class.getName(), ERROR_MISSING_DATA,
|
||||||
|
|
@ -78,6 +78,11 @@ public class InvoicePlugin extends AbstractPlugin {
|
||||||
|
|
||||||
// Buchungsperiode auf plausi prüfen
|
// Buchungsperiode auf plausi prüfen
|
||||||
validateBuchungsperiode(workitem);
|
validateBuchungsperiode(workitem);
|
||||||
|
|
||||||
|
// Cargosoft Kreditorennnummer prüfen
|
||||||
|
if (workitem.getTaskID() == TASK_ERFASSUNG || workitem.getTaskID() == TASK_SACHPRUEFUNG) {
|
||||||
|
validateCargosoftCdtrNumber(workitem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// die prüfung der positionsnummern und Category erfolgt nur im Status
|
// die prüfung der positionsnummern und Category erfolgt nur im Status
|
||||||
|
|
@ -211,6 +216,34 @@ public class InvoicePlugin extends AbstractPlugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void validateCargosoftCdtrNumber(ItemCollection workitem) throws PluginException {
|
||||||
|
String crdtrNumber = workitem.getItemValueString("cdtr.number");
|
||||||
|
|
||||||
|
// wenn keine Nummer eingegeben wurde gehts weiter!
|
||||||
|
if (crdtrNumber.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// search creditor number in cargosoft...
|
||||||
|
// die cargosoft Kreditornummer beginnt seltsamerweise mit einem K.....
|
||||||
|
try {
|
||||||
|
String query = "(type:cargosoftkreditor) AND (name:K" + crdtrNumber + ")";
|
||||||
|
List<ItemCollection> result = this.getWorkflowService().getDocumentService().find(query, 1, 0);
|
||||||
|
if (result == null || result.size() == 0) {
|
||||||
|
throw new PluginException(InvoicePlugin.class.getName(), ERROR_MISSING_DATA,
|
||||||
|
"Die Kreditorennummer ist nicht gültig.");
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// update cargosoft crediotr name
|
||||||
|
ItemCollection cargo = result.get(0);
|
||||||
|
workitem.setItemValue("cdtr.name.cargosoft", cargo.getItemValueString("_VENDOR_Name"));
|
||||||
|
}
|
||||||
|
} catch (QueryException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* converts the Map List of a workitem into a List of ItemCollectons
|
* converts the Map List of a workitem into a List of ItemCollectons
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,11 @@
|
||||||
autocompleteInitInput(this,cargosoftSearch,'autocomplete-resultlist-cargosoft',selectCdtrCallback);
|
autocompleteInitInput(this,cargosoftSearch,'autocomplete-resultlist-cargosoft',selectCdtrCallback);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// add cargsoft label if available
|
||||||
|
var cdtrName="#{workflowController.workitem.item['cdtr.name.cargosoft']}";
|
||||||
|
//alert(cdtrName);
|
||||||
|
var inputElement=$("input[data-item='cdtr.number']");
|
||||||
|
inputElement.after( "<span id='cdtr-name-id' class='small'>" + cdtrName + "</p>" );
|
||||||
});
|
});
|
||||||
|
|
||||||
// schneide die kreditornnummer aus dem selectierten Text aus (wir brauchen nur die)
|
// schneide die kreditornnummer aus dem selectierten Text aus (wir brauchen nur die)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue