andrewdwallo / erpsaas

A Laravel and Filament-powered accounting platform, crafting a modern and automated solution for financial management.
MIT License
580 stars 166 forks source link

Error while seeding database #55

Closed pratikkuikel closed 2 weeks ago

pratikkuikel commented 2 weeks ago

Steps to reproduce :

  1. Clone the repo
  2. Run composer, npm, publish filament assets, run npm dev server
  3. Set database as sqlite
  4. Generate key and run the migrations

Command : php artisan db:seed

 TypeError 

  App\Observers\TransactionObserver::convertToDefaultCurrency(): Argument #2 ($fromCurrency) must be of type string, null given, called in C:\Users\prati\OneDrive\Desktop\erpsaas\app\Observers\TransactionObserver.php on line 114

  at app\Observers\TransactionObserver.php:122
    118▕
    119▕         return $transaction->amount;
    120▕     }
    121▕
  ➜ 122▕     private function convertToDefaultCurrency(string $amount, string $fromCurrency, string $toCurrency): string    123▕     {
    124▕         $amountInCents = CurrencyConverter::prepareForAccessor($amount, $fromCurrency);
    125▕
    126▕         $convertedAmountInCents = CurrencyConverter::convertBalance($amountInCents, $fromCurrency, $toCurrency);

  1   app\Observers\TransactionObserver.php:114
      App\Observers\TransactionObserver::convertToDefaultCurrency("2,638.00", "USD")

  2   app\Observers\TransactionObserver.php:88
      App\Observers\TransactionObserver::getConvertedTransactionAmount(Object(App\Models\Accounting\Transaction)) 
Subeen928 commented 2 weeks ago

Got same issue.

andrewdwallo commented 2 weeks ago

It's weird that I didn't get this issue. Are both of yall using SQLite?

andrewdwallo commented 2 weeks ago

Both of you please update to latest release or try the logic mentioned in the new release and let me know if that fixes your issue. Thanks.

pratikkuikel commented 2 weeks ago

It's weird that I didn't get this issue. Are both of yall using SQLite?

Yesh, It's sqlite.

andrewdwallo commented 2 weeks ago

@pratikkuikel So the issue was only occurring when using SQLite? When using MySQL the error did not occur for you? Is everything working for you now on the latest release?

pratikkuikel commented 2 weeks ago

The previous release with issue, I didn't try that with mysql. But I can confirm that the latest release works fine with mysql too. yes, the issue is no longer present in sqlite after pulling in the latest release.