Skip to content

Commit

Permalink
Merge pull request #1164 from Blair2004/v4.8.x
Browse files Browse the repository at this point in the history
V4.8.x
  • Loading branch information
nexopos authored Nov 7, 2022
2 parents 2458aa9 + 1682d80 commit 2607582
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/Casts/FloatConvertCasting.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class FloatConvertCasting implements CastsAttributes
*/
public function get($model, string $key, $value, array $attributes)
{
return ns()->currency->getRaw( $value );
return ns()->math->set( $value ?: 0 )->toFloat();
}

/**
Expand Down
4 changes: 4 additions & 0 deletions app/Jobs/RecomputeCashFlowForDate.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use App\Models\Role;
use App\Services\ReportService;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
Expand Down Expand Up @@ -40,6 +41,9 @@ public function handle()
Auth::login( $user );
}

$this->fromDate = Carbon::parse( $this->fromDate );
$this->toDate = Carbon::parse( $this->toDate );

/**
* @var ReportService $reportService
*/
Expand Down
4 changes: 3 additions & 1 deletion app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use App\Services\DemoService;
use App\Services\ExpenseService;
use App\Services\Helper;
use App\Services\MathService;
use App\Services\MediaService;
use App\Services\MenuService;
use App\Services\NotificationService;
Expand Down Expand Up @@ -129,7 +130,8 @@ public function register()
app()->make( OrdersService::class ),
app()->make( NotificationService::class ),
app()->make( ProcurementService::class ),
app()->make( Options::class )
app()->make( Options::class ),
app()->make( MathService::class )
);
});

Expand Down
3 changes: 2 additions & 1 deletion app/Services/CoreService.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public function __construct(
public OrdersService $order,
public NotificationService $notification,
public ProcurementService $procurement,
public Options $option
public Options $option,
public MathService $math
) {
// ...
}
Expand Down
12 changes: 12 additions & 0 deletions app/Services/MathService.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
namespace App\Services;

use Brick\Math\BigNumber;

class MathService
{
public function set( $value )
{
return BigNumber::of( $value );
}
}
8 changes: 6 additions & 2 deletions app/Services/UpdateService.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ public function getMigrations( $ignoreMigrations = false ): Collection
$migrations = Migration::get()->map( fn( $migration ) => $migration->migration );
}

$files = collect( Storage::disk( 'ns' )->allFiles( 'database/migrations' ) )->map( function( $file ) {
$files = collect( Storage::disk( 'ns' )->allFiles( 'database/migrations' ) )
->filter( fn( $file ) => pathinfo( $file )[ 'extension' ] === 'php' )
->map( function( $file ) {
$fileInfo = pathinfo( $file );

return $fileInfo[ 'filename' ];
Expand All @@ -41,7 +43,9 @@ public function getMigrations( $ignoreMigrations = false ): Collection

public function getMatchingFullPath( $file )
{
$files = collect( Storage::disk( 'ns' )->allFiles( 'database/migrations' ) )->mapWithKeys( function( $file ) {
$files = collect( Storage::disk( 'ns' )->allFiles( 'database/migrations' ) )
->filter( fn( $file ) => pathinfo( $file )[ 'extension' ] === 'php' )
->mapWithKeys( function( $file ) {
$fileInfo = pathinfo( $file );

return [ $fileInfo[ 'filename' ] => $file ];
Expand Down
2 changes: 1 addition & 1 deletion config/nexopos.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

return [
'version' => '4.8.7',
'version' => '4.8.8',
'languages' => [
'en' => 'English',
'fr' => 'Français',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function up()
$fromDate = Carbon::parse( $order->created_at );
$toDate = ns()->date->copy()->endOfDay();

RecomputeCashFlowForDate::dispatch( $fromDate, $toDate )
RecomputeCashFlowForDate::dispatch( $fromDate->toDateTimeString(), $toDate->toDateTimeString() )
->delay( now()->addMinute() );
}
}
Expand Down
1 change: 1 addition & 0 deletions public/css/animations.cb4544d9bb06aeaa8e48.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions public/css/app.5fa7c899f29731ce3255.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions public/css/dark.0174d418deda1ce7827a.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions public/css/light.9e990100ce36c59d8156.css

Large diffs are not rendered by default.

0 comments on commit 2607582

Please sign in to comment.