Hi everybody:
I made some changes to Codeunit 1 - ApplicationManagement on MakeDateText. I added the following code:
MemberOf.SETCURRENTKEY("User ID","Role ID",Company);
MemberOf.SETFILTER("User ID",USERID);
IF MemberOf.FIND('-') THEN
REPEAT
IF MemberOf."Role ID" <> 'SUPER' THEN
SuperUser:= FALSE
ELSE
SuperUser:= TRUE
UNTIL (SuperUser = TRUE) OR (MemberOf.NEXT=0);
IF UserSetup.GET(USERID) THEN
IF UserSetup."Allow Change Work Date" = TRUE THEN
WorkDateModifyUser := TRUE
ELSE
WorkDateModifyUser := FALSE;
IF (SuperUser = FALSE) AND (WorkDateModifyUser = FALSE) THEN
BEGIN
PreWorkDate := WORKDATE;
MESSAGE('You are not authorized to change Work Date. Please contact your manager.\'
+ '\Usted no esta autorizado para cambiar el Work Date. Por favor contacte a su gerente.');
DateText := FORMAT(PreWorkDate);
WORKDATE := PreWorkDate;
EXIT(1);
END
It works fine preventing not allowed users to change the Work Date. But now I got a problem with users that run Aged Accounts Receivables Reports, Aged Vendor Report, etc. They are getting the same error message. Like it they were trying to change the workdate. Any ideas?
Thank you in advance
0
Comments
because AFAIK, makedatetext is called everytime you write in a date field/variable...(anyway, i've never modified it)
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
Thank you
It shouldn't be because of posting, you can just change the allowed posting dates for the users.
I think you should just train the users not to change it. If they can't follow directions then you have a problem with the employee. Most users don't even know what a workdate is from what I've seen, much less how to change it.
Only, like matttrax said, for posting?
This seems more feasible solution than using hammer on system.
matttrax
We cannot use TODAY instead of WORKDATE because of supprt issues.
I´m considering a code in CU 1
Try putting a warning message in, if the workdate is more than a certain amount past the schedule date it will say "Are you sure you didn't make a mistake?"
Users will make mistakes, even with training, but the best you can do is tell them to pay attention to what they are doing.