updates to M3 module

This commit is contained in:
Mark Gregory
2026-09-16 16:46:15 +01:00
parent 13a7e804af
commit ce06aa9fac
20 changed files with 191 additions and 203 deletions
@@ -14,28 +14,20 @@ class userControlController extends Controller
{
public static function index(Request $request) {
#$sqlstmt="select * from ICM428M";
#$ICM428M = DB::connection(config('m3.connection', 'pgsql'))->table('icm428m')->get();
$ICM428M = DB::connection(config('m3.connection', 'pgsql'))->table('icm428m')
->select('R428US','R428CO', 'R428WH')
->where('R428US','=',strtoUpper(m3_user()))
->first();
$co = $ICM428M->R428CO;
$whs = $ICM428M->R428WH;
$ICM428M = DB::connection(config('m3.connection', 'pgsql'))->select("SELECT * FROM ICM428M where R428CO='$co' and R428WH='$whs'");
#765 add DATE_PASSWORD_EXPIRES as DATE_EXPIRED, SET_PASSWORD_TO_EXPIRE as EXPIRED
$USER_INFO = DB::connection(config('m3.connection', 'pgsql'))->table('icm428m')->selectRaw('R428US as USERPRF, R428STS as STATUS, NULL as DATE_EXPIRED, NULL as EXPIRED')->get()->all();
#echo "<pre>"; var_dump($USER_INFO); echo "</pre>";
$power_user = DB::connection(config('m3.connection', 'pgsql'))->select("select R428PWRUSR, R428CO, R428PL, R428WH from ICM428M where R428US='".strtoUpper(m3_user())."'");
#765
# $expired_users = DB::connection(config('m3.connection', 'pgsql'))->select("SELECT USER_PROFILE FROM TABLE (SYSTOOLS.AUDIT_JOURNAL_CP () ) WHERE PASSWORD_EXPIRED = '*YES'");
# echo "<pre>"; print_r($expired_users); echo "</pre>";
$IC670M = DB::connection(config('m3.connection', 'pgsql'))->table('ic670m')->get();
$connection = config('m3.connection', 'pgsql');
$profile = null;
if (\Illuminate\Support\Facades\Schema::connection($connection)->hasTable('icm428m')) {
$profile = DB::connection($connection)->table('icm428m')->where('R428US',strtoUpper(m3_user()))->first();
}
$co=$profile->R428CO ?? ''; $whs=$profile->R428WH ?? '';
$ICM428M = \Illuminate\Support\Facades\Schema::connection($connection)->hasTable('icm428m')
? DB::connection($connection)->table('icm428m')->where('R428CO',$co)->where('R428WH',$whs)->get() : collect();
$USER_INFO = \Illuminate\Support\Facades\Schema::connection($connection)->hasTable('icm428m')
? DB::connection($connection)->table('icm428m')->selectRaw('R428US as USERPRF, R428STS as STATUS, NULL as DATE_EXPIRED, NULL as EXPIRED')->get()->all() : [];
$power_user = [(object)['R428PWRUSR'=>$profile->R428PWRUSR ?? 'N','R428CO'=>$co,'R428PL'=>$profile->R428PL ?? '','R428WH'=>$whs]];
$IC670M = \Illuminate\Support\Facades\Schema::connection($connection)->hasTable('ic670m')
? DB::connection($connection)->table('ic670m')->get() : collect();
return view('m3::liberty-theme.pages.userControl', compact('ICM428M','IC670M','power_user','USER_INFO'));
}
//