Skip to content

Commit

Permalink
Rename jira_key_fields to key_fields in configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
raviks789 committed Feb 23, 2023
1 parent 0e1fbaf commit 6914b06
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion application/clicommands/SendCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function problemAction()
$ackMessage = "JIRA issue $key has been created";
} else {
$key = $issue->key;
$icingaStatus = $config->get('jira_key_fields', 'icingaStatus', 'icingaStatus');
$icingaStatus = $config->get('key_fields', 'icingaStatus', 'icingaStatus');
$currentStatus = isset($issue->fields->$icingaStatus) ? $issue->fields->$icingaStatus : null;
$ackMessage = "Existing JIRA issue $key has been found";
if ($currentStatus !== $status) {
Expand Down
2 changes: 1 addition & 1 deletion doc/03-Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ password = "password"
; default_project = "SO"
; default_issuetype = "Event"

[jira_key_fields]
[key_fields]
; icingaStatus = "icingaStatus"
; icingaKey = "icingaKey"

Expand Down
4 changes: 2 additions & 2 deletions library/Jira/IssueTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ protected function getCustomFields()
protected function getDefaultFields()
{
$config = Config::module('jira');
$key = $config->get('jira_key_fields', 'icingaKey', 'icingaKey');
$status = $config->get('jira_key_fields', 'icingaStatus', 'icingaStatus');
$key = $config->get('key_fields', 'icingaKey', 'icingaKey');
$status = $config->get('key_fields', 'icingaStatus', 'icingaStatus');
return [
'project.key' => '${project}',
'issuetype.name' => '${issuetype}',
Expand Down
8 changes: 4 additions & 4 deletions library/Jira/RestApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function eventuallyGetLatestOpenIssueFor($project, $host, $service = null
$query = $this->prepareProjectIssueQuery($project, $host, $service, true);

$config = Config::module('jira');
$keyField = $config->get('jira_key_fields', 'icingaKey', 'icingaKey');
$keyField = $config->get('key_fields', 'icingaKey', 'icingaKey');

$issues = $this->post('search', [
'jql' => $query,
Expand Down Expand Up @@ -201,7 +201,7 @@ private function finalizeIssueQuery(string $query, $host = null, $service = null
}

$config = Config::module('jira');
$keyField = $config->get('jira_key_fields', 'icingaKey', 'icingaKey');
$keyField = $config->get('key_fields', 'icingaKey', 'icingaKey');

if ($host === null) {
$query .= ' AND ' . $keyField . ' ~ "BEGIN*"';
Expand Down Expand Up @@ -239,8 +239,8 @@ public static function makeIcingaKey($host, $service = null)
public function fetchIssues($host = null, $service = null, $onlyOpen = true)
{
$config = Config::module('jira');
$keyField = $config->get('jira_key_fields', 'icingaKey', 'icingaKey');
$keyStatus = $config->get('jira_key_fields', 'icingaStatus', 'icingaStatus');
$keyField = $config->get('key_fields', 'icingaKey', 'icingaKey');
$keyStatus = $config->get('key_fields', 'icingaStatus', 'icingaStatus');
$start = 0;
$limit = 15;
$query = $this->prepareIssueQuery($host, $service, $onlyOpen);
Expand Down
2 changes: 1 addition & 1 deletion library/Jira/Web/Table/IssueDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected function assemble()

$fields = $issue->fields;
$projectKey = $fields->project->key;
$keyField = $config->get('jira_key_fields', 'icingaKey', 'icingaKey');
$keyField = $config->get('key_fields', 'icingaKey', 'icingaKey');

$icingaKey = preg_replace('/^BEGIN(.+)END$/', '$1', $fields->$keyField);
$parts = explode('!', $icingaKey);
Expand Down

0 comments on commit 6914b06

Please sign in to comment.