Fatal error: Call to undefined method CRM_Contribute_Task::taskTitles()
Sudesh,

I am not sure if you are using right CiviCRM version. As I can see on 4.7.31 the function does exists and the line number you pointed in your question i.e 163 is showing me different code.

Please make sure your code base is using 4.7.31 version and since you are using older version of CiviCRM, I would recommend you to upgrade atleast to 5.3.1 because of security issues.