Details
-
Type: Bug
-
Status: Open
-
Priority: Major
-
Resolution: Unresolved
-
Affects Version/s: 4.6.18, 4.6.25, 4.7.15
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Versioning Impact:Patch (backwards-compatible bug fixes)
-
Documentation Required?:None
-
Funding Source:Needs Funding
-
Verified?:No
Description
Activities can include custom fields configured to enable user to upload files. We use this functionality extensively both in cases, and in more widely used activity types. However the presentation of those custom fields varies - from not displaying at all to multiple mixed up displays depending on the context. To explain in more detail:
We have a custom field set that includes just two fields, both file fields. This custom field set is used for an activity type that is used within our case management.
If I view the activity when neither of these fields is populated I can see the label for the custom field set and the labels for the two custom fields (this is true when using Civi versions 4.6.18, 4.6.25 and 4.7.15 - I've just gone through an upgrade and tested this issue on all three versions). However if I test this on the current demo site at http://dmaster.demo.civicrm.org (which reports as running 4.7.16) the custom field labels do not display at all (see the attached screendump 'case-activity-view-no-attachments.jpg').
If the fields are populated then viewing the activity on the demo site displays the fields and the linked references to the uploaded files, but displays both linked files on both fields, and on viewing the activity again it displayed repeated file links - very confusing (see attachment 'case-activity-view.jpg'). In my live site tested on 4.6.18, 4.6.25 and now 4.7.15 the view with populated fields is the same as the view with unpopulated fields - i.e. I can see field labels but no file references. If I open the view into a new window rather than using the pop-up then I also see the PHP warnings displayed (see attachment 'live-site-activity-view.jpg'). The warning messages shown are:
Warning: strtolower() expects parameter 1 to be string, array given in CRM_Core_DAO::getFieldValue() (line 1004 of /data/www/html/hcvdrupalv1/sites/all/modules/civicrm/CRM/Core/DAO.php).
Warning: strtolower() expects parameter 1 to be string, array given in CRM_Core_DAO::getFieldValue() (line 1004 of /data/www/html/hcvdrupalv1/sites/all/modules/civicrm/CRM/Core/DAO.php).
(Presumably one warning for each of the custom fields.)
I posted about this issue a while back on the stackexchange site: http://civicrm.stackexchange.com/questions/15961/how-can-i-get-custom-file-fields-in-an-activity-to-display-correctly
When doing the same on the demo site, we get slightly different PHP warnings/notices (see attachment 'view-with-php-warnings.jpg')
If, instead of using the 'view' option to view the activity content, we use the 'edit' option, then on my site and on the demo site I can see the linked file references as expected, and we use this method currently as a workaround for this bug. See the attached file 'case-actitivty-edit-screen.jpg'.
I also looked at how these custom fields behave when in an activity record that is not part of a case is being displayed. The display is different in this case. When viewing the activity record we can see the custom fields, but the link is presented using the file name as stored on the server (see the attachment 'ord-activity-view.jpg'. If I click to edit the activity I can see the file links, but this time they are displayed using the file names as uploaded (see attachment called 'ord-activity-edit-screen.jpg').
Just to be clear, the desired behaviour here (in my opinion) should be that activity records display consistently, regardless of whether they are part of a case or not. Custom field labels, along with any pre or post help text, should be visible when both viewing and editing the activity record. Field contents should be displayed, and displayed consistently, using the file names as uploaded, regardless of whether the activity is being viewed or edited.