CRM-19551 - Display multiple case activity attachments
authorColeman Watts <coleman@civicrm.org>
Thu, 27 Oct 2016 18:59:53 +0000 (14:59 -0400)
committerColeman Watts <coleman@civicrm.org>
Thu, 27 Oct 2016 20:45:19 +0000 (16:45 -0400)
Conflicts:
CRM/Case/BAO/Case.php

CRM/Case/BAO/Case.php

index e83a961595d68fce3bcb3489aa550c0aa54d6554..f7fc28c68741e6dcb31edda99bbbf1a178a6d81b 100644 (file)
@@ -1313,19 +1313,9 @@ SELECT case_status.label AS case_status, status_id, civicrm_case_type.title AS c
       }
       // if there are file attachments we will return how many and, if only one, add a link to it
       if (!empty($dao->attachment_ids)) {
-        $attachmentIDs = explode(',', $dao->attachment_ids);
+        $attachmentIDs = array_unique(explode(',', $dao->attachment_ids));
         $values[$dao->id]['no_attachments'] = count($attachmentIDs);
-        if ($values[$dao->id]['no_attachments'] == 1) {
-          // if there is only one it's easy to do a link - otherwise just flag it
-          $attachmentViewUrl = CRM_Utils_System::url(
-            "civicrm/file",
-            "reset=1&eid=" . $dao->id . "&id=" . $dao->attachment_ids,
-            FALSE,
-            NULL,
-            FALSE
-          );
-          $url .= " <a href='$attachmentViewUrl' ><span class='icon paper-icon'></span></a>";
-        }
+        $url .= implode(' ', CRM_Core_BAO_File::paperIconAttachment('civicrm_activity', $dao->id));
       }
 
       $values[$dao->id]['links'] = $url;