-$AttachmentObj->Load($Attachment) || Abort(loc("Attachment '[_1]' could not be loaded", $Attachment));
-unless ( $AttachmentObj->id ) {
- Abort(loc("Attachment '[_1]' could not be loaded", $Attachment));
+$AttachmentObj->Load($Attachment);
+
+if ( not $AttachmentObj->id
+ or not $AttachmentObj->TransactionId() == $Transaction ) {
+ $title = loc("Error loading attachment");
+ $error = loc("Attachment '[_1]' could not be loaded", $Attachment);
+}
+elsif ( not $AttachmentObj->TransactionObj->CurrentUserCanSee("Transaction")){
+ $title = loc("Permission Denied");
+ $error = loc("Permission Denied");