Page 1 sur 1

Suppression "Logique" des Document

MessagePublié: 10 Nov 2010 à 08:59
par Michael DELIQUE
Ajouter une vue ayant pour Select Form="$$_Trash" pour visualiser les documents "supprimer"

Code : Tout sélectionner
Sub DocDeleteSoftMark(wDoc As NotesDocument,wUser As String)
   
   'supprime de maniere loqique un document
   Dim nmUser As NotesName
   Dim Session As NotesSession
   
   On Error Goto ErreurHandle
   
   If wDoc Is Nothing Then
      Error 9999,"Doc is Nothing"
      Exit Sub
   Elseif Trim(wDoc.GetItemValue("Form")(0)) = "$$_Trash" Then
      Exit Sub
   End If
   
   If Trim(wUser) = "" Then
      Set Session = New NotesSession
      Set nmUser = New NotesName(Session.UserName)
   Else
      Set nmUser = New NotesName(Trim(wUser))
   End If
   
   Call wDoc.ReplaceItemValue("Form_Old",wDoc.GetItemValue("Form")(0))
   Call wDoc.ReplaceItemValue("Form","$$_Trash")
   Call wDoc.ReplaceItemValue("FlagTrash","1")
   Call wDoc.ReplaceItemValue("dteTrash",Now)
   Call wDoc.ReplaceItemValue("nmTrash",nmUser.Abbreviated)
   Call wDoc.Save(True,False)
   
   Set nmUser = Nothing
   
   Exit Sub
ErreurHandle:
   Msgbox "("+Cstr(Getthreadinfo (1))+" Call by "+Cstr(Getthreadinfo(10))+")"+Chr(10)+"Erreur " + Str(Err) + " : "+Chr(10) + Cstr(Error)+". "+Chr(10)+"Ligne N° "+Cstr(Erl),16," ERREUR !"
   Exit Sub
End Sub


Code : Tout sélectionner
Public Sub DocDeleteSoftRestaure(wDoc As NotesDocument)
   
   'restaure le document passé en parametre
   
   
   On Error Goto ErreurHandle
   
   If wDoc Is Nothing Then
      Error 9999,"wDoc is Nothing"
      Exit Sub
   Elseif Trim(wDoc.GetItemValue("Form")(0)) <> "$$_Trash" Then
      Exit Sub
   End If
   
   Call wDoc.ReplaceItemValue("Form", wDoc.GetItemValue("Form_OLD")(0))
   Call wDoc.ReplaceItemValue("Form_Old","")
   Call wDoc.RemoveItem("Form_Old")
   Call wDoc.ReplaceItemValue("FlagTrash","")
   Call wDoc.RemoveItem("FlagTrash")
   Call wDoc.ReplaceItemValue("dteTrash","")
   Call wDoc.RemoveItem("dteTrash")
   Call wDoc.ReplaceItemValue("nmTrash","")
   Call wDoc.RemoveItem("nmTrash")
   Call wDoc.Save(True,False)
   
   Exit Sub
ErreurHandle:
   Msgbox "("+Cstr(Getthreadinfo (1))+" Call by "+Cstr(Getthreadinfo(10))+")"+Chr(10)+"Erreur " + Str(Err) + " : "+Chr(10) + Cstr(Error)+". "+Chr(10)+"Ligne N° "+Cstr(Erl),16," ERREUR !"
   Exit Sub
End Sub


Code : Tout sélectionner
Public Sub DocDeleteSoftRestaure(wDoc As NotesDocument)
   
   'restaure le document passé en parametre
   
   
   On Error Goto ErreurHandle
   
   If wDoc Is Nothing Then
      Error 9999,"wDoc is Nothing"
      Exit Sub
   Elseif Trim(wDoc.GetItemValue("Form")(0)) <> "$$_Trash" Then
      Exit Sub
   End If
   
   Call wDoc.ReplaceItemValue("Form", wDoc.GetItemValue("Form_OLD")(0))
   Call wDoc.ReplaceItemValue("Form_Old","")
   Call wDoc.RemoveItem("Form_Old")
   Call wDoc.ReplaceItemValue("FlagTrash","")
   Call wDoc.RemoveItem("FlagTrash")
   Call wDoc.ReplaceItemValue("dteTrash","")
   Call wDoc.RemoveItem("dteTrash")
   Call wDoc.ReplaceItemValue("nmTrash","")
   Call wDoc.RemoveItem("nmTrash")
   Call wDoc.Save(True,False)
   
   Exit Sub
ErreurHandle:
   Msgbox "("+Cstr(Getthreadinfo (1))+" Call by "+Cstr(Getthreadinfo(10))+")"+Chr(10)+"Erreur " + Str(Err) + " : "+Chr(10) + Cstr(Error)+". "+Chr(10)+"Ligne N° "+Cstr(Erl),16," ERREUR !"
   Exit Sub
End Sub