Verifying german tax number as valid

Our application has German tax numbers in it, which are validated in the A12-Kernel. However, tax numbers can lose their validity when financial offices close, so that their “Bufa” or “Bundesfinanzamt” is no longer valid. With documents still present in our database that now have invalid tax numbers, it is quite a hard problem to resolve. We namely have the general validation turned off (meaning modelled validation only happens in predetermined moments), but kernel validations are still thrown.

Is there a way, that we can have a field designated as a tax number only throw the kernel error when we are deliberately asking for validation of the document?

Hi @jasper-silent-root, I know that during the computation the given values are also checked and if an invalid tax number is found, the error is also reported. Have you already debugged a process for which errors from the Kernel validation are thrown even the general validation is turned off and you did not call the validation explicit?
Otherwise, if you have a property (to identify when you call the validation explicit) which you can access, I could think of custom implementation of ICustomFieldType: if the property is set call SteuernummerVerifier and if not, do nothing.

To your question:

Personally debugged not yet. But without calling for an explicit validation, we attempted to print a document that has a now invalid tax number in it and this fails. Though the field in of itself is read-only in our platform and changing the value happens through a separate window where only valid numbers can be entered, we wouldn’t like to simply put the read-only field to a string, because that would make us lose valuable information when deliberately validating the document: an error that tells us that a number’s validity has expired is still desired.

@jasper-silent-root: My suggestion regarding ICustomFieldType does not work, I mixed it up with ICustomCondition, sorry.
If you change the field to a string, you don’t have to lose the validation, since you could add the rule:
AllFieldsFilled(status, stNr) And [status] == "Not finished" And Invalid(stNr, "Steuernummer").
In this way, you can validate the field depending on the status you have or not.
You can find the documentation about Invalid here.
I will still try to find another solution, but at the moment, this is what I can think of.

Your hint towards “Invalid” was the key for solving my problem. Since all modelled validations are triggered when we want them to, there is no need for the additional “status” in your suggestion.

“FieldFilled(Steuernummer) AND Invalid(Steuernummer, "Steuernummer")” plus setting the field to a String was (with a few minor tweaks in the back-end) sufficient to process a file where the tax number was “bob”, yet we could still collect the error about that tax number being invalid in our validation panel.