| 1 | //kt -- Modified with SourceScanner on 7/19/2007 | 
|---|
| 2 | unit fNoteDR; | 
|---|
| 3 |  | 
|---|
| 4 | interface | 
|---|
| 5 |  | 
|---|
| 6 | uses | 
|---|
| 7 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, | 
|---|
| 8 | fAutoSz, StdCtrls, DKLang; | 
|---|
| 9 |  | 
|---|
| 10 | type | 
|---|
| 11 | TfrmNoteDelReason = class(TfrmAutoSz) | 
|---|
| 12 | lblInstruction: TStaticText; | 
|---|
| 13 | cmdOK: TButton; | 
|---|
| 14 | cmdCancel: TButton; | 
|---|
| 15 | radPrivacy: TRadioButton; | 
|---|
| 16 | radAdmin: TRadioButton; | 
|---|
| 17 | DKLanguageController2: TDKLanguageController; | 
|---|
| 18 | procedure FormCreate(Sender: TObject); | 
|---|
| 19 | procedure cmdOKClick(Sender: TObject); | 
|---|
| 20 | procedure cmdCancelClick(Sender: TObject); | 
|---|
| 21 | private | 
|---|
| 22 | //kt Begin Mod (change Consts to Vars) 7/19/2007 | 
|---|
| 23 | TX_REQRSN  : string;  //kt | 
|---|
| 24 | TC_REQRSN  : string;  //kt | 
|---|
| 25 | //kt End Mod ------------------- | 
|---|
| 26 | OKPressed: Boolean; | 
|---|
| 27 | procedure SetupVars;  //kt | 
|---|
| 28 | end; | 
|---|
| 29 |  | 
|---|
| 30 | function SelectDeleteReason(ANote: Integer): string; | 
|---|
| 31 |  | 
|---|
| 32 | implementation | 
|---|
| 33 |  | 
|---|
| 34 | {$R *.DFM} | 
|---|
| 35 |  | 
|---|
| 36 | uses ORFn, rTIU, uConst; | 
|---|
| 37 |  | 
|---|
| 38 | //const | 
|---|
| 39 | //TX_REQRSN = 'A reason must be selected, otherwise press cancel.';  <-- original line.  //kt 7/19/2007 | 
|---|
| 40 | //TC_REQRSN = 'Reason Required';  <-- original line.  //kt 7/19/2007 | 
|---|
| 41 |  | 
|---|
| 42 |  | 
|---|
| 43 |  | 
|---|
| 44 | procedure TfrmNoteDelReason.SetupVars; | 
|---|
| 45 | //kt Added entire function to replace constant declarations 7/19/2007 | 
|---|
| 46 | begin | 
|---|
| 47 | TX_REQRSN := DKLangConstW('fNoteDR_A_reason_must_be_selectedx_otherwise_press_cancelx'); | 
|---|
| 48 | TC_REQRSN := DKLangConstW('fNoteDR_Reason_Required'); | 
|---|
| 49 | end; | 
|---|
| 50 |  | 
|---|
| 51 | function SelectDeleteReason(ANote: Integer): string; | 
|---|
| 52 | var | 
|---|
| 53 | frmNoteDelReason: TfrmNoteDelReason; | 
|---|
| 54 | begin | 
|---|
| 55 | if not JustifyDocumentDelete(ANote) then | 
|---|
| 56 | begin | 
|---|
| 57 | Result := DR_NOTREQ; | 
|---|
| 58 | Exit; | 
|---|
| 59 | end; | 
|---|
| 60 | Result := DR_CANCEL; | 
|---|
| 61 | frmNoteDelReason := TfrmNoteDelReason.Create(Application); | 
|---|
| 62 | try | 
|---|
| 63 | ResizeFormToFont(TForm(frmNoteDelReason)); | 
|---|
| 64 | frmNoteDelReason.ShowModal; | 
|---|
| 65 | with frmNoteDelReason do if OKPressed then | 
|---|
| 66 | begin | 
|---|
| 67 | if radPrivacy.Checked then Result := DR_PRIVACY; | 
|---|
| 68 | if radAdmin.Checked then Result := DR_ADMIN; | 
|---|
| 69 | end; | 
|---|
| 70 | finally | 
|---|
| 71 | frmNoteDelReason.Release; | 
|---|
| 72 | end; | 
|---|
| 73 | end; | 
|---|
| 74 |  | 
|---|
| 75 | procedure TfrmNoteDelReason.FormCreate(Sender: TObject); | 
|---|
| 76 | begin | 
|---|
| 77 | inherited; | 
|---|
| 78 | OKPressed := False; | 
|---|
| 79 | end; | 
|---|
| 80 |  | 
|---|
| 81 | procedure TfrmNoteDelReason.cmdOKClick(Sender: TObject); | 
|---|
| 82 | begin | 
|---|
| 83 | SetupVars;  //kt added 7/19/2007 to replace constants with vars. | 
|---|
| 84 | inherited; | 
|---|
| 85 | if not (radPrivacy.Checked or radAdmin.Checked) then | 
|---|
| 86 | begin | 
|---|
| 87 | InfoBox(TX_REQRSN, TC_REQRSN, MB_OK); | 
|---|
| 88 | Exit; | 
|---|
| 89 | end; | 
|---|
| 90 | OKPressed := True; | 
|---|
| 91 | Close; | 
|---|
| 92 | end; | 
|---|
| 93 |  | 
|---|
| 94 | procedure TfrmNoteDelReason.cmdCancelClick(Sender: TObject); | 
|---|
| 95 | begin | 
|---|
| 96 | inherited; | 
|---|
| 97 | Close; | 
|---|
| 98 | end; | 
|---|
| 99 |  | 
|---|
| 100 | end. | 
|---|