Mod to fix issue with dissapearing trad/ rev when one and same person! (check back color or trad with trad color setting or with tra/rev color setting)
Private Sub butCreateMails_Click()
'Dim activitiesCode As Byte
' 000 (0) - no activity - complain
' 001 (1) - rev only
' 010 (2) - translation only
' 100 (4) - preparation only
' 101 (5) - preparation an revision only
' 110 (6) - prep and tra only (unlikely)
' 111 (7) - prep, tra and rev
Me.hide
'Debug.Print "Activities code computed as " & activitiesCode: Exit Sub
If activitiesCode = 0 Then MsgBox "Please fill in at least one of the PREP, TRA or REV initials text boxes!", vbOKOnly + vbCritical, "NO assignment selected!": Exit Sub
If Me.lblMailMode = "Mult Msg" Then
For i = 0 To 2
If activitiesCode And 2 ^ i Then ' if user chose that particular operation
Select Case i
Case 0 ' preparation activity
Call Mail_CtDoc_forActivity(Me.astCbo, 2 ^ i, Me.ccTo)
Case 1 ' translation
' only launch a mail to translator if he is NOT doing
If Me.revCbo.Enabled Then
If Me.traCbo <> Me.revCbo Then
Call Mail_CtDoc_forActivity(Me.traCbo, 2 ^ i, Me.ccTo)
Else ' if they're the same, deffer processing, will do in rev loop!
End If
Else ' rev NOT enabled, no need to bundle ops msg to one person (tra+rev)
Call Mail_CtDoc_forActivity(Me.traCbo, 2 ^ i, Me.ccTo)
End If
Case 2 ' revision
If Me.traCbo.Enabled Then
If Me.revCbo <> Me.traCbo Then
Call Mail_CtDoc_forActivity(Me.revCbo, 2 ^ i, Me.ccTo)
Else ' HERE's the corner case, both ops enabled, same person to do both, mult msg active.
' We're NOT going to follow suite and send 2 msg with 2 ops to ONE person ! (about the same doc, too!)
Call Mail_CtDoc_forActivity(Me.revCbo, 2 ^ i + 2 ^ (i - 1), Me.ccTo)
End If
Else
Call Mail_CtDoc_forActivity(Me.revCbo, 2 ^ i, Me.ccTo)
End If
End Select
End If
Next i
Else ' One Msg
Dim allDest As String
For j = 0 To 2
If activitiesCode And 2 ^ j Then
Select Case j
Case 0
If Me.astColorLbl1.BackColor = Me.PrepAccentColor.Value Then
allDest = IIf(allDest = "", Me.astCbo, allDest & "," & Me.astCbo)
End If
Case 1 ' adding current op (trad) only if not already there
If Me.traColorLbl1.BackColor = Me.TraAccentColor.Value Or Me.traColorLbl1.BackColor = Me.TraRevAccentColor.Value Then
allDest = IIf(allDest = "", Me.traCbo, IIf(InStr(1, allDest, Me.traCbo) = 0, allDest & "," & Me.traCbo, allDest))
End If
Case 2 ' Add current op (rev) only if not already there, causing problems
If Me.revColorLbl1.BackColor = Me.RevAccentColor.Value Or Me.revColorLbl1.BackColor = Me.TraRevAccentColor.Value Then
allDest = IIf(allDest = "", Me.revCbo, IIf(InStr(1, allDest, Me.revCbo) = 0, allDest & "," & Me.revCbo, allDest))
End If
End Select
End If
Next j
Call Mail_CtDoc_forActivity(allDest, CInt(activitiesCode), Me.ccTo)
End If
Unload Me
End Sub