M3 Integration fixes

This commit is contained in:
Mark Gregory
2026-09-21 10:59:32 +01:00
parent b849dd766b
commit 8f66223767
9 changed files with 22 additions and 68 deletions
+2 -3
View File
@@ -10,7 +10,7 @@ window.jQuery = $;
select2(window, $);
function livewireComponentFor(element) {
const componentRoot = element.closest('[wire\\:id]');
const componentRoot = element.closest(String.raw`[wire\:id]`);
if (!componentRoot || ! window.Livewire) {
return null;
@@ -30,8 +30,7 @@ function setLivewireProperty(element, model, value) {
}
function initialiseHelpdeskSelects() {
$('[data-helpdesk-select2]').each(function () {
const select = this;
$('[data-helpdesk-select2]').each((_index, select) => {
const $select = $(select);
const placeholder = $select.data('placeholder') || $select.find('option[value=""]').first().text() || 'Select option';
@@ -169,7 +169,7 @@ final class GitWebhookIngestionTest extends TestCase
$repository = $this->repository([
'provider' => 'gitea',
'project_id' => $fixtures['project']->id,
'remote_url' => 'http://git.vm:3000/Admin/WMS-Core.git',
'remote_url' => 'https://git.vm:3000/Admin/WMS-Core.git',
'webhook_secret' => 'gitea-secret',
]);
$ticket = $this->ticket(['project_id' => $fixtures['project']->id]);
@@ -178,14 +178,14 @@ final class GitWebhookIngestionTest extends TestCase
'repository' => [
'name' => 'WMS-Core',
'full_name' => 'Admin/WMS-Core',
'clone_url' => 'http://git.vm:3000/Admin/WMS-Core.git',
'html_url' => 'http://git.vm:3000/Admin/WMS-Core',
'clone_url' => 'https://git.vm:3000/Admin/WMS-Core.git',
'html_url' => 'https://git.vm:3000/Admin/WMS-Core',
],
'commits' => [
[
'id' => str_repeat('d', 40),
'message' => $ticket->reference . ' Fix local Gitea webhook ingestion',
'url' => 'http://git.vm:3000/Admin/WMS-Core/commit/' . str_repeat('d', 40),
'url' => 'https://git.vm:3000/Admin/WMS-Core/commit/' . str_repeat('d', 40),
'timestamp' => '2026-06-24T14:20:00+00:00',
'author' => ['name' => 'Mark Gregory', 'email' => 'mark@example.com'],
],
@@ -227,12 +227,12 @@ final class GitWebhookIngestionTest extends TestCase
$this->repository([
'provider' => 'gitea',
'remote_url' => 'http://git.vm:3000/Admin/WMS-Core.git',
'remote_url' => 'https://git.vm:3000/Admin/WMS-Core.git',
'webhook_secret' => 'gitea-secret',
]);
$payload = [
'ref' => 'refs/heads/main',
'repository' => ['clone_url' => 'http://git.vm:3000/Admin/WMS-Core.git'],
'repository' => ['clone_url' => 'https://git.vm:3000/Admin/WMS-Core.git'],
'commits' => [['id' => str_repeat('e', 40), 'message' => 'No auth']],
];
$json = json_encode($payload, JSON_THROW_ON_ERROR);
@@ -256,12 +256,12 @@ final class GitWebhookIngestionTest extends TestCase
$repository = $this->repository([
'provider' => 'gitea',
'remote_url' => 'http://git.vm:3000/Admin/WMS-Core.git',
'remote_url' => 'https://git.vm:3000/Admin/WMS-Core.git',
'webhook_secret' => 'gitea-secret',
]);
$payload = [
'ref' => 'refs/heads/main',
'repository' => ['clone_url' => 'http://git.vm:3000/Admin/WMS-Core.git'],
'repository' => ['clone_url' => 'https://git.vm:3000/Admin/WMS-Core.git'],
'commits' => [['id' => str_repeat('b', 40), 'message' => 'Valid signed Gitea push']],
];
$json = json_encode($payload, JSON_THROW_ON_ERROR);
@@ -291,7 +291,7 @@ final class GitWebhookIngestionTest extends TestCase
'provider' => 'Gitea',
'project_id' => $fixtures['project']->id,
'name' => 'Local',
'remote_url' => 'http://git.vm:3000/Admin/WMS-Core',
'remote_url' => 'https://git.vm:3000/Admin/WMS-Core',
'webhook_secret' => 'gitea-secret',
]);
$payload = [
@@ -299,14 +299,14 @@ final class GitWebhookIngestionTest extends TestCase
'repository' => [
'name' => 'WMS-Core',
'full_name' => 'Admin/WMS-Core',
'clone_url' => 'http://git.vm:3000/Admin/WMS-Core.git',
'html_url' => 'http://git.vm:3000/Admin/WMS-Core',
'clone_url' => 'https://git.vm:3000/Admin/WMS-Core.git',
'html_url' => 'https://git.vm:3000/Admin/WMS-Core',
],
'commits' => [
[
'id' => str_repeat('f', 40),
'message' => 'Local Gitea push should be visible on the dashboard',
'url' => 'http://git.vm:3000/Admin/WMS-Core/commit/' . str_repeat('f', 40),
'url' => 'https://git.vm:3000/Admin/WMS-Core/commit/' . str_repeat('f', 40),
'timestamp' => '2026-06-24T15:00:00+00:00',
'author' => ['name' => 'Mark Gregory', 'email' => 'mark@example.com'],
],
@@ -224,7 +224,7 @@ class CloseShipment extends Controller
// Close Shipment for Manifest or Single MacPKR
if (count($iCM695M1TMP) > 0 && ($tRANSTYPE == 'M' || $tRANSTYPE == 'P')) {
// Loop the Results from $ICM595M1TMP
foreach ($iCM695M1TMP as $key => $ICM695M1R) {
foreach ($iCM695M1TMP as $ICM695M1R) {
$pACKAGES = [];
$aYWHS = trim($ICM695M1R->AYWHS);
$aYCO = trim($ICM695M1R->AYCO);
@@ -283,7 +283,7 @@ class OrderLinesOfClosedOrder extends Controller
if (Storage::disk('publicCL')->exists($fileName)) {
// File exists, retrieve content or URL
// $content = Storage::disk('publicCL')->get($fileName);
$fileNameOnly = strpos($fileName, '/') != false ? substr($fileName, strpos($fileName, '/') + 1) : $fileName;
$fileNameOnly = strpos($fileName, '/') !== false ? substr($fileName, strpos($fileName, '/') + 1) : $fileName;
// Download the file
return Storage::disk('publicCL')->download($fileName, $fileNameOnly);
@@ -11,15 +11,10 @@ use Modules\M3\Services\PostgresProgramBridge;
class UserControlController extends Controller
{
private const AUTH_FAILURE_MESSAGE = 'Could not connect due to wrong user or password.';
private const DATABASE_NOT_FOUND_MESSAGE = 'Database not found. Try WRKRDBDIRE to check.';
private const CONNECTION_ERROR_PREFIX = 'Could not connect. Error: ';
private const PROGRAM_ERROR_PREFIX = 'Error calling program. Code: ';
private const MESSAGE_SEPARATOR = ' Msg: ';
public static function index(Request $request)
{
@@ -176,19 +171,7 @@ class UserControlController extends Controller
} catch (\Throwable $e) {
// Determine reason for failure.
// Probably database authentication error or invalid or unreachable database.
$code = $e->getCode();
$msg = $e->getMessage();
switch ($code) {
case 8001:
// "Authorization failure on distributed database connection attempt"
// Usually means a wrong DB2 user or password
break;
case 42705:
break;
default:
break;
}
return self::programBridgeConnectionError($e);
}
// Add LIB
@@ -250,19 +233,7 @@ class UserControlController extends Controller
try {
$conn = app(PostgresProgramBridge::class);
} catch (\Throwable $e) {
$code = $e->getCode();
$msg = $e->getMessage();
switch ($code) {
case 8001:
// "Authorization failure on distributed database connection attempt"
// Usually means a wrong DB2 user or password
break;
case 42705:
break;
default:
break;
}
return self::programBridgeConnectionError($e);
}
$result = $conn->CLCommand('QSYS/CHGUSRPRF USRPRF(' . $request->R428US_PWD . ') PASSWORD(' . $request->NEW_PASSWORD . ') STATUS(*ENABLED) PWDEXP(*NO)');
+1 -6
View File
@@ -52,11 +52,6 @@ class ShipTo extends Model
$existingRecord->where($this->getKeyName(), '!=', $this->getKey());
}
if ($existingRecord->count() > 0) {
return false;
} else {
return true;
}
return $existingRecord->count() === 0;
}
}
@@ -14,17 +14,6 @@ class RouteServiceProvider extends ServiceProvider
*/
protected $moduleNamespace = 'Modules\M3\Http\Controllers';
/**
* Called before routes are registered.
*
* Register any model bindings or pattern based filters.
*
* @return void
*/
public function boot()
{
parent::boot();
}
/**
* Define the routes for the application.
@@ -121,7 +121,7 @@
<div class="col-6">
<div class="mb-3">
<label for="recipient-name" class="col-form-label">Warehouse:</label>
<select class="form-select" id="WHDDA" aria-label="WHDD" tabindex="4" required>
<select class="form-select" id="WHDDA" aria-label="WHDD" tabindex="0" required>
<option value="">Select Warehouse</option>
@foreach ($IC670M as $key => $IC670MR)
<option value="{{ trim($IC670MR->WDCO).trim($IC670MR->WDPL).trim($IC670MR->WDWHS) }}"
@@ -215,7 +215,7 @@
<div class="col-6">
<div class="mb-3">
<label for="recipient-name" class="col-form-label">Warehouse:</label>
<select class="form-select" id="WHDD" aria-label="WHDD" tabindex="4" disabled>
<select class="form-select" id="WHDD" aria-label="WHDD" tabindex="0" disabled>
<option value="">Select Warehouse</option>
@foreach ($IC670M as $key => $IC670MR)
<option value="{{ trim($IC670MR->WDCO).trim($IC670MR->WDPL).trim($IC670MR->WDWHS) }}"
+1 -1
View File
@@ -151,7 +151,7 @@ function livewireComponentFor(element) {
return null;
}
return window.Livewire.find(current.getAttribute('wire:id'));
return window.Livewire.find(current.dataset.wireId);
}
current = current.parentElement;