CRM-12814, fixed the total issue, code cleanup and notice fixes

----------------------------------------
* CRM-12814: mailings tab slow performance
  http://issues.civicrm.org/jira/browse/CRM-12814
Merge pull request #1285 from kurund/CRM-12814

CRM-12814, fixed the total issue, code cleanup and notice fixes