-
diff --git a/Modules/M3/Console/ClosedOrderSaveXls.php b/Modules/M3/Console/ClosedOrderSaveXls.php
index a8ba70b4..b967b492 100755
--- a/Modules/M3/Console/ClosedOrderSaveXls.php
+++ b/Modules/M3/Console/ClosedOrderSaveXls.php
@@ -87,16 +87,13 @@ class ClosedOrderSaveXls extends Command
: $warehouse . '/Closedorderlinesreport_' . $from . '-' . $to . '-' . $warehouse . self::XLSX_EXTENSION;
$this->info('Generate Last Month Report...');
- $this->generateReport(
- $company,
- $warehouse,
- $plant,
- str_replace('-', '', $from),
- str_replace('-', '', $to),
- $file,
- ! Storage::disk('publicCL')->exists($file),
- 'Last Month',
- );
+ $this->generateReport($company, $warehouse, $plant, [
+ 'from' => str_replace('-', '', $from),
+ 'to' => str_replace('-', '', $to),
+ 'file' => $file,
+ 'shouldGenerate' => ! Storage::disk('publicCL')->exists($file),
+ 'label' => 'Last Month',
+ ]);
}
private function generateCurrentMonthReport(string $company, string $warehouse, string $plant): void
@@ -109,47 +106,40 @@ class ClosedOrderSaveXls extends Command
: $warehouse . '/first_of_month_to_current_date_' . $warehouse . self::XLSX_EXTENSION;
$this->info('Generate Current Month Report...');
- $this->generateReport(
- $company,
- $warehouse,
- $plant,
- str_replace('-', '', $from),
- str_replace('-', '', $to),
- $file,
- true,
- 'Current Month',
- );
+ $this->generateReport($company, $warehouse, $plant, [
+ 'from' => str_replace('-', '', $from),
+ 'to' => str_replace('-', '', $to),
+ 'file' => $file,
+ 'shouldGenerate' => true,
+ 'label' => 'Current Month',
+ ]);
}
private function generateReport(
string $company,
string $warehouse,
string $plant,
- string $from,
- string $to,
- string $file,
- bool $shouldGenerate,
- string $label,
+ array $report,
): void {
- $this->info('From Date: ' . $from);
- $this->info('To Date: ' . $to);
+ $this->info('From Date: ' . $report['from']);
+ $this->info('To Date: ' . $report['to']);
- if (! $shouldGenerate || ! $this->hasReportScope($company, $warehouse, $plant)) {
+ if (! $report['shouldGenerate'] || ! $this->hasReportScope($company, $warehouse, $plant)) {
return;
}
- $rows = $this->closedOrderRows($company, $warehouse, $plant, $from, $to);
+ $rows = $this->closedOrderRows($company, $warehouse, $plant, $report['from'], $report['to']);
if ($rows->isEmpty()) {
- Log::channel('dailyCron')->info($label . ' report, no records found: Nothing to save...');
+ Log::channel('dailyCron')->info($report['label'] . ' report, no records found: Nothing to save...');
return;
}
$rows->prepend($this->headers());
$this->logRecordLimit($rows->count());
- $this->info('Saving ' . $label . ' Excel Report to Disk');
- Log::channel('dailyCron')->info('Saving ' . $label . ' Excel Report to Disk');
- app(SpreadsheetExport::class)->store($rows, $file, 'publicCL');
+ $this->info('Saving ' . $report['label'] . ' Excel Report to Disk');
+ Log::channel('dailyCron')->info('Saving ' . $report['label'] . ' Excel Report to Disk');
+ app(SpreadsheetExport::class)->store($rows, $report['file'], 'publicCL');
}
private function hasReportScope(string $company, string $warehouse, string $plant): bool
diff --git a/Modules/M3/Helpers/Helper.php b/Modules/M3/Helpers/Helper.php
index 9a994016..b9bd47d4 100755
--- a/Modules/M3/Helpers/Helper.php
+++ b/Modules/M3/Helpers/Helper.php
@@ -313,7 +313,7 @@ class Helper
public static function getUserCOWHSPLT()
{
- $defaults = [
+ $result = [
'UserCO' => '',
'UserWHS' => '',
'UserPL' => '',
@@ -321,32 +321,28 @@ class Helper
$loggedUser = strtoupper(trim((string) m3User()));
if ($loggedUser === '') {
- return $defaults;
+ return $result;
}
try {
- if (! Schema::connection(config('m3.connection', 'pgsql'))->hasTable('icm428m')) {
- return $defaults;
+ if (Schema::connection(config('m3.connection', 'pgsql'))->hasTable('icm428m')) {
+ $user = DB::connection(config('m3.connection', 'pgsql'))->table('icm428m')
+ ->select('R428US', 'R428ADMUSR', 'R428PWRUSR', 'R428CO', 'R428PL', 'R428WH', 'R42811A', 'R42821A')
+ ->where('R428US', $loggedUser)
+ ->first();
+
+ if ($user) {
+ $result = [
+ 'UserCO' => trim((string) ($user->R428CO ?? '')),
+ 'UserWHS' => trim((string) ($user->R428WH ?? '')),
+ 'UserPL' => trim((string) ($user->R428PL ?? '')),
+ ];
+ }
}
-
- $user = DB::connection(config('m3.connection', 'pgsql'))->table('icm428m')
- ->select('R428US', 'R428ADMUSR', 'R428PWRUSR', 'R428CO', 'R428PL', 'R428WH', 'R42811A', 'R42821A')
- ->where('R428US', $loggedUser)
- ->first();
-
- if (! $user) {
- return $defaults;
- }
-
- return [
- 'UserCO' => trim((string) ($user->R428CO ?? '')),
- 'UserWHS' => trim((string) ($user->R428WH ?? '')),
- 'UserPL' => trim((string) ($user->R428PL ?? '')),
- ];
} catch (\Throwable $e) {
\Illuminate\Support\Facades\Log::warning('M3 user context unavailable', ['exception' => $e->getMessage()]);
-
- return $defaults;
}
+
+ return $result;
}
}
diff --git a/Modules/M3/Http/Controllers/API/CloseShipment.php b/Modules/M3/Http/Controllers/API/CloseShipment.php
index cadd3f32..b9470c60 100755
--- a/Modules/M3/Http/Controllers/API/CloseShipment.php
+++ b/Modules/M3/Http/Controllers/API/CloseShipment.php
@@ -454,7 +454,7 @@ class CloseShipment extends Controller
$contentLabel = '';
$docTypes = ['ContentLabel', 'CarrierLabel'];
- foreach ($docTypes as $key => $value) {
+ foreach ($docTypes as $value) {
switch ($value) {
case 'CarrierLabel':
$dOCTYPE = 'CarrierLabel';
diff --git a/Modules/M3/Http/Controllers/API/PdfStorage.php b/Modules/M3/Http/Controllers/API/PdfStorage.php
index 2092f36a..4191c39a 100755
--- a/Modules/M3/Http/Controllers/API/PdfStorage.php
+++ b/Modules/M3/Http/Controllers/API/PdfStorage.php
@@ -18,37 +18,36 @@ class PdfStorage extends Controller
public function PdfStorageAPI(Request $request): JsonResponse
{
$this->configureTimeouts();
-
$context = $this->requestContext($request);
+
if ($context === null) {
- return $this->errorResponse('No URL Parameters Sent', self::ZERO_PAD, '', '', '');
- }
+ $result = $this->errorResponse('No URL Parameters Sent', self::ZERO_PAD, '', '', '');
+ } else {
+ try {
+ $this->logRequest($context);
+ $cacheKey = $this->buildCacheKey($context);
+ $pdfFileName = (string) Config::get('arrays.PdfPath') . $context['FILENAME'] . '.pdf';
+ $error = $this->validateStorageRequest($pdfFileName, $cacheKey);
- try {
- $this->logRequest($context);
-
- $cacheKey = $this->buildCacheKey($context);
- $pdfFileName = (string) Config::get('arrays.PdfPath') . $context['FILENAME'] . '.pdf';
- $error = $this->validateStorageRequest($pdfFileName, $cacheKey);
-
- if ($error !== null) {
- return $this->errorResponse($error, $context['DELIVERYNO'], $context['DOCNUM'], $context['COMPANY'], $context['WHS']);
+ if ($error !== null) {
+ $result = $this->errorResponse($error, $context['DELIVERYNO'], $context['DOCNUM'], $context['COMPANY'], $context['WHS']);
+ } else {
+ Cache::forever($cacheKey, base64_encode(File::get($pdfFileName)));
+ $this->logResult($context, 'PDF File converted to Base64 and Saved to Cache.Key: ' . $cacheKey);
+ $result = response()->json(['code' => '200', 'status' => 'Success', 'cacheKey' => $cacheKey]);
+ }
+ } catch (\Throwable $exception) {
+ $message = 'An Error Occured - ' . substr($exception->getMessage(), 0, 300);
+ $this->safeLog($context, $message, true);
+ $result = response()->json([
+ 'code' => '405',
+ 'status' => 'error',
+ 'message' => 'Catched Error: ' . $exception->getMessage(),
+ ]);
}
-
- Cache::forever($cacheKey, base64_encode(File::get($pdfFileName)));
- $this->logResult($context, 'PDF File converted to Base64 and Saved to Cache.Key: ' . $cacheKey);
-
- return response()->json(['code' => '200', 'status' => 'Success', 'cacheKey' => $cacheKey]);
- } catch (\Throwable $exception) {
- $message = 'An Error Occured - ' . substr($exception->getMessage(), 0, 300);
- $this->safeLog($context, $message, true);
-
- return response()->json([
- 'code' => '405',
- 'status' => 'error',
- 'message' => 'Catched Error: ' . $exception->getMessage(),
- ]);
}
+
+ return $result;
}
private function configureTimeouts(): void
diff --git a/Modules/M3/Http/Controllers/API/TwoShipAPIs.php b/Modules/M3/Http/Controllers/API/TwoShipAPIs.php
index bfae73a9..3bf35768 100755
--- a/Modules/M3/Http/Controllers/API/TwoShipAPIs.php
+++ b/Modules/M3/Http/Controllers/API/TwoShipAPIs.php
@@ -28,33 +28,32 @@ class TwoShipAPIs extends Controller
if ($params === []) {
$this->log($macpkr ?: '000000', $co, $whs, $user, 'X', 'No URL Parameters Sent');
+ $result = response()->json(['code' => '405', 'status' => 'Error', 'message' => 'No URL Parameters Sent']);
+ } else {
+ try {
+ $this->logRequest($macpkr, $co, $whs, $user);
+ $orders = $this->aggregationOrders($macpkr, $co, $whs);
+ $response = $this->callTwoShip($orders);
+ $error = $this->responseError($response);
- return response()->json(['code' => '405', 'status' => 'Error', 'message' => 'No URL Parameters Sent']);
- }
-
- try {
- $this->logRequest($macpkr, $co, $whs, $user);
- $orders = $this->aggregationOrders($macpkr, $co, $whs);
- $response = $this->callTwoShip($orders);
- $error = $this->responseError($response);
- if ($error !== '') {
- $this->log($macpkr, $co, $whs, $user, 'X', $response->status() . '-' . $error);
-
- return response()->json(['code' => '405', 'status' => 'error', 'message' => 'Status: ' . $response->status() . '-' . $error]);
+ if ($error !== '') {
+ $this->log($macpkr, $co, $whs, $user, 'X', $response->status() . '-' . $error);
+ $result = response()->json(['code' => '405', 'status' => 'error', 'message' => 'Status: ' . $response->status() . '-' . $error]);
+ } else {
+ $this->log($macpkr, $co, $whs, $user, '', $response->body());
+ $this->markAggregationComplete($orders, $co, $whs);
+ $result = response()->json(['code' => '200', 'status' => 'Success']);
+ }
+ } catch (\Throwable $th) {
+ $message = str_contains($th->getMessage(), 'cURL error')
+ ? 'Curl Error: Communication with 2Ship Timed Out.'
+ : '2Ship communication failed.';
+ $this->log($macpkr, $co, $whs, $user, 'X', $message);
+ $result = response()->json(['code' => '405', 'status' => 'error', 'message' => $message]);
}
-
- $this->log($macpkr, $co, $whs, $user, '', $response->body());
- $this->markAggregationComplete($orders, $co, $whs);
-
- return response()->json(['code' => '200', 'status' => 'Success']);
- } catch (\Throwable $th) {
- $message = str_contains($th->getMessage(), 'cURL error')
- ? 'Curl Error: Communication with 2Ship Timed Out.'
- : '2Ship communication failed.';
- $this->log($macpkr, $co, $whs, $user, 'X', $message);
-
- return response()->json(['code' => '405', 'status' => 'error', 'message' => $message]);
}
+
+ return $result;
}
private function configureTimeouts(): void
diff --git a/Modules/M3/Http/Controllers/M3CallCloseAPIController.php b/Modules/M3/Http/Controllers/M3CallCloseAPIController.php
index 829bf0f4..6eaa3e62 100755
--- a/Modules/M3/Http/Controllers/M3CallCloseAPIController.php
+++ b/Modules/M3/Http/Controllers/M3CallCloseAPIController.php
@@ -16,31 +16,31 @@ class M3CallCloseAPIController extends Controller
{
self::configureTimeouts();
$params = self::validatedParams($request);
+ $response = null;
if ($params === null) {
Log::channel('dailyCron')->error('Manifest CloseAPI: Manifest, company and warehouse must be defined.');
-
- return self::errorResponse('Manifest CloseAPI: Manifest, company and warehouse must be defined.');
- }
-
- try {
- $records = self::findOpenManifestRecords($params);
- if ($records->isEmpty()) {
- Log::channel('dailyCron')->info('Manifest CloseAPI: No records found in ICM705M1.');
-
- return self::errorResponse('Manifest CloseAPI: No records found in ICM705M1.');
+ $response = self::errorResponse('Manifest CloseAPI: Manifest, company and warehouse must be defined.');
+ } else {
+ try {
+ $records = self::findOpenManifestRecords($params);
+ if ($records->isEmpty()) {
+ Log::channel('dailyCron')->info('Manifest CloseAPI: No records found in ICM705M1.');
+ $response = self::errorResponse('Manifest CloseAPI: No records found in ICM705M1.');
+ } else {
+ $response = self::submitManifest($records->first(), $params['SHUSER']);
+ }
+ } catch (\Throwable $exception) {
+ Log::error($exception);
+ $response = response()->json([
+ 'code' => '500',
+ 'status' => 'Error',
+ 'message' => 'Manifest Closing failed unexpectedly.',
+ ], 500);
}
-
- return self::submitManifest($records->first(), $params['SHUSER']);
- } catch (\Throwable $exception) {
- Log::error($exception);
-
- return response()->json([
- 'code' => '500',
- 'status' => 'Error',
- 'message' => 'Manifest Closing failed unexpectedly.',
- ], 500);
}
+
+ return $response;
}
private static function configureTimeouts(): void
diff --git a/Modules/M3/Http/Middleware/BasicAuth.php b/Modules/M3/Http/Middleware/BasicAuth.php
index cb0f79d1..20fb2777 100755
--- a/Modules/M3/Http/Middleware/BasicAuth.php
+++ b/Modules/M3/Http/Middleware/BasicAuth.php
@@ -27,26 +27,26 @@ class BasicAuth
}
$handle = fopen($passwordFile, 'rb');
- if ($handle === false) {
- return false;
- }
+ $valid = false;
- try {
- while (($line = fgets($handle)) !== false) {
- $parts = explode(':', trim($line), 2);
- if (count($parts) !== 2 || ! hash_equals($parts[0], $login)) {
- continue;
+ if ($handle !== false) {
+ try {
+ while (($line = fgets($handle)) !== false) {
+ $parts = explode(':', trim($line), 2);
+ if (count($parts) !== 2 || ! hash_equals($parts[0], $login)) {
+ continue;
+ }
+
+ $storedHash = trim($parts[1]);
+ $valid = $storedHash !== '' && password_verify($password, $storedHash);
+ break;
}
-
- $storedHash = trim($parts[1]);
-
- return $storedHash !== '' && password_verify($password, $storedHash);
+ } finally {
+ fclose($handle);
}
- } finally {
- fclose($handle);
}
- return false;
+ return $valid;
}
private function unauthorized(): Response
diff --git a/Modules/M3/Resources/public/liberty-theme/css/styles.css b/Modules/M3/Resources/public/liberty-theme/css/styles.css
index 48c9f01f..2aa7658d 100755
--- a/Modules/M3/Resources/public/liberty-theme/css/styles.css
+++ b/Modules/M3/Resources/public/liberty-theme/css/styles.css
@@ -452,7 +452,7 @@ legend + * {
font: inherit;
}
-::-webkit-file-upload-button {
+:where(html) ::-webkit-file-upload-button {
font: inherit;
-webkit-appearance: button;
}
@@ -2276,7 +2276,7 @@ div.table-responsive > table > tbody > tr:last-child > td{
.form-control:hover:not(:disabled):not([readonly])::file-selector-button, .dataTable-input:hover:not(:disabled):not([readonly])::file-selector-button {
background-color: #dde0e3;
}
-.form-control::-webkit-file-upload-button, .dataTable-input::-webkit-file-upload-button {
+:where(html) .form-control::-webkit-file-upload-button, .dataTable-input::-webkit-file-upload-button {
padding: 0.375rem 0.75rem;
margin: -0.375rem -0.75rem;
-webkit-margin-end: 0.75rem;
@@ -2298,7 +2298,7 @@ div.table-responsive > table > tbody > tr:last-child > td{
transition: none;
}
}
-.form-control:hover:not(:disabled):not([readonly])::-webkit-file-upload-button, .dataTable-input:hover:not(:disabled):not([readonly])::-webkit-file-upload-button {
+:where(html) .form-control:hover:not(:disabled):not([readonly])::-webkit-file-upload-button, .dataTable-input:hover:not(:disabled):not([readonly])::-webkit-file-upload-button {
background-color: #dde0e3;
}
@@ -2336,7 +2336,7 @@ div.table-responsive > table > tbody > tr:last-child > td{
-webkit-margin-end: 0.5rem;
margin-inline-end: 0.5rem;
}
-.form-control-sm::-webkit-file-upload-button {
+:where(html) .form-control-sm::-webkit-file-upload-button {
padding: 0.25rem 0.5rem;
margin: -0.25rem -0.5rem;
-webkit-margin-end: 0.5rem;
@@ -2361,7 +2361,7 @@ div.table-responsive > table > tbody > tr:last-child > td{
-webkit-margin-end: 1rem;
margin-inline-end: 1rem;
}
-.form-control-lg::-webkit-file-upload-button {
+:where(html) .form-control-lg::-webkit-file-upload-button {
padding: 0.5rem 1rem;
margin: -0.5rem -1rem;
-webkit-margin-end: 1rem;
@@ -3721,7 +3721,7 @@ textarea.form-control-lg {
.dropend .dropdown-toggle:empty::after {
margin-left: 0;
}
-.dropend .dropdown-toggle::after {
+:where(html) .dropend .dropdown-toggle::after {
vertical-align: 0;
}
@@ -3738,7 +3738,7 @@ textarea.form-control-lg {
vertical-align: 0.255em;
content: "";
}
-.dropstart .dropdown-toggle::after {
+:where(html) .dropstart .dropdown-toggle::after {
display: none;
}
.dropstart .dropdown-toggle::before {
@@ -3753,7 +3753,7 @@ textarea.form-control-lg {
.dropstart .dropdown-toggle:empty::after {
margin-left: 0;
}
-.dropstart .dropdown-toggle::before {
+:where(html) .dropstart .dropdown-toggle::before {
vertical-align: 0;
}
@@ -3821,7 +3821,7 @@ textarea.form-control-lg {
}
.dropdown-menu-dark .dropdown-item:hover, .dropdown-menu-dark .dropdown-item:focus {
color: #fff;
- background-color: rgba(255, 255, 255, 0.15);
+ background-color: rgba(255, 255, 255, 0.25);
}
.dropdown-menu-dark .dropdown-item.active, .dropdown-menu-dark .dropdown-item:active {
color: #fff;
@@ -4849,7 +4849,7 @@ textarea.form-control-lg {
border-color: #dee2e6;
}
-.page-link, .dataTable-pagination a {
+:where(html) .page-link, .dataTable-pagination a {
padding: 0.375rem 0.75rem;
}
@@ -7673,7 +7673,7 @@ textarea.form-control-lg {
/* rtl:begin:remove */
.text-break {
word-wrap: break-word !important;
- word-break: break-word !important;
+ overflow-wrap: anywhere !important;
}
/* rtl:end:remove */
@@ -11652,11 +11652,11 @@ body {
border-color: #dbe3e6
}
-.breadcrumb {
+:where(html) .breadcrumb {
border: 1px solid #f3f3f3
}
-.breadcrumb {
+:where(body) .breadcrumb {
display: flex;
flex-wrap: wrap;
padding: 0.56rem 1.13rem;
@@ -11717,7 +11717,7 @@ nav {
margin-left: 20px;
}
-.breadcrumb.breadcrumb-custom .breadcrumb-item:before {
+:where(html) .breadcrumb.breadcrumb-custom .breadcrumb-item:before {
content: ""
}
@@ -11736,7 +11736,7 @@ a:link {
text-decoration: none
}
-.breadcrumb-item+.breadcrumb-item::before {
+:where(html) .breadcrumb-item+.breadcrumb-item::before {
display: inline-block;
padding-right: 0.5rem;
color: #6c757d;
diff --git a/Modules/M3/Resources/views/liberty-theme/partials/modals/M3DeliveryAdd.blade.php b/Modules/M3/Resources/views/liberty-theme/partials/modals/M3DeliveryAdd.blade.php
index 038318b0..d8d38d46 100755
--- a/Modules/M3/Resources/views/liberty-theme/partials/modals/M3DeliveryAdd.blade.php
+++ b/Modules/M3/Resources/views/liberty-theme/partials/modals/M3DeliveryAdd.blade.php
@@ -11,50 +11,50 @@
-
-
-
-
-
- | Delivery Method |
-
+ |
-
-
- | Ship Via |
-
+
+
+
+ Ship Via
+
- |
-
-
- | Sentinel Route |
-
+
+
+
+ Sentinel Route
+
- |
-
-
- | International Code |
-
+
+
+
+ International Code
+
- |
-
+
+
-
-
+