722 lines
30 KiB
XML
722 lines
30 KiB
XML
<list>
|
|
<ProcessDefinition>
|
|
<processDefinitionPK>
|
|
<companyId>1</companyId>
|
|
<processId>FlowEssentials_LancamentodeDocumento</processId>
|
|
</processDefinitionPK>
|
|
<processDescription>Lançamento de documento</processDescription>
|
|
<instruction>Este Flow permite ao colaborador lançar dados referentes a um documento, seja uma nota, recibo, boleto ou outro que a empresa possua, com a obrigatoriedade de anexar o documento citado. Quando aprovada a etapa de Análise do documento, o mesmo será publicado no ECM e herdará as propriedades de validade e notificação.</instruction>
|
|
<active>true</active>
|
|
<publicProcess>true</publicProcess>
|
|
<volumeId>Default</volumeId>
|
|
<categoryId>Documentos</categoryId>
|
|
<managerEngineAllocationId></managerEngineAllocationId>
|
|
<snapshotFrequency>0</snapshotFrequency>
|
|
<baseDay>0</baseDay>
|
|
<baseMonth>0</baseMonth>
|
|
<periodId>Default</periodId>
|
|
<uniqueCardVersion>false</uniqueCardVersion>
|
|
<keyWord></keyWord>
|
|
<complementsLevel>1</complementsLevel>
|
|
<notifyRequisitionerComplements>true</notifyRequisitionerComplements>
|
|
<notifyManagerComplements>false</notifyManagerComplements>
|
|
<deadlineTime>86400</deadlineTime>
|
|
<warningDeadlineTime>43200</warningDeadlineTime>
|
|
<notifyAuthorityComplements>true</notifyAuthorityComplements>
|
|
</ProcessDefinition>
|
|
<ProcessDefinitionVersion>
|
|
<processDefinitionVersionPK>
|
|
<companyId>1</companyId>
|
|
<processId>Lançamento de documento</processId>
|
|
<version>9</version>
|
|
</processDefinitionVersionPK>
|
|
<versionDescription></versionDescription>
|
|
<formId>41254</formId>
|
|
<editionMode>true</editionMode>
|
|
<updateAttachmentsVersion>false</updateAttachmentsVersion>
|
|
<controlsAttachmentsSecurity>false</controlsAttachmentsSecurity>
|
|
<active>true</active>
|
|
<blockedVersion>false</blockedVersion>
|
|
<counterSign>false</counterSign>
|
|
<openInstances>0</openInstances>
|
|
<bpmnVersion>2</bpmnVersion>
|
|
<processStates/>
|
|
<favorito>false</favorito>
|
|
<inheritFormSecurity>false</inheritFormSecurity>
|
|
<mobileReady>true</mobileReady>
|
|
</ProcessDefinitionVersion>
|
|
<list>
|
|
<ProcessState>
|
|
<processStatePK>
|
|
<companyId>1</companyId>
|
|
<processId>FlowEssentials_LancamentodeDocumento</processId>
|
|
<version>1</version>
|
|
<sequence>4</sequence>
|
|
</processStatePK>
|
|
<stateName>Lançar documento</stateName>
|
|
<stateDescription>Lançar documento</stateDescription>
|
|
<instruction></instruction>
|
|
<deadlineTime>0</deadlineTime>
|
|
<joint>false</joint>
|
|
<agreementPercentage>0</agreementPercentage>
|
|
<engineAllocationId></engineAllocationId>
|
|
<engineAllocationConfiguration></engineAllocationConfiguration>
|
|
<selectColleague>1</selectColleague>
|
|
<initialState>true</initialState>
|
|
<notifyAuthorityDelay>true</notifyAuthorityDelay>
|
|
<notifyRequisitionerDelay>false</notifyRequisitionerDelay>
|
|
<allowanceAuthorityTime>3600</allowanceAuthorityTime>
|
|
<frequenceAuthorityTime>3600</frequenceAuthorityTime>
|
|
<allowanceRequisitionerTime>0</allowanceRequisitionerTime>
|
|
<frequenceRequisitionerTime>0</frequenceRequisitionerTime>
|
|
<transferAttachments>false</transferAttachments>
|
|
<subProcessId></subProcessId>
|
|
<formFolder>0</formFolder>
|
|
<notifyAuthorityFollowUp>true</notifyAuthorityFollowUp>
|
|
<notifyRequisitionerFollowUp>true</notifyRequisitionerFollowUp>
|
|
<automatic>false</automatic>
|
|
<positionX>120</positionX>
|
|
<positionY>100</positionY>
|
|
<forecastedEffortType>0</forecastedEffortType>
|
|
<forecastedEffort>0</forecastedEffort>
|
|
<notifyManagerFollowUp>false</notifyManagerFollowUp>
|
|
<notifyManagerDelay>false</notifyManagerDelay>
|
|
<allowanceManagerTime>0</allowanceManagerTime>
|
|
<frequenceManagerTime>0</frequenceManagerTime>
|
|
<inhibitTransfer>false</inhibitTransfer>
|
|
<periodId></periodId>
|
|
<stateType>0</stateType>
|
|
<bpmnType>10</bpmnType>
|
|
<signalId>0</signalId>
|
|
<counterSign>false</counterSign>
|
|
<openInstances>0</openInstances>
|
|
<noticeExpirationAuthorityTime>0</noticeExpirationAuthorityTime>
|
|
<noticeExpirationRequisitionerTime>0</noticeExpirationRequisitionerTime>
|
|
<noticeExpirationManagerTime>0</noticeExpirationManagerTime>
|
|
<destinationStates/>
|
|
<digitalSignature>false</digitalSignature>
|
|
</ProcessState>
|
|
<ProcessState>
|
|
<processStatePK>
|
|
<companyId>1</companyId>
|
|
<processId>FlowEssentials_LancamentodeDocumento</processId>
|
|
<version>1</version>
|
|
<sequence>5</sequence>
|
|
</processStatePK>
|
|
<stateName>Analisar documento</stateName>
|
|
<stateDescription>Analisar documento</stateDescription>
|
|
<instruction></instruction>
|
|
<deadlineTime>86400</deadlineTime>
|
|
<deadlineFieldName></deadlineFieldName>
|
|
<joint>false</joint>
|
|
<agreementPercentage>0</agreementPercentage>
|
|
<engineAllocationId>Pool Grupo</engineAllocationId>
|
|
<engineAllocationConfiguration><AssignmentController><Group>Fiscal</Group></AssignmentController></engineAllocationConfiguration>
|
|
<selectColleague>1</selectColleague>
|
|
<initialState>false</initialState>
|
|
<notifyAuthorityDelay>true</notifyAuthorityDelay>
|
|
<notifyRequisitionerDelay>false</notifyRequisitionerDelay>
|
|
<allowanceAuthorityTime>3600</allowanceAuthorityTime>
|
|
<frequenceAuthorityTime>3600</frequenceAuthorityTime>
|
|
<allowanceRequisitionerTime>0</allowanceRequisitionerTime>
|
|
<frequenceRequisitionerTime>0</frequenceRequisitionerTime>
|
|
<transferAttachments>false</transferAttachments>
|
|
<subProcessId></subProcessId>
|
|
<formFolder>0</formFolder>
|
|
<notifyAuthorityFollowUp>true</notifyAuthorityFollowUp>
|
|
<notifyRequisitionerFollowUp>false</notifyRequisitionerFollowUp>
|
|
<automatic>false</automatic>
|
|
<positionX>280</positionX>
|
|
<positionY>300</positionY>
|
|
<forecastedEffortType>0</forecastedEffortType>
|
|
<forecastedEffort>0</forecastedEffort>
|
|
<notifyManagerFollowUp>false</notifyManagerFollowUp>
|
|
<notifyManagerDelay>false</notifyManagerDelay>
|
|
<allowanceManagerTime>0</allowanceManagerTime>
|
|
<frequenceManagerTime>0</frequenceManagerTime>
|
|
<inhibitTransfer>false</inhibitTransfer>
|
|
<periodId>Default</periodId>
|
|
<stateType>0</stateType>
|
|
<bpmnType>80</bpmnType>
|
|
<signalId>0</signalId>
|
|
<counterSign>false</counterSign>
|
|
<openInstances>0</openInstances>
|
|
<noticeExpirationAuthorityTime>0</noticeExpirationAuthorityTime>
|
|
<noticeExpirationRequisitionerTime>0</noticeExpirationRequisitionerTime>
|
|
<noticeExpirationManagerTime>0</noticeExpirationManagerTime>
|
|
<destinationStates/>
|
|
<digitalSignature>false</digitalSignature>
|
|
<executionType>0</executionType>
|
|
</ProcessState>
|
|
<ProcessState>
|
|
<processStatePK>
|
|
<companyId>1</companyId>
|
|
<processId>FlowEssentials_LancamentodeDocumento</processId>
|
|
<version>1</version>
|
|
<sequence>9</sequence>
|
|
</processStatePK>
|
|
<stateName>Ajustar dados do documento</stateName>
|
|
<stateDescription>Ajustar dados do documento</stateDescription>
|
|
<instruction></instruction>
|
|
<deadlineTime>86400</deadlineTime>
|
|
<deadlineFieldName></deadlineFieldName>
|
|
<joint>false</joint>
|
|
<agreementPercentage>0</agreementPercentage>
|
|
<engineAllocationId>Executor Atividade</engineAllocationId>
|
|
<engineAllocationConfiguration><AssignmentController><BaseActivity>4</BaseActivity><Returns>Last</Returns></AssignmentController></engineAllocationConfiguration>
|
|
<selectColleague>1</selectColleague>
|
|
<initialState>false</initialState>
|
|
<notifyAuthorityDelay>true</notifyAuthorityDelay>
|
|
<notifyRequisitionerDelay>false</notifyRequisitionerDelay>
|
|
<allowanceAuthorityTime>3600</allowanceAuthorityTime>
|
|
<frequenceAuthorityTime>3600</frequenceAuthorityTime>
|
|
<allowanceRequisitionerTime>0</allowanceRequisitionerTime>
|
|
<frequenceRequisitionerTime>0</frequenceRequisitionerTime>
|
|
<transferAttachments>false</transferAttachments>
|
|
<subProcessId></subProcessId>
|
|
<formFolder>0</formFolder>
|
|
<notifyAuthorityFollowUp>true</notifyAuthorityFollowUp>
|
|
<notifyRequisitionerFollowUp>false</notifyRequisitionerFollowUp>
|
|
<automatic>false</automatic>
|
|
<positionX>500</positionX>
|
|
<positionY>77</positionY>
|
|
<forecastedEffortType>0</forecastedEffortType>
|
|
<forecastedEffort>0</forecastedEffort>
|
|
<notifyManagerFollowUp>false</notifyManagerFollowUp>
|
|
<notifyManagerDelay>false</notifyManagerDelay>
|
|
<allowanceManagerTime>0</allowanceManagerTime>
|
|
<frequenceManagerTime>0</frequenceManagerTime>
|
|
<inhibitTransfer>false</inhibitTransfer>
|
|
<periodId></periodId>
|
|
<stateType>0</stateType>
|
|
<bpmnType>80</bpmnType>
|
|
<signalId>0</signalId>
|
|
<counterSign>false</counterSign>
|
|
<openInstances>0</openInstances>
|
|
<noticeExpirationAuthorityTime>0</noticeExpirationAuthorityTime>
|
|
<noticeExpirationRequisitionerTime>0</noticeExpirationRequisitionerTime>
|
|
<noticeExpirationManagerTime>0</noticeExpirationManagerTime>
|
|
<destinationStates/>
|
|
<digitalSignature>false</digitalSignature>
|
|
<executionType>0</executionType>
|
|
</ProcessState>
|
|
<ProcessState>
|
|
<processStatePK>
|
|
<companyId>1</companyId>
|
|
<processId>FlowEssentials_LancamentodeDocumento</processId>
|
|
<version>1</version>
|
|
<sequence>7</sequence>
|
|
</processStatePK>
|
|
<stateName>Finalizar e aprovar solicitação</stateName>
|
|
<stateDescription>Finalizar e aprovar solicitação</stateDescription>
|
|
<instruction>Atividade final do processo</instruction>
|
|
<deadlineTime>0</deadlineTime>
|
|
<joint>false</joint>
|
|
<agreementPercentage>0</agreementPercentage>
|
|
<engineAllocationId></engineAllocationId>
|
|
<engineAllocationConfiguration></engineAllocationConfiguration>
|
|
<selectColleague>0</selectColleague>
|
|
<initialState>false</initialState>
|
|
<notifyAuthorityDelay>true</notifyAuthorityDelay>
|
|
<notifyRequisitionerDelay>false</notifyRequisitionerDelay>
|
|
<allowanceAuthorityTime>0</allowanceAuthorityTime>
|
|
<frequenceAuthorityTime>1</frequenceAuthorityTime>
|
|
<allowanceRequisitionerTime>0</allowanceRequisitionerTime>
|
|
<frequenceRequisitionerTime>0</frequenceRequisitionerTime>
|
|
<transferAttachments>false</transferAttachments>
|
|
<subProcessId></subProcessId>
|
|
<formFolder>0</formFolder>
|
|
<notifyAuthorityFollowUp>false</notifyAuthorityFollowUp>
|
|
<notifyRequisitionerFollowUp>false</notifyRequisitionerFollowUp>
|
|
<automatic>false</automatic>
|
|
<positionX>800</positionX>
|
|
<positionY>430</positionY>
|
|
<forecastedEffortType>0</forecastedEffortType>
|
|
<forecastedEffort>0</forecastedEffort>
|
|
<notifyManagerFollowUp>false</notifyManagerFollowUp>
|
|
<notifyManagerDelay>false</notifyManagerDelay>
|
|
<allowanceManagerTime>0</allowanceManagerTime>
|
|
<frequenceManagerTime>0</frequenceManagerTime>
|
|
<inhibitTransfer>false</inhibitTransfer>
|
|
<periodId></periodId>
|
|
<stateType>6</stateType>
|
|
<bpmnType>60</bpmnType>
|
|
<signalId>0</signalId>
|
|
<counterSign>false</counterSign>
|
|
<openInstances>0</openInstances>
|
|
<destinationStates/>
|
|
<digitalSignature>false</digitalSignature>
|
|
</ProcessState>
|
|
<ProcessState>
|
|
<processStatePK>
|
|
<companyId>1</companyId>
|
|
<processId>FlowEssentials_LancamentodeDocumento</processId>
|
|
<version>1</version>
|
|
<sequence>14</sequence>
|
|
</processStatePK>
|
|
<stateName>Cancelar</stateName>
|
|
<stateDescription>Cancelar</stateDescription>
|
|
<instruction>Atividade final do processo</instruction>
|
|
<deadlineTime>0</deadlineTime>
|
|
<joint>false</joint>
|
|
<agreementPercentage>0</agreementPercentage>
|
|
<engineAllocationId></engineAllocationId>
|
|
<engineAllocationConfiguration></engineAllocationConfiguration>
|
|
<selectColleague>0</selectColleague>
|
|
<initialState>false</initialState>
|
|
<notifyAuthorityDelay>true</notifyAuthorityDelay>
|
|
<notifyRequisitionerDelay>false</notifyRequisitionerDelay>
|
|
<allowanceAuthorityTime>0</allowanceAuthorityTime>
|
|
<frequenceAuthorityTime>1</frequenceAuthorityTime>
|
|
<allowanceRequisitionerTime>0</allowanceRequisitionerTime>
|
|
<frequenceRequisitionerTime>0</frequenceRequisitionerTime>
|
|
<transferAttachments>false</transferAttachments>
|
|
<subProcessId></subProcessId>
|
|
<formFolder>0</formFolder>
|
|
<notifyAuthorityFollowUp>false</notifyAuthorityFollowUp>
|
|
<notifyRequisitionerFollowUp>false</notifyRequisitionerFollowUp>
|
|
<automatic>false</automatic>
|
|
<positionX>800</positionX>
|
|
<positionY>320</positionY>
|
|
<forecastedEffortType>0</forecastedEffortType>
|
|
<forecastedEffort>0</forecastedEffort>
|
|
<notifyManagerFollowUp>false</notifyManagerFollowUp>
|
|
<notifyManagerDelay>false</notifyManagerDelay>
|
|
<allowanceManagerTime>0</allowanceManagerTime>
|
|
<frequenceManagerTime>0</frequenceManagerTime>
|
|
<inhibitTransfer>false</inhibitTransfer>
|
|
<periodId></periodId>
|
|
<stateType>6</stateType>
|
|
<bpmnType>65</bpmnType>
|
|
<signalId>0</signalId>
|
|
<counterSign>false</counterSign>
|
|
<openInstances>0</openInstances>
|
|
<destinationStates/>
|
|
<digitalSignature>false</digitalSignature>
|
|
</ProcessState>
|
|
</list>
|
|
<list/>
|
|
<list>
|
|
<ProcessLink>
|
|
<processLinkPK>
|
|
<companyId>1</companyId>
|
|
<processId>FlowEssentials_LancamentodeDocumento</processId>
|
|
<version>1</version>
|
|
<linkSequence>6</linkSequence>
|
|
</processLinkPK>
|
|
<actionLabel></actionLabel>
|
|
<returnPermited>false</returnPermited>
|
|
<initialStateSequence>4</initialStateSequence>
|
|
<finalStateSequence>5</finalStateSequence>
|
|
<returnLabel></returnLabel>
|
|
<name></name>
|
|
<automaticLink>false</automaticLink>
|
|
<defaultLink>false</defaultLink>
|
|
<type>0</type>
|
|
</ProcessLink>
|
|
<ProcessLink>
|
|
<processLinkPK>
|
|
<companyId>1</companyId>
|
|
<processId>FlowEssentials_LancamentodeDocumento</processId>
|
|
<version>1</version>
|
|
<linkSequence>8</linkSequence>
|
|
</processLinkPK>
|
|
<actionLabel>Finalizar e aprovar solicitação</actionLabel>
|
|
<returnPermited>false</returnPermited>
|
|
<initialStateSequence>5</initialStateSequence>
|
|
<finalStateSequence>7</finalStateSequence>
|
|
<returnLabel></returnLabel>
|
|
<name>Aprovar</name>
|
|
<automaticLink>false</automaticLink>
|
|
<defaultLink>false</defaultLink>
|
|
<type>0</type>
|
|
</ProcessLink>
|
|
<ProcessLink>
|
|
<processLinkPK>
|
|
<companyId>1</companyId>
|
|
<processId>FlowEssentials_LancamentodeDocumento</processId>
|
|
<version>1</version>
|
|
<linkSequence>10</linkSequence>
|
|
</processLinkPK>
|
|
<actionLabel></actionLabel>
|
|
<returnPermited>false</returnPermited>
|
|
<initialStateSequence>5</initialStateSequence>
|
|
<finalStateSequence>9</finalStateSequence>
|
|
<returnLabel></returnLabel>
|
|
<name>Ajustar</name>
|
|
<automaticLink>false</automaticLink>
|
|
<defaultLink>false</defaultLink>
|
|
<type>0</type>
|
|
</ProcessLink>
|
|
<ProcessLink>
|
|
<processLinkPK>
|
|
<companyId>1</companyId>
|
|
<processId>FlowEssentials_LancamentodeDocumento</processId>
|
|
<version>1</version>
|
|
<linkSequence>11</linkSequence>
|
|
</processLinkPK>
|
|
<actionLabel></actionLabel>
|
|
<returnPermited>false</returnPermited>
|
|
<initialStateSequence>9</initialStateSequence>
|
|
<finalStateSequence>5</finalStateSequence>
|
|
<returnLabel></returnLabel>
|
|
<name></name>
|
|
<automaticLink>false</automaticLink>
|
|
<defaultLink>false</defaultLink>
|
|
<type>0</type>
|
|
</ProcessLink>
|
|
<ProcessLink>
|
|
<processLinkPK>
|
|
<companyId>1</companyId>
|
|
<processId>FlowEssentials_LancamentodeDocumento</processId>
|
|
<version>1</version>
|
|
<linkSequence>13</linkSequence>
|
|
</processLinkPK>
|
|
<actionLabel></actionLabel>
|
|
<returnPermited>false</returnPermited>
|
|
<initialStateSequence>5</initialStateSequence>
|
|
<finalStateSequence>14</finalStateSequence>
|
|
<returnLabel></returnLabel>
|
|
<name>Cancelar</name>
|
|
<automaticLink>false</automaticLink>
|
|
<defaultLink>false</defaultLink>
|
|
<type>0</type>
|
|
</ProcessLink>
|
|
</list>
|
|
<list/>
|
|
<list>
|
|
<WorkflowProcessEvent>
|
|
<workflowProcessEventPK>
|
|
<companyId>1</companyId>
|
|
<eventId>beforeStateEntry</eventId>
|
|
<processId>FlowEssentials_LancamentodeDocumento</processId>
|
|
<version>1</version>
|
|
</workflowProcessEventPK>
|
|
<eventDescription>function beforeStateEntry(sequenceId) {
|
|
appendDebugPublicacao("beforeStateEntry sequenceId=" + sequenceId);
|
|
|
|
if (sequenceId == 7) {
|
|
anexarDocumentoDoCardSeNecessario();
|
|
publicarDocumento();
|
|
}
|
|
|
|
if (sequenceId == 7) {
|
|
var attachments = hAPI.listAttachments();
|
|
var hasAttachment = attachments && attachments.size() > 0;
|
|
appendDebugPublicacao("validacao anexos: total=" + (attachments ? attachments.size() : 0));
|
|
|
|
if (!hasAttachment) {
|
|
appendDebugPublicacao("validacao anexos: nenhum anexo encontrado apos processamento.");
|
|
throw "\n\nNao identificamos nenhum documento anexado, volte ao formulario e anexe pelo menos um documento para avancar a solicitacao.\n\n";
|
|
}
|
|
}
|
|
}
|
|
|
|
function anexarDocumentoDoCardSeNecessario() {
|
|
try {
|
|
var attachments = hAPI.listAttachments();
|
|
if (attachments && attachments.size() > 0) {
|
|
appendDebugPublicacao("anexarDocumentoDoCardSeNecessario: solicitacao ja possui " + attachments.size() + " anexo(s).");
|
|
return;
|
|
}
|
|
|
|
var anexoIdStr = (hAPI.getCardValue("anexo_documento_id") || "") + "";
|
|
anexoIdStr = anexoIdStr.replace(/^\s+|\s+$/g, "");
|
|
if (!anexoIdStr) {
|
|
appendDebugPublicacao("anexarDocumentoDoCardSeNecessario: campo anexo_documento_id vazio.");
|
|
return;
|
|
}
|
|
|
|
var anexoId = parseInt(anexoIdStr, 10);
|
|
if (isNaN(anexoId) || anexoId <= 0) {
|
|
appendDebugPublicacao("anexarDocumentoDoCardSeNecessario: anexo_documento_id invalido: " + anexoIdStr);
|
|
return;
|
|
}
|
|
|
|
hAPI.attachDocument(anexoId);
|
|
appendDebugPublicacao("anexarDocumentoDoCardSeNecessario: hAPI.attachDocument OK documentId=" + anexoId);
|
|
|
|
var attachmentsDepois = hAPI.listAttachments();
|
|
appendDebugPublicacao("anexarDocumentoDoCardSeNecessario: total anexos apos attachDocument = " + (attachmentsDepois ? attachmentsDepois.size() : 0));
|
|
} catch (e) {
|
|
appendDebugPublicacao("anexarDocumentoDoCardSeNecessario: ERRO " + e);
|
|
}
|
|
}
|
|
|
|
function appendDebugPublicacao(msg) {
|
|
try {
|
|
var atual = (hAPI.getCardValue("debug_publicacao") || "") + "";
|
|
var prefix = atual ? atual + "\n" : "";
|
|
hAPI.setCardValue("debug_publicacao", prefix + msg);
|
|
} catch (e) {
|
|
log.warn("appendDebugPublicacao falhou: " + e);
|
|
}
|
|
}
|
|
</eventDescription>
|
|
</WorkflowProcessEvent>
|
|
<WorkflowProcessEvent>
|
|
<workflowProcessEventPK>
|
|
<companyId>1</companyId>
|
|
<eventId>publicarDocumento</eventId>
|
|
<processId>FlowEssentials_LancamentodeDocumento</processId>
|
|
<version>1</version>
|
|
</workflowProcessEventPK>
|
|
<eventDescription>function publicarDocumento() {
|
|
var radioGed = (hAPI.getCardValue("radio_ged") || "") + "";
|
|
var idPastaSelecionadaRaw = (hAPI.getCardValue("idPastaSelecionada") || "") + "";
|
|
log.info("PUBLICAR_DOCUMENTO LANCAMENTO_DOCUMENTO ########## radio_ged=" + radioGed + " idPastaSelecionada=" + idPastaSelecionadaRaw);
|
|
appendDebugPublicacao("publicarDocumento: radio_ged=" + radioGed + " idPastaSelecionada=" + idPastaSelecionadaRaw);
|
|
|
|
if (radioGed != "publica_ged") {
|
|
log.info("PUBLICAR_DOCUMENTO LANCAMENTO_DOCUMENTO ########## Nao publicar no ECM (radio_ged diferente de publica_ged).");
|
|
appendDebugPublicacao("publicarDocumento: radio_ged diferente de publica_ged.");
|
|
return;
|
|
}
|
|
|
|
var attachments = hAPI.listAttachments();
|
|
log.info("PUBLICAR_DOCUMENTO LANCAMENTO_DOCUMENTO ########## attachments.size=" + (attachments ? attachments.size() : 0));
|
|
appendDebugPublicacao("publicarDocumento: attachments.size=" + (attachments ? attachments.size() : 0));
|
|
|
|
for (var i = 0; i < attachments.size(); i++) {
|
|
var docDto = attachments.get(i);
|
|
log.info("PUBLICAR_DOCUMENTO LANCAMENTO_DOCUMENTO ########## analisando anexo documentId=" + docDto.getDocumentId() + " version=" + docDto.getVersion() + " documentType=" + docDto.getDocumentType());
|
|
appendDebugPublicacao("publicarDocumento: analisando documentId=" + docDto.getDocumentId() + " version=" + docDto.getVersion() + " type=" + docDto.getDocumentType());
|
|
|
|
try {
|
|
docAPI.copyDocumentToUploadArea(docDto.getDocumentId(), docDto.getVersion());
|
|
|
|
docDto.setDocumentId(0);
|
|
|
|
var idPastaSelecionada = parseInt((hAPI.getCardValue("idPastaSelecionada") || "") + "", 10);
|
|
if (isNaN(idPastaSelecionada) || idPastaSelecionada <= 0) {
|
|
log.warn("PUBLICAR_DOCUMENTO LANCAMENTO_DOCUMENTO ########## idPastaSelecionada invalido. Documento nao sera publicado no ECM.");
|
|
appendDebugPublicacao("publicarDocumento: idPastaSelecionada invalido.");
|
|
continue;
|
|
}
|
|
|
|
docDto.setParentDocumentId(idPastaSelecionada);
|
|
|
|
var attachArray = new java.util.ArrayList();
|
|
var mainAttach = docAPI.newAttachment();
|
|
mainAttach.setFileName(docDto.getPhisicalFile());
|
|
mainAttach.setPrincipal(true);
|
|
mainAttach.setAttach(false);
|
|
attachArray.add(mainAttach);
|
|
|
|
docDto.setActiveVersion(true);
|
|
docDto.setColleagueId(getValue("WKUser"));
|
|
docDto.setPublisherId(getValue("WKUser"));
|
|
|
|
if (hAPI.getCardValue("radio_data_validade") == "com_data_validade") {
|
|
docDto.setExpires(true);
|
|
|
|
if (hAPI.getCardValue("inicio_validade") != "") {
|
|
var inicioValidade = (hAPI.getCardValue("inicio_validade") || "") + "";
|
|
var dataInicioSplit = inicioValidade.split("-");
|
|
var anoInicio = dataInicioSplit[0];
|
|
var mesInicio = parseFloat(dataInicioSplit[1]) - 1;
|
|
var diaInicio = dataInicioSplit[2];
|
|
var dInicio = new Date(anoInicio, mesInicio, diaInicio);
|
|
docDto.setValidationStartDate(dInicio);
|
|
}
|
|
|
|
if (hAPI.getCardValue("expiracao_validade") != "") {
|
|
var dataVencimento = (hAPI.getCardValue("expiracao_validade") || "") + "";
|
|
var dataSplit = dataVencimento.split("-");
|
|
var ano = dataSplit[0];
|
|
var mes = parseFloat(dataSplit[1]) - 1;
|
|
var dia = dataSplit[2];
|
|
var d = new Date(ano, mes, dia);
|
|
docDto.setExpirationDate(d);
|
|
}
|
|
|
|
if (hAPI.getCardValue("dias_antes_expiracao") != "") {
|
|
var diasAntesExpiracao = parseInt(hAPI.getCardValue("dias_antes_expiracao"), 10);
|
|
docDto.setNotificationDays(diasAntesExpiracao);
|
|
}
|
|
} else {
|
|
docDto.setExpires(false);
|
|
}
|
|
|
|
log.info("PUBLICAR_DOCUMENTO LANCAMENTO_DOCUMENTO ########## before create document");
|
|
var doc = docAPI.createDocument(docDto, attachArray, null, null, null);
|
|
log.info("PUBLICAR_DOCUMENTO LANCAMENTO_DOCUMENTO ########## DOCUMENTO CRIADO COM O ID: " + doc.getDocumentId());
|
|
appendDebugPublicacao("publicarDocumento: documento publicado no ECM com id=" + doc.getDocumentId());
|
|
} catch (e) {
|
|
log.error("PUBLICAR_DOCUMENTO LANCAMENTO_DOCUMENTO ########## falha ao publicar anexo documentId=" + docDto.getDocumentId() + " erro=" + e);
|
|
appendDebugPublicacao("publicarDocumento: ERRO ao publicar documentId=" + docDto.getDocumentId() + " erro=" + e);
|
|
}
|
|
}
|
|
}
|
|
|
|
function appendDebugPublicacao(msg) {
|
|
try {
|
|
var atual = (hAPI.getCardValue("debug_publicacao") || "") + "";
|
|
var prefix = atual ? atual + "\n" : "";
|
|
hAPI.setCardValue("debug_publicacao", prefix + msg);
|
|
} catch (e) {
|
|
log.warn("appendDebugPublicacao falhou: " + e);
|
|
}
|
|
}
|
|
</eventDescription>
|
|
</WorkflowProcessEvent>
|
|
</list>
|
|
<list/>
|
|
<list>
|
|
<SwimLane>
|
|
<color>FFFFFF</color>
|
|
<height>511</height>
|
|
<width>1031</width>
|
|
<positionX>10</positionX>
|
|
<positionY>10</positionY>
|
|
<stateName>Lançamento de documento</stateName>
|
|
<type>1</type>
|
|
<parentSequence>0</parentSequence>
|
|
<swimLanePK>
|
|
<companyId>1</companyId>
|
|
<processId>FlowEssentials_LancamentodeDocumento</processId>
|
|
<version>1</version>
|
|
<sequence>1</sequence>
|
|
</swimLanePK>
|
|
</SwimLane>
|
|
<SwimLane>
|
|
<color>DBE8FF</color>
|
|
<height>255</height>
|
|
<width>1001</width>
|
|
<positionX>40</positionX>
|
|
<positionY>10</positionY>
|
|
<stateName>Solicitante</stateName>
|
|
<type>2</type>
|
|
<parentSequence>1</parentSequence>
|
|
<swimLanePK>
|
|
<companyId>1</companyId>
|
|
<processId>FlowEssentials_LancamentodeDocumento</processId>
|
|
<version>1</version>
|
|
<sequence>2</sequence>
|
|
</swimLanePK>
|
|
</SwimLane>
|
|
<SwimLane>
|
|
<color>E2E2E2</color>
|
|
<height>256</height>
|
|
<width>1001</width>
|
|
<positionX>40</positionX>
|
|
<positionY>265</positionY>
|
|
<stateName>Responsável por documentos</stateName>
|
|
<type>2</type>
|
|
<parentSequence>1</parentSequence>
|
|
<swimLanePK>
|
|
<companyId>1</companyId>
|
|
<processId>FlowEssentials_LancamentodeDocumento</processId>
|
|
<version>1</version>
|
|
<sequence>3</sequence>
|
|
</swimLanePK>
|
|
</SwimLane>
|
|
</list>
|
|
<list/>
|
|
<list/>
|
|
<list>
|
|
<ProcessLinkBend>
|
|
<processLinkBendPK>
|
|
<companyId>1</companyId>
|
|
<processId>FlowEssentials_LancamentodeDocumento</processId>
|
|
<version>9</version>
|
|
<linkSequence>6</linkSequence>
|
|
<bendSequence>1</bendSequence>
|
|
</processLinkBendPK>
|
|
<positionX>137</positionX>
|
|
<positionY>335</positionY>
|
|
</ProcessLinkBend>
|
|
<ProcessLinkBend>
|
|
<processLinkBendPK>
|
|
<companyId>1</companyId>
|
|
<processId>FlowEssentials_LancamentodeDocumento</processId>
|
|
<version>9</version>
|
|
<linkSequence>8</linkSequence>
|
|
<bendSequence>1</bendSequence>
|
|
</processLinkBendPK>
|
|
<positionX>333</positionX>
|
|
<positionY>447</positionY>
|
|
</ProcessLinkBend>
|
|
<ProcessLinkBend>
|
|
<processLinkBendPK>
|
|
<companyId>1</companyId>
|
|
<processId>FlowEssentials_LancamentodeDocumento</processId>
|
|
<version>9</version>
|
|
<linkSequence>10</linkSequence>
|
|
<bendSequence>1</bendSequence>
|
|
</processLinkBendPK>
|
|
<positionX>552</positionX>
|
|
<positionY>335</positionY>
|
|
</ProcessLinkBend>
|
|
<ProcessLinkBend>
|
|
<processLinkBendPK>
|
|
<companyId>1</companyId>
|
|
<processId>FlowEssentials_LancamentodeDocumento</processId>
|
|
<version>9</version>
|
|
<linkSequence>11</linkSequence>
|
|
<bendSequence>1</bendSequence>
|
|
</processLinkBendPK>
|
|
<positionX>333</positionX>
|
|
<positionY>112</positionY>
|
|
</ProcessLinkBend>
|
|
</list>
|
|
<list/>
|
|
<list/>
|
|
<list/>
|
|
<list/>
|
|
<list/>
|
|
<list>
|
|
<ProcessAppConfiguration>
|
|
<id>0</id>
|
|
<tenantId>0</tenantId>
|
|
<processId>FlowEssentials_LancamentodeDocumento</processId>
|
|
<processVersion>9</processVersion>
|
|
<stateSequence>5</stateSequence>
|
|
<appKey>approval</appKey>
|
|
<appField>title</appField>
|
|
<description>Analisar documento</description>
|
|
</ProcessAppConfiguration>
|
|
<ProcessAppConfiguration>
|
|
<id>0</id>
|
|
<tenantId>0</tenantId>
|
|
<processId>FlowEssentials_LancamentodeDocumento</processId>
|
|
<processVersion>9</processVersion>
|
|
<stateSequence>5</stateSequence>
|
|
<appKey>approval</appKey>
|
|
<appField>description</appField>
|
|
<description></description>
|
|
</ProcessAppConfiguration>
|
|
<ProcessAppConfiguration>
|
|
<id>0</id>
|
|
<tenantId>0</tenantId>
|
|
<processId>FlowEssentials_LancamentodeDocumento</processId>
|
|
<processVersion>9</processVersion>
|
|
<stateSequence>5</stateSequence>
|
|
<appKey>approval</appKey>
|
|
<appField>highlight</appField>
|
|
<description>Documento aprovado?</description>
|
|
</ProcessAppConfiguration>
|
|
<ProcessAppConfiguration>
|
|
<id>0</id>
|
|
<tenantId>0</tenantId>
|
|
<processId>FlowEssentials_LancamentodeDocumento</processId>
|
|
<processVersion>9</processVersion>
|
|
<stateSequence>5</stateSequence>
|
|
<appKey>approval</appKey>
|
|
<appField>approve</appField>
|
|
<description>7</description>
|
|
</ProcessAppConfiguration>
|
|
<ProcessAppConfiguration>
|
|
<id>0</id>
|
|
<tenantId>0</tenantId>
|
|
<processId>FlowEssentials_LancamentodeDocumento</processId>
|
|
<processVersion>9</processVersion>
|
|
<stateSequence>5</stateSequence>
|
|
<appKey>approval</appKey>
|
|
<appField>reject</appField>
|
|
<description>9</description>
|
|
</ProcessAppConfiguration>
|
|
</list>
|
|
<list/>
|
|
<list/>
|
|
</list> |