Skip to content

Fix EnvSource Petiton Preview Render for empty data #301

Merged
merged 1 commit into from Feb 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -70,14 +70,13 @@ public function initialize(): void
*/
public function display(int $petitionId): void
{
$EnvSourceCollectors = $this->fetchTable('EnvSourceCollectors');
$PetitionEnvIdentities = $this->fetchTable('EnvSource.PetitionEnvIdentities');

$this->set('vv_petition_env_identities', $EnvSourceCollectors
->PetitionEnvIdentities
$this->set('vv_petition_env_identities', $PetitionEnvIdentities
->find()
->where(['PetitionEnvIdentities.petition_id' => $petitionId])
->contain(['EnvSourceIdentities'])
->firstOrFail());
->first());

$this->set('vv_step', $this->vv_step);
$this->set('vv_obj', $this->vv_obj);
Expand Down
Expand Up @@ -27,6 +27,13 @@

declare(strict_types = 1);

if (empty($vv_petition_env_identities)) {
print $this->element('emptyPetitionFlowStep', [], [
'cache' => '_html_elements',
]);
return;
}

$env_attributes = json_decode($vv_petition_env_identities->env_source_identity->env_attributes);

?>
Expand Down
3 changes: 3 additions & 0 deletions app/resources/locales/en_US/information.po
Expand Up @@ -150,6 +150,9 @@ msgstr "{0} successfully {1} to {2}"
msgid "record"
msgstr "Record"

msgid "no.records"
msgstr "No Records"

msgid "report.for"
msgstr "Report for "

Expand Down
34 changes: 34 additions & 0 deletions app/templates/element/emptyPetitionFlowStep.php
@@ -0,0 +1,34 @@
<?php
/**
* COmanage Registry Empty Petition Flow Step Element
*
* Portions licensed to the University Corporation for Advanced Internet
* Development, Inc. ("UCAID") under one or more contributor license agreements.
* See the NOTICE file distributed with this work for additional information
* regarding copyright ownership.
*
* UCAID licenses this file to you under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @link https://www.internet2.edu/comanage COmanage Project
* @package registry
* @since COmanage Registry v5.0.0
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/


declare(strict_types = 1);
?>

<ul>
<li><?= __d('information', 'no.records') ?></li>
</ul>