--- /dev/null
+/*
+ * Copyright © FYLAB and the Conseil Régional d'Île-de-France, 2009
+ * This file is part of L'Interface Libre et Interactive de l'Enseignement (Lilie).
+ *
+ * Lilie is free software. You can redistribute it and/or modify since
+ * you respect the terms of either (at least one of the both license) :
+ * - under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * - the CeCILL-C as published by CeCILL-C; either version 1 of the
+ * License, or any later version
+ *
+ * There are special exceptions to the terms and conditions of the
+ * licenses as they are applied to this software. View the full text of
+ * the exception in file LICENSE.txt in the directory of this software
+ * distribution.
+ *
+ * Lilie is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * Licenses for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the CeCILL-C along with Lilie. If not, see :
+ * <http://www.gnu.org/licenses/> and
+ * <http://www.cecill.info/licences.fr.html>.
+ */
+
+
+package org.lilie.services.eliot.impression.donnees.eleve
+
+import org.lilie.services.eliot.scolarite.Personne
+import org.lilie.services.eliot.scolarite.StructureEnseignement
+import org.lilie.services.eliot.impression.utils.ChampPublipostage
+import org.lilie.services.eliot.applications.ModuleEliot
+
+/**
+ * Information de base de l'élève liée aux responsables
+ */
+@SuppressWarnings('PropertyName')
+class ResponsableImpression extends MemoImpression {
+
+ /**
+ * Permet de savoir sur quelle adresse on vaut faire le publipostage
+ */
+ SelectionAdresseResponsableEnum selectionAdresseResponsable =
+ SelectionAdresseResponsableEnum.ADRESSE_RESPONSABLE1
+
+ // objet de données associé aux informations d'impression
+ // élève
+ Personne personne
+ // responsable1
+ Personne responsable1
+ // responsable2
+ Personne responsable2
+ // structure enseignement
+ StructureEnseignement structureEnseignement
+
+ // identifiant de la personne
+ @ChampPublipostage(applications = [])
+ Long personneId
+
+ @ChampPublipostage(applications = [ModuleEliot.ELIOT_ABSENCES, ModuleEliot.ELIOT_NOTES, ModuleEliot.BREVET, ModuleEliot.SMS])
+ String eleve_Nom
+ @ChampPublipostage(applications = [ModuleEliot.ELIOT_ABSENCES, ModuleEliot.ELIOT_NOTES, ModuleEliot.BREVET, ModuleEliot.SMS])
+ String eleve_Prenom
+ @ChampPublipostage(applications = [ModuleEliot.ELIOT_ABSENCES, ModuleEliot.ELIOT_NOTES, ModuleEliot.BREVET, ModuleEliot.SMS])
+ String eleve_Regime
+ @ChampPublipostage(applications = [ModuleEliot.ELIOT_ABSENCES, ModuleEliot.ELIOT_NOTES, ModuleEliot.BREVET, ModuleEliot.SMS])
+ String eleve_Sexe
+ @ChampPublipostage(applications = [ModuleEliot.ELIOT_ABSENCES, ModuleEliot.ELIOT_NOTES, ModuleEliot.BREVET, ModuleEliot.SMS])
+ String eleve_DateNaissance
+ @ChampPublipostage(applications = [ModuleEliot.ELIOT_ABSENCES, ModuleEliot.ELIOT_NOTES, ModuleEliot.SMS])
+ String parent_Nom
+
+ @ChampPublipostage(applications = [ModuleEliot.ELIOT_ABSENCES, ModuleEliot.ELIOT_NOTES, ModuleEliot.SMS])
+ String parent_Prenom
+
+ @ChampPublipostage(applications = [ModuleEliot.ELIOT_ABSENCES, ModuleEliot.ELIOT_NOTES, ModuleEliot.SMS])
+ String parent_Adresse
+
+ @ChampPublipostage(applications = [ModuleEliot.ELIOT_ABSENCES, ModuleEliot.ELIOT_NOTES, ModuleEliot.SMS])
+ String parent_CodePostal
+
+ @ChampPublipostage(applications = [ModuleEliot.ELIOT_ABSENCES, ModuleEliot.ELIOT_NOTES, ModuleEliot.SMS])
+ String parent_Ville
+
+ String parent1_Nom
+
+ public String getParent1_Nom() {
+ getParent_Nom()
+ }
+
+ String parent1_Prenom
+
+ public String getParent1_Prenom() {
+ getParent_Prenom()
+ }
+
+ String parent1_Adresse
+
+ public String getParent1_Adresse() {
+ getParent_Adresse()
+ }
+
+ String parent1_CodePostal
+
+ public String getParent1_CodePostal() {
+ getParent_CodePostal()
+ }
+
+ String parent1_Ville
+
+ public String getParent1_Ville() {
+ getParent_Ville()
+ }
+
+ String parent2_Nom
+
+ public String getParent2_Nom() {
+ getParent_Nom()
+ }
+
+ String parent2_Prenom
+
+ public String getParent2_Prenom() {
+ getParent_Prenom()
+ }
+
+ String parent2_Adresse
+
+ public String getParent2_Adresse() {
+ getParent_Adresse()
+ }
+
+ String parent2_CodePostal
+
+ public String getParent2_CodePostal() {
+ getParent_CodePostal()
+ }
+
+ String parent2_Ville
+
+ public String getParent2_Ville() {
+ getParent_Ville()
+ }
+
+ public String getParent_Nom() {
+ switch (selectionAdresseResponsable) {
+ case SelectionAdresseResponsableEnum.ADRESSE_RESPONSABLE1:
+ return parent1_Nom
+ case SelectionAdresseResponsableEnum.ADRESSE_RESPONSABLE2:
+ return parent2_Nom
+ }
+ }
+
+ public String getParent_Prenom() {
+ switch (selectionAdresseResponsable) {
+ case SelectionAdresseResponsableEnum.ADRESSE_RESPONSABLE1:
+ return parent1_Prenom
+ case SelectionAdresseResponsableEnum.ADRESSE_RESPONSABLE2:
+ return parent2_Prenom
+ }
+ }
+
+ public String getParent_Adresse() {
+ switch (selectionAdresseResponsable) {
+ case SelectionAdresseResponsableEnum.ADRESSE_RESPONSABLE1:
+ return parent1_Adresse
+ case SelectionAdresseResponsableEnum.ADRESSE_RESPONSABLE2:
+ return parent2_Adresse
+ }
+ }
+
+ public String getParent_Ville() {
+ switch (selectionAdresseResponsable) {
+ case SelectionAdresseResponsableEnum.ADRESSE_RESPONSABLE1:
+ return parent1_Ville
+ case SelectionAdresseResponsableEnum.ADRESSE_RESPONSABLE2:
+ return parent2_Ville
+ }
+ }
+
+ public String getParent_CodePostal() {
+ switch (selectionAdresseResponsable) {
+ case SelectionAdresseResponsableEnum.ADRESSE_RESPONSABLE1:
+ return parent1_CodePostal
+ case SelectionAdresseResponsableEnum.ADRESSE_RESPONSABLE2:
+ return parent2_CodePostal
+ }
+ }
+
+ /**
+ * indique si le destinataire du publipostage est valide
+ */
+ public Boolean isDestinataireCourrierValide() {
+
+ switch (selectionAdresseResponsable) {
+ case SelectionAdresseResponsableEnum.ADRESSE_RESPONSABLE1:
+ return (parent1_Nom) &&
+ (parent1_Adresse) &&
+ (parent1_CodePostal) &&
+ (parent1_Ville)
+
+ case SelectionAdresseResponsableEnum.ADRESSE_RESPONSABLE2:
+ return (parent2_Nom) &&
+ (parent2_Adresse) &&
+ (parent2_CodePostal) &&
+ (parent2_Ville)
+
+ }
+ }
+
+ /**
+ * Retourne le responsable associé choisit
+ */
+ public Personne getResponsable() {
+
+ switch (selectionAdresseResponsable) {
+ case SelectionAdresseResponsableEnum.ADRESSE_RESPONSABLE1:
+ return responsable1
+ case SelectionAdresseResponsableEnum.ADRESSE_RESPONSABLE2:
+ return responsable2
+ }
+
+ }
+
+ String parent_portable
+
+ public String getParent_portable() {
+ switch (selectionAdresseResponsable) {
+ case SelectionAdresseResponsableEnum.ADRESSE_RESPONSABLE1:
+ if (responsable1) {
+ return responsable1.getTelephonePortable()
+ } else {
+ return ""
+ }
+ case SelectionAdresseResponsableEnum.ADRESSE_RESPONSABLE2:
+ if (responsable2) {
+ return responsable2.getTelephonePortable()
+ } else {
+ return ""
+ }
+ }
+ }
+
+ /**
+ * Permet de savoir si l'adresse 2 est différente de l'adresse 1
+ */
+ public boolean isAdresse2DifferenteAdresse1() {
+
+ if (parent1_Adresse?.trim()?.toLowerCase() != parent2_Adresse?.trim()?.toLowerCase()) {
+ return true
+ }
+
+ if (parent1_CodePostal?.trim()?.toLowerCase() != parent2_CodePostal?.trim()?.toLowerCase()) {
+ return true
+ }
+
+ if (parent1_Ville?.trim()?.toLowerCase() != parent2_Ville?.trim()?.toLowerCase()) {
+ return true
+ }
+
+ return false
+ }
+
+ /**
+ * Permet de savoir si le téléphone portable 2 est différent du téléphone portable 1
+ */
+ public boolean isPortable2DifferentPortable1() {
+ String portable1
+ if (responsable1) {
+ portable1 = responsable1.getTelephonePortable()
+ } else {
+ portable1 = ""
+ }
+
+
+ String portable2
+ if (responsable2) {
+ portable2 = responsable2.getTelephonePortable()
+ } else {
+ portable2 = ""
+ }
+
+ if (portable1 == portable2) {
+ return false
+ }
+
+ return true
+ }
+
+
+}