Skip to content
This repository has been archived by the owner on Feb 26, 2025. It is now read-only.

Commit

Permalink
Issue 623: Search resources with no relationship
Browse files Browse the repository at this point in the history
Currently, resources can be filtered with the following relationship criteria:

 - All: all resources are displayed (child, parent, or no relationship)
 - Parent: only parent resources are displayed
 - Child: only child resources are displayed

This patch adds the following criteria:

 - None: only resources that are neither parent nor child are displayed
   (ie: only resources with no relationship)

Test plan:
 - Perform a search on the resources index page, with 'None' in the Relationship
   dropdown list.
 - Check that only the resources with no relationship are displayed.
  • Loading branch information
veggiematts committed Jan 30, 2020
1 parent 0c60d7a commit 72030f6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
9 changes: 6 additions & 3 deletions resources/admin/classes/domain/Resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -555,9 +555,12 @@ public static function getSearchDetails() {


if ($search['parent'] != null) {
$parentadd = "(" . $search['parent'] . ".relationshipTypeID = 1";
$parentadd .= ")";
$whereAdd[] = $parentadd;
if ($search['parent'] == 'None') {
$parentadd = "(RRP.relationshipTypeID IS NULL AND RRC.relationshipTypeID IS NULL)";
} else {
$parentadd = "(" . $search['parent'] . ".relationshipTypeID = 1)";
}
$whereAdd[] = $parentadd;
}


Expand Down
1 change: 1 addition & 0 deletions resources/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,7 @@
<option value=''><?php echo _("All");?></option>
<option value='RRC'><?php echo _("Parent");?></option>
<option value='RRP'><?php echo _("Child");?></option>
<option value='None'><?php echo _("None");?></option>
</select>
</td>
</tr>
Expand Down

0 comments on commit 72030f6

Please sign in to comment.