diff --git a/vtlib/Vtiger/Functions.php b/vtlib/Vtiger/Functions.php index 9a2eb9057833b7a82029a8e4eb081e3e56ac0bef..c1fb483dd2e9de5e495d8590735c85ef5486dc4a 100644 --- a/vtlib/Vtiger/Functions.php +++ b/vtlib/Vtiger/Functions.php @@ -1571,11 +1571,11 @@ class Vtiger_Functions { $query = "SELECT attachmentsid FROM vtiger_seattachmentsrel WHERE crmid = ?"; $result = $adb->pquery($query, array($crmid)); $noofrows = $adb->num_rows($result); - if ($adb->num_rows($result) > 1) { + if ($noofrows > 1) { for ($i = 0; $i < $noofrows; $i++) { $attachmentIds[] = vtws_getId($WsEntityId,$adb->query_result($result, $i, 'attachmentsid')); } - } else if($adb->num_rows($result) > 0 && $adb->num_rows($result) == 1){ + } else if($noofrows > 0){ $attachmentIds[] = vtws_getId($WsEntityId, $adb->query_result($result, 0, 'attachmentsid')); } }