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
@@ -2,50 +2,52 @@
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 Illuminate\Support\Facades\Schema;
use Modules\M3\Models\ICM664M;
class M3DeliveryController extends Controller
{
public static function index(Request $request) {
public static function index(Request $request)
{
$connection = config('m3.connection', 'pgsql');
$power_user = (object) ['R428PWRUSR'=>'N','R428US'=>strtoUpper(m3_user()),'R428CO'=>'','R428PL'=>'','R428WH'=>''];
if (\Illuminate\Support\Facades\Schema::connection($connection)->hasTable('icm428m')) {
$power_user = DB::connection($connection)->table('icm428m')->select('R428PWRUSR','R428US','R428CO','R428PL','R428WH')
->where('R428US',strtoUpper(m3_user()))->first() ?? $power_user;
$power_user = (object) ['R428PWRUSR' => 'N', 'R428US' => strtoupper(m3_user()), 'R428CO' => '', 'R428PL' => '', 'R428WH' => ''];
if (Schema::connection($connection)->hasTable('icm428m')) {
$power_user = DB::connection($connection)->table('icm428m')->select('R428PWRUSR', 'R428US', 'R428CO', 'R428PL', 'R428WH')
->where('R428US', strtoupper(m3_user()))->first() ?? $power_user;
}
$co=$power_user->R428CO; $plant=$power_user->R428PL; $whs=$power_user->R428WH;
$ICM664M = \Illuminate\Support\Facades\Schema::connection($connection)->hasTable('icm664m')
? DB::connection($connection)->table('icm664m')->where('AVCO',$co)->where('AVPLANT',$plant)->where('AVWHS',$whs)->get() : collect();
$IC670M = \Illuminate\Support\Facades\Schema::connection($connection)->hasTable('ic670m')
? DB::connection($connection)->table('ic670m')->where('WDCO',$co)->where('WDPL',$plant)->where('WDWHS',$whs)->get() : collect();
$shipvia = \Illuminate\Support\Facades\Schema::connection($connection)->hasTable('icm319m')
? DB::connection($connection)->table('icm319m')->select('AXCODE','AXDESC')->orderBy('AXCODE')->get() : collect();
return view('m3::liberty-theme.pages.M3Delivery', compact('ICM664M','IC670M','power_user','shipvia'));
$co = $power_user->R428CO;
$plant = $power_user->R428PL;
$whs = $power_user->R428WH;
$ICM664M = Schema::connection($connection)->hasTable('icm664m')
? DB::connection($connection)->table('icm664m')->where('AVCO', $co)->where('AVPLANT', $plant)->where('AVWHS', $whs)->get() : collect();
$IC670M = Schema::connection($connection)->hasTable('ic670m')
? DB::connection($connection)->table('ic670m')->where('WDCO', $co)->where('WDPL', $plant)->where('WDWHS', $whs)->get() : collect();
$shipvia = Schema::connection($connection)->hasTable('icm319m')
? DB::connection($connection)->table('icm319m')->select('AXCODE', 'AXDESC')->orderBy('AXCODE')->get() : collect();
return view('m3::liberty-theme.pages.M3Delivery', compact('ICM664M', 'IC670M', 'power_user', 'shipvia'));
}
//
// Process data from Add modal
//
public static function saveM3DeliveryAdd(Request $request) {
public static function saveM3DeliveryAdd(Request $request)
{
$icm664m=DB::connection(config('m3.connection', 'pgsql'))->select("select count(*) as COUNT1 from ICM664M
$icm664m = DB::connection(config('m3.connection', 'pgsql'))->select("select count(*) as COUNT1 from ICM664M
where AVCO='$request->AVCO' and AVWHS='$request->AVWHS' and AVPLANT='$request->AVPLANT' and AVDELMETH='$request->AVDELMETH'");
if($icm664m[0]->COUNT1=="1") {
return "exists";
if ($icm664m[0]->COUNT1 == '1') {
return 'exists';
} else {
DB::connection(config('m3.connection', 'pgsql'))->insert("insert into ICM664M
(AVCO, AVPLANT, AVWHS, AVDELMETH, AVSHPVIA, AVSHSRT, AVSHORCL)
values ('$request->AVCO', '$request->AVPLANT', '$request->AVWHS', '$request->AVDELMETH',
'$request->AVSHPVIA', '$request->AVSHSRT', '$request->AVSHORCL')");
return "success";
return 'success';
}
}
@@ -53,16 +55,16 @@ class M3DeliveryController extends Controller
//
// Process data from Edit modal
//
public static function saveM3DeliveryEdit(Request $request) {
#dd($request);
public static function saveM3DeliveryEdit(Request $request)
{
// dd($request);
// Update record to ICM664M
DB::connection(config('m3.connection', 'pgsql'))->update("update ICM664M
set AVSHPVIA='$request->AVSHPVIA', AVSHSRT='$request->AVSHSRT', AVSHORCL='$request->AVSHORCL'
where AVCO='$request->AVCO' and AVPLANT='$request->AVPLANT' and AVWHS='$request->AVWHS' and AVDELMETH='$request->AVDELMETH'");
return "success";
return 'success';
}
}