@seniorsistemas/yms-integration 1.10.4 → 1.10.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2498,24 +2498,10 @@
2498
2498
  this.unsubscribe$ = new rxjs.Subject();
2499
2499
  this.validateNotaFiscal = function (response) {
2500
2500
  if (!response || !response.documentos[0]) {
2501
- _this.messageService.add({
2502
- severity: "error",
2503
- summary: _this.translate.instant("yms.integration.titulo_nota_nao_encontrado"),
2504
- detail: _this.translate.instant("yms.integration.conteudo_nota_nao_encontrado"),
2505
- });
2506
2501
  return;
2507
2502
  }
2508
2503
  var value = response.documentos[0];
2509
- if (!value.itens || !value.itens.length) {
2510
- _this.messageService.add({
2511
- severity: "error",
2512
- summary: _this.translate.instant("yms.integration.titulo_nota_fical_sem_produto"),
2513
- detail: _this.translate.instant("yms.integration.conteudo_nota_fical_sem_produto"),
2514
- });
2515
- return;
2516
- }
2517
- if (!!value.itens[0].produto && !!_this.produto && (value.itens[0].produto.id !== _this.produto.id)) {
2518
- _this.addErrorIfProdutoIsDifferent();
2504
+ if (!_this.validaProdutoNaNotaFiscal(value.itens)) {
2519
2505
  return;
2520
2506
  }
2521
2507
  var notaFiscal = {
@@ -2595,6 +2581,16 @@
2595
2581
  .subscribe(this.validateNotaFiscal);
2596
2582
  this.botaoDesabilitado = false;
2597
2583
  };
2584
+ NotaFormComponent.prototype.validaProdutoNaNotaFiscal = function (produtos) {
2585
+ if (produtos != null && produtos.length > 0) {
2586
+ var produto = produtos[0].produto;
2587
+ if (!!produto && !!this.produto && (produto.id !== this.produto.id)) {
2588
+ this.addErrorIfProdutoIsDifferent();
2589
+ return false;
2590
+ }
2591
+ }
2592
+ return true;
2593
+ };
2598
2594
  NotaFormComponent.prototype.confirmAndAddNovoFornecedor = function (infoNota, fornecedor, origemMercadoria) {
2599
2595
  var _this = this;
2600
2596
  this.confirmationService.confirm({