* @author jbui
* @author othe
*/
-class AppelLigneService extends AbsenceService{
+class AppelLigneService extends AbsenceService {
SessionFactory sessionFactory
StructureEnseignement structure = appel.evenement.agendaMaitre.structureEnseignement
List<AppelLigneCreationInfo> result = []
+ List<AppelLigneInfo> allModifieLigneAppel = appelLigneInfos.findAll {AppelLigneInfo appelLigneInfo ->
+ (appelLigneInfo.id) && (!appelLigneInfo.aSupprimer)
+ }
+
+ // liste les appelLigne liés aux sanctions
+ List<AppelLigne> allAppelLigneSanction = []
+ if (allModifieLigneAppel.size() > 0) {
+ allAppelLigneSanction = (List<AppelLigne>) AppelLigne.withCriteria {
+ 'in'('id', allModifieLigneAppel*.id)
+ isNotNull('sanction')
+ }
+ }
+
+ // liste les appelLigneInfo des appelLigne liés aux sanctions
+ List<AppelLigneInfo> allAppelLigneInfoSanction = []
+ allAppelLigneSanction.each {AppelLigne appelLigne ->
+ allAppelLigneInfoSanction.add(allModifieLigneAppel.find {it.id == appelLigne.id})
+ }
+
+
List<AppelLigneInfo> allCreationLigneAppel = appelLigneInfos.findAll {AppelLigneInfo appelLigneInfo ->
(!appelLigneInfo.getaSupprimer()) && (!appelLigneInfo.id)
}
+ // ajoute les appelLigneInfo des sanctions comme une demande de création
+ // On conserve les appelLigne lié à la sanction, on crée de nouvel
+ // appelLigne pour toute absence de sanction constatée
+ allCreationLigneAppel.addAll(allAppelLigneInfoSanction)
+
+ // On les enlève des demandes de modification
+ allModifieLigneAppel.removeAll(allAppelLigneInfoSanction)
// une absence sera lié à l'appel seulement si l'élève fait partie de la structure
// de l'appel. Sinon, l'absence sera lié à une absence journée. Voir doc
supprimeAppelLignes(allSupprimeLigneAppel*.id)
- List<AppelLigneInfo> allModifieLigneAppel = appelLigneInfos.findAll {AppelLigneInfo appelLigneInfo ->
- (appelLigneInfo.id) && (!appelLigneInfo.aSupprimer)
- }
allModifieLigneAppel.each {
AppelLigneInfo ligne ->
// élèves pour lesquels on veut saisir une absence et qui sont actifs dans la structure
// de l'appel
List personneAutoriteEleves = findAllEleveActifDansClasse(eleveAutoriteIds, structure)
- List<Long> eleveAcifAutoriteIds = personneAutoriteEleves.collect{it[0].id}
+ List<Long> eleveAcifAutoriteIds = personneAutoriteEleves.collect {it[0].id}
eleveAutoriteIds.each {
Autorite autorite = Autorite.get(it)
// si l'élève n'est pas actif dans la structure de l'appel, on ne lie pas son absence à l'appel
// mais à l'absence journée
Long absenceJouneeId = null
- if (!isActifDansStructureAppel){
+ if (!isActifDansStructureAppel) {
appelLigne.appel = null
absenceJouneeId = absenceJournee.id
appelLigne.absenceJournee = absenceJournee
// (voir saisie/saisie/AbsenceController.js.executeEnregistre)
Long appelId = appel.id
// si l'élève est actif dans la structure de l'appel, on lie son absence à l'appel
- if (isActifDansStructureAppel){
+ if (isActifDansStructureAppel) {
appel.addToAppelLignes(appelLigne)
}
// sinon, on ne lie pas son absence à l'appel
depart: appelLigne.departAnticipe,
retard: appelLigne.retard,
couleur: motif.couleur,
- libelle : motif.libelle
+ libelle: motif.libelle
)
copieAppelLigneVersAbstractAppelLigneInfo(appelLigne, statutEleveAppelInfo)
return statutEleveAppelInfo