process mining taxes ledgers update to disregard updating previously saved ledgers to prevent future errors
This commit is contained in:
@@ -92,20 +92,7 @@ class ProcessMiningTaxesLedgers implements ShouldQueue
|
|||||||
'last_updated' => $this->ledger->last_updated,
|
'last_updated' => $this->ledger->last_updated,
|
||||||
])->count();
|
])->count();
|
||||||
|
|
||||||
if($found > 0) {
|
if($found == 0) {
|
||||||
Ledger::where([
|
|
||||||
'character_id' => $this->ledger->character_id,
|
|
||||||
'character_name' => $charName,
|
|
||||||
'observer_id' => $this->observerId,
|
|
||||||
'type_id' => $this->ledger->type_id,
|
|
||||||
'quantity' => $this->ledger->quantity,
|
|
||||||
'last_updated' => $this->ledger->last_updated,
|
|
||||||
])->update([
|
|
||||||
'last_updated' => $this->ledger->last_updated,
|
|
||||||
'quantity' => $this->ledger->quantity,
|
|
||||||
'amount' => $amount,
|
|
||||||
]);
|
|
||||||
} else {
|
|
||||||
$ledg = new Ledger;
|
$ledg = new Ledger;
|
||||||
$ledg->character_id = $this->ledger->character_id;
|
$ledg->character_id = $this->ledger->character_id;
|
||||||
$ledg->character_name = $charName;
|
$ledg->character_name = $charName;
|
||||||
|
|||||||
@@ -14,8 +14,9 @@ use App\Library\Helpers\LookupHelper;
|
|||||||
//Models
|
//Models
|
||||||
use App\Models\MiningTax\Invoice;
|
use App\Models\MiningTax\Invoice;
|
||||||
use App\Models\MiningTax\Ledger;
|
use App\Models\MiningTax\Ledger;
|
||||||
use App\Models\User\User;
|
|
||||||
use App\Models\User\UserAlt;
|
//Jobs
|
||||||
|
use App\Jobs\Commands\Eve\SendEveMail;
|
||||||
|
|
||||||
class MiningTaxHelper {
|
class MiningTaxHelper {
|
||||||
/**
|
/**
|
||||||
@@ -30,12 +31,12 @@ class MiningTaxHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the main character ledgers and send back as a collection
|
* Get the ledgers for a certain character and send back as a collection
|
||||||
*
|
*
|
||||||
* @var $charId
|
* @var $charId
|
||||||
* @return collection $ledgers
|
* @return collection $ledgers
|
||||||
*/
|
*/
|
||||||
public function GetMainLedgers($charId) {
|
public function GetLedgers(int $charId) {
|
||||||
$ledgers = new Collection;
|
$ledgers = new Collection;
|
||||||
|
|
||||||
$rowCount = Ledger::where([
|
$rowCount = Ledger::where([
|
||||||
@@ -43,12 +44,12 @@ class MiningTaxHelper {
|
|||||||
'invoiced' => 'No',
|
'invoiced' => 'No',
|
||||||
])->count();
|
])->count();
|
||||||
|
|
||||||
|
if($rowCount > 0) {
|
||||||
$rows = Ledger::where([
|
$rows = Ledger::where([
|
||||||
'character_id' => $charId,
|
'character_id' => $charId,
|
||||||
'invoiced' => 'No',
|
'invoiced' => 'No',
|
||||||
])->get()->toArry();
|
])->get()->toArray();
|
||||||
|
|
||||||
if($rowCount > 0) {
|
|
||||||
foreach($rows as $row) {
|
foreach($rows as $row) {
|
||||||
$ledgers->push($row);
|
$ledgers->push($row);
|
||||||
}
|
}
|
||||||
@@ -58,16 +59,14 @@ class MiningTaxHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the alt characters ledgers and send back as a collection
|
* Create the invoice and mail it
|
||||||
|
*
|
||||||
|
* @var int $charId
|
||||||
|
* @var collection $ledgers
|
||||||
|
* @var int $mailDelay
|
||||||
*
|
*
|
||||||
* @var array $alts
|
|
||||||
* @return collection ledgers
|
|
||||||
*/
|
*/
|
||||||
public function GetAltLedgers($alts) {
|
public function MailMiningInvoice(int $charId, collection $ledgers, int &$mailDelay) {
|
||||||
$ledgers = new Collection;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user