Advertisement
gunawantw

Attachments rules

Jul 7th, 2020
2,462
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. REM {GTW 2009};
  2. OneMb := 1000000;
  3. BeingMailed:=@If(@IsDocBeingMailed;1;0);
  4.  
  5. REM {DebugFlag=0 –> Debug mode off};
  6. REM {DebugFlag=1 –> Debug mode on};
  7. DebugFlag:=0;
  8.  
  9. quotaStdUser:=6;
  10.  
  11. GroupNameManager := "Group8MB";
  12. quotaManager:=8;
  13.  
  14. GroupNameBOD := "Group10MB";
  15. quotaBOD:=10;
  16.  
  17. GroupNameOwner:= "Group15MB";
  18. quotaOwner:=15;
  19.  
  20. AttLengths:=@If(@Attachments=0;0;@Sum(@AttachmentLengths));
  21.  
  22. msg1:="You are attempting to send a mail item whose total size is ";
  23. msg2:=" megabytes or greater.  Please reduce the number of attachments and/or the size of the attachment(s) so the total amount of data being sent is below ";
  24. msg3:=" megabytes";
  25.  
  26. G2:=@If(@Member(GroupNameManager; @UserNamesList); 1;0);
  27. Q2:=@If(AttLengths < (quotaManager*oneMb);1;0) ;
  28. F2:=msg1+@Text(quotaManager)+msg2+@Text(quotaManager)+msg3;
  29.  
  30. G3:=@If(@Member(GroupNameBOD; @UserNamesList); 1;0);
  31. Q3:= @If(AttLengths < (quotaBOD*oneMb);1;0) ;
  32. F3:=msg1+@Text(quotaBOD)+msg2+@Text(quotaBOD)+msg3;
  33.  
  34. G4:=@If(@Member(GroupNameOwner; @UserNamesList); 1;0);
  35. Q4:= @If(AttLengths < (quotaOwner*oneMb);1;0) ;
  36. F4:=msg1+@Text(quotaOwner)+msg2+@Text(quotaOwner)+msg3;
  37.  
  38. G1:=@If(G2:G3:G4 = 0;1;0);
  39. Q1:= @If(AttLengths < (quotaStdUser*oneMb);1;0) ;
  40. F1:=msg1+@Text(quotaStdUser)+msg2+@Text(quotaStdUser)+msg3;
  41.  
  42. FErrMsg:=@If (
  43. (G2=1 & Q2=0);F2;
  44. (G3=1 & Q3=0);F3;
  45. (G4=1 & Q4=0);F4;
  46. F1);
  47.  
  48. GW:=@If( (G1&Q1=1 | G2&Q2=1 | G3&Q3=1 | G4&Q4=1);"Success";"Gagal " + FErrMsg);
  49. GW2:=@If( (G1&Q1=1 | G2&Q2=1 | G3&Q3=1 | G4&Q4=1);1;0);
  50.  
  51. y1:="G1 = " + @Text(G1) + " G2=" + @Text(G2) + " G3 = " + @Text(G3) +" G4 = " + @Text(G4);
  52. y2:=". Att Length = "+@Text(AttLengths)+""+GW;
  53. y3:=y1+y2;
  54.  
  55. GW3:=@If(DebugFlag = 1 ;@Failure(y3);
  56. DebugFlag = 0 & GW2=1;@Success;
  57. DebugFlag = 0 & GW2=0;@Failure(FerrMsg);@Success
  58. );
  59.  
  60. @If(BeingMailed;GW3;@Success)
Advertisement
RAW Paste Data Copied
Advertisement