--fixed for CRM-12498, added condition to check valid contribution statu...

...s change and throw error if invalid

----------------------------------------
* CRM-12498: API contribution.create/update DB Error: constraint violation
  http://issues.civicrm.org/jira/browse/CRM-12498