<?php include_once __BASE_PATH__ . '/extensoes/pr_snas/1.2/classes/CFModelDocumentoDemanda.php'; include_once __BASE_PATH__ . '/extensoes/pr_snas/1.2/classes/TPDocumentoDemanda.php'; include_once __BASE_PATH__ . '/extensoes/pr_snas/1.2/classes/CFModelDocumentoCamposDemanda.php'; $response = array(); try { $persist = CFModelDocumentoDemanda::factory(); $persist->beginTransaction(); $factory = TPDocumentoDemanda::factory(); $priority = current(CFModelPrioridade::factory()->find($_REQUEST['PRIORIDADE'])); $usuario = Zend_Auth::getInstance()->getStorage()->read(); $digital = CFModelDigital::factory()->next($usuario->ID_UNIDADE); if (!$digital) { throw new Exception('Não existe digitais disponíveis!'); } $_REQUEST['SOLICITACAO'] = $_REQUEST['SOLICITACAO']; $_REQUEST['PROCEDENCIA'] = 'I'; $_REQUEST['TIPO'] = 'MONITORAMENTO'; # MONITORAMENTO! @todo parametrizar... $_REQUEST['NUMERO'] = $digital; $_REQUEST['DT_DOCUMENTO'] = Util::formatDate($_REQUEST['DT_DOCUMENTO']); $_REQUEST['DT_PRAZO'] = Util::formatDate($_REQUEST['DT_PRAZO']); $_REQUEST['DIRETORIA'] = $usuario->DIRETORIA; $_REQUEST['ORIGEM'] = $usuario->DIRETORIA; $_REQUEST['DT_CADASTRO'] = date('Y-m-d'); $_REQUEST['DIGITAL'] = $digital; $_REQUEST['ULTIMO_TRAMITE'] = sprintf('Área de Trabalho - %s', $usuario->DIRETORIA); $_REQUEST['ID_UNIDADE'] = $usuario->ID_UNIDADE; $_REQUEST['ID_USUARIO'] = $usuario->ID; $_REQUEST['ID_UNID_CAIXA_SAIDA'] = $usuario->ID_UNIDADE;
function getPriority($prioridade) { return current(CFModelPrioridade::factory()->find($prioridade)); }