Skip to content

Commit

Permalink
Fix Envsource Petiton Preview Render for empty data (#301)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ioannis authored Feb 15, 2025
1 parent 26a5f33 commit d966733
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 492 deletions.
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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>
Loading

0 comments on commit d966733

Please sign in to comment.