From 751b50448218c032d276b201a70f706ca945ba21 Mon Sep 17 00:00:00 2001
From: Morgan Lesko <15270653+rockhopsoft@users.noreply.github.com>
Date: Wed, 3 Jun 2020 02:52:04 -0400
Subject: [PATCH] Complaint Management Tool Upgrades
And evolving the Department Management.
---
README.md | 6 +-
src/Controllers/DepartmentScores.php | 67 ++--
src/Controllers/OpenComplaintConditions.php | 21 +-
src/Controllers/OpenComplaintEmails.php | 14 +-
src/Controllers/OpenComplaintPrints.php | 2 +-
src/Controllers/OpenComplaintSaves.php | 2 +-
src/Controllers/OpenDashAdmin.php | 16 +-
src/Controllers/OpenDepts.php | 184 +++++++++--
src/Controllers/OpenPolice.php | 1 +
src/Controllers/OpenPoliceAdmin.php | 4 +-
src/Controllers/OpenPoliceAdminMenu.php | 5 -
src/Controllers/OpenPolicePCIF.php | 287 ++++++++++++++++++
src/Controllers/OpenPoliceUtils.php | 41 ++-
src/Controllers/OpenReport.php | 77 ++++-
src/Controllers/OpenReportTools.php | 46 +--
src/Controllers/OpenReportToolsAdmin.php | 3 +-
src/Controllers/OpenSessDataOverride.php | 10 +-
src/Controllers/OpenVolunteers.php | 206 ++++++++++---
src/Models/OPZeditDepartments.php | 3 +-
src/Models/OPZeditOversight.php | 2 +-
src/Models/OPzComplaintReviews.php | 2 +-
src/Models/OPzVolunStatDays.php | 2 +-
src/Models/OPzVolunUserInfo.php | 2 +-
.../screenshot-protip-bottom-nav-jump.jpg | Bin 6586 -> 0 bytes
.../screenshot-protip-bottom-nav-progress.jpg | Bin 2982 -> 0 bytes
src/Views/ajax/search-police-dept.blade.php | 5 +-
src/Views/api/pcif-schema-header.blade.php | 14 +
...t-page-filing-instructs-file-btn.blade.php | 14 +-
.../dept-page-filing-instructs.blade.php | 12 +-
.../nodes/1211-volun-home-all-depts.blade.php | 24 +-
...dmin-complaints-listing-previews.blade.php | 2 +-
.../nodes/1712-report-inc-history.blade.php | 2 +-
...ort-inc-staff-tools-first-review.blade.php | 10 +-
...12-report-inc-staff-tools-status.blade.php | 72 +++--
.../1712-report-inc-staff-tools.blade.php | 63 ++--
...-report-inc-tools-progress-dates.blade.php | 3 +-
.../1714-report-inc-owner-tools.blade.php | 11 +-
src/Views/nodes/2234-beta-listing.blade.php | 2 +-
.../2713-dept-page-calls-action.blade.php | 9 +-
.../2715-dept-page-recent-reports.blade.php | 9 +-
.../2718-dept-page-how-to-file.blade.php | 8 +-
...ts-accessibility-overview-public.blade.php | 278 +++++++++++++----
src/Views/volun/admPrintDeptEdit.blade.php | 2 +-
src/Views/volun/dept-rows.blade.php | 13 +-
.../volun/volunteer-recent-edits.blade.php | 24 +-
src/routes.php | 35 +++
46 files changed, 1268 insertions(+), 347 deletions(-)
create mode 100644 src/Controllers/OpenPolicePCIF.php
delete mode 100644 src/Uploads/screenshot-protip-bottom-nav-jump.jpg
delete mode 100644 src/Uploads/screenshot-protip-bottom-nav-progress.jpg
create mode 100644 src/Views/api/pcif-schema-header.blade.php
diff --git a/README.md b/README.md
index 97a5f5a..365099a 100755
--- a/README.md
+++ b/README.md
@@ -54,7 +54,7 @@ XML included an automatically generated schema, eg.
* php: >=7.2.5
* laravel/laravel: 7.6.*
-* rockhopsoft/survloop: >=0.2.15
+* rockhopsoft/survloop: >=0.2.16
* flexyourrights/openpolice-departments: 0.1.*
* flexyourrights/openpolice-website: 0.1.*
@@ -81,7 +81,7 @@ DB_USERNAME=homestead
DB_PASSWORD=secret
```
-You could do things like install Laravel's out-of-the-box user authentication tools, and push the vendor file copies where they need to be:
+Next, install Laravel's out-of-the-box user authentication tools, and push the vendor file copies where they need to be:
```
$ composer require laravel/ui
$ php artisan ui vue --auth
@@ -98,7 +98,7 @@ $ nano composer.json
...
"require": {
...
- "rockhopsoft/survloop": "^0.2.16",
+ "rockhopsoft/survloop": "^0.2.4",
"flexyourrights/openpolice": "^0.2.16",
...
},
diff --git a/src/Controllers/DepartmentScores.php b/src/Controllers/DepartmentScores.php
index ce5c757..543bbbb 100644
--- a/src/Controllers/DepartmentScores.php
+++ b/src/Controllers/DepartmentScores.php
@@ -16,8 +16,8 @@
use App\Models\OPDepartments;
use App\Models\OPOversight;
use App\Models\OPzComplaintReviews;
-use App\Models\OPZeditDepartments;
-use App\Models\OPZeditOversight;
+use App\Models\OPzEditDepartments;
+use App\Models\OPzEditOversight;
use App\Models\OPOversightModels;
class DepartmentScores
@@ -236,20 +236,14 @@ public function loadAllDepts($searchFilts = [])
$deptName = str_replace('Police Dept', '', trim($dept->dept_name));
$deptName = str_replace('Police Department', '', $deptName);
$deptName = trim(str_replace('Department', 'Dept', $deptName));
- $this->deptNames[$dept->dept_id] = $deptName . ', ' . $dept->dept_address_state;
- $this->deptOvers[$dept->dept_id] = OPOversight::where('over_dept_id', $dept->dept_id)
- ->whereNotNull('over_agnc_name')
- ->where('over_agnc_name', 'NOT LIKE', '')
- ->orderBy('over_type', 'asc')
+ $this->deptNames[$dept->dept_id] = $deptName
+ . ', ' . $dept->dept_address_state;
+ $this->deptOvers[$dept->dept_id]["ia"] = OPOversight::where('over_dept_id', $dept->dept_id)
+ ->where('over_type', $GLOBALS["SL"]->x["defOverIA"])
+ ->first();
+ $this->deptOvers[$dept->dept_id]["civ"] = OPOversight::where('over_dept_id', $dept->dept_id)
+ ->where('over_type', $GLOBALS["SL"]->x["defOverCiv"])
->first();
- if (isset($this->deptOvers[$dept->dept_id]->over_type)
- && $this->deptOvers[$dept->dept_id]->over_type == $GLOBALS["SL"]->x["defOverCiv"]) {
- $this->deptScore[$dept->dept_id] = OPOversight::where('over_dept_id', $dept->dept_id)
- ->whereNotNull('over_agnc_name')
- ->where('over_agnc_name', 'NOT LIKE', '')
- ->where('over_type', $GLOBALS["SL"]->x["defOverIA"])
- ->first();
- }
}
}
}
@@ -261,7 +255,7 @@ public function loadAllDepts($searchFilts = [])
protected function recheckVerified()
{
$verifList = $verifDates = $verifCnt = [];
- $chk = OPZeditOversight::where(function ($query) {
+ $chk = OPzEditOversight::where(function ($query) {
$query->where('zed_over_online_research', 1)
->orWhere('zed_over_made_dept_call', 1)
->orWhere('zed_over_made_ia_call', 1);
@@ -302,7 +296,8 @@ protected function recheckVerified()
if (isset($verifDates[$deptID])) {
$dept = OPDepartments::find($deptID);
if ($dept && isset($dept->dept_id)) {
- $dept->dept_verified = date("Y-m-d H:i:s", strtotime($verifDates[$deptID]));
+ $time = strtotime($verifDates[$deptID]);
+ $dept->dept_verified = date("Y-m-d H:i:s", $time);
$dept->save();
}
}
@@ -320,7 +315,8 @@ public function recalcAllDepts()
$this->loadAllDepts();
if ($this->scoreDepts->isNotEmpty()) {
foreach ($this->scoreDepts as $i => $dept) {
- if ($this->deptOvers[$dept->dept_id]) {
+ $id = $dept->dept_id;
+ if ($this->deptOvers[$id]["ia"]) {
$this->scoreDepts[$i]->dept_score_openness = 0;
foreach ($this->vals as $type => $specs) {
$score = $this->checkRecFld($specs, $dept->dept_id);
@@ -329,12 +325,20 @@ public function recalcAllDepts()
$this->stats[$type]++;
}
}
- if (isset($this->deptOvers[$dept->dept_id]->over_email)
- && trim($this->deptOvers[$dept->dept_id]->over_email) != ''
- && isset($this->deptOvers[$dept->dept_id]->over_way_sub_email)
- && intVal($this->deptOvers[$dept->dept_id]->over_way_sub_email) == 1
- && isset($this->deptOvers[$dept->dept_id]->over_official_form_not_req)
- && intVal($this->deptOvers[$dept->dept_id]->over_official_form_not_req) == 1) {
+ $hasEmail = false;
+ if ((isset($dept->dept_email) && trim($dept->dept_email) != '')
+ || (isset($this->deptOvers[$id]["ia"]->over_email)
+ && trim($this->deptOvers[$id]["ia"]->over_email) != '')
+ || ($this->deptOvers[$id]["civ"]
+ && isset($this->deptOvers[$id]["civ"]->over_email)
+ && trim($this->deptOvers[$id]["civ"]->over_email) != '')) {
+ $hasEmail = true;
+ }
+ if ($hasEmail
+ && isset($this->deptOvers[$id]["ia"]->over_way_sub_email)
+ && intVal($this->deptOvers[$id]["ia"]->over_way_sub_email) == 1
+ && isset($this->deptOvers[$id]["ia"]->over_official_form_not_req)
+ && intVal($this->deptOvers[$id]["ia"]->over_official_form_not_req) == 1) {
$this->scoreDepts[$i]->dept_op_compliant = 1;
} else {
$this->scoreDepts[$i]->dept_op_compliant = 0;
@@ -357,7 +361,7 @@ public function checkRecFld($specs, $deptID, $overrow = null)
if ($deptID <= 0) {
return 0;
}
- $overrow = $this->deptOvers[$deptID];
+ $overrow = $this->deptOvers[$deptID]["ia"];
if (isset($this->deptScore[$deptID])) {
$overrow = $this->deptScore[$deptID];
}
@@ -446,8 +450,10 @@ public function loadDeptStuff($deptID = -3)
}
$d["iaRow"]->save();
}
- if (isset($d["deptRow"]->dept_name) && trim($d["deptRow"]->dept_name) != '') {
- if (!isset($d["iaRow"]->over_agnc_name) || trim($d["iaRow"]->over_agnc_name) == '') {
+ if (isset($d["deptRow"]->dept_name)
+ && trim($d["deptRow"]->dept_name) != '') {
+ if (!isset($d["iaRow"]->over_agnc_name)
+ || trim($d["iaRow"]->over_agnc_name) == '') {
$d["iaRow"]->over_agnc_name = $d["deptRow"]->dept_name;
$d["iaRow"]->save();
}
@@ -458,7 +464,8 @@ public function loadDeptStuff($deptID = -3)
$d["deptAddy"] .= $d["deptRow"]->dept_address2 . ', ';
}
$d["deptAddy"] .= $d["deptRow"]->dept_address_city . ', '
- . $d["deptRow"]->dept_address_state . ' ' . $d["deptRow"]->dept_address_zip;
+ . $d["deptRow"]->dept_address_state . ' '
+ . $d["deptRow"]->dept_address_zip;
$d["iaAddy"] = '';
if (isset($d["iaRow"]->over_address)
&& trim($d["iaRow"]->over_address) != '') {
@@ -508,6 +515,10 @@ public function loadDeptStuff($deptID = -3)
];
}
}
+ $chk = OPzEditDepartments::where('zed_dept_dept_id', $deptID)
+ ->select('zed_dept_dept_id')
+ ->get();
+ $d["editCnt"] = $chk->count();
$GLOBALS["SL"]->x["depts"][$deptID] = $d;
}
return true;
diff --git a/src/Controllers/OpenComplaintConditions.php b/src/Controllers/OpenComplaintConditions.php
index e9c15c1..c8801ff 100644
--- a/src/Controllers/OpenComplaintConditions.php
+++ b/src/Controllers/OpenComplaintConditions.php
@@ -556,6 +556,22 @@ protected function condPrintAnonOnly($complaint)
return 0;
}
+ /**
+ * Checks whether or not the incident record indicates
+ * that the location should be printed.
+ *
+ * @return int
+ */
+ protected function canPrintIncidentLocation()
+ {
+ return (isset($this->sessData->dataSets["incidents"])
+ && isset($this->sessData->dataSets["incidents"][0])
+ && isset($this->sessData->dataSets["incidents"][0]->inc_public)
+ && intVal($this->sessData->dataSets["incidents"][0]->inc_public) == 1
+ && in_array($this->sessData->dataSets["complaints"][0]->com_status,
+ [200, 201, 202, 203, 204]));
+ }
+
/**
* Checks whether or not the incident location
* should be printed for the current page load.
@@ -564,10 +580,7 @@ protected function condPrintAnonOnly($complaint)
*/
protected function condPrintIncidentLocation()
{
- if (isset($this->sessData->dataSets["incidents"])
- && isset($this->sessData->dataSets["incidents"][0])
- && isset($this->sessData->dataSets["incidents"][0]->inc_public)
- && intVal($this->sessData->dataSets["incidents"][0]->inc_public) == 1) {
+ if ($this->canPrintIncidentLocation()) {
return 1;
}
if ((isset($this->v["isAdmin"]) && $this->v["isAdmin"])
diff --git a/src/Controllers/OpenComplaintEmails.php b/src/Controllers/OpenComplaintEmails.php
index 7dee75c..8df2d6f 100644
--- a/src/Controllers/OpenComplaintEmails.php
+++ b/src/Controllers/OpenComplaintEmails.php
@@ -23,7 +23,8 @@ class OpenComplaintEmails extends OpenPoliceEvents
protected function postContactEmail($nID)
{
$this->postNodeLoadEmail($nID);
- if ($GLOBALS["SL"]->REQ->has('n831fld') && trim($GLOBALS["SL"]->REQ->n831fld) != '') {
+ if ($GLOBALS["SL"]->REQ->has('n831fld')
+ && trim($GLOBALS["SL"]->REQ->n831fld) != '') {
return true;
}
$emaSubject = $this->postDumpFormEmailSubject();
@@ -85,7 +86,8 @@ protected function postDumpFormEmailSubject()
}
return $ret;
}
- return $GLOBALS["SL"]->sysOpts["site-name"] . ': ' . $GLOBALS["SL"]->treeRow->tree_name;
+ return $GLOBALS["SL"]->sysOpts["site-name"] . ': '
+ . $GLOBALS["SL"]->treeRow->tree_name;
}
protected function processTokenAccessRedirExtra()
@@ -633,17 +635,15 @@ public function prepEmailComDataRow($deptRow, $cnt)
->where('lnk_com_over_dept_id', $deptRow->dept_id)
//->where('lnk_com_over_over_id', $this->v["comDepts"][0][$w]->over_id)
->first();
- /*
- if (!$this->v["comDepts"][$cnt]["overDates"]
+ /* if (!$this->v["comDepts"][$cnt]["overDates"]
|| !isset($this->v["comDepts"][$cnt]["overDates"]->lnk_com_dept_id)) {
$lnk = new OPLinksComplaintOversight;
$lnk->lnk_com_over_complaint_id = $this->coreID;
$lnk->lnk_com_over_dept_id = $deptRow->dept_id;
$lnk->lnk_com_over_over_id = $this->v["comDepts"][0][$w]->over_id;
+ $lnk->save();
$this->v["comDepts"][$cnt]["overDates"] = $lnk;
- $this->v["comDepts"][$cnt]["overDates"]->save();
- }
- */
+ } */
return true;
}
diff --git a/src/Controllers/OpenComplaintPrints.php b/src/Controllers/OpenComplaintPrints.php
index 4e72e94..3bf874b 100644
--- a/src/Controllers/OpenComplaintPrints.php
+++ b/src/Controllers/OpenComplaintPrints.php
@@ -113,7 +113,7 @@ protected function printEndOfComplaintRedirect($nID)
. $this->sessData->dataSets["compliments"][0]->compli_public_id;
}
$spin = $GLOBALS["SL"]->sysOpts["spinner-code"];
- $this->restartSess($GLOBALS["SL"]->REQ);
+ //$this->restartSess($GLOBALS["SL"]->REQ);
return '
'; print_r($done); echo 'rejects:
'; print_r($rejects); echo ''; exit; +//echo 'priority:
'; print_r($this->v["deptPriorityRows"]); print_r($chk); echo ''; exit; return $this->v["deptPriorityRows"]; } + /** + * Prepare the list of departments which need most urgent help with research. + * + * @return boolean + */ + protected function isDeptBeingEdited($deptID) + { + if ($deptID <= 0) { + return ''; + } + if (!isset($GLOBALS["SL"]->x["deptEditing"])) { + $GLOBALS["SL"]->x["deptEditing"] = []; + } + if (!isset($GLOBALS["SL"]->x["deptEditing"][$deptID])) { + $GLOBALS["SL"]->x["deptEditing"][$deptID] = ''; + $this->v["twohrs"] = mktime( + date("H")-2, date("i"), date("s"), date("m"), date("d"), date("Y") + ); + $chk = SLSess::where('sess_tree', 36) + ->where('sess_core_id', $deptID) + ->where('sess_is_active', 1) + ->where('sess_user_id', 'NOT LIKE', $this->v["uID"]) + ->orderBy('updated_at', 'desc') + ->get(); + if ($chk->isNotEmpty()) { + foreach ($chk as $sess) { +//echo '
'; print_r($sess); echo ''; + $editing = 0; + if ($this->v["twohrs"] < strtotime($sess->updated_at)) { + $editing = strtotime($sess->updated_at); +//echo 'A editing: ' . $editing . '
No police departments found by searching "{{ $search }}" in - {{ $stateName }}. + {{ + ((trim($stateName) != '') ? $stateName + : 'Federal Law Enforcement') + }}. Please type something else in the search bar above.
Police Complaint Interchange Format (PCIF) is a data format +for exchanging civilian reports of negative encounters with +law enforcement entities. PCIF allows a report to be consistently +collected and disseminated across diverse systems and jurisdictions, +including among and between criminal justice advocacy organizations, +civilian police oversight groups, academics, law enforcement agencies, +and private enterprise (such as insurance companies). +
+PCIF is currently available as an XML-based export option on +OpenPolice.org, and will soon also be available in JSON. It will +soon also be available for export on Raheem.ai. We welcome your +collaboration in developing these open standards. +
+ PCIF XML Schema: openpolice.org/api/complaints-pcif-schema-xml
\ No newline at end of file diff --git a/src/Views/dept-page-filing-instructs-file-btn.blade.php b/src/Views/dept-page-filing-instructs-file-btn.blade.php index 3b586db..7de4dfe 100644 --- a/src/Views/dept-page-filing-instructs-file-btn.blade.php +++ b/src/Views/dept-page-filing-instructs-file-btn.blade.php @@ -1,18 +1,22 @@ - -dept_slug }}" -*/ ?> - + diff --git a/src/Views/dept-page-filing-instructs.blade.php b/src/Views/dept-page-filing-instructs.blade.php index 36203f6..4fc1b7e 100644 --- a/src/Views/dept-page-filing-instructs.blade.php +++ b/src/Views/dept-page-filing-instructs.blade.php @@ -180,12 +180,20 @@ Regardless, we recommend you print and send your paper complaint to the department by USPS Certified Mail. + target="_blank">USPS Certified Mail