@@ -33,8 +33,12 @@ class UserPointSaleRepository extends AbstractRepository | |||
]); | |||
} | |||
public function findOneUserPointSale(User $user, PointSale $pointSale) | |||
public function findOneUserPointSale(User $user = null, PointSale $pointSale = null) | |||
{ | |||
if(!$user || !$pointSale) { | |||
return null; | |||
} | |||
return UserPointSale::find() | |||
->where([ | |||
'id_user' => $user->id, |
@@ -359,7 +359,7 @@ class OrderController extends ProducerBaseController | |||
} | |||
$userPointSale = $userPointSaleManager->findOneUserPointSale(GlobalParam::getCurrentUser(), $pointSale); | |||
if ($pointSale->restricted_access && !$userPointSale) { | |||
if ($pointSale && $pointSale->restricted_access && !$userPointSale) { | |||
$errorPointSale = true; | |||
} | |||
} |