Add return item eligibility validator and associated state machine updates. Add a column to persist state transition errors
Fixes #5089
Fix syntax error.