Commit 1ca67421a564b465e76735362317a73f2ebb5279
1 parent
a34091f647
Exists in
develop
Fix
Al seleccionar sinonimo
Showing
4 changed files
with
16 additions
and
24 deletions
Show diff stats
src/app/modules/seleccion-articulos/seleccion-articulos.component.ts
| ... | ... | @@ -155,17 +155,11 @@ export class SeleccionArticulosComponent implements OnInit, AfterViewInit, OnDes |
| 155 | 155 | this.modalRef.content.onClose |
| 156 | 156 | .subscribe((res: any) => { |
| 157 | 157 | this.modalRef = null; |
| 158 | + if (!res) return; | |
| 158 | 159 | for (const a of articulo.productos) { |
| 159 | 160 | for (const aRes of res.articulos) { |
| 160 | 161 | if (a.idSinonimo === aRes.ID_SIN) { |
| 161 | - a.CODA = aRes.CodArt; | |
| 162 | - a.CodArt = aRes.CodArt; | |
| 163 | - a.SECA = aRes.CodSec; | |
| 164 | - aRes.CodSec = aRes.CodSec; | |
| 165 | - a.PreVen = aRes.PreVen; | |
| 166 | - a.id = aRes.id; | |
| 167 | - a.DET_LAR = aRes.DET_LAR; | |
| 168 | - a.DetArt = aRes.DetArt; | |
| 162 | + this.articuloService.changeArticulo(a, aRes); | |
| 169 | 163 | } |
| 170 | 164 | } |
| 171 | 165 | } |
src/app/services/articulo/articulo.service.ts
| ... | ... | @@ -126,4 +126,16 @@ export class ArticuloService { |
| 126 | 126 | } |
| 127 | 127 | }); |
| 128 | 128 | } |
| 129 | + | |
| 130 | + changeArticulo(articuloToChange: IArticulo, articuloData: any) { | |
| 131 | + articuloToChange.CODA = articuloData.CodArt; | |
| 132 | + articuloToChange.CodArt = articuloData.CodArt; | |
| 133 | + articuloToChange.SECA = articuloData.CodSec; | |
| 134 | + articuloToChange.CodSec = articuloData.CodSec; | |
| 135 | + articuloToChange.PreVen = articuloData.PreVen; | |
| 136 | + articuloToChange.id = articuloData.id; | |
| 137 | + articuloToChange.DET_LAR = articuloData.DET_LAR; | |
| 138 | + articuloToChange.DetArt = articuloData.DetArt; | |
| 139 | + articuloToChange.MKT_DESC = articuloData.MKT_DESC; | |
| 140 | + } | |
| 129 | 141 | } |
src/app/shared/header-publicidad/header-publicidad.component.ts
| ... | ... | @@ -121,14 +121,7 @@ export class HeaderPublicidadComponent implements OnInit { |
| 121 | 121 | for (const a of articulo.productos) { |
| 122 | 122 | for (const aRes of res.articulos) { |
| 123 | 123 | if (a.idSinonimo === aRes.ID_SIN) { |
| 124 | - a.CODA = aRes.CodArt; | |
| 125 | - a.CodArt = aRes.CodArt; | |
| 126 | - a.SECA = aRes.CodSec; | |
| 127 | - aRes.CodSec = aRes.CodSec; | |
| 128 | - a.PreVen = aRes.PreVen; | |
| 129 | - a.id = aRes.id; | |
| 130 | - a.DET_LAR = aRes.DET_LAR; | |
| 131 | - a.DetArt = aRes.DetArt; | |
| 124 | + this.articuloService.changeArticulo(a, aRes); | |
| 132 | 125 | } |
| 133 | 126 | } |
| 134 | 127 | } |
src/app/shared/promocion/promocion.component.ts
| ... | ... | @@ -85,14 +85,7 @@ export class PromocionComponent implements OnInit { |
| 85 | 85 | for (const a of articulo.productos) { |
| 86 | 86 | for (const aRes of res.articulos) { |
| 87 | 87 | if (a.idSinonimo === aRes.ID_SIN) { |
| 88 | - a.CODA = aRes.CodArt; | |
| 89 | - a.CodArt = aRes.CodArt; | |
| 90 | - a.SECA = aRes.CodSec; | |
| 91 | - aRes.CodSec = aRes.CodSec; | |
| 92 | - a.PreVen = aRes.PreVen; | |
| 93 | - a.id = aRes.id; | |
| 94 | - a.DET_LAR = aRes.DET_LAR; | |
| 95 | - a.DetArt = aRes.DetArt; | |
| 88 | + this.articuloService.changeArticulo(a, aRes); | |
| 96 | 89 | } |
| 97 | 90 | } |
| 98 | 91 | } |