Skip to content

Commit

Permalink
Afform: Fix syntax for saving reciprocal relationships
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwire committed Feb 18, 2023
1 parent f53f3b2 commit 8d97ee4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ext/afform/core/Civi/Api4/Action/Afform/Submit.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,11 @@ public static function processRelationships(AfformSubmitEvent $event) {
];
// Reciprocal relationship types need an extra check
if ($isReciprocal) {
$where[] = ['OR',
['AND', ['contact_id_a', '=', $contact_id_a], ['contact_id_b', '=', $contact_id_b]],
['AND', ['contact_id_a', '=', $contact_id_b], ['contact_id_b', '=', $contact_id_a]],
$where[] = [
'OR', [
['AND', [['contact_id_a', '=', $contact_id_a], ['contact_id_b', '=', $contact_id_b]]],
['AND', [['contact_id_a', '=', $contact_id_b], ['contact_id_b', '=', $contact_id_a]]],
]
];
}
else {
Expand Down

0 comments on commit 8d97ee4

Please sign in to comment.