From 7f8967a25b3d5a60f315c95774c3947d7c3f5324 Mon Sep 17 00:00:00 2001 From: miqrogroove <1371835+miqrogroove@users.noreply.github.com> Date: Wed, 4 Sep 2024 21:15:35 -0400 Subject: [PATCH] Fixed wrong table reference Fixes #115 By calling `getRepresentationRelationshipTableName` with a representation, the script was looking for a representation x representation relationship. This is wrong. The related object needs to be passed instead. --- app/helpers/displayHelpers.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/displayHelpers.php b/app/helpers/displayHelpers.php index 4473d9419c..ea28e7cb39 100644 --- a/app/helpers/displayHelpers.php +++ b/app/helpers/displayHelpers.php @@ -4296,7 +4296,7 @@ function caRepresentationViewer($po_request, $po_data, $pt_subject, $pa_options= $vn_index = null; if($vn_rep_id == $vn_primary_id){ $vn_index = 0; - }elseif (!($vn_index = (int)$qr_reps->get(RepresentableBaseModel::getRepresentationRelationshipTableName($qr_reps->tableName()).'.rank'))) { + }elseif (!($vn_index = (int)$qr_reps->get(RepresentableBaseModel::getRepresentationRelationshipTableName($pt_subject->tableName()).'.rank'))) { $vn_index = $qr_reps->get('ca_object_representations.representation_id'); } $va_rep_info[$vn_index] = array("rep_id" => $vn_rep_id, "tag" => $va_rep_tags[$vn_rep_id]);