feat: map adherent size and shoe size to dotations
This commit is contained in:
@@ -123,6 +123,26 @@ public class CategorieService {
|
||||
continue;
|
||||
}
|
||||
|
||||
String matchedTaille = "";
|
||||
if (licence.getAdherent() != null) {
|
||||
String taillesDispo = ce.getEquipement().getTaillesDisponibles();
|
||||
if (taillesDispo != null && !taillesDispo.trim().isEmpty()) {
|
||||
String[] dispos = taillesDispo.split(",");
|
||||
String tv = licence.getAdherent().getTailleVetement();
|
||||
String pt = licence.getAdherent().getPointure();
|
||||
for (String t : dispos) {
|
||||
String trimmed = t.trim();
|
||||
if (tv != null && !tv.trim().isEmpty() && trimmed.equalsIgnoreCase(tv.trim())) {
|
||||
matchedTaille = tv.trim();
|
||||
break;
|
||||
} else if (pt != null && !pt.trim().isEmpty() && trimmed.equalsIgnoreCase(pt.trim())) {
|
||||
matchedTaille = pt.trim();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean found = false;
|
||||
for (Dotation d : currentDotations) {
|
||||
if (ce.getEquipement().getId().equals(d.getEquipement().getId())) {
|
||||
@@ -130,6 +150,9 @@ public class CategorieService {
|
||||
if (Boolean.TRUE.equals(ce.getObligatoire()) && !Boolean.TRUE.equals(d.getChoisi())) {
|
||||
d.setChoisi(true);
|
||||
}
|
||||
if ((d.getTaille() == null || d.getTaille().trim().isEmpty()) && !matchedTaille.isEmpty()) {
|
||||
d.setTaille(matchedTaille);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -146,7 +169,7 @@ public class CategorieService {
|
||||
}
|
||||
newDotation.setChoisi(ce.getObligatoire() || (isMaillot && isNouvelle)); // Checked if obligatoire or if it's a new registration
|
||||
newDotation.setFourni(false);
|
||||
newDotation.setTaille("");
|
||||
newDotation.setTaille(matchedTaille);
|
||||
newDotation.setNumero("");
|
||||
if (licence.getAdherent() != null) {
|
||||
String defaultFlocage = "";
|
||||
|
||||
Reference in New Issue
Block a user