fix(): Ajuste na rotina de salvar arquivos que falta descrição
This commit is contained in:
parent
0b59bd22d0
commit
47351ef0c6
1 changed files with 39 additions and 29 deletions
|
|
@ -84,45 +84,55 @@ try{
|
||||||
$markings->documents_categorys_id = new \stdClass();
|
$markings->documents_categorys_id = new \stdClass();
|
||||||
$markings->documents_categorys_id->value = $documentsCategorysId;
|
$markings->documents_categorys_id->value = $documentsCategorysId;
|
||||||
|
|
||||||
/** Verifica se a movimentação foi localizada */
|
/** Verifica se a descrição foi informada */
|
||||||
if($result->financial_movements_id > 0){
|
if(!empty($result->description)){
|
||||||
|
|
||||||
/** Salva as informações do arquivo */
|
|
||||||
if( $Documents->Save(0,
|
|
||||||
$FinancialMovementsValidate->getDocumentsCategorysId(),
|
|
||||||
$result->description,
|
|
||||||
$FinancialMovementsValidate->getArchive(),
|
|
||||||
$FinancialMovementsValidate->getExt(),
|
|
||||||
(object)$markings,
|
|
||||||
$result->financial_movements_id,
|
|
||||||
$result->company_id) ){
|
|
||||||
|
|
||||||
/** Informa o resultado positivo **/
|
|
||||||
$result = [
|
|
||||||
|
|
||||||
'cod' => 200,
|
|
||||||
'title' => 'Atenção',
|
|
||||||
'message' => '<div class="alert alert-success" role="alert">Arquivo cadastrado com sucesso!</div>'
|
|
||||||
|
|
||||||
];
|
|
||||||
|
|
||||||
/** Envio **/
|
|
||||||
echo json_encode($result);
|
|
||||||
|
|
||||||
/** Paro o procedimento **/
|
|
||||||
exit;
|
|
||||||
|
|
||||||
|
|
||||||
}else{/** Caso seja bem sucedido, informo */
|
/** Verifica se a movimentação foi localizada */
|
||||||
|
if($result->financial_movements_id > 0){
|
||||||
|
|
||||||
/** Caso ocorra alguma falha informo */
|
/** Salva as informações do arquivo */
|
||||||
throw new InvalidArgumentException("Não foi possível gravar o arquivo ".$description, 0);
|
if( $Documents->Save(0,
|
||||||
|
$FinancialMovementsValidate->getDocumentsCategorysId(),
|
||||||
|
$result->description,
|
||||||
|
$FinancialMovementsValidate->getArchive(),
|
||||||
|
$FinancialMovementsValidate->getExt(),
|
||||||
|
(object)$markings,
|
||||||
|
$result->financial_movements_id,
|
||||||
|
$result->company_id) ){
|
||||||
|
|
||||||
|
/** Informa o resultado positivo **/
|
||||||
|
$result = [
|
||||||
|
|
||||||
|
'cod' => 200,
|
||||||
|
'title' => 'Atenção',
|
||||||
|
'message' => '<div class="alert alert-success" role="alert">Arquivo cadastrado com sucesso!</div>'
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
/** Envio **/
|
||||||
|
echo json_encode($result);
|
||||||
|
|
||||||
|
/** Paro o procedimento **/
|
||||||
|
exit;
|
||||||
|
|
||||||
|
|
||||||
|
}else{/** Caso seja bem sucedido, informo */
|
||||||
|
|
||||||
|
/** Caso ocorra alguma falha informo */
|
||||||
|
throw new InvalidArgumentException("Não foi possível gravar o arquivo ".$description, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{/** Caso a movimentação não tenha sido informada, informo */
|
||||||
|
|
||||||
|
/** Informo */
|
||||||
|
throw new InvalidArgumentException("Nenhuma movimentação financeira localizada para esta solicitação", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{/** Caso a movimentação não tenha sido informada, informo */
|
}else{
|
||||||
|
|
||||||
/** Informo */
|
/** Informo */
|
||||||
throw new InvalidArgumentException("Nenhuma movimentação financeira localizada para esta solicitação", 0);
|
throw new InvalidArgumentException("A descrição do documento não foi informada", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue