M3 Integration fixes

This commit is contained in:
Mark Gregory
2026-09-21 12:05:53 +01:00
parent 9368dd2f10
commit e776eb0211
7 changed files with 25 additions and 26 deletions
@@ -23,6 +23,8 @@ class StoreDocumentationDocumentRequest extends FormRequest
*/ */
public function rules(): array public function rules(): array
{ {
$maxUploadKb = min(max((int) config('documentation.max_upload_kb', 10240), 1), 10240);
return [ return [
'documentation_category_id' => ['nullable', 'integer', 'exists:documentation_categories,id'], 'documentation_category_id' => ['nullable', 'integer', 'exists:documentation_categories,id'],
'title' => ['required', 'string', 'max:220'], 'title' => ['required', 'string', 'max:220'],
@@ -33,9 +35,9 @@ class StoreDocumentationDocumentRequest extends FormRequest
'is_featured' => ['nullable', 'boolean'], 'is_featured' => ['nullable', 'boolean'],
'version' => ['required', 'string', 'max:50'], 'version' => ['required', 'string', 'max:50'],
'reference' => ['nullable', 'string', 'max:100'], 'reference' => ['nullable', 'string', 'max:100'],
'attachment' => ['nullable', 'file', 'max:' . config('documentation.max_upload_kb', 20480), 'mimes:' . implode(',', config('documentation.allowed_upload_mimes', []))], 'attachment' => ['nullable', 'file', 'max:' . $maxUploadKb, 'mimes:' . implode(',', config('documentation.allowed_upload_mimes', []))],
'attachments' => ['nullable', 'array'], 'attachments' => ['nullable', 'array'],
'attachments.*' => ['file', 'max:' . config('documentation.max_upload_kb', 20480), 'mimes:' . implode(',', config('documentation.allowed_upload_mimes', []))], 'attachments.*' => ['file', 'max:' . $maxUploadKb, 'mimes:' . implode(',', config('documentation.allowed_upload_mimes', []))],
]; ];
} }
} }
@@ -23,6 +23,8 @@ class UpdateDocumentationDocumentRequest extends FormRequest
*/ */
public function rules(): array public function rules(): array
{ {
$maxUploadKb = min(max((int) config('documentation.max_upload_kb', 10240), 1), 10240);
/** @var DocumentationDocument|null $document */ /** @var DocumentationDocument|null $document */
$document = $this->route('document'); $document = $this->route('document');
@@ -36,9 +38,9 @@ class UpdateDocumentationDocumentRequest extends FormRequest
'is_featured' => ['nullable', 'boolean'], 'is_featured' => ['nullable', 'boolean'],
'version' => ['required', 'string', 'max:50'], 'version' => ['required', 'string', 'max:50'],
'reference' => ['nullable', 'string', 'max:100'], 'reference' => ['nullable', 'string', 'max:100'],
'attachment' => ['nullable', 'file', 'max:' . config('documentation.max_upload_kb', 20480), 'mimes:' . implode(',', config('documentation.allowed_upload_mimes', []))], 'attachment' => ['nullable', 'file', 'max:' . $maxUploadKb, 'mimes:' . implode(',', config('documentation.allowed_upload_mimes', []))],
'attachments' => ['nullable', 'array'], 'attachments' => ['nullable', 'array'],
'attachments.*' => ['file', 'max:' . config('documentation.max_upload_kb', 20480), 'mimes:' . implode(',', config('documentation.allowed_upload_mimes', []))], 'attachments.*' => ['file', 'max:' . $maxUploadKb, 'mimes:' . implode(',', config('documentation.allowed_upload_mimes', []))],
'remove_attachment' => ['nullable', 'boolean'], 'remove_attachment' => ['nullable', 'boolean'],
]; ];
} }
@@ -260,7 +260,7 @@ class CloseShipment extends Controller
// ->get(); // ->get();
// PFC : Check that Picked / Packed are all Equal // PFC : Check that Picked / Packed are all Equal
foreach ($iCM688M2SL as $key => $ICM688M2SLR) { foreach ($iCM688M2SL as $ICM688M2SLR) {
$a5PICKED = isset($ICM688M2SLR->A5PICKED) ? $ICM688M2SLR->A5PICKED : 0; $a5PICKED = isset($ICM688M2SLR->A5PICKED) ? $ICM688M2SLR->A5PICKED : 0;
$a5RSVQTY = isset($ICM688M2SLR->A5RSVQTY) ? $ICM688M2SLR->A5RSVQTY : 0; $a5RSVQTY = isset($ICM688M2SLR->A5RSVQTY) ? $ICM688M2SLR->A5RSVQTY : 0;
$a5ShortShipQty = (int) $a5RSVQTY - (int) $a5PICKED; $a5ShortShipQty = (int) $a5RSVQTY - (int) $a5PICKED;
@@ -295,7 +295,7 @@ class CloseShipment extends Controller
->orderBy('AYINTBOX') ->orderBy('AYINTBOX')
->get(); ->get();
foreach ($iCM695M1JOINTMP as $ICM695M1JOINR) { foreach ($iCM695M1JOINTMP as $key => $ICM695M1JOINR) {
$a4SHIPVIA = isset($ICM695M1JOINR->A4SHIPVIA) ? trim(str_replace('&', '_', $ICM695M1JOINR->A4SHIPVIA)) : ''; $a4SHIPVIA = isset($ICM695M1JOINR->A4SHIPVIA) ? trim(str_replace('&', '_', $ICM695M1JOINR->A4SHIPVIA)) : '';
$sHIPTYPE = trim($ICM695M1JOINR->A4SHIPTYPE); $sHIPTYPE = trim($ICM695M1JOINR->A4SHIPTYPE);
@@ -128,7 +128,11 @@ class UserPickingStats5 extends Controller
try { try {
$response = Http::withBasicAuth((string) $request->header('php-auth-user'), (string) $request->header('php-auth-pw')) $response = Http::withBasicAuth((string) $request->header('php-auth-user'), (string) $request->header('php-auth-pw'))
->get($url, ['dates' => $date, 'user' => $request->user, 'format' => 'json']); ->get($url, ['dates' => $date, 'user' => $request->user, 'format' => 'json']);
$data = $response->successful() ? (json_decode($response->body(), true) ?: []) : []; $data = [];
if ($response->successful()) {
$decoded = json_decode($response->body(), true);
$data = is_array($decoded) ? $decoded : [];
}
} catch (\Throwable $e) { } catch (\Throwable $e) {
Log::warning('M3 picking statistics unavailable', ['date' => $date, 'exception' => $e->getMessage()]); Log::warning('M3 picking statistics unavailable', ['date' => $date, 'exception' => $e->getMessage()]);
$data = []; $data = [];
@@ -102,8 +102,7 @@ $(function() {
customize: function(xlsx,btnObj, tableInst) { customize: function(xlsx,btnObj, tableInst) {
let sheet = xlsx.xl.worksheets['sheet1.xml']; let sheet = xlsx.xl.worksheets['sheet1.xml'];
let cellIndexes = tableInst.cells(".bg-danger").indexes(); let cellIndexes = tableInst.cells(".bg-danger").indexes();
for (let i = 0; i < cellIndexes.length; i++) { for (const cellIndex of cellIndexes) {
let cellIndex = cellIndexes[i];
let tblRow = cellIndex['row']+3; // adjusted from 0 indexed let tblRow = cellIndex['row']+3; // adjusted from 0 indexed
let tblCol = cellIndex['column']; // adjusted from 0 indexed let tblCol = cellIndex['column']; // adjusted from 0 indexed
let xlCol = numberToLetters(tblCol); let xlCol = numberToLetters(tblCol);
+7 -15
View File
@@ -22,33 +22,25 @@ class PostgresProgramBridge
public function setOptions(array $options): self public function setOptions(array $options): self
{ {
unset($options);
return $this; return $this;
} }
public function addParameterChar(string $io, int $size, string $comment = '', string $name = '', mixed $value = null, mixed ...$rest): array public function AddParameterChar(string $io, int $size, string $comment = '', string $name = '', mixed $value = null, mixed ...$rest): array
{ {
unset($rest);
return compact('io', 'size', 'comment', 'name', 'value'); return compact('io', 'size', 'comment', 'name', 'value');
} }
public function addParameterPackDec(string $io, int $length, int $scale, string $comment = '', string $name = '', mixed $value = null, mixed ...$rest): array public function AddParameterPackDec(string $io, int $length, int $scale, string $comment = '', string $name = '', mixed $value = null, mixed ...$rest): array
{ {
unset($rest); return ['type' => 'packed_decimal'] + compact('io', 'length', 'scale', 'comment', 'name', 'value');
return compact('io', 'length', 'scale', 'comment', 'name', 'value');
} }
public function addParameterZoned(string $io, int $length, int $scale, string $comment = '', string $name = '', mixed $value = null, mixed ...$rest): array public function AddParameterZoned(string $io, int $length, int $scale, string $comment = '', string $name = '', mixed $value = null, mixed ...$rest): array
{ {
unset($rest); return ['type' => 'zoned_decimal'] + compact('io', 'length', 'scale', 'comment', 'name', 'value');
return compact('io', 'length', 'scale', 'comment', 'name', 'value');
} }
public function pgmCall(string $program, ?string $library = null, array $parameters = [], array $returnParameters = [], array $options = []): array|false public function PgmCall(string $program, ?string $library = null, array $parameters = [], array $returnParameters = [], array $options = []): array|false
{ {
return $this->queue('program', $program, $library, [ return $this->queue('program', $program, $library, [
'parameters' => $parameters, 'parameters' => $parameters,
@@ -57,7 +49,7 @@ class PostgresProgramBridge
]); ]);
} }
public function clCommand(string $command): array|false public function CLCommand(string $command): array|false
{ {
return $this->queue('command', $command, null, []); return $this->queue('command', $command, null, []);
} }
+2 -2
View File
@@ -51,7 +51,7 @@ function renderWmsCharts() {
return; return;
} }
const type = canvas.getAttribute('data-wms-chart'); const type = canvas.dataset.wmsChart;
const labels = parseJsonAttribute(canvas, 'data-labels'); const labels = parseJsonAttribute(canvas, 'data-labels');
const series = parseJsonAttribute(canvas, 'data-series'); const series = parseJsonAttribute(canvas, 'data-series');
const values = parseJsonAttribute(canvas, 'data-values'); const values = parseJsonAttribute(canvas, 'data-values');
@@ -146,7 +146,7 @@ function livewireComponentFor(element) {
let current = element; let current = element;
while (current && current !== document.documentElement) { while (current && current !== document.documentElement) {
if (current.hasAttribute?.('wire:id')) { if (current.hasAttribute && current.hasAttribute('wire:id')) {
if (!window.Livewire) { if (!window.Livewire) {
return null; return null;
} }