CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • PCP Image does not display correct image
Pages: [1]

Author Topic: PCP Image does not display correct image  (Read 824 times)

RachelWright

  • I post occasionally
  • **
  • Posts: 78
  • Karma: 3
  • CiviCRM version: 4.2.7
  • CMS version: Joomla 2.5.17
  • MySQL version: 5.5.37
  • PHP version: 5.4.26
PCP Image does not display correct image
September 26, 2013, 06:34:05 am
As I get more and more PCPs set up by my constituents I've run into an interesting problem. If someone sets up a PCP and decides not to use an image, rather than showing nothing on the page, it will show a file I have uploaded in our backend related to an activity (not a PCP) because the entity_id is the same.

For example, Bob sets up a PCP and his pcp id is 187. The way the databases work, it does into the civicrm_entity_file table and looks for the row with a matching entity_id '187' then it takes that rows file_id in this case let's say '56'. Then it goes to the civicrm_file table and looks for the row with id of '56' and uses whatever file is in that rows URI field.

The problem is, it doesn't take into account that while yes, the entity_id matches the id of the PCP, the entity_table is not 'civicrm_pcp' it's 'civicrm_activity' or a 'custom_field_I_added'.

I've tracked the problem to PCP>Page>PCPInfo.php and I've not gotten anywhere trying to figure out how to add a statement to skip the result if it's not a PCP image. Any suggestions?

Deepak Srivastava

  • Ask me questions
  • ****
  • Posts: 677
  • Karma: 65
Re: PCP Image does not display correct image
September 27, 2013, 12:06:30 am
Able to reproduce this. Filed an issue here - http://issues.civicrm.org/jira/browse/CRM-13459.

One solution would be to use
CRM_Core_BAO_File::getEntityFile() method which takes both the arguments - entity table & id

instead of existing
$file_id = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_EntityFile', $this->_id, 'file_id', 'entity_id')
which takes only entity id as arg.

Thanks.
Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

RachelWright

  • I post occasionally
  • **
  • Posts: 78
  • Karma: 3
  • CiviCRM version: 4.2.7
  • CMS version: Joomla 2.5.17
  • MySQL version: 5.5.37
  • PHP version: 5.4.26
Re: PCP Image does not display correct image
October 07, 2013, 02:49:07 pm
Whew, glad I wasn't the only one!! Thanks for submitting the bug report, all is well now!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • PCP Image does not display correct image

This forum was archived on 2017-11-26.