mecachisenros / cf-civicrm

Caldera Forms CiviCRM Integration
GNU Affero General Public License v3.0
30 stars 26 forks source link

Uploaded Image through Caldera Form for CiviCRM cannot be previewed #64

Closed clement888 closed 6 years ago

clement888 commented 6 years ago

Hello there,

I was trying out the file upload field of caldera form for civicrm to upload a image. the result was that the preview image cannot be shown in the summary/preview of image but is displayed properly when the contact is being edited.  i checked the image URL for both the preview and during edit, and apparantly they are different:

Preview URL: (broken) https://www.example.com/civicrm?page=CiviCRM&q=civicrm/file&reset=1&id=18&eid=62

Image URL: (OK) https://www.example.com/wp-admin/admin.php?page=CiviCRM&q=civicrm/file&reset=1&id=19&eid=62

any advise on how this can be corrected? Thanks.

mecachisenros commented 6 years ago

@clement888 could you upload an export of the form here (in json format) and specify your WP, CiviCRM, Caldera Forms (CF), and Caldera Forms CiviCRM (CFC) integration versions?

It's difficult to tell what it's going on and where to look, ie. is this a custom field or a core field, and on what entity (Activity, Contact, Note)?

clement888 commented 6 years ago

Hello,

Thanks for your help. I have included the json file below.

The field used here is a custom field for files within a contact. the versions of the relevant software are:

Wordpress - 4.9.5 Civicrm - 4.7.29 Caldera Form - 1.5.9.1 Caldera for Civicrm - 0.4.2

After uploading, the image is shown like this in the contact summary:

but if i set to edit for the custom field, it becomes correct:

Thanks for your help!

Clement

On 19 Apr 2018, at 9:06 PM, Andrei Mondoc notifications@github.com wrote:

@clement888 https://github.com/clement888 could you upload an export of the form here (in json format) and specify your WP, CiviCRM, Caldera Forms (CF), and Caldera Forms CiviCRM (CFC) integration versions?

It's difficult to tell what it's going on and where to look, ie. is this a custom field or a core field, and on what entity (Activity, Contact, Note)?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mecachisenros/caldera-forms-civicrm/issues/64#issuecomment-382727461, or mute the thread https://github.com/notifications/unsubscribe-auth/AjYNvD0i3Tx1dly5M23ll0bmW-tBS9hzks5tqIvtgaJpZM4TZZDs.

mecachisenros commented 6 years ago

@clement888 looks like when commenting from email, github doesn't process attachments and images , see below: capture

clement888 commented 6 years ago

Hello there,

just to follow up on this issue, i have looked at the link to the uploaded file for both views are different.

I have uploaded a image file to be part of the record through Caldera form and tested to see whether there links to the image file is the same.

The broken link in the Summary View is:

https://1234.churchsys.info/civicrm?page=CiviCRM&q=civicrm/file&reset=1&id=22&eid=503

but the file is rendered properly when we edit the field and the image file’s location is this:

https://1234.churchsys.info/wp-admin/admin.php?page=CiviCRM&q=civicrm/file&reset=1&id=23&eid=503

Can you advise ? Thanks.

Clement

On 20 Apr 2018, at 5:06 PM, Andrei Mondoc notifications@github.com wrote:

@clement888 https://github.com/clement888 looks like when commenting from email, attachments and github doesn't process them, see below: https://user-images.githubusercontent.com/3038096/39042297-5f47112e-4482-11e8-8472-311065b92792.JPG — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mecachisenros/caldera-forms-civicrm/issues/64#issuecomment-383034793, or mute the thread https://github.com/notifications/unsubscribe-auth/AjYNvJ3HubTmAoLArJX3EGojqyXW3An5ks5tqaT-gaJpZM4TZZDs.

kcristiano commented 6 years ago

@mecachisenros Have you had a chance to look at this? I expect the file is getting the front end URL as it's being uploaded on the front end Can we store the relative path and let CiviCRM determine how to display?

mecachisenros commented 6 years ago

@kcristiano are you able to reproduce this? I haven't been able to, the URL in the form entry summary is the front end url, unless I'm misunderstanding something.

kcristiano commented 6 years ago

@mecachisenros yes I can reproduce. I'll send you a site you can see this on

mecachisenros commented 6 years ago

Right, Summary view == Contact Summary!

I'll review and report back, I thought this was referring to the Summary in CF's Entry viewer.

mecachisenros commented 6 years ago

This should be fixed via aea6aa25848472d3611189762f2d5930f70fb8ff.

mecachisenros commented 6 years ago

@clement888 this should be fixed on master branch, but as per current Civi version (5.6) there's still an underlying issue where custom Civi File fields are created twice when submitted through CFC, the issue has been addressed in this PR, so I suggest you apply the patch to your Civi instance and pull/download latest master branch.

clement888 commented 6 years ago

Hello Andrei,

thanks for following up with this. i have upgraded 0.4.4 onto my CIVICRM 5.3.2 on Wordpress and it works. uploaded files thru caldera forms now render properly in the contact summary. thanks again.

i read the other issue you mentioned on file fields being created twice above, what would be the impact if i do not upgrade civicrm to 5.6 ? thanks.

clement

mecachisenros commented 6 years ago

@clement888 the impact would be that each File uploaded through CFC will be duplicated (two entries in civicrm_file and civicrm_entity_file tables, and two files in the upload folder). So if you don't mind that...

By the way, I believe the patch will make it into CiviCRM 5.8 so version 5.6/5.7 are still affected.

You could apply the patch to your current install without upgrading Civi, as per this StackExchange answer:

cd path/to/civicrm
wget https://github.com/civicrm/civicrm-core/pull/12931.diff
patch -p1 < 12931.diff
rm 12931.diff 

12931 being the PR I referenced above.