Skip to content

Commit

Permalink
Merge pull request #305 from Ansteorra/warranting-feature-branch
Browse files Browse the repository at this point in the history
bug fixes and deployment fixes
  • Loading branch information
jhandel authored Jan 2, 2025
2 parents 694bfbc + 9aa90c9 commit b474d7e
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 19 deletions.
Binary file modified app/config/Migrations/schema-dump-default.lock
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,12 @@ public function up(): void
"limit" => null,
"null" => false,
])
->addColumn("deputy_to_branch_id", "integer", [
->addColumn("reports_to_branch_id", "integer", [
"default" => null,
"limit" => 11,
"null" => true,
])
->addColumn("deputy_to_office_id", "integer", [
->addColumn("reports_to_office_id", "integer", [
"default" => null,
"limit" => 11,
"null" => true,
Expand Down Expand Up @@ -280,7 +280,7 @@ public function up(): void
->update();
$this->table("officers_officers")
->addForeignKey(
"deputy_to_branch_id",
"reports_to_branch_id",
"branches",
"id",
[
Expand Down Expand Up @@ -316,7 +316,7 @@ public function up(): void
],
)
->addForeignKey(
"deputy_to_office_id",
"reports_to_office_id",
"officers_offices",
"id",
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,19 @@ public function change(): void
->update();

$table = $this->table('officers_officers');
$table->addColumn("reports_to_branch_id", "integer", [
$table->addColumn("deputy_to_branch_id", "integer", [
"default" => null,
"limit" => 11,
"null" => true,
]);
$table->addColumn("reports_to_office_id", "integer", [
$table->addColumn("deputy_to_office_id", "integer", [
"default" => null,
"limit" => 11,
"null" => true,
]);

$table->addForeignKey(
"reports_to_branch_id",
"deputy_to_branch_id",
"branches",
"id",
[
Expand All @@ -66,7 +66,7 @@ public function change(): void
],
);
$table->addForeignKey(
"reports_to_office_id",
"deputy_to_office_id",
"officers_offices",
"id",
[
Expand Down
12 changes: 8 additions & 4 deletions app/plugins/Officers/src/Services/DefaultOfficerManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,16 @@ public function assign(
if (!$awResult->success) {
return new ServiceResult(false, $awResult->reason);
}

$newOfficer = $officerTable->get($newOfficer->id);
$branchTable = TableRegistry::getTableLocator()->get('Branches');
$branch = $branchTable->get($branchId);
$member = TableRegistry::getTableLocator()->get('Members')->get($memberId);
if ($office->requires_warrant) {
$branchTable = TableRegistry::getTableLocator()->get('Branches');
$branch = $branchTable->get($branchId);
$newOfficer = $officerTable->get($newOfficer->id);


$warrantRequest = new WarrantRequest("Hiring Warrant: $branch->name - $office->name", 'Officers.Officers', $newOfficer->id, $approverId, $memberId, $startOn, $endOn, $newOfficer->granted_member_role_id);
$member = TableRegistry::getTableLocator()->get('Members')->get($memberId);

$wmResult = $this->warrantManager->request("$office->name : $member->sca_name", "", [$warrantRequest]);
if (!$wmResult->success) {
return new ServiceResult(false, $wmResult->reason);
Expand Down
7 changes: 0 additions & 7 deletions app/plugins/Officers/src/View/Cell/BranchOfficersCell.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,6 @@ protected function addConditions($q, $type)

$reportsToCase = $q->newExpr()
->case()
->when(['DeputyToOffices.id IS NOT NULL'])
->then($q->func()->concat([
"DeputyToOffices.name" => 'identifier',
" (",
"Officers.deputy_description" => 'identifier',
")"
]))
->when(['ReportsToOffices.id IS NULL'])
->then("Society")
->when(['current_report_to.id IS NOT NULL'])
Expand Down

0 comments on commit b474d7e

Please sign in to comment.