Skip to content

Commit

Permalink
Fix handling of Update Match Attributes Request (CO-1714)
Browse files Browse the repository at this point in the history
  • Loading branch information
Benn Oshrin committed Feb 27, 2019
1 parent dd06c07 commit ec552bb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions app/src/Lib/Match/MatchService.php
Original file line number Diff line number Diff line change
Expand Up @@ -630,8 +630,15 @@ protected function update(int $rowid, AttributeManager $attributes, string $refe
// We don't update request time
$resolutionTime = ($referenceId ? gmdate('Y-m-d H:i:s') : null);

$attrs = ['referenceid', 'resolution_time'];
$vals = [$referenceId, $resolutionTime];
$attrs = [];
$vals = [];

if($referenceId) {
// If we don't have a referenceId, we're probably updating an existing record
// (Update Match Attributes).
$attrs = ['referenceid', 'resolution_time'];
$vals = [$referenceId, $resolutionTime];
}

// Walk the list of configured attributes and build a list, but only if attributes
// were provided in the request. (eg: Reassign Reference Identifier does not require
Expand Down Expand Up @@ -738,7 +745,7 @@ protected function upsert(string $sor, string $sorid, AttributeManager $attribut
$this->dbc->completeTrans();
}
catch(\Exception $e) {
$dbh->failTrans();
$this->dbc->failTrans();
Log::write('error', $sor . "/" . $sorid . " Upsert error: " . $e->getMessage());
throw new \RuntimeException($e->getMessage());
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/Model/Table/AttributesTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function validationDefault(Validator $validator) {
'length',
[ 'rule' => [ 'maxLength', 128 ] ]
);
$validator->notEmpty('username');
$validator->notEmpty('name');

$validator->add(
'matchgrid_id',
Expand Down

0 comments on commit ec552bb

Please sign in to comment.