Árvore de páginas

Versões comparadas

Chave

  • Esta linha foi adicionada.
  • Esta linha foi removida.
  • A formatação mudou.

...

Bloco de código
languagejs
linenumberstrue
function beforeDocumentViewer(){
 
 
                var doc = getValue("WKDocument");
                var company = getValue("WKCompany");
                var ds
                
                try {
                               var c1 = DatasetFactory.createConstraint(                                                                                                                                                                                                                                                    "allocatedDocumentPK.companyId", company, company, ConstraintType.MUST);
                               var c2 = DatasetFactory.createConstraint( "allocatedDocumentPK.sourceDocument", doc.getDocumentId(), doc.getDocumentId(), ConstraintType.MUST);
                               var c3 = DatasetFactory.createConstraint( "allocatedDocumentPK.sourceVersion", doc.getVersion(), doc.getVersion(), ConstraintType.MUST);
                               var c4 = DatasetFactory.createConstraint("active", "true","true", ConstraintType.MUST);
                                var constraints = new Array(c1, c2, c3, c4);
                               ds = DatasetFactory.getDataset("allocatedDocument", null, constraints, null);
 
 
                }catch (e) {
                               log.error("Erro ao tentar recuperar o documento em CheckOutcheck-out: " + e.message);
                }
 
 
                if(ds!=null && ds.rowsCount>0){      
                               throw  "Este documento está em Check Outcheck-out e não pode ser visualizado. Foi gerado o documento " + ds.getValue(0,"allocatedDocumentPK.destinationDocument") + " que está sob responsabilidade do usuário com matrícula "+ ds.getValue(0,"colleagueId");
                }
}

...