m3 Security Fixes

This commit is contained in:
Mark Gregory
2026-09-16 17:16:25 +01:00
parent d68687f062
commit 8f37245e13
64 changed files with 4247 additions and 4426 deletions
+56 -60
View File
@@ -2,17 +2,13 @@
namespace Modules\M3\Console;
use Illuminate\Console\Command;
use Modules\M3\Http\Controllers\Controller;
use DB;
use Config;
use DB;
use Illuminate\Console\Command;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
use Log;
use Str;
use Modules\M3\Http\Controllers\API\CloseShipment;
use Str;
class CallCloseAPI extends Command
{
@@ -32,100 +28,101 @@ class CallCloseAPI extends Command
public function handle()
{
//$this->info('Start CallCloseAPI...');
// $this->info('Start CallCloseAPI...');
ini_set('max_execution_time', Config::get('arrays.PHPTimeOut'));
ini_set('max_input_time', Config::get('arrays.PHPTimeOut'));
ini_set('default_socket_timeout', Config::get('arrays.PHPTimeOut'));
try {
# Get the Calling User
$userId = $this->argument('user');
$SHUSER = isset($userId) ? $userId : (m3_user() !== '' ? Str::upper(trim(m3_user())) : '');
// Get the Calling User
$userId = $this->argument('user');
$SHUSER = isset($userId) ? $userId : (m3_user() !== '' ? Str::upper(trim(m3_user())) : '');
# Get the Manifest Number
$manifest = $this->argument('manifest');
$MANIFESTNum = isset($manifest) ? $manifest : '';
$co = $this->argument('co');
$APCO = isset($co) ? $co : '';
$whs = $this->argument('whs');
$APWHS = isset($whs) ? $whs : '';
// Get the Manifest Number
$manifest = $this->argument('manifest');
$MANIFESTNum = isset($manifest) ? $manifest : '';
$co = $this->argument('co');
$APCO = isset($co) ? $co : '';
$whs = $this->argument('whs');
$APWHS = isset($whs) ? $whs : '';
// if ($SHUSER!='') {
// Log::channel('dailyCron')->info("Cron...Start CallCloseAPI...For Manifest#: ".$MANIFESTNum); // ".$SHUSER."
if( $MANIFESTNum==''){
# Get Macpickers from ICM705M1
if ($MANIFESTNum == '') {
// Get Macpickers from ICM705M1
$ICM705M1 = DB::connection(config('m3.connection', 'pgsql'))->table('icm705m1')
->select('APMANIFEST','APCO','APWHS')
->where('APSPARE2','')
->where('APMANIFEST','!=','0')
->select('APMANIFEST', 'APCO', 'APWHS')
->where('APSPARE2', '')
->where('APMANIFEST', '!=', '0')
->whereRaw('EXTRACT(EPOCH FROM (CURRENT_TIMESTAMP - APLDCLOZ)) / 60 > 15')
->orderBy('APMANIFEST','desc')
->orderBy('APMANIFEST', 'desc')
->get();
// dump($ICM705M1);
if (count($ICM705M1)>0) {
# Loop the Results from $ICM705M1
if (count($ICM705M1) > 0) {
// Loop the Results from $ICM705M1
foreach ($ICM705M1 as $key => $ICM705M1R) {
$MANIFESTNum = $ICM705M1R->APMANIFEST;
$USERCO = isset($ICM705M1R->APCO) ? $ICM705M1R->APCO : '';
$USERWH = isset($ICM705M1R->APWHS) ? $ICM705M1R->APWHS : '';
# Update ICM705M1 and set APSPARE2 to P
// Update ICM705M1 and set APSPARE2 to P
$ICM705M1U = DB::connection(config('m3.connection', 'pgsql'))->table('icm705m1')
->where('APMANIFEST',$MANIFESTNum)
->where('APCO',$USERCO)
->where('APWHS',$USERWH)
->update(["APSPARE2"=>"P"]);
->where('APMANIFEST', $MANIFESTNum)
->where('APCO', $USERCO)
->where('APWHS', $USERWH)
->update(['APSPARE2' => 'P']);
$myRequest = new Request();
$myRequest = new Request;
$myRequest->setMethod('POST');
$myRequest->request->add([
'WHS' => $USERWH,
'COMPANY' => $USERCO,
'WHS' => $USERWH,
'COMPANY' => $USERCO,
'TRANSTYPE' => 'M',
'MANIFEST' => $MANIFESTNum
'MANIFEST' => $MANIFESTNum,
]);
$callCloseShipment = CloseShipment::CloseShipmentCoChargeAPI($myRequest);
$responseData = $callCloseShipment->getData();
$jsonData = json_encode($responseData);
Log::channel('dailyCron')->info("Close Shipment API Response for Manifest:".(string)(int)$MANIFESTNum.'-'.$jsonData);
$responseData = $callCloseShipment->getData();
$jsonData = json_encode($responseData);
Log::channel('dailyCron')->info('Close Shipment API Response for Manifest:' . (string) (int) $MANIFESTNum . '-' . $jsonData);
}
}
}
# Call Closing for a specific Manifest
else{
# Get Macpickers from ICM705M1
// Call Closing for a specific Manifest
else {
// Get Macpickers from ICM705M1
$ICM705M1 = DB::connection(config('m3.connection', 'pgsql'))->table('icm705m1')
->select('APMANIFEST','APCO','APWHS')
->where('APSPARE2','')
->where('APCO',$APCO)
->where('APWHS',$APWHS)
->where('APMANIFEST','=',$MANIFESTNum)
->select('APMANIFEST', 'APCO', 'APWHS')
->where('APSPARE2', '')
->where('APCO', $APCO)
->where('APWHS', $APWHS)
->where('APMANIFEST', '=', $MANIFESTNum)
->first();
# Update ICM705M1 and set APSPARE2 to P
// Update ICM705M1 and set APSPARE2 to P
$ICM705M1U = DB::connection(config('m3.connection', 'pgsql'))->table('icm705m1')
->where('APMANIFEST',$MANIFESTNum)
->where('APCO',$APCO)
->where('APWHS',$APWHS)
->update(["APSPARE2"=>"P"]);
->where('APMANIFEST', $MANIFESTNum)
->where('APCO', $APCO)
->where('APWHS', $APWHS)
->update(['APSPARE2' => 'P']);
$myRequest = new Request();
$myRequest = new Request;
$myRequest->setMethod('POST');
$myRequest->request->add([
'WHS' => $APWHS ,
'COMPANY' => $APCO,
'WHS' => $APWHS,
'COMPANY' => $APCO,
'TRANSTYPE' => 'M',
'MANIFEST' => $MANIFESTNum
'MANIFEST' => $MANIFESTNum,
]);
$callCloseShipment = CloseShipment::CloseShipmentCoChargeAPI($myRequest);
$responseData = $callCloseShipment->getData();
$jsonData = json_encode($responseData);
Log::channel('dailyCron')->info("Close Shipment API Response for Manifest:".$MANIFESTNum.'-'.$jsonData);
$responseData = $callCloseShipment->getData();
$jsonData = json_encode($responseData);
Log::channel('dailyCron')->info('Close Shipment API Response for Manifest:' . $MANIFESTNum . '-' . $jsonData);
return 1;
}
// }
@@ -135,8 +132,7 @@ class CallCloseAPI extends Command
// $this->error('A user must be defined...');
// }
}
catch (\Throwable $th) {
} catch (\Throwable $th) {
// Log::error($th);
Log::channel('dailyCron')->error($th);
}