Skip to content

Commit e31f129

Browse files
authored
Merge pull request #2425 from Blair2004/v6.0.x
V6.0.x
2 parents 3dfe175 + e0682f6 commit e31f129

File tree

58 files changed

+2179
-115
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+2179
-115
lines changed

.github/instructions/nexopos-blade-layouts.instructions.md

Lines changed: 566 additions & 0 deletions
Large diffs are not rendered by default.

.github/instructions/nexopos-httpclient.instructions.md

Lines changed: 608 additions & 0 deletions
Large diffs are not rendered by default.

.github/instructions/nexopos-modules.instructions.md

Lines changed: 845 additions & 0 deletions
Large diffs are not rendered by default.

.github/instructions/nexopos.instructions.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,5 @@ At the root of the directory, we might also have some laravel (or laravel packag
9494
.github/instructions/nexopos-localization.instructions.md
9595
.github/instructions/nexopos-forminput.instructions.md
9696
.github/instructions/nexopos-roles-permissions.instructions.md
97-
.github/instructions/nexopos-crud.instructions.md
97+
.github/instructions/nexopos-crud.instructions.md
98+
.github/instructions/nexopos-modules.instructions.md

app/Console/Commands/AutoTranslateCommand.php

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,25 @@ public function handle(): int
5555

5656
$targetFiles = [];
5757
if ($this->option('file')) {
58-
$single = $langPath . DIRECTORY_SEPARATOR . $this->option('file');
59-
if (!is_file($single)) {
60-
$this->error('Specified file not found: ' . $single);
58+
// the option file might consist of multiple files separated by commas
59+
$files = explode(',', $this->option('file'));
60+
61+
foreach ($files as $file) {
62+
$file = trim($file);
63+
if (empty($file)) { continue; }
64+
$single = $langPath . DIRECTORY_SEPARATOR . $file;
65+
if (!is_file($single)) {
66+
$this->error('Specified file not found: ' . $single);
67+
return self::FAILURE;
68+
}
69+
$targetFiles[] = $single;
70+
}
71+
72+
if (empty($targetFiles)) {
73+
$this->error('No valid files specified.');
6174
return self::FAILURE;
6275
}
63-
$targetFiles[] = $single;
76+
6477
} else {
6578
foreach (glob($langPath . DIRECTORY_SEPARATOR . '*.json') as $file) {
6679
if (basename($file) === 'en.json') { continue; }
@@ -108,13 +121,16 @@ public function handle(): int
108121
];
109122
try {
110123
$response = Http::timeout(30)->post($endpoint . '/translate', $payload);
111-
if ($response->failed()) { $errors++; continue; }
124+
if ($response->failed()) {
125+
$errors++; continue;
126+
}
112127
$json = $response->json();
113128
if (!is_array($json) || !array_key_exists('translated', $json)) { $errors++; continue; }
114129
$data[$key] = $json['translated'];
115130
$translatedCount++;
116131
} catch (\Throwable $e) {
117132
$errors++;
133+
$this->error("Error translating key '{$key}': " . $e->getMessage());
118134
}
119135
}
120136
$this->output->progressFinish();

app/Http/Controllers/DashboardController.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@
1010

1111
use App\Models\Customer;
1212
use App\Models\DashboardDay;
13+
use App\Models\Notification;
1314
use App\Models\Order;
1415
use App\Models\Role;
1516
use App\Services\DateService;
1617
use Carbon\Carbon;
18+
use Illuminate\Http\Request;
1719
use Illuminate\Support\Facades\View;
1820

1921
class DashboardController extends Controller
@@ -126,4 +128,17 @@ public function getWeekReports()
126128
'result' => $weekMap,
127129
];
128130
}
131+
132+
public function createSymbolicLinks( Request $request )
133+
{
134+
// we might delete the notification that is provided on the query parameters
135+
if ( $request->has( 'notification_id' ) ) {
136+
$notification = Notification::find( $request->get( 'notification_id' ) );
137+
if ( $notification ) {
138+
$notification->delete();
139+
}
140+
}
141+
142+
ns()->createSymbolicLinks();
143+
}
129144
}

app/Services/CoreService.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Carbon\Carbon;
1616
use Illuminate\Support\Collection;
1717
use Illuminate\Support\Facades\App;
18+
use Illuminate\Support\Facades\Artisan;
1819
use Illuminate\Support\Facades\Auth;
1920
use Illuminate\Support\Facades\Cache;
2021
use Illuminate\Support\Facades\Gate;
@@ -375,7 +376,7 @@ public function checkModulesSymbolicLinks(): void
375376
/**
376377
* We'll check if the links is broken
377378
*/
378-
if ( is_link( public_path( 'modules/' . $tolowercase ) ) ) {
379+
if ( ! is_link( public_path( 'modules/' . $tolowercase ) ) ) {
379380
$notification = Notification::where( 'identifier', 'symlink-' . $tolowercase )->first();
380381

381382
if ( ! $notification instanceof Notification ) {
@@ -405,6 +406,7 @@ public function checkSymbolicLinks(): void
405406
{
406407
if ( ! file_exists( public_path( 'storage' ) ) ) {
407408
$notification = Notification::where( 'identifier', NotificationsEnum::NSSYMBOLICLINKSMISSING )
409+
->where( 'user_id', Auth::id() )
408410
->first();
409411

410412
if ( ! $notification instanceof Notification ) {
@@ -417,6 +419,13 @@ public function checkSymbolicLinks(): void
417419
source: 'system',
418420
url: 'https://my.nexopos.com/en/documentation/troubleshooting/broken-media-images?utm_source=nexopos&utm_campaign=warning&utm_medium=app',
419421
description: __( 'The Symbolic Links to the public directory is missing. Your medias might be broken and not display.' ),
422+
actions: [
423+
[
424+
'label' => __( 'Fix it' ),
425+
'url' => route( 'ns.dashboard.system.fix-symbolic-links' ),
426+
'type' => 'primary',
427+
]
428+
]
420429
)->dispatchForGroup( Role::namespace( Role::ADMIN ) );
421430
}
422431
} else {
@@ -629,4 +638,15 @@ public function moduleViteAssets( string $fileName, $moduleId ): string
629638

630639
return $assets->flatten()->join( '' );
631640
}
641+
642+
public function createSymbolicLinks(): void
643+
{
644+
// we'll first delete any symbolic links that might exists
645+
if ( file_exists( public_path( 'storage' ) ) ) {
646+
@unlink( public_path( 'storage' ) );
647+
}
648+
649+
// We'll create a symbolic link using the command line
650+
Artisan::call( 'storage:link' );
651+
}
632652
}

config/nexopos.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* This is the core version of NexoPOS. This is used to displays on the
1010
* dashboard and to ensure a compatibility with the modules.
1111
*/
12-
'version' => '6.0.3',
12+
'version' => '6.0.4',
1313

1414
/**
1515
* --------------------------------------------------------------------

public/build/assets/app-d272526e.js renamed to public/build/assets/app-9bc70a03.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/build/assets/auth-1dd0a272.js renamed to public/build/assets/auth-0d3e6549.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)