From c1dc50e7d03bd9fc768a7cc63b8afdb635a7c0bc Mon Sep 17 00:00:00 2001
From: Vinciane <vinciane.bizet@maarch.org>
Date: Wed, 23 Jan 2019 15:08:31 +0100
Subject: [PATCH] FIX #9370 error redirected all basket

---
 src/frontend/app/profile.component.ts | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/src/frontend/app/profile.component.ts b/src/frontend/app/profile.component.ts
index a2cd5dedfac..01676cc1b50 100755
--- a/src/frontend/app/profile.component.ts
+++ b/src/frontend/app/profile.component.ts
@@ -86,7 +86,9 @@ export class ProfileComponent extends AutoCompletePlugin implements OnInit {
     masterToggleBaskets(event: any) {
         if (event.checked) {  
             this.user.baskets.forEach((basket: any) => {
-                this.selectionBaskets.select(basket);   
+                if ( !basket.userToDisplay) {
+                    this.selectionBaskets.select(basket);
+                }
             });
         } else {
             this.selectionBaskets.clear();
@@ -509,18 +511,18 @@ export class ProfileComponent extends AutoCompletePlugin implements OnInit {
 
     addBasketRedirection(newUser: any) {
         let basketsRedirect:any[] = [];
-        this.user.baskets.forEach((elem: any) => {
-            if (this.selectionBaskets.selected.map((e:any) => { return e.basket_id; }).indexOf(elem.basket_id) != -1 && this.selectionBaskets.selected.map((e:any) => { return e.group_id; }).indexOf(elem.group_id) != -1) {
-                basketsRedirect.push(
-                    {
-                        actual_user_id: newUser.serialId,
-                        basket_id:elem.basket_id,
-                        group_id:elem.groupSerialId,
-                        originalOwner: null
-                    }
-                )
-            }
+
+        this.selectionBaskets.selected.forEach((elem: any) => {
+            basketsRedirect.push(
+                {
+                    actual_user_id: newUser.serialId,
+                    basket_id:elem.basket_id,
+                    group_id:elem.groupSerialId,
+                    originalOwner: null
+                }
+            )
         });
+
         let r = confirm(this.lang.confirmAction + ' ' + this.lang.redirectBasket);
 
         if (r) {
-- 
GitLab