Author: mble Date: 2012-12-05 14:26:03 +0100 (Wed, 05 Dec 2012) New Revision: 282 Url: http://chorem.org/projects/chorem/repository/revisions/282 Log: Updates for VacationRequest Added: trunk/chorem-entities/src/main/java/org/chorem/entities/EmployeeMigration.java trunk/chorem-entities/src/main/java/org/chorem/entities/InvoiceMigration.java trunk/chorem-entities/src/main/java/org/chorem/entities/QuotationMigration.java trunk/chorem-entities/src/main/java/org/chorem/entities/VacationMigration.java trunk/chorem-entities/src/main/xmi/vacations.rst trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/ChoremDateUtil.java trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardHRAction.java trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/HrAction.java trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardVacationRequest.jsp trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/editMulti.jsp trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/editRelated.jsp trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/editVacationRequest.jsp trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/vacationDiv.jsp trunk/chorem-webmotion/src/main/webapp/css/vacationRequest.css trunk/chorem-webmotion/src/main/webapp/js/jquery.ui.datepicker-fr.js Modified: trunk/chorem-entities/src/main/xmi/chorem-model.zargo trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/GenericAction.java trunk/chorem-webmotion/src/main/resources/mapping trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardRequestVacation.jsp trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/decorator.jsp Added: trunk/chorem-entities/src/main/java/org/chorem/entities/EmployeeMigration.java =================================================================== --- trunk/chorem-entities/src/main/java/org/chorem/entities/EmployeeMigration.java (rev 0) +++ trunk/chorem-entities/src/main/java/org/chorem/entities/EmployeeMigration.java 2012-12-05 13:26:03 UTC (rev 282) @@ -0,0 +1,85 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package org.chorem.entities; + + +import java.beans.PropertyChangeListener; +import java.math.BigDecimal; +import java.util.Collection; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Set; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.ChoremClient; +import org.nuiton.util.VersionUtil; +import org.nuiton.wikitty.WikittyService; +import org.nuiton.wikitty.WikittyUtil; +import org.nuiton.wikitty.entities.FieldType; +import org.nuiton.wikitty.entities.Wikitty; +import org.nuiton.wikitty.entities.WikittyExtension; +import org.nuiton.wikitty.services.WikittyExtensionMigrationRename; + +/** + * + * @author mble + */ +public class EmployeeMigration extends WikittyExtensionMigrationRename { + + static private Log log = LogFactory.getLog(EmployeeMigration.class); + + /** + * Passage de la v9 à la v10 : Suppression de 5 champs + * (ces 5 champs sont migrés dans un entitée nommée employeeRH) + + */ + protected void clearFieldType(Wikitty old, Wikitty result) { + String fType = WikittyUtil.getFQFieldName(Employee.EXT_EMPLOYEE, "type"); + result.clearField(fType); + } + protected void clearFieldPaidLeave(Wikitty old, Wikitty result) { + String fPaidLeave = WikittyUtil.getFQFieldName(Employee.EXT_EMPLOYEE, "paidLeave"); + result.clearField(fPaidLeave); + } + protected void clearFieldRtt(Wikitty old, Wikitty result) { + String fRtt = WikittyUtil.getFQFieldName(Employee.EXT_EMPLOYEE, "rtt"); + result.clearField(fRtt); + } + protected void clearFieldSalary(Wikitty old, Wikitty result) { + String fSalary = WikittyUtil.getFQFieldName(Employee.EXT_EMPLOYEE, "salary"); + result.clearField(fSalary); + } + protected void clearFieldWorkingTime(Wikitty old, Wikitty result) { + String fWorkingTime = WikittyUtil.getFQFieldName(Employee.EXT_EMPLOYEE, "workingTime"); + result.clearField(fWorkingTime); + } + + + + @Override + public Wikitty migrate(WikittyService service, Wikitty wikitty, + WikittyExtension oldExt, WikittyExtension newExt) { + Wikitty result = super.migrate(service, wikitty, oldExt, newExt); + + if (Employee.EXT_EMPLOYEE.equals(newExt.getName())) { + String oldVersion = oldExt.getVersion(); + String newVersion = newExt.getVersion(); + if (!VersionUtil.greaterThan("9.0", oldVersion) + && !VersionUtil.smallerThan(newVersion, "10.0")) { + clearFieldType(wikitty, result); + clearFieldPaidLeave(wikitty, result); + clearFieldRtt(wikitty, result); + clearFieldSalary(wikitty, result); + clearFieldWorkingTime(wikitty, result); + } + } + + + return result; + } + + +} Added: trunk/chorem-entities/src/main/java/org/chorem/entities/InvoiceMigration.java =================================================================== --- trunk/chorem-entities/src/main/java/org/chorem/entities/InvoiceMigration.java (rev 0) +++ trunk/chorem-entities/src/main/java/org/chorem/entities/InvoiceMigration.java 2012-12-05 13:26:03 UTC (rev 282) @@ -0,0 +1,70 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package org.chorem.entities; + + +import java.beans.PropertyChangeListener; +import java.math.BigDecimal; +import java.util.Collection; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Set; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.ChoremClient; +import org.nuiton.util.VersionUtil; +import org.nuiton.wikitty.WikittyService; +import org.nuiton.wikitty.WikittyUtil; +import org.nuiton.wikitty.entities.FieldType; +import org.nuiton.wikitty.entities.Wikitty; +import org.nuiton.wikitty.entities.WikittyExtension; +import org.nuiton.wikitty.services.WikittyExtensionMigrationRename; + +/** + * + * @author mble + */ +public class InvoiceMigration extends WikittyExtensionMigrationRename { + + static private Log log = LogFactory.getLog(InvoiceMigration.class); + + /** + * Migration du champ VTA vers VAT + + */ + protected void migrateFieldVTA(Wikitty old, Wikitty result) { + + String oldFieldName = WikittyUtil.getFQFieldName( + Invoice.EXT_INVOICE, "VTA"); + String newFieldName = WikittyUtil.getFQFieldName( + Invoice.EXT_INVOICE, Invoice.FIELD_INVOICE_VAT); + Object v = old.getFqField(oldFieldName); + result.setFqField(newFieldName, v); + + } + + + @Override + public Wikitty migrate(WikittyService service, Wikitty wikitty, + WikittyExtension oldExt, WikittyExtension newExt) { + Wikitty result = super.migrate(service, wikitty, oldExt, newExt); + + if (Invoice.EXT_INVOICE.equals(newExt.getName())) { + String oldVersion = oldExt.getVersion(); + String newVersion = newExt.getVersion(); + if (!VersionUtil.greaterThan("14.0", oldVersion) + && !VersionUtil.smallerThan(newVersion, "15.0")) { + + migrateFieldVTA(wikitty, result); + } + } + + + return result; + } + + +} Added: trunk/chorem-entities/src/main/java/org/chorem/entities/QuotationMigration.java =================================================================== --- trunk/chorem-entities/src/main/java/org/chorem/entities/QuotationMigration.java (rev 0) +++ trunk/chorem-entities/src/main/java/org/chorem/entities/QuotationMigration.java 2012-12-05 13:26:03 UTC (rev 282) @@ -0,0 +1,65 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package org.chorem.entities; + + +import java.beans.PropertyChangeListener; +import java.math.BigDecimal; +import java.util.Collection; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Set; +import org.chorem.ChoremClient; +import org.nuiton.util.VersionUtil; +import org.nuiton.wikitty.WikittyService; +import org.nuiton.wikitty.WikittyUtil; +import org.nuiton.wikitty.entities.FieldType; +import org.nuiton.wikitty.entities.Wikitty; +import org.nuiton.wikitty.entities.WikittyExtension; +import org.nuiton.wikitty.services.WikittyExtensionMigrationRename; + +/** + * + * @author mble + */ +public class QuotationMigration extends WikittyExtensionMigrationRename { + + + /** + * Migration du champ VTA vers VAT + + */ + protected void migrateFieldVTA(Wikitty old, Wikitty result) { + + String oldFieldName = WikittyUtil.getFQFieldName( + Quotation.EXT_QUOTATION, "VTA"); + String newFieldName = WikittyUtil.getFQFieldName( + Quotation.EXT_QUOTATION, Quotation.FIELD_QUOTATION_VAT); + Object v = old.getFqField(oldFieldName); + result.setFqField(newFieldName, v); + + } + + + @Override + public Wikitty migrate(WikittyService service, Wikitty wikitty, + WikittyExtension oldExt, WikittyExtension newExt) { + Wikitty result = super.migrate(service, wikitty, oldExt, newExt); + + if (Quotation.EXT_QUOTATION.equals(newExt.getName())) { + String oldVersion = oldExt.getVersion(); + String newVersion = newExt.getVersion(); + if (!VersionUtil.greaterThan("17.0", oldVersion) + && !VersionUtil.smallerThan(newVersion, "18.0")) { + migrateFieldVTA(wikitty, result); + } + } + return result; + } + + + +} Added: trunk/chorem-entities/src/main/java/org/chorem/entities/VacationMigration.java =================================================================== --- trunk/chorem-entities/src/main/java/org/chorem/entities/VacationMigration.java (rev 0) +++ trunk/chorem-entities/src/main/java/org/chorem/entities/VacationMigration.java 2012-12-05 13:26:03 UTC (rev 282) @@ -0,0 +1,75 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package org.chorem.entities; + + +import java.beans.PropertyChangeListener; +import java.math.BigDecimal; +import java.util.Collection; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Set; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.ChoremClient; +import org.nuiton.util.VersionUtil; +import org.nuiton.wikitty.WikittyService; +import org.nuiton.wikitty.WikittyUtil; +import org.nuiton.wikitty.entities.FieldType; +import org.nuiton.wikitty.entities.Wikitty; +import org.nuiton.wikitty.entities.WikittyExtension; +import org.nuiton.wikitty.services.WikittyExtensionMigrationRename; + +/** + * + * @author mble + */ +public class VacationMigration extends WikittyExtensionMigrationRename { + + static private Log log = LogFactory.getLog(VacationMigration.class); + + /** + * Passage de la v9 à la v10 : Suppression de 3 champs et ajout de 3 nveaux + * + + */ + protected void clearFieldDescription(Wikitty old, Wikitty result) { + String fDescription = WikittyUtil.getFQFieldName(Employee.EXT_EMPLOYEE, "description"); + result.clearField(fDescription); + } + protected void clearFieldType(Wikitty old, Wikitty result) { + String fType = WikittyUtil.getFQFieldName(Employee.EXT_EMPLOYEE, "type"); + result.clearField(fType); + } + protected void clearFieldStatus(Wikitty old, Wikitty result) { + String fStatus = WikittyUtil.getFQFieldName(Employee.EXT_EMPLOYEE, "status"); + result.clearField(fStatus); + } + + + + + @Override + public Wikitty migrate(WikittyService service, Wikitty wikitty, + WikittyExtension oldExt, WikittyExtension newExt) { + Wikitty result = super.migrate(service, wikitty, oldExt, newExt); + + if (Employee.EXT_EMPLOYEE.equals(newExt.getName())) { + String oldVersion = oldExt.getVersion(); + String newVersion = newExt.getVersion(); + if (!VersionUtil.greaterThan("9.0", oldVersion) + && !VersionUtil.smallerThan(newVersion, "10.0")) { + clearFieldDescription(wikitty, result); + clearFieldType(wikitty, result); + clearFieldStatus(wikitty, result); + } + } + + return result; + } + + +} Modified: trunk/chorem-entities/src/main/xmi/chorem-model.zargo =================================================================== (Binary files differ) Added: trunk/chorem-entities/src/main/xmi/vacations.rst =================================================================== --- trunk/chorem-entities/src/main/xmi/vacations.rst (rev 0) +++ trunk/chorem-entities/src/main/xmi/vacations.rst 2012-12-05 13:26:03 UTC (rev 282) @@ -0,0 +1,46 @@ +EmployeeHR est une nouvelle entité définissant l'employé interne à la société (Default Company). +On a donc passé les attributs types "ressources humaines" (salary, workingtime, paidleave) de l'entité Employee vers l'entité EmployeeHR. +Trois attributs pour les congés : + - paidLeave : solde de jours de congés payés dans l'année + - rtt : solde de jours de récupération du temps de travail + - otherLeave : solde de jours de congés de diverses natures éventuellements attribués dans l'année + +VacationRequest : +Pour effectuer une demande de congés, l'employé doit passer par la saisie d'une "demande" de congés (VacationRequest). +Une demande de congé peut contenir plusieurs périodes de congés définies dans l'entité Vacation. +Les attributs : + - reqDate : c'est la date de dernière modification de la demande effectuée par l'employé demandeur + - reqComment : commentaires saisis par l'employé demandeur + - ansDate : c'est la date à laquelle l'employé décideur a statué sur la demande (acceptation ou refus) + - ansComment : commentaires de l'employé décideur + - reqStatus (fieldset) : + . EN PREVISION : status par défaut à la création de la demande (permet au salarié de saisir un "prévisionnel" des congés) + . EN DEMANDE : le salarié demandeur sélectionne ce statut pour soumettre la demande au décideur + . ACCEPTEE : seul le décideur peut attribué ce statut à la demande + . REFUSEE : idem ACCEPTEE + . FERMETURE ANNUELLE : statut particulier (pas vraiment une demande), c'est un congé forcé par le décideur + - employeeRequest : objet EmployeeHR définissant l'employé demandeur + - employeeWriter : objet EmployeeHR définissant l'employé qui saisit la demande pour le compte du demandeur (peut être identique) + - employeeAnswer : objet EmployeeHR définissant l'employé décideur + +Vacation : +Entité définissant une période de congé. +Les attributs : + - amount : nombre de jours réels, saisis par l'employé, de congés dans cette période (permet de gérer, par exemple, les jours fériés) + - typeLeave (fieldset) : type de congé (CONGES ANNUELS,RTT,SANS-SOLDE,MATERNITE,DIVERS) + - vacationRequest : objet demande auquel la période est rattachée + +ReferenceYear : +Entité définissant une année de référence (ou, en France, année fiscale). +Les attributs : + - leavePaidDays : nombre de jours par défaut de congés payés par an attribué aux employés + - differLeave : (booléen) report des congés payés oui/non + +WorkingDays : +Entité qui référencie les demi-journées travaillées + + + + . + + Added: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/ChoremDateUtil.java =================================================================== --- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/ChoremDateUtil.java (rev 0) +++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/ChoremDateUtil.java 2012-12-05 13:26:03 UTC (rev 282) @@ -0,0 +1,42 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package org.chorem.webmotion; + +import java.util.Date; +import java.util.GregorianCalendar; + +/** + * + * @author ble + */ +public class ChoremDateUtil extends GregorianCalendar { + + + // -- Constructor ---------------------------------------------------------- + + public ChoremDateUtil() { + super(); + } + + public ChoremDateUtil(Date d) { + this.setTime(d); + } + + public ChoremDateUtil(int jj, int mm, int aaaa) { + this.set(aaaa, (mm-1), jj); + } + + public ChoremDateUtil(String jour, String mois, String annee) { + this.set(Integer.parseInt(jour),(Integer.parseInt(mois)-1),Integer.parseInt(annee)); + } + + + // -- Methods -------------------------------------------------------------- + + public Integer dayOfWeek() { // retourne le numero de jour de la date... + return this.get(DAY_OF_WEEK); + } + +} Added: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardHRAction.java =================================================================== --- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardHRAction.java (rev 0) +++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardHRAction.java 2012-12-05 13:26:03 UTC (rev 282) @@ -0,0 +1,188 @@ +/* + * #%L + * Chorem webmotion + * $Id:$ + * $HeadURL:$ + * %% + * Copyright (C) 2011 - 2012 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it 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. + * + * This program 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ +package org.chorem.webmotion.actions; + + +import java.util.Calendar; +import java.util.Collection; +import java.util.Date; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.time.DateFormatUtils; +import org.apache.commons.lang3.time.DateUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.ChoremClient; +import org.chorem.ChoremQueryHelper; +import org.chorem.ChoremQueryMaker; +import org.chorem.entities.Attachment; +import org.chorem.entities.Category; +import org.chorem.entities.Configuration; +import org.chorem.entities.Employee; +import org.chorem.entities.EmployeeHR; +import org.chorem.entities.Interval; +import org.chorem.entities.Invoice; +import org.chorem.entities.Quotation; +import org.chorem.entities.QuotationStatus; +import org.chorem.entities.Task; +import org.chorem.entities.TaskStatus; +import org.chorem.entities.Time; +import org.chorem.entities.Touch; +import org.chorem.entities.Vacation; +import org.chorem.entities.VacationRequest; +import org.chorem.entities.VacationStatus; +import org.debux.webmotion.server.WebMotionController; +import org.debux.webmotion.server.render.Render; +import org.nuiton.util.DateUtil; +import org.nuiton.wikitty.WikittyUtil; +import org.nuiton.wikitty.entities.Element; +import org.nuiton.wikitty.entities.ElementField; +import org.nuiton.wikitty.entities.WikittyExtension; +import org.nuiton.wikitty.query.WikittyQuery; +import org.nuiton.wikitty.query.WikittyQueryMaker; +import org.nuiton.wikitty.query.WikittyQueryResult; +import org.nuiton.wikitty.query.WikittyQueryResultTreeNode; +import org.nuiton.wikitty.query.conditions.Aggregate; + +/** + * + * @author ble + * @version $Revision$ + * + * Last update: $Date$ + * by : $Author$ + */ +public class DashboardHRAction extends WebMotionController { + + /** to use log facility, just put in your code: log.info(\"...\"); */ + static private Log log = LogFactory.getLog(DashboardHRAction.class); + + static final public String budgetDateFormat = "MM/yyyy"; + static final public String summaryDateFormat = "dd/MM/yyyy hh:mm"; + + + public Render vacationFilter(ChoremClient client, String query) { + // recuperation des vacances + WikittyQuery vacationQuery = new WikittyQueryMaker().and() + .exteq(Interval.EXT_INTERVAL) + .exteq(Vacation.EXT_VACATION) + .end() + .addSortAscending(new ElementField(VacationRequest.FQ_FIELD_VACATIONREQUEST_STATUSREQUEST)); + + WikittyQueryResult<String> vacationIds = + client.findAllByQuery(vacationQuery); + + List<Vacation> vacations = + client.restore(Vacation.class, vacationIds.getAll(), + "Vacation.vacationRequest;VacationRequest.employeeRequest"); + + WikittyQuery employeeHRRequestQuery = new WikittyQueryMaker().and() + .parse(query) + .exteq(EmployeeHR.EXT_INTERVAL) + .exteq(EmployeeHR.EXT_EMPLOYEE) + .exteq(EmployeeHR.EXT_EMPLOYEEHR) + .end(); + + + WikittyQueryResult<String> employeeHRIds = + client.findAllByQuery(employeeHRRequestQuery); + + List<EmployeeHR> employeeHRRequests = + client.restore(EmployeeHR.class, employeeHRIds.getAll()); + + + return renderView("dashboardRequestVacation.jsp", + "vacations", vacations, "employes", employeeHRRequests + ); + + } + + + /** + * Les vacances + * @param client + * @param query + * @return + */ + public Render requestVacation(ChoremClient client, String query) { + return vacationFilter(client, query); + } + + + + + public Render vacationRequestFilter(ChoremClient client, String query) { + // recuperation des vacances + WikittyQuery vacationRequestQuery = new WikittyQueryMaker().and() + .parse(query) + .exteq(VacationRequest.EXT_VACATIONREQUEST) + .end() + .addSortAscending(new ElementField(VacationRequest.FQ_FIELD_VACATIONREQUEST_STATUSREQUEST)); + + WikittyQueryResult<String> vacationIds = + client.findAllByQuery(vacationRequestQuery); + + List<VacationRequest> vacationRequests = + client.restore(VacationRequest.class, vacationIds.getAll(), + "Vacation.vacationRequest;VacationRequest.employeeRequest"); + + + WikittyQuery employeeHRRequestQuery = new WikittyQueryMaker().and() + .parse(query) + .exteq(EmployeeHR.EXT_INTERVAL) + .exteq(EmployeeHR.EXT_EMPLOYEE) + .exteq(EmployeeHR.EXT_EMPLOYEEHR) + .end(); + + WikittyQueryResult<String> employeeHRIds = + client.findAllByQuery(employeeHRRequestQuery); + + List<EmployeeHR> employeeHRRequests = + client.restore(EmployeeHR.class, employeeHRIds.getAll()); + + + + return renderView("dashboardVacationRequest.jsp", + "vacations", vacationRequests, "employes", employeeHRRequests); + + } + + + /** + * Les vacances + * @param client + * @param query + * @return + */ + public Render vacationRequest(ChoremClient client, String query) { + return vacationRequestFilter(client, query); + } + + +} Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/GenericAction.java =================================================================== --- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/GenericAction.java 2012-12-01 14:17:26 UTC (rev 281) +++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/GenericAction.java 2012-12-05 13:26:03 UTC (rev 282) @@ -494,62 +494,58 @@ public Render editMultiRender(ChoremClient client, String ids, String[] extension, Call call, String jspRender) { log.debug("editMulti: " + ids); - // on preload rien, le preload sera fait a la fin + LinkedHashSet<WikittyExtension> exts = new LinkedHashSet<WikittyExtension>(); List<WikittyExtension> newExts = null; if (extension != null) { // Be sure that the wikitty has good extension if wanted and their requirements List<String> extensionNames = Arrays.asList(extension); newExts = client.restoreExtensionAndDependenciesLastVesion(extensionNames); + exts.addAll(newExts); } - String[] idArrays = StringUtils.split(ids, ","); - - List<String> tmpList = Arrays.asList(idArrays); - ids = ""; - // il faut parcourir la liste tmpList qui contient les ids passés en paramètre - for (int ii=0;ii<tmpList.size();ii++) { - // puis vérifier si l'id passé correspond a un wikitty - Wikitty nw = new WikittyImpl(tmpList.get(ii)); - ids += nw.getWikittyId()+","; - } - idArrays = StringUtils.split(ids, ","); - List<Wikitty> ws = client.restore(Arrays.asList(idArrays)); - + ArrayList<Integer> newW = new ArrayList<Integer>(); + int index = 0; - for (Wikitty w : ws) { String error=""; - // si on ne retrouve pas l'objet demande, on en edit un nouveau -// Wikitty wNew = null; -// if (w==null) { -// wNew = new WikittyImpl(); -// } - LinkedHashSet<WikittyExtension> exts = new LinkedHashSet<WikittyExtension>(); - if (extension == null) { - // Show all wikitty if no extension were mentioned - exts.addAll(w.getExtensions()); - } - - // si des nouvelles valeurs sont en parametre, on change les valeurs - // actuel du wikitty - Map<String, Object> params = call.getExtractParameters(); - - error += setWikittyField(w, "", params); - // on recharge des entites qui ont pu apparaitre, pour pouvoir les afficher comme il faut - client.preload(Collections.singleton(w), ".*"); + // si on ne retrouve pas l'objet demande, on en edit un nouveau + if (w == null) { + if (extension != null) { + newW.add(index); + } + } else { + // si des nouvelles valeurs sont en parametre, on change les valeurs + // actuel du wikitty + Map<String, Object> params = call.getExtractParameters(); + error += setWikittyField(w, "", params); + + // on recharge des entites qui ont pu apparaitre, pour pouvoir les afficher comme il faut + client.preload(Collections.singleton(w), ".*"); + } + index++; + getContext().addInfoMessage("message", "Warning: Can't put some value in object" + error + " ! "); } - return renderView(jspRender, "ws", ws); + + // ajout des nouveaux Wikitty dans ws + for (int ii=0;ii<newW.size();ii++) { + Wikitty w = new WikittyImpl(); + w.addExtension(newExts); + // on ajoute le nouveau wikitty au bon endroit + ws.add(newW.get(ii)+1, w); + } + return renderView(jspRender, "ws", ws, "extensions", exts); } - + // les nouveaux wikittyId passés en paramètre dans l'URL doivent avoir des noms différents : + // exemple /wikitty/{extension}/editMulti/new1,new2,new3... public Render editMulti(ChoremClient client, String ids, String[] extension, Call call) { return editMultiRender(client, ids, extension, call, "editMulti.jsp"); } Added: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/HrAction.java =================================================================== --- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/HrAction.java (rev 0) +++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/HrAction.java 2012-12-05 13:26:03 UTC (rev 282) @@ -0,0 +1,218 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package org.chorem.webmotion.actions; + +import java.beans.PropertyChangeListener; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.LinkedHashSet; +import java.util.List; +import org.chorem.entities.*; +import java.util.Map; +import javax.servlet.http.HttpSession; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.ChoremClient; +import org.debux.webmotion.server.call.Call; +import org.debux.webmotion.server.render.Render; +import org.nuiton.wikitty.WikittyUtil; +import org.nuiton.wikitty.entities.BusinessEntity; +import org.nuiton.wikitty.entities.Wikitty; +import org.nuiton.wikitty.entities.WikittyExtension; +import org.nuiton.wikitty.entities.WikittyImpl; + +/** + * + * @author ble + */ +public class HrAction extends GenericAction { + + /** + * to use log facility, just put in your code: log.info(\"...\"); + */ + static private Log log = LogFactory.getLog(HrAction.class); + + private Map<String, Object> params = new HashMap<String, Object>(); + private String dateDuJour = ""; + private boolean isAnswer = true; + + + + public Render editVacationRequest(ChoremClient client, String id, String[] extension, Call call) { + + String ids = ""; + boolean newVR = false; + Wikitty w = client.restore(id); + + // si on ne retrouve pas l'objet demandé, on en edit un nouveau + if (w == null) { + w = new WikittyImpl(); + newVR = true; + } + + String[] extVac = StringUtils.split(Vacation.EXT_VACATION); + Map<String,List<Wikitty>> wRelated = super.searchAsMap(client, extVac, id, 1); + String separator = ","; + + + // edition VacationRequest existante (pas new) + if (!newVR) { + ids = w.getFieldAsString(VacationRequest.EXT_VACATIONREQUEST, + VacationRequest.FIELD_VACATIONREQUEST_EMPLOYEEREQUEST) + +separator+id; + } + + // ajout des id Vacation liés à la VacationRequest + for (String ws : wRelated.keySet()) { + int size = wRelated.get(ws).size(); + for (int ii=0;ii<size;ii++) { + String wid = wRelated.get(ws).get(ii).getWikittyId(); + ids = ids + separator + wid; + } + + } + return editMultiRender(client, ids, extension, call, "editVacationRequest.jsp"); + } + + + public Render editVacationDiv(ChoremClient client, String ids, String[] extension, Call call) { + return editMultiRender(client, ids, extension, call, "vacationDiv.jsp"); + } + + + public Render saveVacationRequest(ChoremClient client, String[] ids, Call call) { + log.debug("saveVacationRequest: " + ids); + + String idVR = ""; + String reqStatus = ""; + Double vacAmount = 0.0; + String typeLeave = ""; + Wikitty wEmployeeReq = null; + + this.dateDuJour = WikittyUtil.toString((new java.util.Date())); + this.params = call.getExtractParameters(); + String keyParams = ""; + //this.isAnswer = (isAdmin.equals("yes")); + + + + for (String id : ids) { + Wikitty w = client.restore(id); + if (w == null) { + w = new WikittyImpl(); + } + + if (w.hasExtension(VacationRequest.EXT_VACATIONREQUEST)) { + keyParams = id+"."+VacationRequest.FQ_FIELD_VACATIONREQUEST_STATUSREQUEST; + if (this.params.containsKey(keyParams)) { + reqStatus = StringUtils.join((String[])this.params.get(keyParams)); + } + } + + + + + if (w.hasExtension(EmployeeHR.EXT_EMPLOYEEHR)) { + wEmployeeReq = w; + } + + + // si ce n'est pas une réponse c'est une demande + if (!this.isAnswer) { + // on enregistre la date de demande + updateVacationRequestField(w, VacationRequest.EXT_VACATIONREQUEST, + VacationRequest.FIELD_VACATIONREQUEST_DATEREQUEST, this.dateDuJour); + + // pour chaque période (Vacation) on enregistre le champ vacationRequest pour lier la période à la demande + updateVacationRequestField(w, Vacation.EXT_VACATION, Vacation.FIELD_VACATION_VACATIONREQUEST, idVR); + + } else { + // on enregistre la date de réponse + updateVacationRequestField(w, VacationRequest.EXT_VACATIONREQUEST, + VacationRequest.FIELD_VACATIONREQUEST_DATEANSWER, this.dateDuJour); + + // si la réponse est "ACCEPTEE" : pour chaque période demandée on met à jour les soldes de l'Employé + if (w.hasExtension(Vacation.EXT_VACATION)) { + for (int ii=0;ii<10;ii++) System.out.println(" GAZOU"); + System.out.println("gazou reqStatus = "+reqStatus); + System.out.println("gazou wEmployeeReq = "+wEmployeeReq.getWikittyId() + " ... "+ wEmployeeReq.toString()); + if ( (reqStatus.equals("ACCEPTEE") || (reqStatus.equals("FERMETURE ANNUELLE"))) && (wEmployeeReq != null)) { + + keyParams = id+"."+Vacation.FQ_FIELD_VACATION_AMOUNT; + vacAmount = 0.0; + if (this.params.containsKey(keyParams)) { + vacAmount = Double.parseDouble(StringUtils.join((String[])this.params.get(keyParams))); + } + + for (int ii=0;ii<30;ii++) System.out.println("gazou"); + System.out.println("keyParams = "+keyParams); + for (int ii=0;ii<30;ii++) System.out.println("gazou"); + System.out.println("vacAmount = "+ String.valueOf(vacAmount)); // fin gazou + + keyParams = id+"."+Vacation.FQ_FIELD_VACATION_TYPELEAVE; + typeLeave = ""; + if (this.params.containsKey(keyParams)) { + typeLeave = StringUtils.join((String[])this.params.get(keyParams)); + } + + for (int ii=0;ii<30;ii++) System.out.println("gazou"); + System.out.println("keyParams = "+keyParams); + for (int ii=0;ii<30;ii++) System.out.println("gazou"); + System.out.println("typeLeave = "+ typeLeave); // fin gazou + + updateAmounts(wEmployeeReq, vacAmount, typeLeave); + } + } + } + } + call.setExtractParameters(this.params); + return saveMulti(client, ids, call); + } + + + // écriture d'une "value" dans un champ "fieldname" + private void updateVacationRequestField(Wikitty w, String extensionName, String fieldName, String value) { + if ((w != null) && (w.hasExtension(extensionName))) { + String cleParams = w.getWikittyId() + "." + extensionName + "." + fieldName; + this.params.put(cleParams, StringUtils.split(value)); + } + } + + + + private void updateAmounts(Wikitty wEmployeeReq, Double amount, String typeLeave) { +// String typeLeave = w.getFieldAsString(Vacation.EXT_VACATION, Vacation.FIELD_VACATION_TYPELEAVE); +// float amount = w.getFieldAsFloat(Vacation.EXT_VACATION, Vacation.FIELD_VACATION_AMOUNT); + Double eAmount = 0.0; + + + if (typeLeave.equals("CONGES ANNUELS")) { + eAmount = wEmployeeReq.getFieldAsDouble(EmployeeHR.EXT_EMPLOYEEHR, + EmployeeHR.FIELD_EMPLOYEEHR_PAIDLEAVE) - amount; + updateVacationRequestField(wEmployeeReq, EmployeeHR.EXT_EMPLOYEEHR, + EmployeeHR.FIELD_EMPLOYEEHR_PAIDLEAVE, Double.toString(eAmount)); + + } else if (typeLeave.equals("RTT")) { + eAmount = wEmployeeReq.getFieldAsDouble(EmployeeHR.EXT_EMPLOYEEHR, + EmployeeHR.FIELD_EMPLOYEEHR_RTT) - amount; + updateVacationRequestField(wEmployeeReq, EmployeeHR.EXT_EMPLOYEEHR, + EmployeeHR.FIELD_EMPLOYEEHR_RTT, Double.toString(eAmount)); + + } else { + eAmount = wEmployeeReq.getFieldAsDouble(EmployeeHR.EXT_EMPLOYEEHR, + EmployeeHR.FIELD_EMPLOYEEHR_OTHERLEAVE) - amount; + updateVacationRequestField(wEmployeeReq, EmployeeHR.EXT_EMPLOYEEHR, + EmployeeHR.FIELD_EMPLOYEEHR_OTHERLEAVE, Double.toString(eAmount)); + } + } + + + + +} \ No newline at end of file Modified: trunk/chorem-webmotion/src/main/resources/mapping =================================================================== --- trunk/chorem-webmotion/src/main/resources/mapping 2012-12-01 14:17:26 UTC (rev 281) +++ trunk/chorem-webmotion/src/main/resources/mapping 2012-12-05 13:26:03 UTC (rev 282) @@ -52,4 +52,4 @@ * /hr/vacationRequest/save action:HrAction.saveVacationRequest * /sales view:sales.jsp * /sales/{method} action:SalesAction.{method} -* /vracble action:VracBle.testBle \ No newline at end of file + Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardRequestVacation.jsp =================================================================== --- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardRequestVacation.jsp 2012-12-01 14:17:26 UTC (rev 281) +++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardRequestVacation.jsp 2012-12-05 13:26:03 UTC (rev 282) @@ -41,19 +41,24 @@ </tr> </thead> + <c:forEach var="q" items="${vacations}"> - <tbody> - <tr> - <td><a href="hr/vacationRequest/edit/${q.vacationRequest}" />Edit</a></td> - <td><w:display wikitty="${q.wikitty}" toString="${q.getVacationRequest(true).getEmployeeRequest(false)}" label=""/></td> - <td><w:display wikitty="${q.wikitty}" fqfield="Vacation.typeLeave" label=""/></td> - <td class="date"><w:display wikitty="${q.wikitty}" fqfield="Interval.beginDate" label=""/></td> - <td class="date"><w:display wikitty="${q.wikitty}" fqfield="Interval.endDate" label=""/></td> - <td><w:display wikitty="${q.wikitty}" fqfield="Vacation.amount" label=""/></td> - <td><w:display wikitty="${q.wikitty}" toString="${q.getVacationRequest(false).statusRequest}" label=""/></td> - <td class="date"><w:display wikitty="${q.wikitty}" toString="${q.getVacationRequest(false).dateRequest}" label=""/></td> - </tr> - </tbody> + <c:forEach var="emp" items="${employes}"> + <c:if test="${emp.getWikittyId() eq q.getVacationRequest(true).employeeRequest}"> + <tbody> + <tr> + <td><a href="hr/vacationRequest/edit/${q.vacationRequest}" />Edit</a></td> + <td>${emp.toString()}</td> + <td><w:display wikitty="${q.wikitty}" fqfield="Vacation.typeLeave" label=""/></td> + <td class="date"><w:display wikitty="${q.wikitty}" fqfield="Interval.beginDate" label=""/></td> + <td class="date"><w:display wikitty="${q.wikitty}" fqfield="Interval.endDate" label=""/></td> + <td><w:display wikitty="${q.wikitty}" fqfield="Vacation.amount" label=""/></td> + <td><w:display wikitty="${q.wikitty}" toString="${q.getVacationRequest(false).statusRequest}" label=""/></td> + <td class="date"><w:display wikitty="${q.wikitty}" toString="${q.getVacationRequest(false).dateRequest}" label=""/></td> + </tr> + </tbody> + </c:if> + </c:forEach> </c:forEach> </table> Added: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardVacationRequest.jsp =================================================================== --- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardVacationRequest.jsp (rev 0) +++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardVacationRequest.jsp 2012-12-05 13:26:03 UTC (rev 282) @@ -0,0 +1,72 @@ +<%-- + #%L + Chorem webmotion + $Id:$ + $HeadURL:$ + %% + Copyright (C) 2011 - 2012 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it 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. + + This program 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 + GNU General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + #L% + --%> +<%@page contentType="text/html" pageEncoding="UTF-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="f" %> +<%@ taglib uri="/WEB-INF/wikitty.tld" prefix="w"%> + +<h1>${title}</h1> + +<table class="table table-striped table-bordered table-condensed"> + <thead> + <tr> + <th></th> + <th>Employee</th> + + <th>Status</th> + <th>Request Date</th> + </tr> + </thead> + + + <c:forEach var="emp" items="${employes}"> + + <c:forEach var="q" items="${vacations}"> + <tbody> + <c:if test="${emp.getWikittyId() eq q.employeeRequest}"> + <tr> + <td><a href="hr/vacationRequest/edit/${q}" />Edit</a></td> + + + + + + <td>${emp.toString()}</td> + + + + + + + <td><w:display wikitty="${q.wikitty}" toString="${q.statusRequest}" label=""/></td> + <td class="date"><w:display wikitty="${q.wikitty}" toString="${q.dateRequest}" label=""/></td> + </tr> + </c:if> + </tbody> + </c:forEach> + + </c:forEach> + +</table> + + Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/decorator.jsp =================================================================== --- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/decorator.jsp 2012-12-01 14:17:26 UTC (rev 281) +++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/decorator.jsp 2012-12-05 13:26:03 UTC (rev 282) @@ -180,8 +180,8 @@ <li><a href="<c:url value="/wikitty/ReferenceYear/search"/>"><i class="icon-th-list icon-black"></i> All years</a></li> <li><a href="<c:url value="/wikitty/ReferenceYear/edit/new"/>"><i class="icon-plus icon-black"></i> Add year</a></li> <li>Employee HR</li> - <li><a href="<c:url value="/wikitty/EmployeeHR/search"/>"><i class="icon-th-list icon-black"></i> All employees</a></li> - <li><a href="<c:url value="/wikitty/EmployeeHR/edit/new"/>"><i class="icon-plus icon-black"></i> Add employee</a> + <li><a href="<c:url value="/wikitty/EmployeeHR/search"/>"><i class="icon-th-list icon-black"></i> All employees HR</a></li> + <li><a href="<c:url value="/wikitty/EmployeeHR/edit/new"/>"><i class="icon-plus icon-black"></i> Add employee HR</a> <li>Vacation</li> <li><a href="<c:url value="/wikitty/Vacation/search"/>"><i class="icon-th-list icon-black"></i> All vacations</a></li> <li><a href="<c:url value="/wikitty/Vacation/edit/new"/>"><i class="icon-plus icon-black"></i> Add vacation</a></li> Added: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/editMulti.jsp =================================================================== --- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/editMulti.jsp (rev 0) +++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/editMulti.jsp 2012-12-05 13:26:03 UTC (rev 282) @@ -0,0 +1,64 @@ +<%-- + #%L + Chorem webmotion + $Id:$ + $HeadURL:$ + %% + Copyright (C) 2011 - 2012 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it 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. + + This program 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 + GNU General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + #L% +--%> +<%@page contentType="text/html" pageEncoding="UTF-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/wikitty.tld" prefix="w"%> + +<c:if test="${not empty ws}"> + <%//FIXME ymartel 2012/07/02 fix the need of iso accept charset ? %> + <form class="form-horizontal" method="post" accept-charset="ISO-8859-15" action="<c:url value="/wikitty/saveMulti"/>" enctype="multipart/form-data"> + + <p> + <button class="btn btn-success" type="submit"><i class="icon-ok icon-white"></i> Save</button> + <a class="btn btn-info" href="<c:url value="/wikitty/view/${wikitty.id}"/>"><i class="icon-remove icon-white"></i> Cancel</a> + </p> + <c:forEach var="wikitty" items="${ws}"> + + <c:if test="${(wikitty.getExtensions() != null) && (wikitty != null)}"> + <input type="hidden" name="ids" value="${wikitty.id}"/> + <c:forEach var="ext" items="${wikitty.getExtensions()}"> + <fieldset> + <legend>${ext.name}</legend> + <input type="hidden" name="${wikitty.id}.extension" value="${ext.name}"> + <c:forEach var="fieldName" items="${ext.fieldNames}"> + <div class="control-group"> + <label class="control-label">${fieldName}</label> + <div class="controls"> + <w:input wikitty="${wikitty}" name="${wikitty.id}.${ext.name}.${fieldName}" fqfield="${ext.name}.${fieldName}"/> + </div> + </div> + </c:forEach> + </fieldset> + </c:forEach> + <div align="center">------------------------------------------</div> + </c:if> + </c:forEach> + </form> +</c:if> + +<div class="container"> + <c:if test="${not empty extensions}"> + <a class="btn btn-success" href="<c:url value="#"/>"><i class="icon-plus icon-white"></i> Add ${extensions}</a> + </c:if> + +</div> \ No newline at end of file Added: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/editRelated.jsp =================================================================== --- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/editRelated.jsp (rev 0) +++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/editRelated.jsp 2012-12-05 13:26:03 UTC (rev 282) @@ -0,0 +1,50 @@ +<%-- + #%L + Chorem webmotion + $Id:$ + $HeadURL:$ + %% + Copyright (C) 2011 - 2012 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it 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. + + This program 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 + GNU General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + #L% + --%> +<%@page contentType="text/html" pageEncoding="UTF-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/wikitty.tld" prefix="w"%> + + +<c:forEach var="key" items="${result.keySet()}"> +<c:forEach var="wikitty" items="${result.get(key)}"> +<c:forEach var="extens" items="${extensions.keySet()}"> + + <c:forEach var="ext" items="${extensions.get(extens)}"> + + <legend>${ext.name}</legend> + <input type="hidden" name="extension" value="${ext.name}"> + <c:forEach var="fieldName" items="${ext.fieldNames}"> + <fieldset> + <div class="control-group"> + <label class="control-label">${fieldName}</label> + <div class="controls"> + <w:input wikitty="${wikitty}" fqfield="${ext.name}.${fieldName}"/> + </div> + </div> + </fieldset> + </c:forEach> + + </c:forEach> +</c:forEach> +</c:forEach> +</c:forEach> \ No newline at end of file Added: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/editVacationRequest.jsp =================================================================== --- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/editVacationRequest.jsp (rev 0) +++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/editVacationRequest.jsp 2012-12-05 13:26:03 UTC (rev 282) @@ -0,0 +1,120 @@ +<%-- + #%L + Chorem webmotion + $Id:$ + $HeadURL:$ + %% + Copyright (C) 2011 - 2012 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it 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. + + This program 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 + GNU General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + #L% +--%> +<%@page contentType="text/html" pageEncoding="UTF-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/wikitty.tld" prefix="w"%> +<link rel="stylesheet" href="<c:url value="/css/vacationRequest.css"/>"> + +<c:if test="${not empty ws}"> + <form class="form-horizontal" method="post" accept-charset="ISO-8859-15" action="<c:url value="/hr/vacationRequest/save"/>" enctype="multipart/form-data"> + <c:forEach var="wikitty" items="${ws}"> + + + + + + <!-- EmployeeHR --> + + <c:forEach var="ext" items="${wikitty.getExtensions()}"> + <c:if test="${ext.name eq 'EmployeeHR'}"> + <input type="hidden" name="ids" value="${wikitty.id}"/> + <input type="hidden" name="${wikitty.id}.extension" value="${ext.name}"> + <div class="pull-right"> + <table> + <tr><td><strong>PaidLeave amount : </strong> + </td><td><strong> <w:display wikitty="${wikitty}" fqfield="EmployeeHR.paidLeave" label=""/> days</strong></td></tr> + <tr><td><strong>Rtt amount : </strong> + </td><td><strong> <w:display wikitty="${wikitty}" fqfield="EmployeeHR.rtt" label=""/> days </strong></td></tr> + <tr><td><strong>OtherLeave amount : </strong> + </td><td><strong> <w:display wikitty="${wikitty}" fqfield="EmployeeHR.otherLeave" label=""/> days </strong></td></tr> + </table> + </div> + </c:if> + </c:forEach> + + + + + <!-- get(1) est la VacationRequest --> + + <c:forEach var="ext" items="${wikitty.getExtensions()}"> + <c:if test="${ext.name eq 'VacationRequest'}"> + <input type="hidden" name="ids" value="${wikitty.id}"/> + <input type="hidden" name="${wikitty.id}.extension" value="${ext.name}"> + <h3><w:display wikitty="${wikitty}" fqfield="VacationRequest.employeeRequest" label=""/> : Request for leave periods </h3> + <div hidden="hidden"> + <w:input wikitty="${wikitty}" name="${wikitty.id}.VacationRequest.employeeRequest" fqfield="VacationRequest.employeeRequest" /> + <w:input wikitty="${wikitty}" name="${wikitty.id}.VacationRequest.employeeWriter" fqfield="VacationRequest.employeeWriter" /> + </div> + <br /> + <div class="well"> + <p> + <button class="btn btn-success" type="submit" href="../../../report?report=requestVacation"> + <i class="icon-ok icon-white"></i> Save + </button> + <a class="btn btn-info" href="../../../report?report=requestVacation"> + <i class="icon-remove icon-white"></i> Cancel + </a> + <a class="btn btn-warning" href="#"> + <i class="icon-plus icon-white"></i> Duplicate + </a> + <h4>Status of request : + <w:input wikitty="${wikitty}" name="${wikitty.id}.VacationRequest.statusRequest" fqfield="VacationRequest.statusRequest"/> + </h4> + </p> + </div> + <br /> + + + <div id="bottom" class="row"> + <a class="btn btn-success" href="<c:url value="#"/>"><i class="icon-plus icon-white"></i> Add new period</a> + <br /><br /> + <label class="control-label">Comments : </label> + <w:input wikitty="${wikitty}" name="${wikitty.id}.VacationRequest.commentRequest" fqfield="VacationRequest.commentRequest" defaultValue="Commentaires"/> + <br /><br /> + </div> + </c:if> + </c:forEach> + + + + + + + </c:forEach> + + + <!-- Vacations --> + <c:forEach var="wikitty" items="${ws}"> + <c:forEach var="ext" items="${wikitty.getExtensions()}"> + <c:if test="${ext.name eq 'Vacation'}"> + <div class="row"> + <jsp:include page="/hr/vacationDiv/${wikitty.id}"/> + </div> + </c:if> + </c:forEach> + </c:forEach> + + + </form> +</c:if> \ No newline at end of file Added: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/vacationDiv.jsp =================================================================== --- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/vacationDiv.jsp (rev 0) +++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/vacationDiv.jsp 2012-12-05 13:26:03 UTC (rev 282) @@ -0,0 +1,69 @@ +<%-- + #%L + Chorem webmotion + $Id:$ + $HeadURL:$ + %% + Copyright (C) 2011 - 2012 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it 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. + + This program 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 + GNU General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + #L% +--%> +<%@page contentType="text/html" pageEncoding="UTF-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/wikitty.tld" prefix="w"%> + + +<div name="vacationDiv"> + <c:if test="${not empty ws}"> + <c:forEach var="wikittyd" items="${ws}"> + <h4>Period of vacation :</h4> + <input type="hidden" name="ids" value="${wikittyd.id}"/> + <input type="hidden" name="${wikittyd.id}.extension" value="Interval"> + <input type="hidden" name="${wikittyd.id}.extension" value="Vacation"> + <div class="well"> + <p class="intervalvacation"> + <table> + + <tr> + <td><label class="control-label">Type of leave : </label></td> + <td><w:input wikitty="${wikittyd}" name="${wikittyd.id}.Vacation.typeLeave" fqfield="Vacation.typeLeave"/></td> + <td> </td> + <td><label class="control-label"> Calculated amount :</label></td> + <td><label id="calcAmType"> 0</label></td> + </tr> + <tr> + <td> </td><td> </td><td> </td> + <td><label class="control-label"> Real amount : </label></td> + <td><w:input wikitty="${wikittyd}" name="${wikittyd.id}.Vacation.amount" fqfield="Vacation.amount"/></td> + </tr> + + <tr class="beginDateTR"> + <td><label class="control-label">Begin date : </label></td> + <td class="beginDateTD"><w:input wikitty="${wikittyd}" name="${wikittyd.id}.Interval.beginDate" fqfield="Interval.beginDate"/></td> + <td> <input type="checkbox" class="halfBeg" value="beg" /> half-day</td> + + </tr> + <tr class="endDateTR"> + <td><label class="control-label">End date : </label></td> + <td class="endDateTD"><w:input wikitty="${wikittyd}" name="${wikittyd.id}.Interval.endDate" fqfield="Interval.endDate"/></td> + <td> <input type="checkbox" class="halfEnd" value="end" /> half-day</td> + </tr> + </table> + </p> + </div> + </c:forEach> + + </c:if> +</div> \ No newline at end of file Added: trunk/chorem-webmotion/src/main/webapp/css/vacationRequest.css =================================================================== --- trunk/chorem-webmotion/src/main/webapp/css/vacationRequest.css (rev 0) +++ trunk/chorem-webmotion/src/main/webapp/css/vacationRequest.css 2012-12-05 13:26:03 UTC (rev 282) @@ -0,0 +1,13 @@ +/* + Document : vacationRequest.css + Created on : 26 nov. 2012, 14:42:50 + Author : ble + Description: + Purpose of the stylesheet follows. +*/ + +div#bottom { + position: absolute; + bottom: 0; +} + Added: trunk/chorem-webmotion/src/main/webapp/js/jquery.ui.datepicker-fr.js =================================================================== --- trunk/chorem-webmotion/src/main/webapp/js/jquery.ui.datepicker-fr.js (rev 0) +++ trunk/chorem-webmotion/src/main/webapp/js/jquery.ui.datepicker-fr.js 2012-12-05 13:26:03 UTC (rev 282) @@ -0,0 +1,22 @@ +/* French initialisation for the jQuery UI date picker plugin. */ +/* Written by Keith Wood (kbwood@virginbroadband.com.au) and Stéphane Nahmani (sholby@sholby.net). */ +jQuery(function($){ + $.datepicker.regional['fr'] = {clearText: 'Effacer', clearStatus: '', + closeText: 'Fermer', closeStatus: 'Fermer sans modifier', + prevText: '<Préc', prevStatus: 'Voir le mois précédent', + nextText: 'Suiv>', nextStatus: 'Voir le mois suivant', + currentText: 'Courant', currentStatus: 'Voir le mois courant', + monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin', + 'Juillet','Août','Septembre','Octobre','Novembre','Décembre'], + monthNamesShort: ['Jan','Fév','Mar','Avr','Mai','Jun', + 'Jul','Aoû','Sep','Oct','Nov','Déc'], + monthStatus: 'Voir un autre mois', yearStatus: 'Voir un autre année', + weekHeader: 'Sm', weekStatus: '', + dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'], + dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'], + dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'], + dayStatus: 'Utiliser DD comme premier jour de la semaine', dateStatus: 'Choisir le DD, MM d', + dateFormat: 'dd/mm/yy', firstDay: 0, + initStatus: 'Choisir la date', isRTL: false}; + $.datepicker.setDefaults($.datepicker.regional['fr']); +});