Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML do conteúdo do documento em Base64 #57

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/MdWsSeiRest.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public static function dataToIso88591($item)
* @param bool $jsonEncode - Se alterado para true retornar� como json_encode
* @return array
*/
public static function formataRetornoSucessoREST($mensagem = null, $result = null, $total = null, $jsonEncode = false)
public static function formataRetornoSucessoREST($mensagem = null, $result = null, $total = null, $jsonEncode = false, $base64Encode = false)
{
$data = array();
$data['sucesso'] = true;
Expand All @@ -90,6 +90,10 @@ public static function formataRetornoSucessoREST($mensagem = null, $result = nul
if (!is_null($total)) {
$data['total'] = $total;
}
if($base64Encode){
$data['data'] = base64_encode($result);
}

$retorno = MdWsSeiRest::dataToUtf8($data);

return !$jsonEncode ? $retorno : json_encode($retorno);
Expand Down
4 changes: 2 additions & 2 deletions src/rn/MdWsSeiDocumentoRN.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ protected function visualizarInternoConectado(DocumentoDTO $documentoDTOParam)
$auditoriaProtocoloRN->auditarVisualizacao($auditoriaProtocoloDTO);
}

return MdWsSeiRest::formataRetornoSucessoREST(null, $result);
return MdWsSeiRest::formataRetornoSucessoREST(null, $result, null, false, true);
}catch (Exception $e){
LogSEI::getInstance()->gravar(InfraException::inspecionar($e));
return MdWsSeiRest::formataRetornoErroREST($e);
Expand Down Expand Up @@ -943,7 +943,7 @@ protected function downloadAnexoConectado(ProtocoloDTO $protocoloDTOParam)
} else if (in_array($documentoDTO->getStrStaDocumento(), array(DocumentoRN::$TD_FORMULARIO_AUTOMATICO, DocumentoRN::$TD_FORMULARIO_GERADO))) {
$html = $documentoRN->consultarHtmlFormulario($documentoDTO);

return MdWsSeiRest::formataRetornoSucessoREST(null, array('html' => $html));
return MdWsSeiRest::formataRetornoSucessoREST(null, $html, null, false, true);
} else if ($documentoDTO->getStrStaDocumento() == DocumentoRN::$TD_EDITOR_INTERNO) {
$editorDTOConsulta = new EditorDTO();
$editorDTOConsulta->setDblIdDocumento($documentoDTO->getDblIdDocumento());
Expand Down