Subversion Repositories SmartDukaan

Rev

Rev 35603 | Rev 35617 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 35603 Rev 35607
Line 403... Line 403...
403
        boolean hasAllPartners = selectedFofoIds.contains(0);
403
        boolean hasAllPartners = selectedFofoIds.contains(0);
404
        if (hasAllPartners && selectedFofoIds.size() > 1) {
404
        if (hasAllPartners && selectedFofoIds.size() > 1) {
405
            throw new ProfitMandiBusinessException("Position", 0, "Cannot mix 'All Partners' (0) with specific partner IDs");
405
            throw new ProfitMandiBusinessException("Position", 0, "Cannot mix 'All Partners' (0) with specific partner IDs");
406
        }
406
        }
407
        if (!hasAllPartners) {
407
        if (!hasAllPartners) {
408
            Map<Integer, CustomRetailer> validRetailers = retailerService.getFofoRetailers(false);
408
            // Use direct database query instead of cached retailerService to include newly added partners
-
 
409
            Set<Integer> validFofoIds = fofoStoreRepository.selectAll().stream()
-
 
410
                    .map(fs -> fs.getId())
-
 
411
                    .collect(Collectors.toSet());
409
            for (int fofoId : selectedFofoIds) {
412
            for (int fofoId : selectedFofoIds) {
410
                if (!validRetailers.containsKey(fofoId)) {
413
                if (!validFofoIds.contains(fofoId)) {
411
                    throw new ProfitMandiBusinessException("Position", fofoId, "Invalid fofoId");
414
                    throw new ProfitMandiBusinessException("Position", fofoId, "Invalid fofoId");
412
                }
415
                }
413
            }
416
            }
414
        }
417
        }
415
 
418