mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge branch 'new_protocol' of ssh://**REDACTED**/~/php/cakePHP/gradido_community_server into new_protocol
This commit is contained in:
commit
730f44c61b
@ -63,7 +63,7 @@ class JsonRpcRequestClientComponent extends Component
|
||||
//$responseType = $response->getType();
|
||||
return ['state' => 'error', 'type' => 'request error', 'msg' => 'server response isn\'t valid json'];
|
||||
}
|
||||
return $json;
|
||||
return $json['result'];
|
||||
//return ['state' => 'success', 'data' => $json];
|
||||
}
|
||||
|
||||
|
||||
@ -80,12 +80,18 @@ class JsonRequestHandlerController extends AppController {
|
||||
if(!$last_transaction_query->isEmpty()) {
|
||||
$last_transaction_id = $last_transaction_query->first()->id;
|
||||
}
|
||||
if($last_transaction_query->count() < $last_transaction_id) {
|
||||
$last_transaction_id = $last_transaction_query->count();
|
||||
}
|
||||
|
||||
$group_alias = Configure::read('GroupAlias');
|
||||
$result = (array)$this->JsonRpcRequestClient->request('getTransactions', ['groupAlias' => $group_alias, 'lastKnownSequenceNumber' => $last_transaction_id]);
|
||||
$result = $this->JsonRpcRequestClient->request('getTransactions', ['groupAlias' => $group_alias, 'lastKnownSequenceNumber' => $last_transaction_id]);
|
||||
if(isset($result['state']) && $result['state'] == 'error') {
|
||||
return $this->returnJson(['state' => 'error', 'msg' => 'jsonrpc error', 'details' => $result]);
|
||||
}
|
||||
if(!isset($result['transaction_count']) || $result['transaction_count'] == 0) {
|
||||
return $this->returnJson(['state' => 'success']);
|
||||
}
|
||||
/* example
|
||||
$result = json_decode("[
|
||||
{
|
||||
@ -222,7 +228,12 @@ class JsonRequestHandlerController extends AppController {
|
||||
$part_count = -1;
|
||||
$temp_record = new Record;
|
||||
$errors = [];
|
||||
foreach($result as $_record) {
|
||||
|
||||
foreach($result['blocks'] as $_record) {
|
||||
if(is_string($_record)) {
|
||||
// if it is a string, it is block validation hash in hex
|
||||
continue;
|
||||
}
|
||||
$parse_result = $temp_record->parseRecord($_record);
|
||||
if($parse_result == true) {
|
||||
$sequenceNumber = $temp_record->getSequenceNumber();
|
||||
|
||||
@ -20,7 +20,7 @@ class StateGroupAddressesController extends AppController
|
||||
public function index()
|
||||
{
|
||||
$this->paginate = [
|
||||
'contain' => ['StateGroups', 'AddressTypes']
|
||||
'contain' => ['AddressTypes'],
|
||||
];
|
||||
$stateGroupAddresses = $this->paginate($this->StateGroupAddresses);
|
||||
|
||||
@ -37,7 +37,7 @@ class StateGroupAddressesController extends AppController
|
||||
public function view($id = null)
|
||||
{
|
||||
$stateGroupAddress = $this->StateGroupAddresses->get($id, [
|
||||
'contain' => ['StateGroups', 'AddressTypes']
|
||||
'contain' => ['StateGroups', 'AddressTypes'],
|
||||
]);
|
||||
|
||||
$this->set('stateGroupAddress', $stateGroupAddress);
|
||||
@ -75,7 +75,7 @@ class StateGroupAddressesController extends AppController
|
||||
public function edit($id = null)
|
||||
{
|
||||
$stateGroupAddress = $this->StateGroupAddresses->get($id, [
|
||||
'contain' => []
|
||||
'contain' => [],
|
||||
]);
|
||||
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||
$stateGroupAddress = $this->StateGroupAddresses->patchEntity($stateGroupAddress, $this->request->getData());
|
||||
|
||||
@ -7,7 +7,7 @@ use Cake\ORM\Entity;
|
||||
* StateGroupAddress Entity
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $state_group_id
|
||||
* @property int $group_id
|
||||
* @property string|resource $public_key
|
||||
* @property int $address_type_id
|
||||
*
|
||||
@ -26,10 +26,10 @@ class StateGroupAddress extends Entity
|
||||
* @var array
|
||||
*/
|
||||
protected $_accessible = [
|
||||
'state_group_id' => true,
|
||||
'group_id' => true,
|
||||
'public_key' => true,
|
||||
'address_type_id' => true,
|
||||
'state_group' => true,
|
||||
'address_type' => true
|
||||
'address_type' => true,
|
||||
];
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ use Cake\Validation\Validator;
|
||||
/**
|
||||
* StateGroupAddresses Model
|
||||
*
|
||||
* @property \App\Model\Table\StateGroupsTable&\Cake\ORM\Association\BelongsTo $StateGroups
|
||||
* @property &\Cake\ORM\Association\BelongsTo $Groups
|
||||
* @property \App\Model\Table\AddressTypesTable&\Cake\ORM\Association\BelongsTo $AddressTypes
|
||||
*
|
||||
* @method \App\Model\Entity\StateGroupAddress get($primaryKey, $options = [])
|
||||
@ -37,13 +37,13 @@ class StateGroupAddressesTable extends Table
|
||||
$this->setDisplayField('id');
|
||||
$this->setPrimaryKey('id');
|
||||
|
||||
$this->belongsTo('StateGroups', [
|
||||
'foreignKey' => 'state_group_id',
|
||||
'joinType' => 'INNER'
|
||||
]);
|
||||
/*$this->belongsTo('Groups', [
|
||||
'foreignKey' => 'group_id',
|
||||
'joinType' => 'INNER',
|
||||
]);*/
|
||||
$this->belongsTo('AddressTypes', [
|
||||
'foreignKey' => 'address_type_id',
|
||||
'joinType' => 'INNER'
|
||||
'joinType' => 'INNER',
|
||||
]);
|
||||
}
|
||||
|
||||
@ -56,12 +56,13 @@ class StateGroupAddressesTable extends Table
|
||||
public function validationDefault(Validator $validator)
|
||||
{
|
||||
$validator
|
||||
->integer('id')
|
||||
->nonNegativeInteger('id')
|
||||
->allowEmptyString('id', null, 'create');
|
||||
|
||||
$validator
|
||||
->requirePresence('public_key', 'create')
|
||||
->notEmptyString('public_key');
|
||||
->notEmptyString('public_key')
|
||||
->add('public_key', 'unique', ['rule' => 'validateUnique', 'provider' => 'table']);
|
||||
|
||||
return $validator;
|
||||
}
|
||||
@ -75,7 +76,8 @@ class StateGroupAddressesTable extends Table
|
||||
*/
|
||||
public function buildRules(RulesChecker $rules)
|
||||
{
|
||||
$rules->add($rules->existsIn(['state_group_id'], 'StateGroups'));
|
||||
$rules->add($rules->isUnique(['public_key']));
|
||||
//$rules->add($rules->existsIn(['group_id'], 'Groups'));
|
||||
$rules->add($rules->existsIn(['address_type_id'], 'AddressTypes'));
|
||||
|
||||
return $rules;
|
||||
|
||||
@ -61,16 +61,36 @@ class GradidoModifieUserBalance
|
||||
|
||||
public function getUserId($userPublicKey)
|
||||
{
|
||||
$userPublicBin = hex2bin($userPublicKey);
|
||||
$stateUsersTable = TableRegistry::getTableLocator()->get('StateUsers');
|
||||
|
||||
// hack for pauls public key format with many FF instead of the real values
|
||||
$stateUsers = $stateUsersTable->find('all')->select(['id', 'public_key']);
|
||||
$debug_user_publics = [];
|
||||
foreach($stateUsers as $user) {
|
||||
$user_public = stream_get_contents($user->public_key);
|
||||
$debug_user_publics[] = bin2hex($user_public);
|
||||
if(($user_public & $userPublicBin) == $user_public) {
|
||||
array_push($this->state_users, (int)$user->id);
|
||||
return $user->id;
|
||||
}
|
||||
}
|
||||
return [
|
||||
'state' => 'error',
|
||||
'msg' => '[GradidoModifieUserBalance::getUserId] couldn\'t find user via public key binary &',
|
||||
'details' => ['input public' => $userPublicKey, 'user publics' => $debug_user_publics]
|
||||
];
|
||||
// hack end
|
||||
|
||||
$stateUser = $stateUsersTable->find('all')->where(['public_key' => hex2bin($userPublicKey)]);
|
||||
if($stateUser->isEmpty()) {
|
||||
return ['state' => 'error', 'msg' => 'couldn\'t find user via public key'];
|
||||
return ['state' => 'error', 'msg' => '[GradidoModifieUserBalance::getUserId] couldn\'t find user via public key'];
|
||||
}
|
||||
$id = $stateUser->first()->id;
|
||||
if($id && is_int($id) && (int)$id > 0 && !in_array((int)$id, $this->state_users)) {
|
||||
array_push($this->state_users, (int)$id);
|
||||
}
|
||||
return $stateUser->first()->id;
|
||||
return $id;
|
||||
}
|
||||
|
||||
public function updateBalance($newBalance, $recordDate, $userId)
|
||||
@ -138,6 +158,9 @@ class ManageNodeGroupAdd extends GradidoModifieUserBalance
|
||||
$transactionGroupAddadressTable = TableRegistry::getTableLocator()->get('TransactionGroupAddaddress');
|
||||
$stateGroupAddresses = TableRegistry::getTableLocator()->get('StateGroupAddresses');
|
||||
$transactionGroupEntity = $transactionGroupAddadressTable->newEntity();
|
||||
if(!is_int($transactionId)) {
|
||||
return ['state' => 'error', 'msg' => '[ManageNodeGroupAdd::finalize] transaction id is not int', 'details' => $transactionId];
|
||||
}
|
||||
$transactionGroupEntity->transaction_id = $transactionId;
|
||||
$transactionGroupEntity->address_type_id = 1;
|
||||
if(strlen($this->user_pubkey) != 64) {
|
||||
@ -147,13 +170,19 @@ class ManageNodeGroupAdd extends GradidoModifieUserBalance
|
||||
return ['state' => 'error', 'msg' => 'user_pubkey isn\'t in hex format'];
|
||||
}
|
||||
|
||||
$transactionGroupEntity->public_key = hex2bin($this->user_pubkey);
|
||||
$transactionGroupEntity->state_user_id = $this->getUserId($this->user_pubkey);
|
||||
$userPubkeyBin = hex2bin($this->user_pubkey);
|
||||
|
||||
$transactionGroupEntity->public_key = $userPubkeyBin;
|
||||
$user_id = $this->getUserId($this->user_pubkey);
|
||||
if(!is_int($user_id)) {
|
||||
return ['state' => 'error', 'msg' => '[ManageNodeGroupAdd::finalize] user id is not int', 'details' => $user_id];
|
||||
}
|
||||
$transactionGroupEntity->state_user_id = $user_id;
|
||||
$transactionGroupEntity->remove_from_group = $this->remove_from_group;
|
||||
if(!$transactionGroupAddadressTable->save($transactionGroupEntity)) {
|
||||
return ['state' => 'error', 'msg' => 'error saving TransactionGroupAddaddress Entity', 'details' => $transactionGroupEntity->getErrors()];
|
||||
}
|
||||
$userPubkeyBin = hex2bin($this->user_pubkey);
|
||||
|
||||
|
||||
if($this->remove_from_group) {
|
||||
$stateGroup_query = $stateGroupAddresses->find('all')->where(['public_key' => hex2bin($this->user_pubkey)]);
|
||||
@ -351,6 +380,9 @@ class Record
|
||||
|
||||
|
||||
public function parseRecord($json) {
|
||||
if(!isset($json['record_type'])) {
|
||||
return false;
|
||||
}
|
||||
//var_dump($json);
|
||||
switch($json['record_type']) {
|
||||
case 'GRADIDO_TRANSACTION':
|
||||
@ -373,75 +405,77 @@ class Record
|
||||
*/
|
||||
public function finalize()
|
||||
{
|
||||
$transactionTypesTable = TableRegistry::getTableLocator()->get('TransactionTypes');
|
||||
$transactionsTable = TableRegistry::getTableLocator()->get('Transactions');
|
||||
$stateUserTransactionsTable = TableRegistry::getTableLocator()->get('StateUserTransactions');
|
||||
|
||||
$transactionTypeName = $this->nodeTransactionTypeToDBTransactionType($this->transactionType);
|
||||
$transactionTypeResults = $transactionTypesTable->find('all')->where(['name' => $transactionTypeName]);
|
||||
if($transactionTypeResults->isEmpty()) {
|
||||
return [
|
||||
'state' => 'error', 'msg' => 'transaction type not found',
|
||||
'details' => ['nodeType' => $this->transactionType, 'dbType' => $transactionTypeName]
|
||||
];
|
||||
}
|
||||
if(!$this->transactionObj) {
|
||||
return ['state' => 'error', 'msg' => 'transaction obj is null'];
|
||||
}
|
||||
if($this->sequenceNumber <= 0) {
|
||||
return ['state' => 'error', 'msg' => 'sequence number invalid', 'details' => $this->sequenceNumber];
|
||||
}
|
||||
$transactionExistResult = $transactionsTable->find('all')->where(['id' => $this->sequenceNumber]);
|
||||
if(!$transactionExistResult->isEmpty()) {
|
||||
return ['state' => 'warning', 'msg' => 'transaction already exist in db', 'details' => $this->sequenceNumber];
|
||||
}
|
||||
$newTransaction = $transactionsTable->newEntity();
|
||||
$newTransaction->id = $this->sequenceNumber;
|
||||
$newTransaction->transaction_type_id = $transactionTypeResults->first()->id;
|
||||
$newTransaction->memo = $this->memo;
|
||||
$newTransaction->tx_hash = hex2bin($this->runningHash);
|
||||
$newTransaction->received = $this->received;
|
||||
|
||||
//! TODO change into transaction, if at least one fail, rollback
|
||||
/*
|
||||
// In a controller.
|
||||
$articles->getConnection()->transactional(function () use ($articles, $entities) {
|
||||
foreach ($entities as $entity) {
|
||||
$articles->save($entity, ['atomic' => false]);
|
||||
$transactionTypesTable = TableRegistry::getTableLocator()->get('TransactionTypes');
|
||||
$transactionsTable = TableRegistry::getTableLocator()->get('Transactions');
|
||||
$stateUserTransactionsTable = TableRegistry::getTableLocator()->get('StateUserTransactions');
|
||||
|
||||
$transactionTypeName = $this->nodeTransactionTypeToDBTransactionType($this->transactionType);
|
||||
$transactionTypeResults = $transactionTypesTable->find('all')->where(['name' => $transactionTypeName]);
|
||||
if($transactionTypeResults->isEmpty()) {
|
||||
return [
|
||||
'state' => 'error', 'msg' => 'transaction type not found',
|
||||
'details' => ['nodeType' => $this->transactionType, 'dbType' => $transactionTypeName]
|
||||
];
|
||||
}
|
||||
if(!$this->transactionObj) {
|
||||
return ['state' => 'error', 'msg' => 'transaction obj is null'];
|
||||
}
|
||||
if($this->sequenceNumber <= 0) {
|
||||
return ['state' => 'error', 'msg' => 'sequence number invalid', 'details' => $this->sequenceNumber];
|
||||
}
|
||||
$transactionExistResult = $transactionsTable->find('all')->where(['id' => $this->sequenceNumber]);
|
||||
if(!$transactionExistResult->isEmpty()) {
|
||||
return ['state' => 'warning', 'msg' => 'transaction already exist in db', 'details' => $this->sequenceNumber];
|
||||
}
|
||||
$newTransaction = $transactionsTable->newEntity();
|
||||
$newTransaction->id = $this->sequenceNumber;
|
||||
$newTransaction->transaction_type_id = $transactionTypeResults->first()->id;
|
||||
$newTransaction->memo = $this->memo;
|
||||
if($this->runningHash != '' && strlen($this->runningHash) % 2 == 0) {
|
||||
$newTransaction->tx_hash = hex2bin($this->runningHash);
|
||||
}
|
||||
$newTransaction->received = $this->received;
|
||||
|
||||
//! TODO change into transaction, if at least one fail, rollback
|
||||
/*
|
||||
// In a controller.
|
||||
$articles->getConnection()->transactional(function () use ($articles, $entities) {
|
||||
foreach ($entities as $entity) {
|
||||
$articles->save($entity, ['atomic' => false]);
|
||||
}
|
||||
});
|
||||
*/
|
||||
if(!$transactionsTable->save($newTransaction)) {
|
||||
return ['state' => 'error', 'msg' => 'error saving transaction', 'details' => $newTransaction->getErrors()];
|
||||
}
|
||||
|
||||
foreach($this->signatures as $sign) {
|
||||
$sign_result = $sign->finalize($this->sequenceNumber);
|
||||
if($sign_result !== true) {
|
||||
return ['state' => 'error', 'msg', 'error finalizing signature', 'details' => $sign_result];
|
||||
}
|
||||
});
|
||||
*/
|
||||
if(!$transactionsTable->save($newTransaction)) {
|
||||
return ['state' => 'error', 'msg' => 'error saving transaction', 'details' => $newTransaction->getErrors()];
|
||||
}
|
||||
|
||||
foreach($this->signatures as $sign) {
|
||||
$sign_result = $sign->finalize($this->sequenceNumber);
|
||||
iF($sign_result !== true) {
|
||||
return ['state' => 'error', 'msg', 'error finalizing signature', 'details' => $sign_result];
|
||||
}
|
||||
}
|
||||
$transaction_obj_result = $this->transactionObj->finalize($newTransaction->id, $this->received);
|
||||
if($transaction_obj_result !== true) {
|
||||
return ['state' => 'error', 'msg' => 'error finalizing transaction object', 'details' => $transaction_obj_result];
|
||||
}
|
||||
$state_users = $this->transactionObj->getAllStateUsers();
|
||||
$sut_entities = [];
|
||||
foreach($state_users as $state_user_id) {
|
||||
$entity = $stateUserTransactionsTable->newEntity();
|
||||
$entity->state_user_id = $state_user_id;
|
||||
$entity->transaction_id = $newTransaction->id;
|
||||
$entity->transaction_type_id = $newTransaction->transaction_type_id;
|
||||
$sut_entities[] = $entity;
|
||||
}
|
||||
$sut_results = $stateUserTransactionsTable->saveMany($sut_entities);
|
||||
foreach($sut_results as $i => $result) {
|
||||
if(false == $result) {
|
||||
return ['state' => 'error', 'msg' => 'error saving state_user_transaction', 'details' => $sut_entities[$i]->getErrors()];
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
$transaction_obj_result = $this->transactionObj->finalize($newTransaction->id, $this->received);
|
||||
if($transaction_obj_result !== true) {
|
||||
return ['state' => 'error', 'msg' => 'error finalizing transaction object', 'details' => $transaction_obj_result];
|
||||
}
|
||||
$state_users = $this->transactionObj->getAllStateUsers();
|
||||
$sut_entities = [];
|
||||
foreach($state_users as $state_user_id) {
|
||||
$entity = $stateUserTransactionsTable->newEntity();
|
||||
$entity->state_user_id = $state_user_id;
|
||||
$entity->transaction_id = $newTransaction->id;
|
||||
$entity->transaction_type_id = $newTransaction->transaction_type_id;
|
||||
$sut_entities[] = $entity;
|
||||
}
|
||||
$sut_results = $stateUserTransactionsTable->saveMany($sut_entities);
|
||||
foreach($sut_results as $i => $result) {
|
||||
if(false == $result) {
|
||||
return ['state' => 'error', 'msg' => 'error saving state_user_transaction', 'details' => $sut_entities[$i]->getErrors()];
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -4,8 +4,8 @@
|
||||
* @var \App\Model\Entity\StateGroupAddress $stateGroupAddress
|
||||
*/
|
||||
?>
|
||||
<nav id="actions-sidebar">
|
||||
<ul class="nav-horizontal nav-smaller">
|
||||
<nav class="large-3 medium-4 columns" id="actions-sidebar">
|
||||
<ul class="side-nav">
|
||||
<li class="heading"><?= __('Actions') ?></li>
|
||||
<li><?= $this->Html->link(__('List State Group Addresses'), ['action' => 'index']) ?></li>
|
||||
<li><?= $this->Html->link(__('List State Groups'), ['controller' => 'StateGroups', 'action' => 'index']) ?></li>
|
||||
@ -19,7 +19,7 @@
|
||||
<fieldset>
|
||||
<legend><?= __('Add State Group Address') ?></legend>
|
||||
<?php
|
||||
echo $this->Form->control('state_group_id', ['options' => $stateGroups]);
|
||||
echo $this->Form->control('group_id');
|
||||
echo $this->Form->control('address_type_id', ['options' => $addressTypes]);
|
||||
?>
|
||||
</fieldset>
|
||||
|
||||
@ -4,8 +4,8 @@
|
||||
* @var \App\Model\Entity\StateGroupAddress $stateGroupAddress
|
||||
*/
|
||||
?>
|
||||
<nav id="actions-sidebar">
|
||||
<ul class="nav-horizontal nav-smaller">
|
||||
<nav class="large-3 medium-4 columns" id="actions-sidebar">
|
||||
<ul class="side-nav">
|
||||
<li class="heading"><?= __('Actions') ?></li>
|
||||
<li><?= $this->Form->postLink(
|
||||
__('Delete'),
|
||||
@ -25,7 +25,7 @@
|
||||
<fieldset>
|
||||
<legend><?= __('Edit State Group Address') ?></legend>
|
||||
<?php
|
||||
echo $this->Form->control('state_group_id', ['options' => $stateGroups]);
|
||||
echo $this->Form->control('group_id');
|
||||
echo $this->Form->control('address_type_id', ['options' => $addressTypes]);
|
||||
?>
|
||||
</fieldset>
|
||||
|
||||
@ -4,8 +4,8 @@
|
||||
* @var \App\Model\Entity\StateGroupAddress[]|\Cake\Collection\CollectionInterface $stateGroupAddresses
|
||||
*/
|
||||
?>
|
||||
<nav id="actions-sidebar">
|
||||
<ul class="nav-horizontal nav-smaller">
|
||||
<nav class="large-3 medium-4 columns" id="actions-sidebar">
|
||||
<ul class="side-nav">
|
||||
<li class="heading"><?= __('Actions') ?></li>
|
||||
<li><?= $this->Html->link(__('New State Group Address'), ['action' => 'add']) ?></li>
|
||||
<li><?= $this->Html->link(__('List State Groups'), ['controller' => 'StateGroups', 'action' => 'index']) ?></li>
|
||||
@ -20,8 +20,9 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><?= $this->Paginator->sort('id') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('state_group_id') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('group_id') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('address_type_id') ?></th>
|
||||
<th scope="col"><?= __('user public key') ?></th>
|
||||
<th scope="col" class="actions"><?= __('Actions') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -29,8 +30,9 @@
|
||||
<?php foreach ($stateGroupAddresses as $stateGroupAddress): ?>
|
||||
<tr>
|
||||
<td><?= $this->Number->format($stateGroupAddress->id) ?></td>
|
||||
<td><?= $stateGroupAddress->has('state_group') ? $this->Html->link($stateGroupAddress->state_group->name, ['controller' => 'StateGroups', 'action' => 'view', $stateGroupAddress->state_group->id]) : '' ?></td>
|
||||
<td><?= $this->Number->format($stateGroupAddress->group_id) ?></td>
|
||||
<td><?= $stateGroupAddress->has('address_type') ? $this->Html->link($stateGroupAddress->address_type->name, ['controller' => 'AddressTypes', 'action' => 'view', $stateGroupAddress->address_type->id]) : '' ?></td>
|
||||
<td><?= bin2hex(stream_get_contents($stateGroupAddress->public_key)) ?>
|
||||
<td class="actions">
|
||||
<?= $this->Html->link(__('View'), ['action' => 'view', $stateGroupAddress->id]) ?>
|
||||
<?= $this->Html->link(__('Edit'), ['action' => 'edit', $stateGroupAddress->id]) ?>
|
||||
@ -40,8 +42,8 @@
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<div>
|
||||
<ul class="nav-horizontal">
|
||||
<div class="paginator">
|
||||
<ul class="pagination">
|
||||
<?= $this->Paginator->first('<< ' . __('first')) ?>
|
||||
<?= $this->Paginator->prev('< ' . __('previous')) ?>
|
||||
<?= $this->Paginator->numbers() ?>
|
||||
|
||||
@ -4,8 +4,8 @@
|
||||
* @var \App\Model\Entity\StateGroupAddress $stateGroupAddress
|
||||
*/
|
||||
?>
|
||||
<nav id="actions-sidebar">
|
||||
<ul class="nav-horizontal nav-smaller">
|
||||
<nav class="large-3 medium-4 columns" id="actions-sidebar">
|
||||
<ul class="side-nav">
|
||||
<li class="heading"><?= __('Actions') ?></li>
|
||||
<li><?= $this->Html->link(__('Edit State Group Address'), ['action' => 'edit', $stateGroupAddress->id]) ?> </li>
|
||||
<li><?= $this->Form->postLink(__('Delete State Group Address'), ['action' => 'delete', $stateGroupAddress->id], ['confirm' => __('Are you sure you want to delete # {0}?', $stateGroupAddress->id)]) ?> </li>
|
||||
@ -20,10 +20,6 @@
|
||||
<div class="stateGroupAddresses view large-9 medium-8 columns content">
|
||||
<h3><?= h($stateGroupAddress->id) ?></h3>
|
||||
<table class="vertical-table">
|
||||
<tr>
|
||||
<th scope="row"><?= __('State Group') ?></th>
|
||||
<td><?= $stateGroupAddress->has('state_group') ? $this->Html->link($stateGroupAddress->state_group->name, ['controller' => 'StateGroups', 'action' => 'view', $stateGroupAddress->state_group->id]) : '' ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?= __('Address Type') ?></th>
|
||||
<td><?= $stateGroupAddress->has('address_type') ? $this->Html->link($stateGroupAddress->address_type->name, ['controller' => 'AddressTypes', 'action' => 'view', $stateGroupAddress->address_type->id]) : '' ?></td>
|
||||
@ -32,5 +28,9 @@
|
||||
<th scope="row"><?= __('Id') ?></th>
|
||||
<td><?= $this->Number->format($stateGroupAddress->id) ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?= __('Group Id') ?></th>
|
||||
<td><?= $this->Number->format($stateGroupAddress->group_id) ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
<th scope="col"><?= $this->Paginator->sort('id') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('transaction_id') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('address_type_id') ?></th>
|
||||
<th scope="col"><?= __('user public key') ?></th>
|
||||
<th scope="col" class="actions"><?= __('Actions') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -31,6 +32,7 @@
|
||||
<td><?= $this->Number->format($transactionGroupAddaddres->id) ?></td>
|
||||
<td><?= $transactionGroupAddaddres->has('transaction') ? $this->Html->link($transactionGroupAddaddres->transaction->id, ['controller' => 'Transactions', 'action' => 'view', $transactionGroupAddaddres->transaction->id]) : '' ?></td>
|
||||
<td><?= $transactionGroupAddaddres->has('address_type') ? $this->Html->link($transactionGroupAddaddres->address_type->name, ['controller' => 'AddressTypes', 'action' => 'view', $transactionGroupAddaddres->address_type->id]) : '' ?></td>
|
||||
<td><?= bin2hex(stream_get_contents($transactionGroupAddaddres->public_key)) ?>
|
||||
<td class="actions">
|
||||
<?= $this->Html->link(__('View'), ['action' => 'view', $transactionGroupAddaddres->id]) ?>
|
||||
<?= $this->Html->link(__('Edit'), ['action' => 'edit', $transactionGroupAddaddres->id]) ?>
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit 81a461566e46d71533dc3e284fa075d7d68fd020
|
||||
Subproject commit 9004e6978ac3dafcc635b2ffcf8bc6a156451cca
|
||||
@ -15,16 +15,17 @@ class StateGroupAddressesFixture extends TestFixture
|
||||
*/
|
||||
// @codingStandardsIgnoreStart
|
||||
public $fields = [
|
||||
'id' => ['type' => 'integer', 'length' => 11, 'unsigned' => false, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null],
|
||||
'state_group_id' => ['type' => 'integer', 'length' => 11, 'unsigned' => false, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null],
|
||||
'id' => ['type' => 'integer', 'length' => 10, 'unsigned' => true, 'null' => false, 'default' => null, 'comment' => '', 'autoIncrement' => true, 'precision' => null],
|
||||
'group_id' => ['type' => 'integer', 'length' => 10, 'unsigned' => true, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null],
|
||||
'public_key' => ['type' => 'binary', 'length' => 32, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null],
|
||||
'address_type_id' => ['type' => 'integer', 'length' => 11, 'unsigned' => false, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null],
|
||||
'address_type_id' => ['type' => 'integer', 'length' => 10, 'unsigned' => true, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null],
|
||||
'_constraints' => [
|
||||
'primary' => ['type' => 'primary', 'columns' => ['id'], 'length' => []],
|
||||
'public_key' => ['type' => 'unique', 'columns' => ['public_key'], 'length' => []],
|
||||
],
|
||||
'_options' => [
|
||||
'engine' => 'InnoDB',
|
||||
'collation' => 'utf8_bin'
|
||||
'collation' => 'utf8mb4_unicode_ci'
|
||||
],
|
||||
];
|
||||
// @codingStandardsIgnoreEnd
|
||||
@ -38,9 +39,9 @@ class StateGroupAddressesFixture extends TestFixture
|
||||
$this->records = [
|
||||
[
|
||||
'id' => 1,
|
||||
'state_group_id' => 1,
|
||||
'group_id' => 1,
|
||||
'public_key' => 'Lorem ipsum dolor sit amet',
|
||||
'address_type_id' => 1
|
||||
'address_type_id' => 1,
|
||||
],
|
||||
];
|
||||
parent::init();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user