Skip to content

Commit

Permalink
Fix attribute conflict.Fix BasicAttributesCollector dispaly.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ioannis committed Feb 5, 2025
1 parent f80f43f commit 3f13002
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,23 +121,4 @@ public function dispatch(string $id) {

$this->render('/Standard/dispatch');
}

/**
* Display information about this Step.
*
* @since COmanage Registry v5.1.0
* @param string $id Attribute Collector ID
*/

public function display(string $id): void {
$petition = $this->getPetition();

$this->set('vv_petition_attributes',
$this->AttributeCollectors
->EnrollmentAttributes
->PetitionAttributes
->find()
->where(['petition_id' => $petition->id])
->all());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,21 +87,4 @@ public function dispatch(string $id) {

$this->render('/Standard/dispatch');
}

/**
* Display information about this Step.
*
* @since COmanage Registry v5.1.0
* @param string $id Attribute Collector ID
*/

public function display(string $id) {
$petition = $this->getPetition();

$this->set('vv_petition_basic_attribute_set', $this->BasicAttributeCollectors
->PetitionBasicAttributeSets
->find()
->where(['PetitionBasicAttributeSets.petition_id' => $petition->id])
->firstOrFail());
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*
* COmanage Registry Enrollment Flow Step
/**
* COmanage Registry Basic Attribute Collector Set
*
* Portions licensed to the University Corporation for Advanced Internet
* Development, Inc. ("UCAID") under one or more contributor license agreements.
Expand All @@ -23,18 +23,25 @@
* @package registry
* @since COmanage Registry v5.1.0
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*
* This generic modal dialog stub is used for confirmations, e.g. when deleting a record.
* The text of the box is overridden with JavaScript, and the confirm button is intended to
* click a CakePHP postLink or postButton in the DOM. Use jsConfirmGeneric() to call it.
*/

declare(strict_types = 1);
declare(strict_types = 1);

if($vv_obj->id === null) {
return __d('error', 'notfound', 'Petition Attributes');
}

$parsePluginName = explode('.', $vv_step->plugin);
$modelName = array_pop($parsePluginName);
$elementName = lcfirst($modelName) . 'Step';
$tableObj = $this->Petition->getTable('PetitionBasicAttributeSets');
$vv_petition_basic_attribute_set = $tableObj->find()
->where(['PetitionBasicAttributeSets.petition_id' => $vv_obj->id])
->firstOrFail();
?>

// The convention is that the element name for each step is the name of the EnrollmentFlow Step model followed by
// the word Step
print $this->element("petition/enrollmentFlowSteps/$elementName", ['vv_step' => $vv_step]);
<ul>
<li>Honorific: <?= $vv_petition_basic_attribute_set['honorific'] ?? "" ?></li>
<li>Given: <?= $vv_petition_basic_attribute_set['given'] ?? "" ?></li>
<li>Middle: <?= $vv_petition_basic_attribute_set['middle'] ?? "" ?></li>
<li>Family: <?= $vv_petition_basic_attribute_set['family'] ?? "" ?></li>
<li>Suffix: <?= $vv_petition_basic_attribute_set['suffix'] ?? "" ?></li>
<li>Email: <?= $vv_petition_basic_attribute_set['mail'] ?? "" ?></li>
</ul>
2 changes: 1 addition & 1 deletion app/src/Model/Table/PetitionsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function initialize(array $config): void {
$this->hasMany('PetitionStepResults')
->setDependent(true)
->setCascadeCallbacks(true);
$this->hasMany('PetitionAttributes')
$this->hasMany('CoreEnroller.PetitionAttributes')
->setDependent(true)
->setCascadeCallbacks(true);

Expand Down
2 changes: 1 addition & 1 deletion app/src/View/Helper/PetitionHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function populateAutoViewVars(): void
}

/**
* Get the table validation rules
* Get reference to the Table Object
*
* @param string $tableName
*
Expand Down
11 changes: 7 additions & 4 deletions app/templates/Petitions/fields.inc
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,13 @@ if (!empty($vv_obj?->petitioner_person?->id)) {
</div>
</li>
<li id="collapse-box-<?= $step->id ?>" class="petition-attrs collapse">
<h3>
<?= __d('menu', 'co.attributes') ?>
</h3>
<?= $this->element('petition/enrollmentFlowStep', ['vv_step' => $step])?>
<h3><?= $step->plugin ?></h3>
<?php
[$pluginName, $pluginClass] = explode('.', $step->plugin);
$elementName = lcfirst($pluginClass) . 'Step';

print $this->element("$pluginName.petition/$elementName", ['vv_step' => $step]);
?>
</li>
<?php endforeach; ?>

Expand Down

0 comments on commit 3f13002

Please sign in to comment.