From 244a9eceaf3d24161e9c1f45242c7a77bef55435 Mon Sep 17 00:00:00 2001 From: Benn Oshrin Date: Sat, 24 Apr 2021 19:35:29 -0400 Subject: [PATCH] Fix rematch on Reference ID deletion (CO-2132) --- app/src/Controller/MatchgridRecordsController.php | 2 +- app/src/Lib/Match/MatchService.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/Controller/MatchgridRecordsController.php b/app/src/Controller/MatchgridRecordsController.php index 07abc510e..7d92bd1c4 100644 --- a/app/src/Controller/MatchgridRecordsController.php +++ b/app/src/Controller/MatchgridRecordsController.php @@ -387,7 +387,7 @@ protected function performMatch(MatchService $MatchService, string $sor, string if(!empty($refIds[0])) { $MatchService->attachReferenceId($sor, $sorid, $AttributeManager, (string)$refIds[0]); - $this->Flash->sucess(__('match.rs.refid.matched', [(string)$refIds[0]])); + $this->Flash->success(__('match.rs.refid.matched', [(string)$refIds[0]])); } } else { // Fuzzy match, we insert the record but do NOT send notification diff --git a/app/src/Lib/Match/MatchService.php b/app/src/Lib/Match/MatchService.php index 114808859..1ee5d7f74 100644 --- a/app/src/Lib/Match/MatchService.php +++ b/app/src/Lib/Match/MatchService.php @@ -63,7 +63,9 @@ public function assignReferenceId(string $sor, string $sorid, AttributeManager $ $referenceId = $this->generateReferenceId(); Log::write('debug', $sor . "/" . $sorid . " Generated reference ID for request: " . $referenceId); - $this->insert($sor, $sorid, $attributes, $referenceId); + // We use upsert rather than insert because a forced re-match (by blanking + // out the referenceId via the UI) will rematch on an existing row. + $this->upsert($sor, $sorid, $attributes, $referenceId); return $referenceId; }