Skip to content

Commit

Permalink
Correctly link resource entities in list of assignments
Browse files Browse the repository at this point in the history
  • Loading branch information
jensschuppe committed Jan 6, 2022
1 parent f7db204 commit 8d1e18e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion CRM/Resource/BAO/ResourceDemand.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ public function isFulfilledWithResource($resource, $cached = true, &$error_list
*
* @param $count integer maximal number of resources
*
* @return array list of CRM_Resource_BAO_Resource
* @return CRM_Resource_BAO_Resource[]
* A list of possible resources to fulfill the demand.
*/
public function getResourceCandidates($count)
{
Expand Down
12 changes: 6 additions & 6 deletions CRM/Resource/Form/DemandAssignments.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ public function buildQuickForm()
$display_resources = [];
foreach ($this->assigned_resources as $resource) {
/** @var CRM_Resource_BAO_Resource $resource */
$display_candidate = $resource->toArray();
$display_candidate['id'] = $resource->id;
$display_candidate['field_name'] = "unassign_{$resource->id}";
$display_candidate['meets_demand'] = $this->resource_demand->isFulfilledWithResource($resource);
$display_candidate['paths']['view'] = $candidate->getEntityUrl('view');
$display_resources[] = $display_candidate;
$display_resource = $resource->toArray();
$display_resource['id'] = $resource->id;
$display_resource['field_name'] = "unassign_{$resource->id}";
$display_resource['meets_demand'] = $this->resource_demand->isFulfilledWithResource($resource);
$display_resource['paths']['view'] = $resource->getEntityUrl('view');
$display_resources[] = $display_resource;
}

// assign some stuff
Expand Down
2 changes: 1 addition & 1 deletion templates/CRM/Resource/Form/DemandAssignments.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<tr id="demand-{$resource.id}" class="demand resource-view {if $resource.meets_demand}resource-demand-met{else}resource-demand-not-met{/if}">
{assign var="field_name" value=$resource.field_name}
<td>
<a href="{$candidate.paths.view}">
<a href="{$resource.paths.view}">
{$resource.label} [{$resource.id}]
</a>
</td>
Expand Down

0 comments on commit 8d1e18e

Please sign in to comment.