diff --git a/app/Console/Commands/Finances/HoldingFinances.php b/app/Console/Commands/Finances/HoldingFinances.php index c81bc9c09..95bc7253a 100644 --- a/app/Console/Commands/Finances/HoldingFinances.php +++ b/app/Console/Commands/Finances/HoldingFinances.php @@ -61,6 +61,7 @@ class HoldingFinancesCommand extends Command //Get the total pages for the journal for the holding corporation $pages = $finance->GetJournalPageCount(1, $config['primary']); + dd($pages); //Dispatch a single job for each page to process for($i = 1; $i <= $pages; $i++) { @@ -73,6 +74,7 @@ class HoldingFinancesCommand extends Command //Get the total pages for the journal for the sov bills from the holding corporation $pages = $finance->GetJournalPageCount(6, $config['primary']); + dd($pages); //Dispatch a job for each page to process for($i = 1; $i <= $pages; $i++) { diff --git a/app/Library/Finances/Helper/FinanceHelper.php b/app/Library/Finances/Helper/FinanceHelper.php index 7569d89b6..1067b5fda 100644 --- a/app/Library/Finances/Helper/FinanceHelper.php +++ b/app/Library/Finances/Helper/FinanceHelper.php @@ -94,8 +94,11 @@ class FinanceHelper { return null; } - //Set the total pages we need to cycle through. - $totalPages = $journals->pages; + if($currentPage == 1) { + //Set the total pages we need to cycle through. + $totalPages = $journals->pages; + } + //Decode the wallet from json into an array $wallet = json_decode($journals->raw, true); //For each journal entry, attempt to store it in the database. @@ -115,7 +118,7 @@ class FinanceHelper { $industry->InsertStructureIndustryTax($entry, $corpId, $division); } else if($entry['ref_type'] == 'office_rental_fee' && $entry['second_party_id'] == 98287666) { $office->InsertOfficeFee($entry, $corpId, $division); - } else if($entry['ref_type'] == 'infrastructure_hub_maintenance') { + } else if($entry['ref_type'] == 'infrastructure_hub_maintenance' && $entry['first_party_id'] == 98287666) { $sovBillHelper->InsertSovBillExpense($entry, $corpId, $division); } } @@ -225,7 +228,7 @@ class FinanceHelper { $pi = new PlanetProductionTax; $esiHelper = new Esi; $lookup = new LookupHelper; - $sovBillHelper = new SovBillExpenses; + $sovBill = new SovBillExpenses; //Get the ESI refresh token for the corporation to add new wallet journals into the database $hasScope = $esiHelper->HaveEsiScope($charId, 'esi-wallet.read_corporation_wallets.v1'); @@ -260,7 +263,6 @@ class FinanceHelper { 'division' => $division, ]); } catch(RequestFailedException $e) { - //Log::warning($e->getEsiResponse()); return null; } @@ -285,8 +287,8 @@ class FinanceHelper { $office->InsertOfficeFee($entry, $corpId, $division); } else if($entry['ref_type'] == 'planetary_export_tax' || $entry['ref_type'] == 'planetary_import_tax') { $pi->InsertPlanetProductionTax($entry, $corpId, $division); - } else if($entry['ref_type'] == 'infrastructure_hub_maintenance') { - $sovBillHelper->InsertSovBillExpense($entry, $corpId, $division); + } else if($entry['ref_type'] == 'infrastructure_hub_maintenance' && $entry['first_party_id'] == 98287666) { + $sovBill->InsertSovBillExpense($entry, $corpId, $division); } } }