diff --git a/app/Console/Commands/corpJournal.php b/app/Console/Commands/corpJournal.php index 756f85485..be44a56e9 100644 --- a/app/Console/Commands/corpJournal.php +++ b/app/Console/Commands/corpJournal.php @@ -60,6 +60,7 @@ class CorpJournal extends Command private function GetJournal($charId) { $finances = new Finances(); + //Get the master wallet journal for the corporation for the character $finances->GetWalletJournal(1, $charId); } } diff --git a/app/Library/Esi.php b/app/Library/Esi.php index a2507e750..9ea3cdf02 100644 --- a/app/Library/Esi.php +++ b/app/Library/Esi.php @@ -66,6 +66,20 @@ class Esi { return $character->corporation_name; } + public function DecodeDate($date) { + //Find the end of the date + $dateEnd = strpos($date, "T"); + //Split the string up into date and time + $dateArr = str_split($date, $dateEnd); + //Trim the T and Z from the end of the second item in the array + $dateArr[1] = ltrim($dateArr[1], "T"); + $dateArr[1] = rtrim($dateArr[1], "Z"); + //Combine the date + $realDate = $dateArr[0] . " " . $dateArr[1]; + + //Return the combined date in the correct format + return $realDate; + } } ?> \ No newline at end of file diff --git a/app/Library/Finances.php b/app/Library/Finances.php index a515ef3af..e5c8d211f 100644 --- a/app/Library/Finances.php +++ b/app/Library/Finances.php @@ -107,6 +107,10 @@ class Finances { } private function PutWalletJournal($journal, $corpId, $division) { + //Create ESI Helper class + $esiHelper = new Esi; + $date = $esiHelper->DecodeDate($journal['date']); + $check = DB::table('CorpJournals')->where('id', $journal['id'])->get(); //if we don't find the journal entry, add the journal entry to the database if($check->count() === 0) { @@ -126,7 +130,7 @@ class Finances { if(isset($journal['context_id_type'])) { $entry->context_id_type = $journal['context_id_type']; } - $entry->date = $journal['date']; + $entry->date = $date; $entry->description = $journal['description']; if(isset($journal['first_party_id'])) { $entry->first_party_id = $journal['first_party_id'];