$onlyDeleted = FALSE,
$skipDeleteClause = FALSE
) {
- // the default value which is valid for rhe final AND
+ // the default value which is valid for the final AND
$deleteClause = ' ( 1 ) ';
if (!$skipDeleteClause) {
if (CRM_Core_Permission::check('access deleted contacts') and $onlyDeleted) {
// first see if the contact has edit / view all contacts
if (CRM_Core_Permission::check('edit all contacts') ||
- ($type == self::VIEW &&
- CRM_Core_Permission::check('view all contacts')
- )
+ ($type == self::VIEW && CRM_Core_Permission::check('view all contacts'))
) {
- return $skipDeleteClause ? ' ( 1 ) ' : $deleteClause;
+ return $deleteClause;
}
$user = CRM_Core_Session::getLoggedInContactID();
if ($contactID == NULL) {
- $contactID = $user;
+ $contactID = $user ? $user : 0;
}
- if (!$contactID) {
- // anonymous user
- $contactID = 0;
- }
// Check if contact has permissions on self
- elseif ($contactID == $user) {
+ if ($user && $contactID == $user) {
if (CRM_Core_Permission::check('edit my contact') ||
($type == self::VIEW && CRM_Core_Permission::check('view my contact'))
) {