Skip to content

Commit

Permalink
Post-rebase vs. develop corrections (CFM-31)
Browse files Browse the repository at this point in the history
  • Loading branch information
arlen committed Aug 14, 2024
1 parent 1c33cb2 commit acd3a1c
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 65 deletions.
116 changes: 58 additions & 58 deletions app/config/schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -521,8 +521,8 @@
"history_records": {
"columns": {
"id": {},
"action": { "type": "string", "size": 4 },
"comment": { "type": "string", "size": 256 },
"action": {},
"comment": {},
"person_id": {},
"person_role_id": {},
"external_identity_id": {},
Expand All @@ -542,6 +542,62 @@
}
},

"message_templates": {
"columns": {
"id": {},
"co_id": {},
"description": {},
"status": {},
"context": {},
"format": { "type": "string", "size": 4 },
"subject": { "type": "string", "size": 256 },
"body_text": { "type": "text" },
"body_html": { "type": "text" },
"cc": { "type": "string", "size": 256 },
"bcc": { "type": "string", "size": 256 },
"reply_to": { "type": "string", "size": 256 }
},
"indexes": {
"message_templates_i1": { "columns": [ "co_id" ] }
}
},

"notifications": {
"columns": {
"id": {},
"subject_person_id": { "type": "integer", "foreignkey": { "table": "people", "column": "id" } },
"subject_group_id": { "type": "integer", "foreignkey": { "table": "people", "column": "id" } },
"actor_person_id": { "type": "integer", "foreignkey": { "table": "people", "column": "id" } },
"recipient_person_id": { "type": "integer", "foreignkey": { "table": "people", "column": "id" } },
"recipient_group_id": { "type": "integer", "foreignkey": { "table": "people", "column": "id" } },
"resolver_person_id": { "type": "integer", "foreignkey": { "table": "people", "column": "id" } },
"action": {
"comment": "revert this to use the library definition after feature-cfm31 merge",
"type": "string", "size": 4
},
"comment": {},
"message_template_id": { "type": "integer", "foreignkey": { "table": "message_templates", "column": "id" } },
"source": { "type": "text" },
"email_subject": { "type": "string", "size": 256 },
"email_body_text": { "type": "text" },
"email_body_html": { "type": "text" },
"resolution_subject": { "type": "string", "size": 256 },
"resolution_body": { "type": "text" },
"status": {},
"notification_time": { "type": "datetime" },
"resolution_time": { "type": "datetime" }
},
"indexes": {
"notifications_i1": { "columns": [ "subject_person_id" ] },
"notifications_i2": { "columns": [ "subject_group_id" ] },
"notifications_i3": { "columns": [ "recipient_person_id" ] },
"notifications_i4": { "columns": [ "recipient_group_id" ] },
"notifications_i5": { "columns": [ "source" ] },
"notifications_i6": { "needed": false, "columns": [ "actor_person_id" ] },
"notifications_i7": { "needed": false, "columns": [ "resolver_person_id" ] }
}
},

"enrollment_flows": {
"columns": {
"id": {},
Expand Down Expand Up @@ -627,62 +683,6 @@
}
},

"message_templates": {
"columns": {
"id": {},
"co_id": {},
"description": {},
"status": {},
"context": {},
"format": { "type": "string", "size": 4 },
"subject": { "type": "string", "size": 256 },
"body_text": { "type": "text" },
"body_html": { "type": "text" },
"cc": { "type": "string", "size": 256 },
"bcc": { "type": "string", "size": 256 },
"reply_to": { "type": "string", "size": 256 }
},
"indexes": {
"message_templates_i1": { "columns": [ "co_id" ] }
}
},

"notifications": {
"columns": {
"id": {},
"subject_person_id": { "type": "integer", "foreignkey": { "table": "people", "column": "id" } },
"subject_group_id": { "type": "integer", "foreignkey": { "table": "people", "column": "id" } },
"actor_person_id": { "type": "integer", "foreignkey": { "table": "people", "column": "id" } },
"recipient_person_id": { "type": "integer", "foreignkey": { "table": "people", "column": "id" } },
"recipient_group_id": { "type": "integer", "foreignkey": { "table": "people", "column": "id" } },
"resolver_person_id": { "type": "integer", "foreignkey": { "table": "people", "column": "id" } },
"action": {
"comment": "revert this to use the library definition after feature-cfm31 merge",
"type": "string", "size": 4
},
"comment": {},
"message_template_id": { "type": "integer", "foreignkey": { "table": "message_templates", "column": "id" } },
"source": { "type": "text" },
"email_subject": { "type": "string", "size": 256 },
"email_body_text": { "type": "text" },
"email_body_html": { "type": "text" },
"resolution_subject": { "type": "string", "size": 256 },
"resolution_body": { "type": "text" },
"status": {},
"notification_time": { "type": "datetime" },
"resolution_time": { "type": "datetime" }
},
"indexes": {
"notifications_i1": { "columns": [ "subject_person_id" ] },
"notifications_i2": { "columns": [ "subject_group_id" ] },
"notifications_i3": { "columns": [ "recipient_person_id" ] },
"notifications_i4": { "columns": [ "recipient_group_id" ] },
"notifications_i5": { "columns": [ "source" ] },
"notifications_i6": { "needed": false, "columns": [ "actor_person_id" ] },
"notifications_i7": { "needed": false, "columns": [ "resolver_person_id" ] }
}
},

"jobs": {
"columns": {
"id": {},
Expand Down
26 changes: 26 additions & 0 deletions app/src/Model/Table/IdentifiersTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,32 @@ public function lookupPersonByLogin(int $coId, string $identifier): int {
return $id->person_id;
}

/**
* Lookup a Person ID from a login identifier. Only active Identifiers can
* be used for lookups.
*
* @since COmanage Registry v5.0.0
* @param string $identifier Identifier
* @param int $coId CO ID
* @return int Person ID or null
*/

public function lookupPersonForLogin(string $identifier, int $coId): ?int {
$id = $this->find()
->where([
'Identifiers.identifier' => $identifier,
'Identifiers.status' => SuspendableStatusEnum::Active,
'Identifiers.login' => true,
'Identifiers.person_id IS NOT NULL'
])
->matching('People', function ($q) use ($coId) {
return $q->where(['People.co_id' => $coId]);
})
->firstOrFail();

return $id->person_id ?? null;
}

/**
* Perform a keyword search.
*
Expand Down
15 changes: 8 additions & 7 deletions app/templates/Standard/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,11 @@
$actionOrderDefault = $this->Menu->getMenuOrder('Default');
foreach ($rowActions as $a) {
$ok = false;
if (!empty($a['controller'])) {
$tableName = Inflector::camelize($a['controller']);
if (!empty($a['controller']) && $a['controller'] != $tableName) {
$relTableName = Inflector::camelize($a['controller']);

if (isset($vv_permission_set[$entity->id][$tableName][$a['action']])) {
$ok = $vv_permission_set[$entity->id][$tableName][$a['action']];
if (isset($vv_permission_set[$entity->id][$relTableName][$a['action']])) {
$ok = $vv_permission_set[$entity->id][$relTableName][$a['action']];
}
} else {
$ok = $vv_permission_set[$entity->id][$a['action']];
Expand All @@ -295,7 +295,7 @@
$actionUrl = ['action' => $a['action'], $entity->id];
$actionLabel = !empty($a['label']) ? $a['label'] : __d('operation', $a['action']);

if (!empty($a['controller'])) {
if (!empty($a['controller']) && $a['controller'] != $tableName) {
// We're linking into a related controller
$actionLabel = !empty($a['label']) ? $a['label'] : __d('controller', Inflector::camelize(Inflector::pluralize($a['controller'])), [99]);
$actionUrl = [
Expand Down Expand Up @@ -386,10 +386,11 @@
}

// Output the row actions if present
if($isFirstLink && !empty($rowActions)) {
if($isFirstLink && !empty($action_args['vv_actions'])) {
// todo check if needed
print '<div class="field-actions-container">';
print '<div class="field-actions">';
print $this->element('menuAction', $action_args);
print $this->element('menuAction', $action_args);
print '</div>';
}

Expand Down

0 comments on commit acd3a1c

Please sign in to comment.