Good Evening all,I am using Dynamic user level security in project following the Phpmaker documentation, after generation, I getting the error, which I could not solve."Fatal error: Uncaught Error: Call to a member function phrase() on null in D:\XAMPP\htdocs\PROJECT1\src\AdvancedSecurity.php:688 …
{main} thrown in D:\XAMPP\htdocs\PROJECT1\src\AdvancedSecurity.php on line 688"Line no 688 have below code
If you have added code in server event (e.g. global code), you might not have created the langauge object first. You should enable Debug and trace the source of the error.
Sir, Thanks to both of you for reply,Sir, I used below code in userfn.php (Global code) When I do not use below code this code it works website works excepting the below function return values, otherwise it create error as"display "Server can not handle request … 500"Kindly help me to know, where I am making mistakefunction wpmautofils($prm)
{
if($prm == “WH”) {
// Get Warehouse ID
$ei = CurrentUserID();
$wh = ExecuteRow(“SELECT eWarehouse FROM employees WHERE euUserLevel =$ei”);
$whr = $wh[“eWarehouse”];
return $whr;
}
elseif($prm == “DTM”) {
// Get current Month
$dtm = CurrentDate();
$dtmr = date(“F”,strtotime($dtm));
return $dtmr;
}
elseif($prm == “DTY”) {
// Get a Current year
$dty = CurrentDate();
$dtyr = date(“Y”,strtotime($dty));
return $dtyr;
}
}
Sir, this is the code where I call function in Row_inserting eventpublic function rowInserting($rsold, &$rsnew)
{
// Enter your code here
$rsnew[“iFinancialYear”] = wpmautofils(“FY”);
$rsnew[“iWarehouseID”] = wpmautofils(“WH”);
$rsnew[“iDateMonth”] = wpmautofils(“DTM”);
$rsnew[“iDateYear”] = wpmautofils(“DTY”);
}
$ei = CurrentUserID();
$wh = ExecuteRow("SELECT eWarehouse FROM employees WHERE euUserLevel =$ei");
You tried to assign the $ei variable with current user id, and then in the next row, you tried to assign the value of $ei to euUserLevel which I assumed it as user level field. If so, then you should change this code:$ei = CurrentUserID();to:$ei = CurrentUserLevel();and try again.