Case 2844 - Added proper check for available tickets.

Sorry for autodeleted trailing whitespaces.
Merge branch 'case-2844' into ding2.x

* case-2844:
  Case 2844 - Added proper check for available tickets.