Skip to content

Commit

Permalink
Fix OrgIdentity returning duplicates on search (#677)
Browse files Browse the repository at this point in the history
  • Loading branch information
ioigoume authored Jan 8, 2025
1 parent 7be7e93 commit 20d5746
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/Controller/OrgIdentitiesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,9 @@ function paginationConditions() {
$jcnt++;
}

// CO-2882, we need at least the following fields for the View to render properly
$this->paginate['fields'] = $this->OrgIdentity->getPaginateFields();

// We need to manually add this in for some reason. (It should have been
// added automatically by Cake based on the CoPerson Model definition of
// PrimaryName.)
Expand Down
22 changes: 22 additions & 0 deletions app/Model/OrgIdentity.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,18 @@ class OrgIdentity extends AppModel {
// An Org Identity may belong to a CO, if not pooled
"Co"
);

// Select clause for the paginator
private $paginate_fields = array( "DISTINCT OrgIdentity.id",
"PrimaryName.given",
"PrimaryName.family",
"OrgIdentity.title",
"OrgIdentity.affiliation",
"OrgIdentity.o",
"OrgIdentity.ou",
"OrgIdentity.created",
"OrgIdentity.modified"
);

// Default display field for cake generated views
public $displayField = "PrimaryName.family";
Expand Down Expand Up @@ -423,6 +435,16 @@ public function linkableCos($id) {
return $cos;
}

/**
* Get paginator Select clause
*
* @since COmanage Registry v4.4.1
* @return array
*/
public function getPaginateFields() {
return $this->paginate_fields;
}

/**
* Determine the Pipeline this OrgIdentity should be processed using, if any.
* The priority for selecting a Pipeline when multiple are available is the Pipeline
Expand Down

0 comments on commit 20d5746

Please sign in to comment.