Every member of the Police Department shall appear as a witness whenever it is necessary to a prosecution for a violation of a provision of this code or other city ordinance, or of a state or federal law, and may be compensated for the same by the city, if he is not on duty. But no member of the Police Force shall receive any witness fee for such services in any action or suit to which the city is party; all witness fees for such services shall, if paid, be turned over to the City Treasurer.
(`79 Code, § 31.055)