<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Форум компьютерной помощи &mdash; Проверка, при отправке, что открыт ответный докумнет]]></title>
	<link rel="self" href="https://itpmr.ru/extern.php?action=feed&amp;tid=1068&amp;type=atom" />
	<updated>2024-05-31T11:57:15Z</updated>
	<generator>PunBB</generator>
	<id>https://itpmr.ru/viewtopic.php?id=1068</id>
		<entry>
			<title type="html"><![CDATA[Re: Проверка, при отправке, что открыт ответный докумнет]]></title>
			<link rel="alternate" href="https://itpmr.ru/viewtopic.php?pid=124954#p124954" />
			<content type="html"><![CDATA[<p>А еще на события базы Postopen и Queryclose повесил отчистку idopendoc и&nbsp; empty.</p><p>Sub Postopen(Source As Notesuidatabase)<br />&nbsp; &nbsp; Print &quot;Открыли базу&quot;<br />&nbsp; &nbsp; On Error Goto ErrH<br />&nbsp; &nbsp; Dim session As New NotesSession<br />&nbsp; &nbsp; Set db = session.CurrentDatabase<br />&nbsp; &nbsp; server = db.Server<br />&nbsp; &nbsp; user = session.CommonUserName<br />&nbsp; &nbsp; Dim item As NotesItem<br />&nbsp; &nbsp; Dim idopen As String<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; Dim view As NotesView, docreg As NotesDocument<br />&nbsp; &nbsp; Set view = db.GetView (&quot;reg&quot; )<br />&nbsp; &nbsp; Set docreg = view.GetFirstDocument<br />&nbsp; &nbsp; PolicyPatch$ = docreg.PolicyPatch(0) + &quot;.nsf&quot;<br />&nbsp; &nbsp; Print&nbsp; PolicyPatch$<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; Set strukdb = session.GetDatabase(server, PolicyPatch$ , False )<br />&nbsp; &nbsp; Set view = strukdb.GetView(&quot;notespeople&quot;)<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; Set ftdoc=view.GetDocumentByKey(user)<br />&nbsp; &nbsp; If Not(ftdoc Is Nothing) Then<br />&nbsp; &nbsp; &nbsp; &nbsp; ftdoc.idopendoc=&quot;&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; ftdoc.empty = &quot;&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; ftdoc.computewithform False, False<br />&nbsp; &nbsp; &nbsp; &nbsp; Call ftdoc.Save(True,True)<br />&nbsp; &nbsp; &nbsp; &nbsp; Print &quot;очистили&quot;<br />&nbsp; &nbsp; Else<br />&nbsp; &nbsp; &nbsp; &nbsp; MsgBox &quot;Пользователь не найден в БД структура!&quot;<br />&nbsp; &nbsp; End If<br />&nbsp; &nbsp; Exit Sub<br />ErrH:<br />&nbsp; &nbsp; Print &quot;Ошибка&nbsp; Postopen&quot; &amp; Error(Err) &amp; &quot; в строке &quot; &amp; Erl&nbsp; &nbsp; <br />End Sub</p>]]></content>
			<author>
				<name><![CDATA[admin]]></name>
				<uri>https://itpmr.ru/profile.php?id=2</uri>
			</author>
			<updated>2024-05-31T11:57:15Z</updated>
			<id>https://itpmr.ru/viewtopic.php?pid=124954#p124954</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Проверка, при отправке, что открыт ответный докумнет]]></title>
			<link rel="alternate" href="https://itpmr.ru/viewtopic.php?pid=124739#p124739" />
			<content type="html"><![CDATA[<p>А вот сама отправка ответного дока, вариант с открытием в УИ интерфейсе:</p><div class="codebox"><pre><code>Set dc = curdoc.Responses
    
    Set ftdoc = dc.GetFirstDocument    
    While Not ftdoc Is Nothing
        If ftdoc.IsValid=False Then 
            Print &quot;Документ не валидный&quot;
        Else
            Set ftuidoc = ws.EditDocument( False, ftdoc , True ,  , True, False )
                        ftdoc.who = curdoc.who
            ftdoc.whois = curdoc.whois
            ftdoc.addreaders = curdoc.addreaders
            ftdoc.addauthors = curdoc.addauthors
&#039;        ftdoc.hierarchy = curdoc.hierarchy
            ftdoc.history=mes2+ftdoc.history(0)
            ftdoc.save True, False
                        If ftdoc.responce(0)=&quot;1&quot;  Then Call ftuidoc.Close(True)
        End If
        Set nextftdoc = dc.GetNextDocument (ftdoc )
        Set ftdoc=nextftdoc
        Set nextftdoc=Nothing
        </code></pre></div><p>&nbsp; &nbsp; Wend</p>]]></content>
			<author>
				<name><![CDATA[admin]]></name>
				<uri>https://itpmr.ru/profile.php?id=2</uri>
			</author>
			<updated>2019-04-08T08:05:15Z</updated>
			<id>https://itpmr.ru/viewtopic.php?pid=124739#p124739</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Проверка, при отправке, что открыт ответный докумнет]]></title>
			<link rel="alternate" href="https://itpmr.ru/viewtopic.php?pid=124737#p124737" />
			<content type="html"><![CDATA[<p>Агент clearUnids: очищает поле idopendoc и empty, если они не пустые<br /></p><div class="codebox"><pre><code>Option Public

Sub Initialize
    Print &quot;START clearUnids&quot;
    On Error Goto ErrH
    &#039; Очищает поле Unids в документах(открытые пользоватлем документы) по view StrukChoice2
    Dim session As New NotesSession
    Dim currdoc As NotesDocument
    Dim nextdoc As NotesDocument
    Dim db As NotesDatabase
    Dim item As notesitem
    Dim view As NotesView
    Set db = session.CurrentDatabase
    Set view = db.getview(&quot;people&quot;)
    Print view.Name
    Set currdoc = view.Getfirstdocument()
    While Not (currdoc Is Nothing)
        Set item = currdoc.GetFirstItem(&quot;idopendoc&quot;)
        If item.Text&lt;&gt;&quot;&quot; Then
        currdoc.idopendoc = &quot;&quot;
        currdoc.empty = &quot;&quot;
        currdoc.save True, False
        Print currdoc.FIO(0) &quot; idopendoc ОЧИЩЕН &quot;
    End If    
        Set currdoc = view.getnextdocument(currdoc)    
    Wend
    Print &quot;END clearUnids&quot;
    Exit Sub
ErrH:
    Print &quot;Ошибка &quot; &amp; Error(Err) &amp; &quot; в строке &quot; &amp; Erl
End Sub</code></pre></div>]]></content>
			<author>
				<name><![CDATA[admin]]></name>
				<uri>https://itpmr.ru/profile.php?id=2</uri>
			</author>
			<updated>2019-03-27T08:59:15Z</updated>
			<id>https://itpmr.ru/viewtopic.php?pid=124737#p124737</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Проверка, при отправке, что открыт ответный докумнет]]></title>
			<link rel="alternate" href="https://itpmr.ru/viewtopic.php?pid=124736#p124736" />
			<content type="html"><![CDATA[<p>На кнопку отправки документа можно добавить проверку - что один из ответных документов открыт у пользователя.<br />Выдаст название документа и фио &quot;заблокировавшего&quot;.</p><div class="codebox"><pre><code>&#039; Проверка открытого ответа
    Set strukdb = session.GetDatabase(server, &quot;promdoc\policy.nsf&quot; , False )
    Set view = strukdb.GetView(&quot;counteropen&quot;)
    Set dc = curdoc.Responses   
    
    Dim ftdoc2 As NotesDocument   &#039; в структуре ищем открытый док
    Set ftdoc = dc.GetFirstDocument &#039; ответ в докобороте
    While Not ftdoc Is Nothing    
        idopen=ftdoc.id(0)    &#039; unid ответного дока в докобороте
        Set ftdoc2=view.GetDocumentByKey(idopen)
        If Not(ftdoc2 Is Nothing) Then
            Msgbox {Ответный документ &quot;} &amp;    ftdoc.header(0) &amp; {&quot; открыт у } &amp; ftdoc2.FIO(0)
            Exit Sub
        Else
            Print ftdoc.header(0) &quot;ответ закрыт у юзера&quot;
        End If
        Set nextftdoc = dc.GetNextDocument (ftdoc )
        Set ftdoc=nextftdoc
        Set nextftdoc=Nothing
    Wend    </code></pre></div>]]></content>
			<author>
				<name><![CDATA[admin]]></name>
				<uri>https://itpmr.ru/profile.php?id=2</uri>
			</author>
			<updated>2019-03-22T12:19:47Z</updated>
			<id>https://itpmr.ru/viewtopic.php?pid=124736#p124736</id>
		</entry>
</feed>
