New cron job for bills.

This commit is contained in:
James Cole
2022-03-28 12:23:46 +02:00
parent e5a08d2cf1
commit f2849c8058
29 changed files with 714 additions and 142 deletions

View File

@@ -51,7 +51,7 @@ class BillFactory
{
Log::debug(sprintf('Now in %s', __METHOD__), $data);
$factory = app(TransactionCurrencyFactory::class);
$currency = $factory->find((int)($data['currency_id'] ?? null), (string)($data['currency_code'] ?? null)) ??
$currency = $factory->find((int) ($data['currency_id'] ?? null), (string) ($data['currency_code'] ?? null)) ??
app('amount')->getDefaultCurrencyByUser($this->user);
try {
@@ -82,7 +82,7 @@ class BillFactory
}
if (array_key_exists('notes', $data)) {
$this->updateNote($bill, (string)$data['notes']);
$this->updateNote($bill, (string) $data['notes']);
}
$objectGroupTitle = $data['object_group_title'] ?? '';
if ('' !== $objectGroupTitle) {
@@ -93,7 +93,7 @@ class BillFactory
}
}
// try also with ID:
$objectGroupId = (int)($data['object_group_id'] ?? 0);
$objectGroupId = (int) ($data['object_group_id'] ?? 0);
if (0 !== $objectGroupId) {
$objectGroup = $this->findObjectGroupById($objectGroupId);
if (null !== $objectGroup) {
@@ -113,8 +113,8 @@ class BillFactory
*/
public function find(?int $billId, ?string $billName): ?Bill
{
$billId = (int)$billId;
$billName = (string)$billName;
$billId = (int) $billId;
$billName = (string) $billName;
$bill = null;
// first find by ID:
if ($billId > 0) {