Commit 0de0110d70ecac19fd4803660cf4eaf37590763d

Authored by Jose Pinto
1 parent f4b1e80e35
Exists in master

fuera facturas duplicadas

Showing 1 changed file with 11 additions and 3 deletions   Show diff stats
src/js/controller.js
... ... @@ -485,10 +485,18 @@ angular.module('focaCrearCobranza') .controller('cobranzaController',
485 485 );
486 486 modalInstance.result.then(
487 487 function(facturas) {
488   - $scope.cobranza.facturas = $scope.cobranza.facturas.concat(facturas);
489   - }, function() {
  488 + var facturasResult = [];
  489 + //AGREGO A FACTURASRESULT LAS FACTURAS QUE NO HAN SIDO SELECCIONADAS
  490 + facturas.forEach(function(factura) {
  491 + var existe = $scope.cobranza.facturas.filter(function(e) {
  492 + return angular.equals(factura, e);
  493 + });
490 494  
491   - }
  495 + if (!existe.length) facturasResult.push(factura);
  496 + });
  497 +
  498 + $scope.cobranza.facturas = $scope.cobranza.facturas.concat(facturasResult);
  499 + }, function() { }
492 500 );
493 501 };
494 502