Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/ChurchCRM/CRM
Browse files Browse the repository at this point in the history
  • Loading branch information
DawoudIO committed Nov 5, 2023
2 parents 92a3dfe + adbbe72 commit bc3fb19
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 124 deletions.
12 changes: 12 additions & 0 deletions cypress/e2e/ui/user/standard.user.report-issue.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/// <reference types="cypress" />

context('Report Issue', () => {

it('Click Menus to Report issue', () => {
cy.loginStandard('v2/dashboard');
cy.get('.fa-headset').click();
cy.get('#reportIssue').click();
cy.contains("Issue Report!")
});

});
39 changes: 8 additions & 31 deletions locale/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ msgstr ""
"#-#-#-#-# messages.po (PACKAGE VERSION) #-#-#-#-#\n"
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-11-02 17:49-0700\n"
"POT-Creation-Date: 2023-11-04 17:15-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand All @@ -25,16 +25,16 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2023-11-03T00:49:43.662Z\n"
"PO-Revision-Date: 2023-11-03T00:49:43.662Z\n"
"POT-Creation-Date: 2023-11-05T00:15:54.052Z\n"
"PO-Revision-Date: 2023-11-05T00:15:54.053Z\n"
"#-#-#-#-# react-js-strings.po (i18next-conv) #-#-#-#-#\n"
"Project-Id-Version: i18next-conv\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2023-11-03T00:49:43.875Z\n"
"PO-Revision-Date: 2023-11-03T00:49:43.875Z\n"
"POT-Creation-Date: 2023-11-05T00:15:54.268Z\n"
"PO-Revision-Date: 2023-11-05T00:15:54.269Z\n"

msgid "Backup Database"
msgstr ""
Expand Down Expand Up @@ -3357,31 +3357,17 @@ msgstr ""
msgid "Issue Report!"
msgstr ""

msgid "Enter a Title for your bug / feature report"
msgstr ""

msgid "What were you doing when you noticed the bug / feature opportunity?"
msgstr ""

msgid ""
"When you click \"submit,\" an error report will be posted to the ChurchCRM "
"GitHub Issue tracker."
msgstr ""

msgid "Please do not include any confidential information."
msgstr ""

msgid ""
"Some general information about your system will be submitted along with the "
"request such as Server version and browser headers."
"When you click \"Submit to GitHub\" you will be directed to github issues "
"page with your system info prefilled."
msgstr ""

msgid ""
"No personally identifiable information will be submitted unless you "
"purposefully include it."
msgstr ""

msgid "Submit"
msgid "Submit to GitHub"
msgstr ""

msgid "Help translate this project"
Expand Down Expand Up @@ -5381,9 +5367,6 @@ msgstr ""
msgid "Web Server"
msgstr ""

msgid "Server Software"
msgstr ""

msgid "Email Information"
msgstr ""

Expand Down Expand Up @@ -7163,12 +7146,6 @@ msgstr ""
msgid "Move"
msgstr ""

msgid "Successfully submitted Issue"
msgstr ""

msgid "View Issue on GitHub"
msgstr ""

msgid "Do you want to delete this person? This cannot be undone."
msgstr ""

Expand Down
45 changes: 0 additions & 45 deletions src/ChurchCRM/Service/SystemService.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,51 +73,6 @@ public static function getPrerequisiteStatus()
}
}

public function reportIssue($data)
{
$serviceURL = 'http://demo.churchcrm.io/issues/';
$headers = [];
$headers[] = 'Content-type: application/json';

$issueDescription = $data->issueDescription . "\r\n\r\n\r\n" .
"Collected Value Title | Data \r\n" .
"----------------------|----------------\r\n" .
'Page Name |' . $data->pageName . "\r\n" .
'Screen Size |' . $data->screenSize->height . 'x' . $data->screenSize->width . "\r\n" .
'Window Size |' . $data->windowSize->height . 'x' . $data->windowSize->width . "\r\n" .
'Page Size |' . $data->pageSize->height . 'x' . $data->pageSize->width . "\r\n" .
'Platform Information | ' . php_uname($mode = 'a') . "\r\n" .
'PHP Version | ' . phpversion() . "\r\n" .
'SQL Version | ' . self::getDBServerVersion() . "\r\n" .
'ChurchCRM Version |' . $_SESSION['sSoftwareInstalledVersion'] . "\r\n" .
'Reporting Browser |' . $_SERVER['HTTP_USER_AGENT'] . "\r\n" .
'Prerequisite Status |' . self::getPrerequisiteStatus() . "\r\n" .
'Integrity check status |' . file_get_contents(SystemURLs::getDocumentRoot() . '/integrityCheck.json') . "\r\n";

if (function_exists('apache_get_modules')) {
$issueDescription .= 'Apache Modules |' . implode(',', apache_get_modules());
}

$postdata = new \stdClass();
$postdata->issueTitle = InputUtils::legacyFilterInput($data->issueTitle);
$postdata->issueDescription = $issueDescription;

$curlService = curl_init($serviceURL);

curl_setopt($curlService, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curlService, CURLOPT_POST, true);
curl_setopt($curlService, CURLOPT_POSTFIELDS, json_encode($postdata, JSON_THROW_ON_ERROR));
curl_setopt($curlService, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curlService, CURLOPT_CONNECTTIMEOUT, 1);

$result = curl_exec($curlService);
if ($result === false) {
throw new \Exception('Unable to reach the issue bridge', 500);
}

return $result;
}

private static function isTimerThresholdExceeded(string $LastTime, int $ThresholdHours)
{
if (empty($LastTime)) {
Expand Down
45 changes: 14 additions & 31 deletions src/Include/Header-function.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,49 +27,32 @@ function Header_modals()
?>
<!-- Issue Report Modal -->
<div id="IssueReportModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-dialog modal-lg">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-content" id="bugForm">
<form name="issueReport">
<input type="hidden" name="pageName" value="<?= $_SERVER['REQUEST_URI'] ?>"/>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title"><?= gettext('Issue Report!') ?></h4>
<h5 class="modal-title"><?= gettext('Issue Report!') ?></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">x</span>
</button>
</div>
<div class="modal-body">
<div class="container-fluid">
<div class="row">
<div class="col-xl-3">
<label
for="issueTitle"><?= gettext('Enter a Title for your bug / feature report') ?>
: </label>
</div>
<div class="col-xl-3">
<input type="text" name="issueTitle">
</div>
</div>
<div class="row">
<div class="col-xl-3">
<label
for="issueDescription"><?= gettext('What were you doing when you noticed the bug / feature opportunity?') ?></label>
</div>
<div class="col-xl-3">
<textarea rows="10" cols="50" name="issueDescription"></textarea>
</div>
</div>
<div class="alert alert-info alert-dismissible">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<h5><i class="icon fas fa-info"></i>Alert!</h5>
<?= gettext('When you click "Submit to GitHub" you will be directed to GitHub issues page with your system info prefilled.') ?> <?= gettext('No personally identifiable information will be submitted unless you purposefully include it.') ?>
</div>
<ul>
<li><?= gettext('When you click "submit," an error report will be posted to the ChurchCRM GitHub Issue tracker.') ?></li>
<li><?= gettext('Please do not include any confidential information.') ?></li>
<li><?= gettext('Some general information about your system will be submitted along with the request such as Server version and browser headers.') ?></li>
<li><?= gettext('No personally identifiable information will be submitted unless you purposefully include it.') ?></li>
</ul>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" id="submitIssue"><?= gettext('Submit') ?></button>
<button type="button" class="btn btn-primary" id="submitIssue"><?= gettext('Submit to GitHub') ?></button>
</div>
</form>
</div>
<div id="bug-content">
test
</div>
</div>
</div>
<!-- End Issue Report Modal -->
Expand Down
4 changes: 2 additions & 2 deletions src/Include/Header.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,15 @@

<!-- Support Dropdown Menu -->
<li class="nav-item dropdown show">
<a class="nav-link" data-toggle="dropdown" href="#" aria-expanded="true">
<a class="nav-link" data-toggle="dropdown" href="#" aria-expanded="true" id="supportMenu">
<i class="fas fa-headset"></i>
</a>
<div class="dropdown-menu dropdown-menu-lg dropdown-menu-right" style="left: inherit; right: 0px;">
<a href="<?= SystemURLs::getSupportURL() ?>" target="help" class="dropdown-item" title="<?= gettext('Help & Manual') ?>">
<i class="fas fa-book-reader"></i> <?= gettext('Help & Manual') ?>
</a>
<div class="dropdown-divider"></div>
<a href="#" class="dropdown-item" data-target="#IssueReportModal" title="<?= gettext('Report an issue') ?>">
<a href="#" id="reportIssue" class="dropdown-item" data-toggle="modal" data-target="#IssueReportModal" title="<?= gettext('Report an issue') ?>">
<i class="fas fa-bug"></i> <?= gettext('Report an issue') ?>
</a>
<a href="https://gitter.im/ChurchCRM/CRM" target="_blank" class="dropdown-item" title="<?= gettext('Developer Chat') ?>">
Expand Down
21 changes: 18 additions & 3 deletions src/api/routes/system/system-issues.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
<?php

use ChurchCRM\dto\SystemURLs;
use ChurchCRM\Service\SystemService;

// Routes
$app->post('/issues', function ($request, $response, $args) use ($app) {
$input = json_decode($request->getBody(), null, 512, JSON_THROW_ON_ERROR);
$systemService = $this->get('SystemService');
$data = json_decode($request->getBody(), null, 512, JSON_THROW_ON_ERROR);
$issueDescription =
"Collected Value Title | Data \r\n" .
"----------------------|----------------\r\n" .
'Page Name |' . $data->pageName . "\r\n" .
'Screen Size |' . $data->screenSize->height . 'x' . $data->screenSize->width . "\r\n" .
'Window Size |' . $data->windowSize->height . 'x' . $data->windowSize->width . "\r\n" .
'Page Size |' . $data->pageSize->height . 'x' . $data->pageSize->width . "\r\n" .
'Platform Information | ' . php_uname($mode = 'a') . "\r\n" .
'PHP Version | ' . phpversion() . "\r\n" .
'SQL Version | ' . SystemService::getDBServerVersion() . "\r\n" .
'ChurchCRM Version |' . $_SESSION['sSoftwareInstalledVersion'] . "\r\n" .
'Reporting Browser |' . $_SERVER['HTTP_USER_AGENT'] . "\r\n" .
'Prerequisite Status |' . SystemService::getPrerequisiteStatus() . "\r\n" ;

return $systemService->reportIssue($input);
return $response->withJson(["issueBody" => $issueDescription]);
});
17 changes: 5 additions & 12 deletions src/skin/js/IssueReporter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
$("#submitIssue").click(function () {
var postData = {
"issueTitle": $("input:text[name=issueTitle]").val(),
"issueDescription": $("textarea[name=issueDescription]").val(),
"pageName" : $("input[name=pageName]").val(),
"screenSize": {
"height":screen.height,
Expand All @@ -23,16 +21,11 @@ $("#submitIssue").click(function () {
contentType: "application/json; charset=utf-8",
dataType: "json"
}).done(function (data) {
console.log(data);
$("#IssueReportModal .modal-body").empty();
$("<h2/>").text( i18next.t("Successfully submitted Issue")+" #" + data.number).appendTo("#IssueReportModal .modal-body");
$("<a/>", {
href: data.url,
target: "_blank",
text: i18next.t("View Issue on GitHub") + ": #" + data.number
}).appendTo("#IssueReportModal .modal-body");
$("#submitIssue").remove();
$("<button/>").text("Close").attr("data-dismiss", "modal").addClass("btn btn-primary").appendTo("#IssueReportModal .modal-footer");
var bugMsg = "**Describe the issue** \n\n\n\n";
var systemInfo = encodeURIComponent(bugMsg + data['issueBody']);
var gitHubURL = 'https://github.com/ChurchCRM/CRM/issues/new?assignees=&labels=Web%20Report&body='+systemInfo;
window.open(gitHubURL, `github`);
$('#IssueReportModal').modal('toggle');
});

});

0 comments on commit bc3fb19

Please sign in to comment.