m3 Security Fixes
This commit is contained in:
@@ -2,40 +2,36 @@
|
||||
|
||||
namespace Modules\M3\Http\Controllers;
|
||||
|
||||
use Modules\M3\Http\Controllers\Controller;
|
||||
use DB;
|
||||
use Config;
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Log;
|
||||
use Str;
|
||||
use Artisan;
|
||||
|
||||
use Modules\M3\Http\Controllers\API\CloseShipment;
|
||||
use Config;
|
||||
use DB;
|
||||
use Illuminate\Http\Request;
|
||||
use Log;
|
||||
|
||||
class M3CallCloseAPIController extends Controller
|
||||
{
|
||||
public static function index(Request $request){
|
||||
public static function index(Request $request)
|
||||
{
|
||||
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
|
||||
# Get URL PARAMS
|
||||
$urlParams = count($request->all())>0 ? $request->all() : '';
|
||||
// Get the Calling User
|
||||
// Get URL PARAMS
|
||||
$urlParams = count($request->all()) > 0 ? $request->all() : '';
|
||||
// dd($urlParams);
|
||||
$SHUSER = isset($urlParams["SHUSER"]) ? $urlParams["SHUSER"] : '';
|
||||
$MANIFEST = isset($urlParams["MANIFEST"]) ? $urlParams["MANIFEST"] : '';
|
||||
$APCO = isset($urlParams["APCO"]) ? $urlParams["APCO"] : '';
|
||||
$APWHS = isset($urlParams["APWHS"]) ? $urlParams["APWHS"] : '';
|
||||
$SHUSER = isset($urlParams['SHUSER']) ? $urlParams['SHUSER'] : '';
|
||||
$MANIFEST = isset($urlParams['MANIFEST']) ? $urlParams['MANIFEST'] : '';
|
||||
$APCO = isset($urlParams['APCO']) ? $urlParams['APCO'] : '';
|
||||
$APWHS = isset($urlParams['APWHS']) ? $urlParams['APWHS'] : '';
|
||||
|
||||
if ($MANIFEST!='' && $APCO!='' && $APWHS!='') { // $SHUSER!='' &&
|
||||
if ($MANIFEST != '' && $APCO != '' && $APWHS != '') { // $SHUSER!='' &&
|
||||
// Log::channel('dailyCron')->info("Cron...Start CallCloseAPI...For user:".$SHUSER." Manifest#: ".$MANIFEST);
|
||||
|
||||
# Get Logged User CO & WH
|
||||
# Get users from ICM428M
|
||||
// Get Logged User CO & WH
|
||||
// Get users from ICM428M
|
||||
// $ICM428M = DB::connection(config('m3.connection', 'pgsql'))->table('icm428m')
|
||||
// ->select('R428US','R428CO', 'R428WH')
|
||||
// ->where('R428US','=',$SHUSER)
|
||||
@@ -46,68 +42,64 @@ class M3CallCloseAPIController extends Controller
|
||||
// $USERWH = isset($ICM428M->R428WH) ? $ICM428M->R428WH : '';
|
||||
// dump($R428US.':'.$USERCO.':'.$USERWH);
|
||||
|
||||
# Get Macpickers from ICM705M1
|
||||
# SELECT APMANIFEST FROM ICM705M1 WHERE APSPARE2='' AND APCO='110' AND APWHS='321'
|
||||
// Get Macpickers from ICM705M1
|
||||
// SELECT APMANIFEST FROM ICM705M1 WHERE APSPARE2='' AND APCO='110' AND APWHS='321'
|
||||
$ICM705M1 = DB::connection(config('m3.connection', 'pgsql'))->table('icm705m1')
|
||||
->select('APMANIFEST','APCO','APWHS')
|
||||
->where('APSPARE2','')
|
||||
->where('APCO',$APCO)
|
||||
->where('APWHS',$APWHS)
|
||||
->where('APMANIFEST','=',$MANIFEST)
|
||||
->select('APMANIFEST', 'APCO', 'APWHS')
|
||||
->where('APSPARE2', '')
|
||||
->where('APCO', $APCO)
|
||||
->where('APWHS', $APWHS)
|
||||
->where('APMANIFEST', '=', $MANIFEST)
|
||||
->whereRaw('EXTRACT(EPOCH FROM (CURRENT_TIMESTAMP - APLDCLOZ)) / 60 > 15')
|
||||
->orderBy('APMANIFEST')
|
||||
->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) {
|
||||
# Send CO and WHS to CallCloseAPI
|
||||
// Send CO and WHS to CallCloseAPI
|
||||
$USERCO = isset($ICM705M1R->APCO) ? $ICM705M1R->APCO : '';
|
||||
$USERWH = isset($ICM705M1R->APWHS) ? $ICM705M1R->APWHS : '';
|
||||
|
||||
$callCloseShipment = Artisan::call('command:CallCloseAPI', ['user'=> $SHUSER ,'manifest' => $ICM705M1R->APMANIFEST ,
|
||||
'co' => $USERCO ,'whs' => $USERWH]);
|
||||
$callCloseShipment = Artisan::call('command:CallCloseAPI', ['user' => $SHUSER, 'manifest' => $ICM705M1R->APMANIFEST,
|
||||
'co' => $USERCO, 'whs' => $USERWH]);
|
||||
// dump($callCloseShipment);
|
||||
|
||||
if ($callCloseShipment==1) {
|
||||
if ($callCloseShipment == 1) {
|
||||
return response()->json([
|
||||
'code' => '200',
|
||||
'code' => '200',
|
||||
'status' => 'Success',
|
||||
'message'=> 'Manifest Closing submitted'
|
||||
'message' => 'Manifest Closing submitted',
|
||||
]);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
return response()->json([
|
||||
'code' => '206',
|
||||
'code' => '206',
|
||||
'status' => 'Failure',
|
||||
'message'=> 'Manifest Closing Failed'
|
||||
'message' => 'Manifest Closing Failed',
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
Log::channel('dailyCron')->info("Manifest CloseAPI: No records found in ICM705M1...");
|
||||
} else {
|
||||
Log::channel('dailyCron')->info('Manifest CloseAPI: No records found in ICM705M1...');
|
||||
|
||||
return response()->json([
|
||||
'code' => '206',
|
||||
'code' => '206',
|
||||
'status' => 'Error',
|
||||
'message'=> "Manifest CloseAPI: No records found in ICM705M1..."
|
||||
'message' => 'Manifest CloseAPI: No records found in ICM705M1...',
|
||||
]);
|
||||
}
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
Log::channel('dailyCron')->error('Manifest CloseAPI: A User and Manifest must be defined...');
|
||||
|
||||
return response()->json([
|
||||
'code' => '206',
|
||||
'code' => '206',
|
||||
'status' => 'Error',
|
||||
'message'=> 'Manifest CloseAPI: A User and Manifest must be defined...'
|
||||
'message' => 'Manifest CloseAPI: A User and Manifest must be defined...',
|
||||
]);
|
||||
}
|
||||
}
|
||||
catch (\Throwable $th) {
|
||||
} catch (\Throwable $th) {
|
||||
Log::error($th);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user