M3 Security Fixes for Pass 40

This commit is contained in:
Mark Gregory
2026-09-17 13:22:35 +01:00
parent 34c3460760
commit a9b63e43b3
28 changed files with 80 additions and 116 deletions
@@ -17,7 +17,9 @@ use Str;
class CloseShipment extends Controller
{
private const ZERO_PAD = '000000';
private const JSON_CONTENT_TYPE = 'application/json';
private const NULL_M3_RESPONSE = 'M3 API responded with null value';
// CloseShipmentCoChargeAPI : with URL PARAMS COCharge
@@ -54,7 +56,6 @@ class CloseShipment extends Controller
$pdfFilePath = Config::get('arrays.PdfPath');
$dELIVERYNO = $mANIFEST != '' ? $mANIFEST : self::ZERO_PAD;
if ($urlParams != '') {
// Write to Logs : JSON
$jSONIN = json_encode([
@@ -216,7 +217,6 @@ class CloseShipment extends Controller
}
$iCM695M1TMP = $iCM695M1TMPF;
$freightTermsTMP = DB::connection(config('m3.connection', 'pgsql'))->table('icm321m')
->selectRaw('TRIM(ARCODE) as FREIGHTTERMS,ARCHARGE as BILLABLE')
->get();
@@ -605,10 +605,10 @@ class CloseShipment extends Controller
Helper::logToICM699M($data);
$response = Http::withHeaders([
'accept' => self::JSON_CONTENT_TYPE,
'Content-Type' => self::JSON_CONTENT_TYPE,
'Connection' => 'close',
])
'accept' => self::JSON_CONTENT_TYPE,
'Content-Type' => self::JSON_CONTENT_TYPE,
'Connection' => 'close',
])
->withToken($token)
->withBody($jSONCS, self::JSON_CONTENT_TYPE)
->timeout(Config::get('arrays.curlTimeOut'))
@@ -826,10 +826,10 @@ class CloseShipment extends Controller
Helper::logToICM699M($data);
$response = Http::withHeaders([
'accept' => self::JSON_CONTENT_TYPE,
'Content-Type' => self::JSON_CONTENT_TYPE,
'Connection' => 'close',
])
'accept' => self::JSON_CONTENT_TYPE,
'Content-Type' => self::JSON_CONTENT_TYPE,
'Connection' => 'close',
])
->withToken($token)
->withBody($jSONCS, self::JSON_CONTENT_TYPE)
->timeout(Config::get('arrays.curlTimeOut'))
@@ -5,7 +5,6 @@ namespace Modules\M3\Http\Controllers\API;
use Config;
use DB;
use Illuminate\Http\Request;
use Log;
use Modules\M3\Helpers\Helper;
use Modules\M3\Http\Controllers\Controller;
use Modules\M3\Services\PostgresProgramBridge;
@@ -14,6 +13,7 @@ use Str;
class M3Controller extends Controller
{
private const FIELD_PREFIX = 'Field: ';
private const M3_LIST_SUFFIX = ' M3-Lis-JSN';
// Split Data and Write to ICM666M2
@@ -15,6 +15,7 @@ use Str;
class ReplenAPI extends Controller
{
private const ZERO_PAD = '000000';
private const JSON_CONTENT_TYPE = 'application/json';
// M3Replenishement with URL Params
@@ -53,7 +54,7 @@ class ReplenAPI extends Controller
Helper::logToICM699M($data);
$pART = explode(',', $pARTNO);
foreach ($pART as $key => $value) {
foreach ($pART as $value) {
$pARTS[] = ['PART' => $value, 'LOT' => ''];
}
@@ -84,9 +85,9 @@ class ReplenAPI extends Controller
$token = $ionToken;
$response = Http::withHeaders([
'accept' => self::JSON_CONTENT_TYPE,
'Content-Type' => self::JSON_CONTENT_TYPE,
])
'accept' => self::JSON_CONTENT_TYPE,
'Content-Type' => self::JSON_CONTENT_TYPE,
])
->withToken($token)
->withBody($jSON, self::JSON_CONTENT_TYPE)
->timeout(Config::get('arrays.curlTimeOut'))
@@ -130,7 +131,7 @@ class ReplenAPI extends Controller
}
$dataToWrite2 = [];
foreach ($responseTMP as $key => $value) {
foreach ($responseTMP as $value) {
$dataToWrite = [];
foreach ($value as $key2 => $content) {
@@ -145,15 +146,15 @@ class ReplenAPI extends Controller
}
// Delete Old Records from IC630M
foreach ($dataToWrite2 as $key => $value) {
$iCM630MDeleteSQL = DB::connection(config('m3.connection', 'pgsql'))->table('ic630m')
foreach ($dataToWrite2 as $value) {
DB::connection(config('m3.connection', 'pgsql'))->table('ic630m')
->where('LLCO', $cO)
->where('LLWHNO', $wHS)
->where('LLPPN', trim($value['PartNumber']))
->delete();
}
foreach ($dataToWrite2 as $key => $value) {
foreach ($dataToWrite2 as $value) {
// Check if Location exist in DE640M $value['Location']
$dE640MSQLSEL = DB::connection(config('m3.connection', 'pgsql'))->table('de640m')
->where('LVCO', $cO)
@@ -16,8 +16,11 @@ use Str;
class TransferAPI extends Controller
{
private const ZERO_PAD = '000000';
private const JSON_CONTENT_TYPE = 'application/json';
private const ORDER_CATEGORY_LABEL = ' Order Category: ';
private const NO_URL_PARAMETERS = 'No URL Parameters Sent';
// TransferAPIURL : with URL PARAMS