An alarm company may not bring or maintain a court action to collect compensation for work requiring a license under this chapter unless the alarm company alleges and proves that the alarm company held the required license:
(1) when entering into the contract; and
(2) when the cause of action arose.