Selaa lähdekoodia

wip timezone handling

3.x
Andrew Wallo 2 kuukautta sitten
vanhempi
commit
9f8e4c891c

+ 1
- 1
app/Enums/Setting/WeekStart.php Näytä tiedosto

18
 
18
 
19
     public function getLabel(): ?string
19
     public function getLabel(): ?string
20
     {
20
     {
21
-        return today()->isoWeekday($this->value)->dayName;
21
+        return company_today()->isoWeekday($this->value)->dayName;
22
     }
22
     }
23
 }
23
 }

+ 2
- 2
app/Jobs/ProcessTransactionImport.php Näytä tiedosto

30
     public function handle(PlaidService $plaid, TransactionService $transactionService): void
30
     public function handle(PlaidService $plaid, TransactionService $transactionService): void
31
     {
31
     {
32
         $accessToken = $this->connectedBankAccount->access_token;
32
         $accessToken = $this->connectedBankAccount->access_token;
33
-        $endDate = Carbon::now()->toDateString();
33
+        $endDate = company_now()->toDateString();
34
         $startDate = Carbon::parse($this->startDate)->toDateString();
34
         $startDate = Carbon::parse($this->startDate)->toDateString();
35
         $allTransactions = [];
35
         $allTransactions = [];
36
         $offset = 0;
36
         $offset = 0;
64
             $transactionService->storeTransactions($this->company, $this->bankAccount, $newTransactions);
64
             $transactionService->storeTransactions($this->company, $this->bankAccount, $newTransactions);
65
 
65
 
66
             $this->connectedBankAccount->update([
66
             $this->connectedBankAccount->update([
67
-                'last_imported_at' => Carbon::now(),
67
+                'last_imported_at' => company_now(),
68
             ]);
68
             ]);
69
         }
69
         }
70
     }
70
     }

+ 2
- 2
app/Jobs/ProcessTransactionUpdate.php Näytä tiedosto

39
             $bufferDays = 15;
39
             $bufferDays = 15;
40
             $lastImportedAtDate = Carbon::parse($connectedBankAccount->last_imported_at);
40
             $lastImportedAtDate = Carbon::parse($connectedBankAccount->last_imported_at);
41
             $startDate = $lastImportedAtDate->subDays($bufferDays)->toDateString();
41
             $startDate = $lastImportedAtDate->subDays($bufferDays)->toDateString();
42
-            $endDate = Carbon::now()->toDateString();
42
+            $endDate = company_today()->toDateString();
43
 
43
 
44
             $transactionsResponse = $plaidService->getTransactions($accessToken, $startDate, $endDate, [
44
             $transactionsResponse = $plaidService->getTransactions($accessToken, $startDate, $endDate, [
45
                 'account_ids' => [$connectedBankAccount->external_account_id],
45
                 'account_ids' => [$connectedBankAccount->external_account_id],
67
                 $transactionService->storeTransactions($this->company, $bankAccount, $newTransactions);
67
                 $transactionService->storeTransactions($this->company, $bankAccount, $newTransactions);
68
 
68
 
69
                 $connectedBankAccount->update([
69
                 $connectedBankAccount->update([
70
-                    'last_imported_at' => Carbon::now(),
70
+                    'last_imported_at' => company_now(),
71
                 ]);
71
                 ]);
72
             }
72
             }
73
         }
73
         }

+ 1
- 1
app/Listeners/UpdateAccountBalances.php Näytä tiedosto

58
                         'type' => $transactionType,
58
                         'type' => $transactionType,
59
                         'amount' => $formattedSimpleDifference,
59
                         'amount' => $formattedSimpleDifference,
60
                         'payment_channel' => 'other',
60
                         'payment_channel' => 'other',
61
-                        'posted_at' => today(),
61
+                        'posted_at' => company_today(),
62
                         'description' => $description,
62
                         'description' => $description,
63
                         'pending' => false,
63
                         'pending' => false,
64
                         'reviewed' => false,
64
                         'reviewed' => false,

+ 2
- 2
app/Providers/MacroServiceProvider.php Näytä tiedosto

176
             $localization = Localization::firstOrFail();
176
             $localization = Localization::firstOrFail();
177
 
177
 
178
             $dateFormat = $localization->date_format->value ?? DateFormat::DEFAULT;
178
             $dateFormat = $localization->date_format->value ?? DateFormat::DEFAULT;
179
-            $timezone = $localization->timezone ?? Carbon::now()->timezoneName;
179
+            $timezone = $localization->timezone ?? company_now()->timezoneName;
180
 
180
 
181
             $this->date($dateFormat, $timezone);
181
             $this->date($dateFormat, $timezone);
182
 
182
 
187
             $localization = Localization::firstOrFail();
187
             $localization = Localization::firstOrFail();
188
 
188
 
189
             $dateFormat = $localization->date_format->value ?? DateFormat::DEFAULT;
189
             $dateFormat = $localization->date_format->value ?? DateFormat::DEFAULT;
190
-            $timezone = $localization->timezone ?? Carbon::now()->timezoneName;
190
+            $timezone = $localization->timezone ?? company_now()->timezoneName;
191
 
191
 
192
             $this->displayFormat($dateFormat)
192
             $this->displayFormat($dateFormat)
193
                 ->timezone($timezone);
193
                 ->timezone($timezone);

+ 1
- 1
app/Services/AccountService.php Näytä tiedosto

372
     {
372
     {
373
         $earliestDate = Transaction::min('posted_at');
373
         $earliestDate = Transaction::min('posted_at');
374
 
374
 
375
-        return $earliestDate ?? today()->toDateTimeString();
375
+        return $earliestDate ?? company_today()->toDateTimeString();
376
     }
376
     }
377
 
377
 
378
     public function getUnpaidClientInvoices(?string $asOfDate = null): Builder
378
     public function getUnpaidClientInvoices(?string $asOfDate = null): Builder

+ 2
- 2
app/Services/ExportService.php Näytä tiedosto

28
             $dateLabel = $formattedAsOfDate;
28
             $dateLabel = $formattedAsOfDate;
29
         }
29
         }
30
 
30
 
31
-        $timestamp = Carbon::now()->format('Y-m-d_H-i-s');
31
+        $timestamp = company_now()->format('Y-m-d_H-i-s');
32
 
32
 
33
         $filename = $company->name . ' ' . $report->getTitle() . ' ' . $dateLabel . ' ' . $timestamp . '.csv';
33
         $filename = $company->name . ' ' . $report->getTitle() . ' ' . $dateLabel . ' ' . $timestamp . '.csv';
34
 
34
 
269
             $dateLabel = $formattedAsOfDate;
269
             $dateLabel = $formattedAsOfDate;
270
         }
270
         }
271
 
271
 
272
-        $timestamp = Carbon::now()->format('Y-m-d_H-i-s');
272
+        $timestamp = company_now()->format('Y-m-d_H-i-s');
273
 
273
 
274
         $filename = $company->name . ' ' . $report->getTitle() . ' ' . $dateLabel . ' ' . $timestamp . '.pdf';
274
         $filename = $company->name . ' ' . $report->getTitle() . ' ' . $dateLabel . ' ' . $timestamp . '.pdf';
275
 
275
 

+ 1
- 1
app/Support/ScheduleHandler.php Näytä tiedosto

22
 
22
 
23
     public function __construct(Set $set, ?Get $get = null)
23
     public function __construct(Set $set, ?Get $get = null)
24
     {
24
     {
25
-        $this->today = today()->toImmutable();
25
+        $this->today = company_today()->toImmutable();
26
         $this->set = $set;
26
         $this->set = $set;
27
         $this->get = $get;
27
         $this->get = $get;
28
     }
28
     }

Loading…
Peruuta
Tallenna