r128 - in trunk: . chorem-web chorem-web/src/main/java/org/chorem chorem-web/src/main/java/org/chorem/action chorem-web/src/main/java/org/chorem/billy/action chorem-web/src/main/java/org/chorem/bonzoms/action chorem-web/src/main/java/org/chorem/gepeto/action chorem-web/src/main/resources chorem-web/src/main/resources/i18n chorem-web/src/main/resources/org/chorem/bonzoms/action chorem-web/src/main/resources/org/chorem/gepeto/action chorem-web/src/main/webapp/WEB-INF/decorators chorem-web/src
Author: bpoussin Date: 2011-11-06 18:01:34 +0100 (Sun, 06 Nov 2011) New Revision: 128 Url: http://chorem.org/repositories/revision/chorem/128 Log: debut de retravaille de chorem Mise en place d'une action generique qui travail avec le grid jquery Added: trunk/chorem-web/src/main/java/org/chorem/ChoremConfigOption.java trunk/chorem-web/src/main/java/org/chorem/action/ChoremBaseAction.java trunk/chorem-web/src/main/java/org/chorem/action/EntitySearchJsonAction.java trunk/chorem-web/src/main/resources/freemarker.properties trunk/src/ trunk/src/site/ trunk/src/site/chorem-cdc.txt trunk/src/site/requisite.txt Removed: trunk/chorem-web/src/main/java/org/chorem/action/BaseAction.java Modified: trunk/chorem-web/pom.xml trunk/chorem-web/src/main/java/org/chorem/ChoremConfig.java trunk/chorem-web/src/main/java/org/chorem/ChoremProxy.java trunk/chorem-web/src/main/java/org/chorem/ChoremSession.java trunk/chorem-web/src/main/java/org/chorem/action/HomeAction.java trunk/chorem-web/src/main/java/org/chorem/billy/action/QuotationAction.java trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/ContactDetailsAction.java trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/EmployeeAction.java trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/EmploymentContractAction.java trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/PersonAction.java trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectAction.java trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectOrderAction.java trunk/chorem-web/src/main/java/org/chorem/gepeto/action/TaskAction.java trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties trunk/chorem-web/src/main/resources/log4j.properties trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/CompanyAction-addCompany-validation.xml trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/CompanyAction-modifyCompany-validation.xml trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/EmploymentContractAction-addEmploymentContract-validation.xml trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/PersonAction-addPerson-validation.xml trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/ProjectAction-addProject-validation.xml trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/ProjectAction-modifyProject-validation.xml trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/TaskAction-addTask-validation.xml trunk/chorem-web/src/main/resources/struts.properties trunk/chorem-web/src/main/resources/struts.xml trunk/chorem-web/src/main/webapp/WEB-INF/decorators/billy.jsp trunk/chorem-web/src/main/webapp/WEB-INF/decorators/bonzoms.jsp trunk/chorem-web/src/main/webapp/WEB-INF/decorators/cash.jsp trunk/chorem-web/src/main/webapp/WEB-INF/decorators/gepeto.jsp trunk/chorem-web/src/main/webapp/WEB-INF/decorators/main.jsp trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/addQuotation.jsp trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/quotationDetails.jsp trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/companies.jsp trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/menu.jsp trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/persons.jsp trunk/chorem-web/src/main/webapp/WEB-INF/jsp/common/inc/header.jsp trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/projectsByYear.jsp trunk/pom.xml Modified: trunk/chorem-web/pom.xml =================================================================== --- trunk/chorem-web/pom.xml 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/pom.xml 2011-11-06 17:01:34 UTC (rev 128) @@ -38,6 +38,33 @@ </dependency> <dependency> + <groupId>net.sf.json-lib</groupId> + <artifactId>json-lib</artifactId> + <version>1.0</version> + <classifier>jdk15</classifier> + </dependency> + + <dependency> + <groupId>org.nuiton.web</groupId> + <artifactId>nuiton-struts2</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.struts</groupId> + <artifactId>struts2-json-plugin</artifactId> + </dependency> + + <dependency> + <groupId>com.jgeppert.struts2.jquery</groupId> + <artifactId>struts2-jquery-plugin</artifactId> + </dependency> + + <dependency> + <groupId>com.jgeppert.struts2.jquery</groupId> + <artifactId>struts2-jquery-grid-plugin</artifactId> + </dependency> + + <dependency> <groupId>org.nuiton.i18n</groupId> <artifactId>nuiton-i18n</artifactId> </dependency> @@ -102,13 +129,13 @@ <dependency> <groupId>org.nuiton.wikitty</groupId> - <artifactId>wikitty-jdbc-impl</artifactId> + <artifactId>wikitty-jdbc</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>org.nuiton.wikitty</groupId> - <artifactId>wikitty-solr-impl</artifactId> + <artifactId>wikitty-solr</artifactId> <scope>runtime</scope> </dependency> Modified: trunk/chorem-web/src/main/java/org/chorem/ChoremConfig.java =================================================================== --- trunk/chorem-web/src/main/java/org/chorem/ChoremConfig.java 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/src/main/java/org/chorem/ChoremConfig.java 2011-11-06 17:01:34 UTC (rev 128) @@ -1,10 +1,10 @@ package org.chorem; -import java.util.Properties; +import org.apache.commons.lang.UnhandledException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.util.ApplicationConfig; -import org.nuiton.util.ArgumentsParserException; +import org.nuiton.wikitty.WikittyConfigOption; import static org.nuiton.i18n.I18n._; @@ -16,105 +16,39 @@ /** to use log facility, just put in your code: log.info(\"...\"); */ static private Log log = LogFactory.getLog(ChoremConfig.class); - static protected ApplicationConfig instance = null; - - private ChoremConfig() { - } + static protected ApplicationConfig config = null; - static public ApplicationConfig getConfig() { - return getConfig(null, null); - } - - static public ApplicationConfig getConfig( - Properties props, String configFilename, String ... args) { - ApplicationConfig conf = new ApplicationConfig( - Option.class, null, props, configFilename); - - try { - conf.parse(args); - } catch (ArgumentsParserException eee) { - if (log.isErrorEnabled()) { - log.error("Can't load chorem configuration", eee); - } - } - return conf; - } - - /** - * Returns config instance (singleton) - * @return ChoremConfig instance + /** + * constructeur public seulement pour pouvoir mettre une variable de ce + * type dans BowBaseAction et acceder facilement au donnees dans les jsp + * en ognl */ - public static ApplicationConfig getInstance() { - if (instance == null) { - synchronized(ChoremConfig.class) { - if (instance == null) { - instance = ChoremConfig.getConfig(); - } - } - } - return instance; + public ChoremConfig() { } - - /** - * Vradi option definition. - */ - public enum Option implements ApplicationConfig.OptionDef { - CONFIG_FILE( - ApplicationConfig.CONFIG_FILE_NAME, - _("chorem.config.configFileName.description"), - "chorem.properties", String.class, false, false); - - public final String key; - public final String description; - public String defaultValue; - public final Class<?> type; - public boolean isTransient; - public boolean isFinal; - Option(String key, String description, String defaultValue, - Class<?> type, boolean isTransient, boolean isFinal) { - this.key = key; - this.description = description; - this.defaultValue = defaultValue; - this.type = type; - this.isFinal = isFinal; - this.isTransient = isTransient; - } + public static ApplicationConfig getConfig(String... args) { + if (config == null) { + synchronized (ChoremConfig.class) { + if (config == null) { + try { + config = new ApplicationConfig(ChoremConfigOption.CONFIG_FILE.getDefaultValue()); - public String getKey() { - return key; - } + // Load wikitty options + config.loadDefaultOptions(WikittyConfigOption.class); - public Class<?> getType() { - return type; - } + // Load bow options + config.loadDefaultOptions(ChoremConfigOption.class); - public String getDescription() { - return description; + // Parse args + config.parse(args); + } catch (Exception eee) { + log.error("Can't create chorem configuration", eee); + throw new UnhandledException(eee); + } + } + } } - - public String getDefaultValue() { - return defaultValue; - } - - public boolean isTransient() { - return isTransient; - } - - public boolean isFinal() { - return isFinal; - } - - public void setDefaultValue(String defaultValue) { - this.defaultValue = defaultValue; - } - - public void setTransient(boolean isTransient) { - this.isTransient = isTransient; - } - - public void setFinal(boolean isFinal) { - this.isFinal = isFinal; - } + return config; } + } Added: trunk/chorem-web/src/main/java/org/chorem/ChoremConfigOption.java =================================================================== --- trunk/chorem-web/src/main/java/org/chorem/ChoremConfigOption.java (rev 0) +++ trunk/chorem-web/src/main/java/org/chorem/ChoremConfigOption.java 2011-11-06 17:01:34 UTC (rev 128) @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2011 poussin. All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +package org.chorem; + +import static org.nuiton.i18n.I18n._; +import org.nuiton.util.ApplicationConfig; + +/** + * Chorem option definition. + * + * @author poussin + */ +public enum ChoremConfigOption implements ApplicationConfig.OptionDef { + CONFIG_FILE(ApplicationConfig.CONFIG_FILE_NAME, + _("chorem.config.configFileName.description"), + "chorem.properties", String.class, false, false); + + public final String key; + public final String description; + public String defaultValue; + public final Class<?> type; + public boolean isTransient; + public boolean isFinal; + + ChoremConfigOption(String key, String description, String defaultValue, + Class<?> type, boolean isTransient, boolean isFinal) { + this.key = key; + this.description = description; + this.defaultValue = defaultValue; + this.type = type; + this.isFinal = isFinal; + this.isTransient = isTransient; + } + + public String getKey() { + return key; + } + + public Class<?> getType() { + return type; + } + + public String getDescription() { + return description; + } + + public String getDefaultValue() { + return defaultValue; + } + + public boolean isTransient() { + return isTransient; + } + + public boolean isFinal() { + return isFinal; + } + + public void setDefaultValue(String defaultValue) { + this.defaultValue = defaultValue; + } + + public void setTransient(boolean isTransient) { + this.isTransient = isTransient; + } + + public void setFinal(boolean isFinal) { + this.isFinal = isFinal; + } + +} Modified: trunk/chorem-web/src/main/java/org/chorem/ChoremProxy.java =================================================================== --- trunk/chorem-web/src/main/java/org/chorem/ChoremProxy.java 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/src/main/java/org/chorem/ChoremProxy.java 2011-11-06 17:01:34 UTC (rev 128) @@ -32,7 +32,7 @@ * @return */ static public ChoremProxy getInstance(String token) { - ApplicationConfig config = ChoremConfig.getInstance(); + ApplicationConfig config = ChoremConfig.getConfig(); WikittyService ws = getWikittyService(config); ChoremProxy result = new ChoremProxy(config, ws); result.setSecurityToken(token); Modified: trunk/chorem-web/src/main/java/org/chorem/ChoremSession.java =================================================================== --- trunk/chorem-web/src/main/java/org/chorem/ChoremSession.java 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/src/main/java/org/chorem/ChoremSession.java 2011-11-06 17:01:34 UTC (rev 128) @@ -48,11 +48,7 @@ public void login(String login, String password) { getProxy().login(login, password); securityToken = getProxy().getSecurityToken(); - // TODO poussin 20110315, lorsque la methode proxy.getUser() existera - // remplacer le code suivant - String userId = WikittySecurityUtil.getUserForToken( - getProxy().getWikittyService(), securityToken); - user = getProxy().restore(WikittyUser.class, userId); + user = proxy.getUser(); } public ChoremProxy getProxy() { Deleted: trunk/chorem-web/src/main/java/org/chorem/action/BaseAction.java =================================================================== --- trunk/chorem-web/src/main/java/org/chorem/action/BaseAction.java 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/src/main/java/org/chorem/action/BaseAction.java 2011-11-06 17:01:34 UTC (rev 128) @@ -1,119 +0,0 @@ -package org.chorem.action; - -import java.util.List; - -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import com.opensymphony.xwork2.ActionSupport; -import com.opensymphony.xwork2.util.ValueStack; -import java.util.Map; -import org.apache.struts2.interceptor.SessionAware; -import org.chorem.ChoremProxy; -import org.chorem.ChoremSession; - -/** - * Base class which must be extended by every action - * Overrides the Struts2 methods to render text in order to explicitly show - * the missing i18n translations - */ -public class BaseAction extends ActionSupport implements SessionAware { - - private static final long serialVersionUID = 6360393466153765988L; - - private static final Log log = LogFactory.getLog(BaseAction.class); - - final static protected String CONTEXT_ACTION_KEY = "action"; - - public static final String UNTRANSLATED_MARKER = "???"; - - protected static final String MISSING_PARAM = "param"; - - protected Map<String, Object> session; - - public ChoremSession getChoremSession() { - ChoremSession result = ChoremSession.getChoremSession(session); - return result; - } - - public ChoremProxy getChoremProxy() { - ChoremProxy result = getChoremSession().getProxy(); - return result; - } - - @Override - public void setSession(Map<String, Object> session) { - this.session = session; - } - - @Override - public String getText(String aTextName) { - String value = super.getText(aTextName); - return getSafeText(aTextName, value); - } - - @Override - public String getText(String aTextName, String defaultValue) { - String value = super.getText(aTextName, defaultValue); - return getSafeText(aTextName, value); - } - - @Override - public String getText(String aTextName, String defaultValue, String obj) { - String value = super.getText(aTextName, defaultValue, obj); - return getSafeText(aTextName, value); - } - - @Override - public String getText(String aTextName, List<Object> args) { - String value = super.getText(aTextName, args); - return getSafeText(aTextName, value); - } - - @Override - public String getText(String key, String[] args) { - String value = super.getText(key, args); - return getSafeText(key, value); - } - - @Override - public String getText(String aTextName, String defaultValue, - List<Object> args) { - String value = super.getText(aTextName, defaultValue, args); - return getSafeText(aTextName, value); - } - - @Override - public String getText(String key, String defaultValue, String[] args) { - String value = super.getText(key, defaultValue, args); - return getSafeText(key, value); - } - - @Override - public String getText(String key, String defaultValue, List<Object> args, - ValueStack stack) { - String value = super.getText(key, defaultValue, args, stack); - return getSafeText(key, value); - } - - @Override - public String getText(String key, String defaultValue, String[] args, - ValueStack stack) { - String value = super.getText(key, defaultValue, args, stack); - return getSafeText(key, value); - } - - /** - * Surrounds the non translated keys with a marker to make them visible - */ - protected String getSafeText(String key, String value) { - if (StringUtils.isEmpty(value)) { - if (log.isWarnEnabled()) { - log.warn("Key [" + key + "] is not translated"); - } - return UNTRANSLATED_MARKER + key + UNTRANSLATED_MARKER; - } - return value; - } -} Copied: trunk/chorem-web/src/main/java/org/chorem/action/ChoremBaseAction.java (from rev 121, trunk/chorem-web/src/main/java/org/chorem/action/BaseAction.java) =================================================================== --- trunk/chorem-web/src/main/java/org/chorem/action/ChoremBaseAction.java (rev 0) +++ trunk/chorem-web/src/main/java/org/chorem/action/ChoremBaseAction.java 2011-11-06 17:01:34 UTC (rev 128) @@ -0,0 +1,57 @@ +package org.chorem.action; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import org.nuiton.web.struts2.BaseAction; +import java.util.Map; +import org.apache.struts2.interceptor.SessionAware; +import org.chorem.ChoremConfig; +import org.chorem.ChoremProxy; +import org.chorem.ChoremSession; + +/** + * Base class which must be extended by every action + * Overrides the Struts2 methods to render text in order to explicitly show + * the missing i18n translations + */ +public class ChoremBaseAction extends BaseAction implements SessionAware { + + private static final long serialVersionUID = 6360393466153765988L; + + private static final Log log = LogFactory.getLog(ChoremBaseAction.class); + + final static protected String CONTEXT_ACTION_KEY = "action"; + + public static final String UNTRANSLATED_MARKER = "???"; + + protected static final String MISSING_PARAM = "param"; + + protected Map<String, Object> session; + + /** Configuration, default null for lazy loading */ + protected transient ChoremConfig config; + + public ChoremConfig getConfig() { + if (config == null) { + config = new ChoremConfig(); + } + return config; + } + + public ChoremSession getChoremSession() { + ChoremSession result = ChoremSession.getChoremSession(session); + return result; + } + + public ChoremProxy getChoremProxy() { + ChoremProxy result = getChoremSession().getProxy(); + return result; + } + + @Override + public void setSession(Map<String, Object> session) { + this.session = session; + } + +} Added: trunk/chorem-web/src/main/java/org/chorem/action/EntitySearchJsonAction.java =================================================================== --- trunk/chorem-web/src/main/java/org/chorem/action/EntitySearchJsonAction.java (rev 0) +++ trunk/chorem-web/src/main/java/org/chorem/action/EntitySearchJsonAction.java 2011-11-06 17:01:34 UTC (rev 128) @@ -0,0 +1,280 @@ +package org.chorem.action; + +import java.util.Arrays; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; +import net.sf.json.JSONSerializer; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.UnhandledException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.struts2.interceptor.ParameterAware; +import org.nuiton.wikitty.search.Criteria; +import org.nuiton.wikitty.search.PagedResult; +import org.nuiton.wikitty.search.Search; + +/** + * Action qui recherche n'importe qu'elle type d'extension de wikitty. + * L'extension doit etre passee via le parametre 'wikittyExtension' + * Il est possible d'ajouter une condition de recherche via le parametre + * 'fulltextSearch'. + * + * @author poussin + * @version $Revision$ + * + * Last update: $Date$ + * by : $Author$ + */ +public class EntitySearchJsonAction extends ChoremBaseAction implements ParameterAware { + + /** to use log facility, just put in your code: log.info(\"...\"); */ + static private Log log = LogFactory.getLog(EntitySearchJsonAction.class); + private static final long serialVersionUID = 1L; + + //get how many rows we want to have into the grid - rowNum attribute in the grid + protected int rows = 0; + + //Get the requested page. By default grid sets this to 1. + protected int page = 0; + + // sorting order - asc or desc + protected String sord; + + // get index row - i.e. user click to sort. + protected String sidx; + + // Your Total Pages + protected int total = 0; + + // All Record + protected int records = 0; + + protected List gridModel; + + protected String wikittyExtension; + + protected String fulltextSearch = ""; + + protected String filters; + + /** action faite via le grid ['add', 'edit', 'del'], si vide alors une simple recherche */ + protected String oper; + /** id ou list d'id sur lequel l'action est faite, le separateur est la ','*/ + protected String id; + + protected Map<String, String[]> parameters; + + public void setParameters(Map<String, String[]> parameters) { + this.parameters = parameters; + } + public void setFilters(String filters) { + this.filters = filters; + } + + public void setWikittyExtension(String wikittyExtension) { + this.wikittyExtension = wikittyExtension; + } + + public void setFulltextSearch(String fulltextSearch) { + this.fulltextSearch = fulltextSearch; + } + + public void setPage(Integer page) { + this.page = page; + } + + public void setSord(String sord) { + this.sord = sord; + } + + public void setSidx(String sidx) { + this.sidx = sidx; + } + + public void setRows(Integer rows) { + this.rows = rows; + } + + public void setRecords(Integer records) { + this.records = records; + } + + public void setTotal(Integer total) { + this.total = total; + } + + public List getGridModel() { + return gridModel; + } + public String execute() { + try { + if (log.isDebugEnabled()) { + for (String param : parameters.keySet()) { + log.debug("param:" + param + "=" + Arrays.toString(parameters.get(param))); + } + } + + Class clazz = Class.forName(wikittyExtension); + + Search search = Search.query(); + + if (StringUtils.isNotBlank(filters)) { + JSONObject jsonFilter = (JSONObject) JSONSerializer.toJSON( filters ); + String groupOp = jsonFilter.getString("groupOp"); + log.debug("groupOp: " + groupOp); + if ("or".equalsIgnoreCase(groupOp)) { + search = search.or(); + } else { + search = search.and(); + } + JSONArray rules = jsonFilter.getJSONArray("rules"); + int rulesCount = JSONArray.getDimensions(rules)[0]; + for (int i = 0; i < rulesCount; i++) { + JSONObject rule = rules.getJSONObject(i); + String field = rule.getString("field"); + String op = rule.getString("op"); + String data = rule.getString("data"); + addCondition(search, field, op, data); + } + + } else if (StringUtils.isNotBlank(fulltextSearch)) { + // TODO poussin 20111106: ca ne serait pas au like d'ajouter les * ? + String s = "*" + fulltextSearch + "*"; + // TODO poussin 20111106: voir pourquoi like fontion comme on souhaite et pas Keyword :( + // keyword ne fonctionne pas avec les * + search.like("#fulltext", s); + } else { + // si pas de filtre on recherche tout + search.rTrue(); + } + + + int first = rows * (page - 1); + int last = rows * page - 1; + + Criteria criteria = search.criteria(); + criteria.setFirstIndex(first); + criteria.setEndIndex(last); + + if (StringUtils.isNotBlank(sidx)) { + if ("asc".equalsIgnoreCase(sord)) { + criteria.setSortAscending(sidx); + } else { + criteria.setSortDescending(sidx); + } + } + + if (log.isDebugEnabled()) { + log.debug("rows:" + rows); + log.debug("page:" + page); + + log.debug("first:" + first); + log.debug("last:" + last); + + log.debug("sord:" + sord); + log.debug("sidx:" + sidx); + + log.debug("wikittyExtension:" + wikittyExtension); + log.debug("searchString: " + fulltextSearch); + log.debug("filters: " + filters); + log.debug("criteria: " + criteria); + } + + PagedResult result = getChoremProxy().findAllByCriteria(clazz, criteria); + + setGridModel(result.getAll()); + setRecords(result.getNumFound()); + setTotal((int) Math.ceil((double) getRecords() / (double) getRows())); + + return SUCCESS; + } catch (ClassNotFoundException eee) { + log.error(String.format("Can't find class '%s'", wikittyExtension), eee); + throw new UnhandledException(eee); + } + } + + public void setGridModel(List gridModel) { + this.gridModel = gridModel; + } + + public String getFulltextSearch() { + return fulltextSearch; + } + + public int getTotal() { + return total; + } + + public int getRecords() { + return records; + } + + public int getRows() { + return rows; + } + + public int getPage() { + return page; + } + + public String getSord() { + return sord; + } + + public String getSidx() { + return sidx; + } + + /** + * Ajoute une contrainte a une recherche + * + * @param search la requete ou il faut ajouter la contrainte + * @param field le fq du champs a traiter + * @param op ['eq','ne','cn','nc','bw','bn','ew','en','lt','le','gt','ge','nu','nn','in','ni'] + * @param data la valuer de la condition + */ + protected void addCondition(Search search, String field, String op, String data) { + if ("eq".equalsIgnoreCase(op)) { + search.eq(field, data); + } else if ("ne".equalsIgnoreCase(op)) { + search.neq(field, data); + } else if ("lt".equalsIgnoreCase(op)) { + search.lt(field, data); + } else if ("le".equalsIgnoreCase(op)) { + search.le(field, data); + } else if ("gt".equalsIgnoreCase(op)) { + search.gt(field, data); + } else if ("ge".equalsIgnoreCase(op)) { + search.ge(field, data); + } else if ("bw".equalsIgnoreCase(op)) { + search.sw(field, data); + } else if ("bn".equalsIgnoreCase(op)) { + search.nsw(field, data); + } else if ("ew".equalsIgnoreCase(op)) { + search.ew(field, data); + } else if ("en".equalsIgnoreCase(op)) { + search.notew(field, data); + } else if ("cn".equalsIgnoreCase(op)) { + search.like(field, data); + } else if ("nc".equalsIgnoreCase(op)) { + search.unlike(field, data); + } else if ("nu".equalsIgnoreCase(op)) { + search.isNull(field); + } else if ("nn".equalsIgnoreCase(op)) { + search.isNotNull(field); + } else { + Collection<String> col = Arrays.asList(StringUtils.split(data, " :,;|")); + if ("in".equalsIgnoreCase(op)) { + search.in(field, col); + } else if ("ni".equalsIgnoreCase(op)) { + search.not().in(field, col); + } else { + log.error(String.format("Unreconize Operator %s for field %s and value %s", op, field, data)); + } + } + + } +} Modified: trunk/chorem-web/src/main/java/org/chorem/action/HomeAction.java =================================================================== --- trunk/chorem-web/src/main/java/org/chorem/action/HomeAction.java 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/src/main/java/org/chorem/action/HomeAction.java 2011-11-06 17:01:34 UTC (rev 128) @@ -36,7 +36,7 @@ * Last update: $Date$ * by : $Author$ */ -public class HomeAction extends BaseAction { +public class HomeAction extends ChoremBaseAction { /** to use log facility, just put in your code: log.info(\"...\"); */ static private Log log = LogFactory.getLog(HomeAction.class); Modified: trunk/chorem-web/src/main/java/org/chorem/billy/action/QuotationAction.java =================================================================== --- trunk/chorem-web/src/main/java/org/chorem/billy/action/QuotationAction.java 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/src/main/java/org/chorem/billy/action/QuotationAction.java 2011-11-06 17:01:34 UTC (rev 128) @@ -9,10 +9,9 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.ChoremProxy; -import org.chorem.action.BaseAction; +import org.chorem.action.ChoremBaseAction; import org.chorem.bonzoms.EmployeeFull; import org.chorem.entities.Employee; -import org.chorem.entities.Person; import org.chorem.entities.Project; import org.chorem.entities.ProjectOrder; import org.chorem.entities.Quotation; @@ -22,6 +21,7 @@ import org.nuiton.wikitty.search.Search; import com.opensymphony.xwork2.ActionContext; +import org.nuiton.wikitty.entities.Wikitty; import static org.nuiton.i18n.I18n.n_; @@ -30,16 +30,33 @@ * * @author vbriand */ -public class QuotationAction extends BaseAction { +public class QuotationAction extends ChoremBaseAction { private static final long serialVersionUID = -8773692389143447193L; - private static final Log log = LogFactory.getLog(BaseAction.class); + private static final Log log = LogFactory.getLog(ChoremBaseAction.class); static public QuotationAction getAction() { return (QuotationAction)ActionContext.getContext().get(CONTEXT_ACTION_KEY); } + protected String projectId; + protected String projectName; + protected String type; + protected String reference; + protected String description; + protected String amount; + protected String vta; + protected String beginDate; + protected String endDate; + protected String postedDate; + protected String conversionHope; + protected String quotationId; + protected String supplierId; + protected String customerId; + protected EmployeeFull customer; + protected EmployeeFull supplier; + /** * Adds a new quotation * @@ -64,10 +81,9 @@ result = ERROR; } else { projectName = project.getName(); - if (reference != null && description != null && - amount != null && vta != null && postedDate != null) { + if (reference != null) { //If the quotation has been created successfully - if (addQuotation()) { + if (addOrModifyQuotation(null)) { result = SUCCESS; } else { result = ERROR; @@ -100,15 +116,26 @@ UUID.fromString(quotationId); Quotation quotation = proxy.restore(Quotation.class, quotationId); + log.debug(String.format("Restored quotation: ", quotation)); if (quotation != null) { //If the quotationId exists SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); - + + setType(quotation.getType()); setReference(quotation.getReference()); setDescription(quotation.getDescription()); setAmount(String.valueOf(quotation.getAmount())); setVta(String.valueOf(quotation.getVTA())); - setPostedDate(formatter.format(quotation.getPostedDate())); + if (quotation.getBeginDate() != null) { + setBeginDate(formatter.format(quotation.getBeginDate())); + } + if (quotation.getEndDate() != null) { + setEndDate(formatter.format(quotation.getEndDate())); + } + if (quotation.getPostedDate() != null) { + setPostedDate(formatter.format(quotation.getPostedDate())); + } + setConversionHope(String.valueOf(quotation.getConversionHope())); setProjectId(quotation.getProject()); setSupplier(EmployeeFull.initEmployee(quotation.getSupplier(), proxy)); @@ -140,40 +167,17 @@ quotation = proxy.restore(Quotation.class, quotationId); if (quotation != null) { //If the id exists - quotation.setDescription(description); - quotation.setAmount(Double.parseDouble(amount)); - quotation.setVTA(Double.parseDouble(vta)); - - //Lenient mode disabled because results may be very odd - formatter.setLenient(false); - try { - quotation.setPostedDate(formatter.parse(postedDate)); - } catch (ParseException e) { + if (addOrModifyQuotation(quotation)) { + result = SUCCESS; + } else { result = INPUT; - addFieldError("postedDate", getText(n_("chorem.date.wrongFormat"))); } - if (result.equals(SUCCESS)) { - proxy.store(quotation); - } } else { result = ERROR; } return result; } - protected String projectId; - protected String projectName; - protected String reference; - protected String description; - protected String amount; - protected String vta; - protected String postedDate; - protected String quotationId; - protected String supplierId; - protected String customerId; - protected EmployeeFull customer; - protected EmployeeFull supplier; - /** * Returns the project order linked with the quotation (if it exists) * @@ -204,50 +208,100 @@ /** * Stores the new quotation through the proxy - * + * + * @param newQuotation if null new quotation is created, else argument is used * @return true if the quotation has been stored properly, * false if a problem occurred */ - protected boolean addQuotation() { + protected boolean addOrModifyQuotation(Quotation newQuotation) { boolean result = true; try { ChoremProxy proxy = getChoremProxy(); - QuotationImpl newQuotation = new QuotationImpl(); + if (newQuotation == null) { + newQuotation = new QuotationImpl(); + } + SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); + if (getType() != null) { + newQuotation.setType(getType()); + } + if (getReference() != null) { + newQuotation.setReference(getReference()); + } + if (getDescription() != null) { + newQuotation.setDescription(getDescription()); + } + if (getAmount() != null) { + String val = getAmount(); + val = val.replace(',', '.'); + newQuotation.setAmount(Double.parseDouble(val)); + } - newQuotation.setReference(reference); - newQuotation.setDescription(description); - newQuotation.setAmount(Double.parseDouble(amount)); - //Replaces the (possible) comma by a dot, so the string can be - //parsed successfully as a double - vta = vta.replace(',', '.'); - newQuotation.setVTA(Double.parseDouble(vta)); - newQuotation.setProject(projectId); + if (getVta() != null) { + String val = getVta(); + //Replaces the (possible) comma by a dot, so the string can be + //parsed successfully as a double + val = val.replace(',', '.'); + newQuotation.setVTA(Double.parseDouble(val)); + } + if (getProjectId() != null) { + newQuotation.setProject(getProjectId()); + } //Lenient mode disabled because results may be very odd formatter.setLenient(false); - try { - newQuotation.setPostedDate(formatter.parse(postedDate)); - } catch (ParseException e) { - result = false; - addActionError(getText(n_("chorem.date.wrongFormat"))); + + if (getBeginDate() != null) { + try { + newQuotation.setBeginDate(formatter.parse(getBeginDate())); + } catch (ParseException e) { + result = false; + addActionError(getText(n_("chorem.date.wrongFormat"))); + } } - - if (proxy.restore(Person.class, supplierId) != null) { - newQuotation.setSupplier(supplierId); - } else { //If the id doesn't exist or is invalid - addActionError(getText(n_("chorem.billy.quotation.invalidSupplier"))); - result = false; + if (getEndDate() != null) { + try { + newQuotation.setEndDate(formatter.parse(getEndDate())); + } catch (ParseException e) { + result = false; + addActionError(getText(n_("chorem.date.wrongFormat"))); + } } + if (getPostedDate() != null) { + try { + newQuotation.setPostedDate(formatter.parse(getPostedDate())); + } catch (ParseException e) { + result = false; + addActionError(getText(n_("chorem.date.wrongFormat"))); + } + } + if (getConversionHope() != null) { + int val = Integer.parseInt(getConversionHope()); + newQuotation.setConversionHope(val); + } - if (proxy.restore(Person.class, customerId) != null) { - newQuotation.setCustomer(customerId); - } else { //If the id doesn't exist or is invalid - addActionError(getText(n_("chorem.billy.quotation.invalidCustomer"))); - result = false; + + if (supplierId != null) { + Wikitty wsupplier = proxy.restore(supplierId); + if (wsupplier != null) { + newQuotation.setSupplier(supplierId); + } else { //If the id doesn't exist or is invalid + addActionError(getText(n_("chorem.billy.quotation.invalidSupplier"))); + result = false; + } } + if (customerId != null) { + Wikitty wcustomer = proxy.restore(customerId); + if (wcustomer != null) { + newQuotation.setCustomer(customerId); + } else { //If the id doesn't exist or is invalid + addActionError(getText(n_("chorem.billy.quotation.invalidCustomer"))); + result = false; + } + } + //If everything went smoothly if (result) { proxy.store(newQuotation); @@ -259,7 +313,15 @@ } return result; } - + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + /** * @return the reference */ @@ -315,6 +377,22 @@ public void setVta(String vta) { this.vta = vta; } + + public String getBeginDate() { + return beginDate; + } + + public void setBeginDate(String beginDate) { + this.beginDate = beginDate; + } + + public String getEndDate() { + return endDate; + } + + public void setEndDate(String endDate) { + this.endDate = endDate; + } /** * @return the postedDate @@ -330,6 +408,14 @@ this.postedDate = postedDate; } + public String getConversionHope() { + return conversionHope; + } + + public void setConversionHope(String conversionHope) { + this.conversionHope = conversionHope; + } + /** * @return the projectId */ Modified: trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java =================================================================== --- trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java 2011-11-06 17:01:34 UTC (rev 128) @@ -8,7 +8,7 @@ import org.apache.commons.logging.LogFactory; import org.chorem.ChoremProxy; import org.chorem.ContactDetailsConstants; -import org.chorem.action.BaseAction; +import org.chorem.action.ChoremBaseAction; import org.chorem.entities.Company; import org.chorem.entities.CompanyImpl; import org.chorem.entities.ContactDetails; @@ -28,7 +28,7 @@ * * @author vbriand */ -public class CompanyAction extends BaseAction implements ContactDetailsConstants { +public class CompanyAction extends ChoremBaseAction implements ContactDetailsConstants { private static final long serialVersionUID = 2266576941588474102L; Modified: trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/ContactDetailsAction.java =================================================================== --- trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/ContactDetailsAction.java 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/ContactDetailsAction.java 2011-11-06 17:01:34 UTC (rev 128) @@ -3,7 +3,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.ChoremProxy; -import org.chorem.action.BaseAction; +import org.chorem.action.ChoremBaseAction; import org.chorem.entities.ContactDetailsImpl; import static org.nuiton.i18n.I18n.n_; @@ -13,7 +13,7 @@ * * @author vbriand */ -public class ContactDetailsAction extends BaseAction { +public class ContactDetailsAction extends ChoremBaseAction { private static final long serialVersionUID = 2480555291620298704L; Modified: trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/EmployeeAction.java =================================================================== --- trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/EmployeeAction.java 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/EmployeeAction.java 2011-11-06 17:01:34 UTC (rev 128) @@ -3,7 +3,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.ChoremProxy; -import org.chorem.action.BaseAction; +import org.chorem.action.ChoremBaseAction; import org.chorem.entities.Employee; import org.chorem.entities.EmployeeImpl; import org.chorem.entities.Person; @@ -19,7 +19,7 @@ * * @author vbriand */ -public class EmployeeAction extends BaseAction { +public class EmployeeAction extends ChoremBaseAction { private static final long serialVersionUID = -5757750975509965421L; Modified: trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/EmploymentContractAction.java =================================================================== --- trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/EmploymentContractAction.java 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/EmploymentContractAction.java 2011-11-06 17:01:34 UTC (rev 128) @@ -9,7 +9,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.ChoremProxy; -import org.chorem.action.BaseAction; +import org.chorem.action.ChoremBaseAction; import org.chorem.bonzoms.EmployeeFull; import org.chorem.entities.Employee; import org.chorem.entities.EmploymentContract; @@ -28,7 +28,7 @@ * * @author vbriand */ -public class EmploymentContractAction extends BaseAction { +public class EmploymentContractAction extends ChoremBaseAction { private static final long serialVersionUID = -5841507190565206548L; Modified: trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/PersonAction.java =================================================================== --- trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/PersonAction.java 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/PersonAction.java 2011-11-06 17:01:34 UTC (rev 128) @@ -10,7 +10,7 @@ import org.apache.commons.logging.LogFactory; import org.chorem.ChoremProxy; import org.chorem.ContactDetailsConstants; -import org.chorem.action.BaseAction; +import org.chorem.action.ChoremBaseAction; import org.chorem.bonzoms.EmployeeFull; import org.chorem.entities.Company; import org.chorem.entities.ContactDetailsImpl; @@ -26,6 +26,7 @@ import org.nuiton.wikitty.search.Search; import com.opensymphony.xwork2.ActionContext; +import org.apache.commons.lang.StringUtils; import static org.nuiton.i18n.I18n.n_; @@ -34,7 +35,7 @@ * * @author vbriand */ -public class PersonAction extends BaseAction implements ContactDetailsConstants { +public class PersonAction extends ChoremBaseAction implements ContactDetailsConstants { private static final long serialVersionUID = -5757750975509965421L; @@ -54,8 +55,7 @@ public String add() { String result = INPUT; - if (firstName != null && lastName != null && email != null && - birthDate != null) { + if (firstName != null && lastName != null) { //If the person has been added successfully if (addPerson()) { result = SUCCESS; @@ -91,7 +91,9 @@ setFirstName(person.getFirstName()); setLastName(person.getLastName()); setEmail(person.getEmail()); - setBirthDate(formatter.format(person.getBirthDate())); + if (person.getBirthDate() != null) { + setBirthDate(formatter.format(person.getBirthDate())); + } } else { result = ERROR; } @@ -158,39 +160,45 @@ try { ChoremProxy proxy = getChoremProxy(); PersonImpl newPerson = new PersonImpl(); - SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); newPerson.setFirstName(firstName); newPerson.setLastName(lastName); - newPerson.setEmail(email); - - //Lenient mode disabled because results may be very odd - formatter.setLenient(false); - try { - newPerson.setBirthDate(formatter.parse(birthDate)); - } catch (ParseException e) { - result = false; - addActionError(getText(n_("chorem.date.wrongFormat"))); + + if (StringUtils.isNotBlank(email)) { + newPerson.setEmail(email); } - + + if (StringUtils.isNotBlank(birthDate)) { + SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); + //Lenient mode disabled because results may be very odd + formatter.setLenient(false); + try { + newPerson.setBirthDate(formatter.parse(birthDate)); + } catch (ParseException e) { + result = false; + addActionError(getText(n_("chorem.date.wrongFormat.birth"))); + } + } //If everything went smoothly if (result) { ContactDetailsImpl newContactDetails = new ContactDetailsImpl(); String address = addressLine1; - if (!addressLine2.isEmpty()) { + if (StringUtils.isNotBlank(addressLine2)) { address += "\n" + addressLine2; } address += "\n" + postcode + "\n" + city + "\n" + country; - newContactDetails.setName(CONTACT_DETAILS_POSTAL_ADDRESS + - " of person \"" + firstName + " " + lastName + "\""); - newContactDetails.setType(CONTACT_DETAILS_POSTAL_ADDRESS); - newContactDetails.setValue(address); - newContactDetails.setTarget(newPerson.getWikittyId()); - proxy.store(newContactDetails); + if (StringUtils.isNotBlank(address)) { + newContactDetails.setName(CONTACT_DETAILS_POSTAL_ADDRESS + + " of person \"" + firstName + " " + lastName + "\""); + newContactDetails.setType(CONTACT_DETAILS_POSTAL_ADDRESS); + newContactDetails.setValue(address); + newContactDetails.setTarget(newPerson.getWikittyId()); + proxy.store(newContactDetails); + } - if (!phoneNb.isEmpty()) { + if (StringUtils.isNotBlank(phoneNb)) { newContactDetails = new ContactDetailsImpl(); newContactDetails.setName(CONTACT_DETAILS_PHONE + " of person \"" + firstName + " " + lastName + "\""); @@ -227,64 +235,53 @@ */ protected boolean storeEmployee(PersonImpl newPerson, boolean result, ChoremProxy proxy) { - //Filling the employee fields isn't mandatory, but if one of - //them is filled, the others (except the diploma) must be - //filled as well - if (!employeePaidLeave.isEmpty() || !employeeRtt.isEmpty() || - !employeeDiploma.isEmpty()) { - if (!employeePaidLeave.isEmpty() && !employeeRtt.isEmpty()) { - EmployeeImpl newEmployee = new EmployeeImpl(); - - newEmployee.setDiploma(employeeDiploma); - newEmployee.setPerson(newPerson.getWikittyId()); - try { - newEmployee.setPaidLeave( - Float.parseFloat(employeePaidLeave)); - if (newEmployee.getPaidLeave() < 0) { - throw new NumberFormatException(); - } - } catch (NumberFormatException e) { - result = false; - addFieldError("employeePaidLeave", getText( - n_("chorem.bonzoms.employee.paidLeave.wrongFormat"))); + EmployeeImpl newEmployee = new EmployeeImpl(); + + newEmployee.setPerson(newPerson.getWikittyId()); + newEmployee.setDiploma(employeeDiploma); + + if (StringUtils.isNotBlank(employeePaidLeave)) { + try { + newEmployee.setPaidLeave( + Float.parseFloat(employeePaidLeave)); + if (newEmployee.getPaidLeave() < 0) { + throw new NumberFormatException(); } - try { - newEmployee.setRtt(Float.parseFloat(employeeRtt)); - if (newEmployee.getRtt() < 0) { - throw new NumberFormatException(); - } - } catch (NumberFormatException e) { - result = false; - addFieldError("employeeRtt", getText( - n_("chorem.bonzoms.employee.rtt.wrongFormat"))); + } catch (NumberFormatException e) { + result = false; + addFieldError("employeePaidLeave", getText( + n_("chorem.bonzoms.employee.paidLeave.wrongFormat"))); + } + } + + if (StringUtils.isNotBlank(employeeRtt)) { + try { + newEmployee.setRtt(Float.parseFloat(employeeRtt)); + if (newEmployee.getRtt() < 0) { + throw new NumberFormatException(); } - - if (proxy.restore(Company.class, companyId) != null) { - newEmployee.setCompany(companyId); - } else { //If the id doesn't exist or is invalid - addActionError(getText(n_("chorem.bonzoms.employee.invalidCompany"))); - result = false; - } - - if (result) { - result = storeEmploymentContract(newEmployee, result, proxy); - if (result) { - proxy.store(newEmployee); - } - } + } catch (NumberFormatException e) { + result = false; + addFieldError("employeeRtt", getText( + n_("chorem.bonzoms.employee.rtt.wrongFormat"))); + } + } - } else { + if (StringUtils.isNotBlank(companyId)) { + if (proxy.restore(Company.class, companyId) != null) { + newEmployee.setCompany(companyId); + } else { //If the id doesn't exist or is invalid + addActionError(getText(n_("chorem.bonzoms.employee.invalidCompany"))); result = false; - if (employeeDiploma.isEmpty()) { - addFieldError("employeeDiploma", - getText(n_("chorem.field.required"))); - } - if (employeePaidLeave.isEmpty()) { - addFieldError("employeePaidLeave", - getText(n_("chorem.field.required"))); - } } } + + if (result) { + result = storeEmploymentContract(newEmployee, result, proxy); + if (result) { + proxy.store(newEmployee); + } + } return result; } @@ -298,35 +295,46 @@ */ protected boolean storeEmploymentContract(EmployeeImpl employee, boolean result, ChoremProxy proxy) { - if (!contractDescription.isEmpty() && !contractSalary.isEmpty() && - !contractType.isEmpty() && !contractWorkingTime.isEmpty()) { - EmploymentContractImpl newEmploymentContract = + + EmploymentContractImpl newEmploymentContract = new EmploymentContractImpl(); - SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); - newEmploymentContract.setDescription(contractDescription); - newEmploymentContract.setEmployee(employee.getWikittyId()); - + newEmploymentContract.setEmployee(employee.getWikittyId()); + newEmploymentContract.setType(contractType); + newEmploymentContract.setDescription(contractDescription); + + SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); + if (StringUtils.isNotBlank(contractBeginDate)) { try { newEmploymentContract.setBeginDate( formatter.parse(contractBeginDate)); - if (!contractEndDate.isEmpty()) { - newEmploymentContract.setEndDate( - formatter.parse(contractEndDate)); - } } catch (ParseException e) { - addActionError(getText(n_("chorem.date.wrongFormat"))); + addActionError(getText(n_("chorem.date.wrongFormat.contractBegin"))); result = false; } - + } + + if (StringUtils.isNotBlank(contractEndDate)) { try { + newEmploymentContract.setEndDate( + formatter.parse(contractEndDate)); + } catch (ParseException e) { + addActionError(getText(n_("chorem.date.wrongFormat.contractEnd"))); + result = false; + } + } + + if (StringUtils.isNotBlank(contractSalary)) { + try { newEmploymentContract.setSalary(Float.parseFloat(contractSalary)); } catch (NumberFormatException e) { - addFieldError("contractSalary", + addFieldError("contractSalary", getText(n_("chorem.bonzoms.employmentContract.salary.wrongFormat"))); result = false; } - newEmploymentContract.setType(contractType); + } + + if (StringUtils.isNotBlank(contractWorkingTime)) { try { newEmploymentContract.setWorkingTime( Integer.parseInt(contractWorkingTime)); @@ -335,14 +343,11 @@ getText(n_("chorem.bonzoms.employmentContract.workingTime.wrongFormat"))); result = false; } - if (result) { - proxy.store(newEmploymentContract); - } - } else { - addActionError(getText( - n_("chorem.bonzoms.employmentContract.allFieldsRequired"))); - result = false; } + + if (result) { + proxy.store(newEmploymentContract); + } return result; } Modified: trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectAction.java =================================================================== --- trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectAction.java 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectAction.java 2011-11-06 17:01:34 UTC (rev 128) @@ -12,7 +12,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.ChoremProxy; -import org.chorem.action.BaseAction; +import org.chorem.action.ChoremBaseAction; import org.chorem.entities.Company; import org.chorem.entities.Project; import org.chorem.entities.ProjectImpl; @@ -32,7 +32,7 @@ * * @author vbriand */ -public class ProjectAction extends BaseAction { +public class ProjectAction extends ChoremBaseAction { private static final long serialVersionUID = 498267854350348906L; Modified: trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectOrderAction.java =================================================================== --- trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectOrderAction.java 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectOrderAction.java 2011-11-06 17:01:34 UTC (rev 128) @@ -10,7 +10,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.ChoremProxy; -import org.chorem.action.BaseAction; +import org.chorem.action.ChoremBaseAction; import org.chorem.entities.Company; import org.chorem.entities.ProjectOrder; import org.chorem.entities.ProjectOrderImpl; @@ -29,7 +29,7 @@ * * @author vbriand */ -public class ProjectOrderAction extends BaseAction { +public class ProjectOrderAction extends ChoremBaseAction { private static final long serialVersionUID = -5469320345746533520L; Modified: trunk/chorem-web/src/main/java/org/chorem/gepeto/action/TaskAction.java =================================================================== --- trunk/chorem-web/src/main/java/org/chorem/gepeto/action/TaskAction.java 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/src/main/java/org/chorem/gepeto/action/TaskAction.java 2011-11-06 17:01:34 UTC (rev 128) @@ -8,7 +8,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.ChoremProxy; -import org.chorem.action.BaseAction; +import org.chorem.action.ChoremBaseAction; import org.chorem.entities.ProjectOrder; import org.chorem.entities.TaskImpl; @@ -21,7 +21,7 @@ * * @author vbriand */ -public class TaskAction extends BaseAction { +public class TaskAction extends ChoremBaseAction { private static final long serialVersionUID = -3938480897148282089L; Added: trunk/chorem-web/src/main/resources/freemarker.properties =================================================================== --- trunk/chorem-web/src/main/resources/freemarker.properties (rev 0) +++ trunk/chorem-web/src/main/resources/freemarker.properties 2011-11-06 17:01:34 UTC (rev 128) @@ -0,0 +1,24 @@ +### +# #%L +# BOW UI +# +# $Id: freemarker.properties 333 2011-08-31 12:32:26Z bpoussin $ +# $HeadURL: http://svn.chorem.org/svn/bow/trunk/bow-ui/src/main/resources/freemarker.pro... $ +# %% +# Copyright (C) 2010 - 2011 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% +### +template_update_delay=600000 \ No newline at end of file Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties =================================================================== --- trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-11-06 17:01:34 UTC (rev 128) @@ -1,9 +1,9 @@ chorem.beginDate.beforeToday=The date cannot be set before today''s date chorem.billy.home=Home -chorem.billy.quotation=Quotation \#{0} +chorem.billy.quotation=Quotation \#%s chorem.billy.quotation.add=Add a new quotation chorem.billy.quotation.addProjectOrder= -chorem.billy.quotation.addToProject=Add a new quotation to the project "{0}" +chorem.billy.quotation.addToProject=Add a new quotation to the project "%s" chorem.billy.quotation.amount=Amount chorem.billy.quotation.backToProjectDetails=Get back to project chorem.billy.quotation.customer= @@ -22,7 +22,7 @@ chorem.billy.quotation.vta=VTA chorem.billy.quotationDetails.title= chorem.bonzoms.companies= -chorem.bonzoms.company=Company {0} +chorem.bonzoms.company=Company %s chorem.bonzoms.company.add=Add a new company chorem.bonzoms.company.address= chorem.bonzoms.company.addressLine1=Address @@ -82,11 +82,14 @@ chorem.config.configFileName.description=chorem''s configuration filename chorem.create.error=An error occurred, please try again. If the problem persists, please contact an administrator chorem.date.wrongFormat=The date must be in the following format \: dd/mm/yyyy +chorem.date.wrongFormat.birth= +chorem.date.wrongFormat.contractBegin= +chorem.date.wrongFormat.contractEnd= chorem.endDate.afterBegin=The end date cannot be posterior to the begin date chorem.error.internal=An internal error occurred chorem.field.required=You must fill in this field chorem.gepeto.home=Home -chorem.gepeto.project=Project {0} +chorem.gepeto.project=Project %s chorem.gepeto.project.add=New project chorem.gepeto.project.description=Description chorem.gepeto.project.name=Project''s name @@ -94,13 +97,13 @@ chorem.gepeto.projectDetails.noQuotations=No quotations chorem.gepeto.projectDetails.projectOrder= chorem.gepeto.projectDetails.projectOrders= -chorem.gepeto.projectDetails.quotation=Quotation of {0} (ref. {1}) +chorem.gepeto.projectDetails.quotation=Quotation of %s (ref. %s) chorem.gepeto.projectDetails.quotationWithProjectOrder=Project''s quotation with project order chorem.gepeto.projectDetails.quotationsWithoutProjectOrder=Project''s quotations without project order -chorem.gepeto.projectDetails.title=Details of project "{0}" +chorem.gepeto.projectDetails.title=Details of project "%s" chorem.gepeto.projectOrder=Project order chorem.gepeto.projectOrder.add=Add a new project order -chorem.gepeto.projectOrder.addToQuotation=Add a new project order to the quotation \#{0} +chorem.gepeto.projectOrder.addToQuotation=Add a new project order to the quotation \#%s chorem.gepeto.projectOrder.backToQuotationDetails=Get back to the quotation chorem.gepeto.projectOrder.beginDate=Begin date (dd/mm/yyyy) chorem.gepeto.projectOrder.company.name= @@ -127,11 +130,11 @@ chorem.gepeto.projectsByYear.thead.end=End chorem.gepeto.projectsByYear.thead.name=Name chorem.gepeto.projectsByYear.thead.start=Start -chorem.gepeto.projectsByYear.title=Projects of year {0} +chorem.gepeto.projectsByYear.title=Projects of year %s chorem.gepeto.projectsWithoutQuotation=Projects list without quotation chorem.gepeto.projectsWithoutQuotation.title= chorem.gepeto.results.title=Results by year -chorem.gepeto.task=Task {0} +chorem.gepeto.task=Task %s chorem.gepeto.task.add=Add a new task chorem.gepeto.task.backToProjectDetails= chorem.gepeto.task.beginDate=Begin date (dd/mm/yyyy) Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties =================================================================== --- trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-11-06 17:01:34 UTC (rev 128) @@ -1,9 +1,9 @@ chorem.beginDate.beforeToday=La date entr\u00E9e ne peut \u00EAtre ant\u00E9rieure \u00E0 la date du jour chorem.billy.home=Accueil -chorem.billy.quotation=Devis \#{0} +chorem.billy.quotation=Devis \#%s chorem.billy.quotation.add=Ajouter un nouveau devis chorem.billy.quotation.addProjectOrder=Cr\u00E9er un contrat pour ce devis -chorem.billy.quotation.addToProject=Ajouter un nouveau devis au projet "{0}" +chorem.billy.quotation.addToProject=Ajouter un nouveau devis au projet "%s" chorem.billy.quotation.amount=Montant chorem.billy.quotation.backToProjectDetails=Retourner sur le projet chorem.billy.quotation.customer=Client @@ -12,14 +12,14 @@ chorem.billy.quotation.invalidSupplier= chorem.billy.quotation.postedDate=Date de d\u00E9p\u00F4t chorem.billy.quotation.projectOrder=Contrat r\u00E9alis\u00E9 sur la base de ce devis -chorem.billy.quotation.projectOrder.beginDate=Date de d\u00E9but \: {0} -chorem.billy.quotation.projectOrder.company=Soci\u00E9t\u00E9 \: {0} -chorem.billy.quotation.projectOrder.endDate=Date de fin \: {0} -chorem.billy.quotation.projectOrder.type=Type \: {0} +chorem.billy.quotation.projectOrder.beginDate=Date de d\u00E9but \: %s +chorem.billy.quotation.projectOrder.company=Soci\u00E9t\u00E9 \: %s +chorem.billy.quotation.projectOrder.endDate=Date de fin \: %s +chorem.billy.quotation.projectOrder.type=Type \: %s chorem.billy.quotation.reference=R\u00E9f\u00E9rence chorem.billy.quotation.supplier=Fournisseur chorem.billy.quotation.vta=TVA -chorem.billy.quotationDetails.title=D\u00E9tails du devis "{0}" +chorem.billy.quotationDetails.title=D\u00E9tails du devis "%s" chorem.bonzoms.companies=Liste des entreprises chorem.bonzoms.company=Soci\u00E9t\u00E9 chorem.bonzoms.company.add=Ajouter une nouvelle soci\u00E9t\u00E9 @@ -35,8 +35,8 @@ chorem.bonzoms.company.postcode=Code postal chorem.bonzoms.company.type=Type de la soci\u00E9t\u00E9 chorem.bonzoms.company.website=Site internet (opt.) -chorem.bonzoms.companyDetails.name=Entreprise "{0}" -chorem.bonzoms.companyDetails.title=D\u00E9tails de l''entreprise "{0}" +chorem.bonzoms.companyDetails.name=Entreprise "%s" +chorem.bonzoms.companyDetails.title=D\u00E9tails de l''entreprise "%s" chorem.bonzoms.contactDetails=M\u00E9thode de contact chorem.bonzoms.contactDetails.add=Ajouter une nouvelle m\u00E9thode de contact chorem.bonzoms.contactDetails.name=Nom de la m\u00E9thode de contact @@ -77,30 +77,33 @@ chorem.bonzoms.person.list=Obtenir la liste des personnes chorem.bonzoms.person.phoneNb=Num\u00E9ro de t\u00E9l\u00E9phone (opt.) chorem.bonzoms.person.postcode=Code postal -chorem.bonzoms.personDetails.title=Informations d\u00E9taill\u00E9es de "{0}" +chorem.bonzoms.personDetails.title=Informations d\u00E9taill\u00E9es de "%s" chorem.bonzoms.persons=Liste des personnes chorem.config.configFileName.description=Nom du fichier de configuration de chorem chorem.create.error=Une erreur s''est produite, merci d''essayer \u00E0 nouveau. Si le probl\u00E8me se reproduit, merci de contacter un administrateur chorem.date.wrongFormat=La date doit respecter le format suivant \: jj/mm/yyyy +chorem.date.wrongFormat.birth= +chorem.date.wrongFormat.contractBegin= +chorem.date.wrongFormat.contractEnd= chorem.endDate.afterBegin=La date de fin ne doit pas pas \u00EAtre ant\u00E9rieure \u00E0 la date de d\u00E9but chorem.error.internal=Une erreur interne s''est produite chorem.field.required=Vous devez remplir ce champ chorem.gepeto.home=Accueil -chorem.gepeto.project=Projet {0} +chorem.gepeto.project=Projet %s chorem.gepeto.project.add=Nouveau projet chorem.gepeto.project.description=Description chorem.gepeto.project.name=Nom du projet chorem.gepeto.projectDetails.noProjectOrder=Pas de contrat chorem.gepeto.projectDetails.noQuotations=Pas de devis -chorem.gepeto.projectDetails.projectOrder=Contrat du {0} au {1} +chorem.gepeto.projectDetails.projectOrder=Contrat du %s au %s chorem.gepeto.projectDetails.projectOrders=Contrats du projet -chorem.gepeto.projectDetails.quotation=Devis du {0} (r\u00E9f. {1}) +chorem.gepeto.projectDetails.quotation=Devis du %s (r\u00E9f. %s) chorem.gepeto.projectDetails.quotationWithProjectOrder=Devis du projet avec un contrat chorem.gepeto.projectDetails.quotationsWithoutProjectOrder=Devis du projet sans contrat -chorem.gepeto.projectDetails.title=D\u00E9tails du projet "{0}" +chorem.gepeto.projectDetails.title=D\u00E9tails du projet "%s" chorem.gepeto.projectOrder=Contrat de commande d''un projet chorem.gepeto.projectOrder.add=Ajouter le contrat d''un projet -chorem.gepeto.projectOrder.addToQuotation=Lier un nouveau contrat au devis \#{0} +chorem.gepeto.projectOrder.addToQuotation=Lier un nouveau contrat au devis \#%s chorem.gepeto.projectOrder.backToQuotationDetails=Retourner sur le devis chorem.gepeto.projectOrder.beginDate=Date de d\u00E9but chorem.gepeto.projectOrder.company=Entreprise @@ -112,14 +115,14 @@ chorem.gepeto.projectOrder.status=Statut chorem.gepeto.projectOrder.type=Type chorem.gepeto.projectOrderDetails.beginDate=Date de d\u00E9but -chorem.gepeto.projectOrderDetails.companyName=Nom de la soci\u00E9t\u00E9 \: {0} +chorem.gepeto.projectOrderDetails.companyName=Nom de la soci\u00E9t\u00E9 \: %s chorem.gepeto.projectOrderDetails.endDate=Date de fin -chorem.gepeto.projectOrderDetails.quotation=Contrat r\u00E9alis\u00E9 sur la base du devis \#{0} -chorem.gepeto.projectOrderDetails.task.beginDate=D\u00E9but de la t\u00E2che \: {0} -chorem.gepeto.projectOrderDetails.task.endDate=Fin de la t\u00E2che \: {0} -chorem.gepeto.projectOrderDetails.task.name=Nom de la t\u00E2che \: {0} -chorem.gepeto.projectOrderDetails.task.price=Prix de la t\u00E2che \: {0} -chorem.gepeto.projectOrderDetails.task.status=Statut de la t\u00E2che \: {0} +chorem.gepeto.projectOrderDetails.quotation=Contrat r\u00E9alis\u00E9 sur la base du devis \#%s +chorem.gepeto.projectOrderDetails.task.beginDate=D\u00E9but de la t\u00E2che \: %s +chorem.gepeto.projectOrderDetails.task.endDate=Fin de la t\u00E2che \: %s +chorem.gepeto.projectOrderDetails.task.name=Nom de la t\u00E2che \: %s +chorem.gepeto.projectOrderDetails.task.price=Prix de la t\u00E2che \: %s +chorem.gepeto.projectOrderDetails.task.status=Statut de la t\u00E2che \: %s chorem.gepeto.projectOrderDetails.tasks=T\u00E2ches li\u00E9es au contrat chorem.gepeto.projectOrderDetails.title=D\u00E9tails du contrat chorem.gepeto.projectOrderDetails.type=Type de contrat @@ -128,13 +131,13 @@ chorem.gepeto.projectsByYear.thead.end=Fin chorem.gepeto.projectsByYear.thead.name=Nom chorem.gepeto.projectsByYear.thead.start=D\u00E9but -chorem.gepeto.projectsByYear.title=Projets de l''ann\u00E9e {0} +chorem.gepeto.projectsByYear.title=Projets de l''ann\u00E9e %s chorem.gepeto.projectsByYear.withProjectOrder=Avec contrat chorem.gepeto.projectsByYear.withoutProjectOrder=Sans contrat chorem.gepeto.projectsWithoutQuotation=Liste des projets sans devis chorem.gepeto.projectsWithoutQuotation.title=Liste des projets sans devis chorem.gepeto.results.title=R\u00E9sultats par ann\u00E0e -chorem.gepeto.task=T\u00E2che {0} +chorem.gepeto.task=T\u00E2che %s chorem.gepeto.task.add=Ajouter une nouvelle t\u00E2che chorem.gepeto.task.backToProjectDetails=Retourner sur le contrat chorem.gepeto.task.beginDate=Date de d\u00E9but Modified: trunk/chorem-web/src/main/resources/log4j.properties =================================================================== --- trunk/chorem-web/src/main/resources/log4j.properties 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/src/main/resources/log4j.properties 2011-11-06 17:01:34 UTC (rev 128) @@ -22,7 +22,7 @@ # #L% ### # Global logging configuration -log4j.rootLogger=WARN, stdout +log4j.rootLogger=INFO, stdout # Console output... log4j.appender.stdout=org.apache.log4j.ConsoleAppender @@ -30,5 +30,5 @@ log4j.appender.stdout.layout.ConversionPattern=%d %5p [%t] (%F:%L) %M - %m%n # package level -log4j.logger.org.chorem=INFO +log4j.logger.org.chorem=DEBUG log4j.logger.org.nuiton=INFO Modified: trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/CompanyAction-addCompany-validation.xml =================================================================== --- trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/CompanyAction-addCompany-validation.xml 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/CompanyAction-addCompany-validation.xml 2011-11-06 17:01:34 UTC (rev 128) @@ -8,6 +8,8 @@ <message key="chorem.field.required" /> </field-validator> </field> + <!-- poussin 20110616 seul le nom est requis les autres infos doivent pouvoir + etre saisie plus tard <field name="type"> <field-validator type="requiredstring"> <message key="chorem.field.required" /> @@ -33,4 +35,5 @@ <message key="chorem.field.required" /> </field-validator> </field> + --> </validators> Modified: trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/CompanyAction-modifyCompany-validation.xml =================================================================== --- trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/CompanyAction-modifyCompany-validation.xml 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/CompanyAction-modifyCompany-validation.xml 2011-11-06 17:01:34 UTC (rev 128) @@ -3,6 +3,8 @@ "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> <validators> + <!-- poussin 20110616 seul le nom est requis les autres infos doivent pouvoir + etre saisie plus tard <field name="type"> <field-validator type="requiredstring"> <message key="chorem.field.required" /> @@ -13,4 +15,5 @@ <message key="chorem.field.required" /> </field-validator> </field> + --> </validators> Modified: trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/EmploymentContractAction-addEmploymentContract-validation.xml =================================================================== --- trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/EmploymentContractAction-addEmploymentContract-validation.xml 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/EmploymentContractAction-addEmploymentContract-validation.xml 2011-11-06 17:01:34 UTC (rev 128) @@ -3,6 +3,9 @@ "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> <validators> + <!-- poussin 20110616 seul la societe est requise les autres infos doivent pouvoir + etre saisie plus tard + <field name="type"> <field-validator type="requiredstring"> <message key="chorem.field.required" /> @@ -46,4 +49,5 @@ <message key="chorem.date.wrongFormat" /> </field-validator> </field> + --> </validators> Modified: trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/PersonAction-addPerson-validation.xml =================================================================== --- trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/PersonAction-addPerson-validation.xml 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/PersonAction-addPerson-validation.xml 2011-11-06 17:01:34 UTC (rev 128) @@ -13,6 +13,8 @@ <message key="chorem.field.required" /> </field-validator> </field> + <!-- poussin 20110616 seul le nom et prenom sont requis les autres infos doivent pouvoir + etre saisie plus tard <field name="email"> <field-validator type="requiredstring"> <message key="chorem.field.required" /> @@ -46,4 +48,5 @@ <message key="chorem.field.required" /> </field-validator> </field> + --> </validators> Modified: trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/ProjectAction-addProject-validation.xml =================================================================== --- trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/ProjectAction-addProject-validation.xml 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/ProjectAction-addProject-validation.xml 2011-11-06 17:01:34 UTC (rev 128) @@ -1,16 +1,19 @@ <!DOCTYPE validators PUBLIC - "-//OpenSymphony Group//XWork Validator 1.0.2//EN" - "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> +"-//OpenSymphony Group//XWork Validator 1.0.2//EN" +"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> <validators> <field name="name"> - <field-validator type="requiredstring"> - <message key="chorem.field.required" /> - </field-validator> + <field-validator type="requiredstring"> + <message key="chorem.field.required" /> + </field-validator> </field> + <!-- poussin 20110616 seul le nom est requis les autres infos doivent pouvoir + etre saisie plus tard <field name="description"> <field-validator type="requiredstring"> <message key="chorem.field.required" /> </field-validator> </field> + --> </validators> Modified: trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/ProjectAction-modifyProject-validation.xml =================================================================== --- trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/ProjectAction-modifyProject-validation.xml 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/ProjectAction-modifyProject-validation.xml 2011-11-06 17:01:34 UTC (rev 128) @@ -1,11 +1,14 @@ <!DOCTYPE validators PUBLIC - "-//OpenSymphony Group//XWork Validator 1.0.2//EN" - "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> +"-//OpenSymphony Group//XWork Validator 1.0.2//EN" +"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> <validators> + <!-- poussin 20110616 seul le nom est requis les autres infos doivent pouvoir + etre saisie plus tard <field name="description"> <field-validator type="requiredstring"> <message key="chorem.field.required" /> </field-validator> </field> + --> </validators> Modified: trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/TaskAction-addTask-validation.xml =================================================================== --- trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/TaskAction-addTask-validation.xml 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/TaskAction-addTask-validation.xml 2011-11-06 17:01:34 UTC (rev 128) @@ -4,9 +4,9 @@ <validators> <field name="name"> - <field-validator type="requiredstring"> - <message key="chorem.field.required" /> - </field-validator> + <field-validator type="requiredstring"> + <message key="chorem.field.required" /> + </field-validator> </field> <field name="description"> <field-validator type="requiredstring"> Modified: trunk/chorem-web/src/main/resources/struts.properties =================================================================== --- trunk/chorem-web/src/main/resources/struts.properties 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/src/main/resources/struts.properties 2011-11-06 17:01:34 UTC (rev 128) @@ -47,5 +47,6 @@ #struts.freemarker.manager.classname=org.apache.struts2.views.freemarker.FreemarkerManager struts.freemarker.wrapper.altMap=true +struts.freemarker.templatesCache=true struts.xslt.nocache=false Modified: trunk/chorem-web/src/main/resources/struts.xml =================================================================== --- trunk/chorem-web/src/main/resources/struts.xml 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/src/main/resources/struts.xml 2011-11-06 17:01:34 UTC (rev 128) @@ -1,19 +1,58 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts PUBLIC - "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" - "http://struts.apache.org/dtds/struts-2.0.dtd"> + "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" + "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> - <constant name="struts.devMode" value="true" /> - <constant name="struts.ognl.allowStaticMethodAccess" value="true" /> - - <package name="chorem" namespace="/" extends="struts-default"> - <default-action-ref name="home" /> + <bean class="org.nuiton.web.struts2.I18nTextProvider" name="i18nTextProvider" + type="com.opensymphony.xwork2.TextProvider" /> + <constant name="struts.xworkTextProvider" value="i18nTextProvider" /> + + <!-- pour ne pas remettre tous les parametres deja existant sur + les url construite avec s:url --> + <constant name="struts.url.includeParams" value="none" /> + <constant name="struts.devMode" value="true"/> + <constant name="struts.ognl.allowStaticMethodAccess" value="true"/> + <constant name="struts.enable.SlashesInActionNames" value="true"/> + + <!-- + | Definition d'un package pour l'espace public + | - surcharge de parametre de certain intercepteur + +--> + <package name="publicArea" extends="struts-default"> + <result-types> + <result-type name="json" class="org.apache.struts2.json.JSONResult"/> + </result-types> + + <interceptors> + <interceptor name="json" class="org.apache.struts2.json.JSONInterceptor"/> + <interceptor-stack name="publicAreaStack"> + + <!-- display errors in logger --> + <interceptor-ref name="exception"> + <param name="logEnabled">true</param> + <param name="logCategory">org.chorem</param> + <param name="logLevel">ERROR</param> + </interceptor-ref> + <interceptor-ref name="defaultStack"/> + <interceptor-ref name="json"> + <param name="enableSMD">true</param> + </interceptor-ref> + </interceptor-stack> + </interceptors> + <default-interceptor-ref name="publicAreaStack"/> + </package> + + <package name="chorem" namespace="/" extends="publicArea"> + <default-action-ref name="home" /> <action name="home" class="org.chorem.action.HomeAction"> <result>/WEB-INF/jsp/home.jsp</result> </action> + <action name="EntitySearchJson" class="org.chorem.action.EntitySearchJsonAction"> + <result type="json"/> + </action> </package> - <package name="bonzoms" namespace="/bonzoms" extends="struts-default"> + <package name="bonzoms" namespace="/bonzoms" extends="publicArea"> <default-action-ref name="companies" /> <action name="addCompanyInput"> <result>/WEB-INF/jsp/bonzoms/addCompany.jsp</result> @@ -35,7 +74,7 @@ <param name="companyId">${companyId}</param> </result> </action> - <action name="companies" class="org.chorem.bonzoms.action.CompanyAction"> + <action name="companies"> <result>/WEB-INF/jsp/bonzoms/companies.jsp</result> </action> <action name="addPersonInput" class="org.chorem.bonzoms.action.PersonAction"> @@ -103,8 +142,8 @@ </action> </package> - <package name="gepeto" namespace="/gepeto" extends="struts-default"> - <default-action-ref name="projectsWithoutQuotation" /> + <package name="gepeto" namespace="/gepeto" extends="publicArea"> + <default-action-ref name="projectsWithoutQuotation" /> <action name="addProjectInput"> <result>/WEB-INF/jsp/gepeto/addProject.jsp</result> </action> @@ -181,8 +220,8 @@ </action> </package> - <package name="billy" namespace="/billy" extends="struts-default"> - <default-action-ref name="home" /> + <package name="billy" namespace="/billy" extends="publicArea"> + <default-action-ref name="home" /> <action name="home"> <result>/WEB-INF/jsp/billy/home.jsp</result> </action> Modified: trunk/chorem-web/src/main/webapp/WEB-INF/decorators/billy.jsp =================================================================== --- trunk/chorem-web/src/main/webapp/WEB-INF/decorators/billy.jsp 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/src/main/webapp/WEB-INF/decorators/billy.jsp 2011-11-06 17:01:34 UTC (rev 128) @@ -2,6 +2,7 @@ <%@taglib prefix="decorator" uri="http://www.opensymphony.com/sitemesh/decorator" %> <%@taglib prefix="page" uri="http://www.opensymphony.com/sitemesh/page" %> <%@taglib prefix="s" uri="/struts-tags" %> +<%@taglib prefix="sj" uri="/struts-jquery-tags" %> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" @@ -9,11 +10,13 @@ xmlns:decorator="http://www.opensymphony.com/sitemesh/decorator"> <head> <title>Chorem - billy : <decorator:title default="no title" /></title> - <decorator:head /> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <meta name="description" content="" /> <s:url var="CSS" value="/css/style.css" /> <link href="${CSS}" rel="stylesheet" type="text/css" media="all" /> + <s:head /> + <sj:head locale="fr" jqueryui="true" jquerytheme="redmond"/> + <decorator:head /> </head> <body> <s:include value="/WEB-INF/jsp/common/inc/header.jsp" /> Modified: trunk/chorem-web/src/main/webapp/WEB-INF/decorators/bonzoms.jsp =================================================================== --- trunk/chorem-web/src/main/webapp/WEB-INF/decorators/bonzoms.jsp 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/src/main/webapp/WEB-INF/decorators/bonzoms.jsp 2011-11-06 17:01:34 UTC (rev 128) @@ -2,6 +2,7 @@ <%@taglib prefix="decorator" uri="http://www.opensymphony.com/sitemesh/decorator" %> <%@taglib prefix="page" uri="http://www.opensymphony.com/sitemesh/page" %> <%@taglib prefix="s" uri="/struts-tags" %> +<%@taglib prefix="sj" uri="/struts-jquery-tags" %> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" @@ -9,11 +10,13 @@ xmlns:decorator="http://www.opensymphony.com/sitemesh/decorator"> <head> <title>Chorem - bonzoms : <decorator:title default="no title" /></title> - <decorator:head /> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <meta name="description" content="" /> <s:url var="CSS" value="/css/style.css" /> <link href="${CSS}" rel="stylesheet" type="text/css" media="all" /> + <s:head /> + <sj:head locale="fr" jqueryui="true" jquerytheme="redmond"/> + <decorator:head /> </head> <body> <s:include value="/WEB-INF/jsp/common/inc/header.jsp" /> Modified: trunk/chorem-web/src/main/webapp/WEB-INF/decorators/cash.jsp =================================================================== --- trunk/chorem-web/src/main/webapp/WEB-INF/decorators/cash.jsp 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/src/main/webapp/WEB-INF/decorators/cash.jsp 2011-11-06 17:01:34 UTC (rev 128) @@ -2,6 +2,7 @@ <%@taglib prefix="decorator" uri="http://www.opensymphony.com/sitemesh/decorator" %> <%@taglib prefix="page" uri="http://www.opensymphony.com/sitemesh/page" %> <%@taglib prefix="s" uri="/struts-tags" %> +<%@taglib prefix="sj" uri="/struts-jquery-tags" %> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" @@ -9,11 +10,13 @@ xmlns:decorator="http://www.opensymphony.com/sitemesh/decorator"> <head> <title>Chorem - cash : <decorator:title default="no title" /></title> - <decorator:head /> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <meta name="description" content="" /> <s:url var="CSS" value="/css/style.css" /> <link href="${CSS}" rel="stylesheet" type="text/css" media="all" /> + <s:head /> + <sj:head locale="fr" jqueryui="true" jquerytheme="redmond"/> + <decorator:head /> </head> <body> <s:include value="/WEB-INF/jsp/common/inc/header.jsp" /> Modified: trunk/chorem-web/src/main/webapp/WEB-INF/decorators/gepeto.jsp =================================================================== --- trunk/chorem-web/src/main/webapp/WEB-INF/decorators/gepeto.jsp 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/src/main/webapp/WEB-INF/decorators/gepeto.jsp 2011-11-06 17:01:34 UTC (rev 128) @@ -2,6 +2,7 @@ <%@taglib prefix="decorator" uri="http://www.opensymphony.com/sitemesh/decorator" %> <%@taglib prefix="page" uri="http://www.opensymphony.com/sitemesh/page" %> <%@taglib prefix="s" uri="/struts-tags" %> +<%@taglib prefix="sj" uri="/struts-jquery-tags" %> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" @@ -9,11 +10,13 @@ xmlns:decorator="http://www.opensymphony.com/sitemesh/decorator"> <head> <title>Chorem - gepeto : <decorator:title default="no title" /></title> - <decorator:head /> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <meta name="description" content="" /> <s:url var="CSS" value="/css/style.css" /> <link href="${CSS}" rel="stylesheet" type="text/css" media="all" /> + <s:head /> + <sj:head locale="fr" jqueryui="true" jquerytheme="redmond"/> + <decorator:head /> </head> <body> <s:include value="/WEB-INF/jsp/common/inc/header.jsp" /> Modified: trunk/chorem-web/src/main/webapp/WEB-INF/decorators/main.jsp =================================================================== --- trunk/chorem-web/src/main/webapp/WEB-INF/decorators/main.jsp 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/src/main/webapp/WEB-INF/decorators/main.jsp 2011-11-06 17:01:34 UTC (rev 128) @@ -2,6 +2,7 @@ <%@taglib prefix="decorator" uri="http://www.opensymphony.com/sitemesh/decorator" %> <%@taglib prefix="page" uri="http://www.opensymphony.com/sitemesh/page" %> <%@taglib prefix="s" uri="/struts-tags" %> +<%@taglib prefix="sj" uri="/struts-jquery-tags" %> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" @@ -9,13 +10,17 @@ xmlns:decorator="http://www.opensymphony.com/sitemesh/decorator"> <head> <title>Chorem : <decorator:title default="no title" /></title> - <decorator:head /> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <meta name="description" content="" /> <s:url var="CSS" value="/css/style.css" /> <link href="${CSS}" rel="stylesheet" type="text/css" media="all" /> + <s:head /> + <sj:head locale="fr" jqueryui="true" jquerytheme="redmond"/> + <decorator:head /> + toto </head> <body> + titi <s:include value="/WEB-INF/jsp/common/inc/header.jsp" /> <decorator:body /> <s:include value="/WEB-INF/jsp/common/inc/footer.jsp" /> Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/addQuotation.jsp =================================================================== --- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/addQuotation.jsp 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/addQuotation.jsp 2011-11-06 17:01:34 UTC (rev 128) @@ -8,58 +8,66 @@ <html xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" xmlns:jsp="http://java.sun.com/JSP/Page"> - <head> - <title><s:text name="chorem.billy.quotation.add" /></title> - <s:head /> - </head> - <body> - <h2> - <s:text name="chorem.billy.quotation.addToProject"> - <s:param><%= QuotationAction.getAction().getProjectName() %></s:param> - </s:text> - </h2> - <s:actionerror /> - <s:url action="addQuotation" var="addQuotation"> - <s:param name="projectId"><%= QuotationAction.getAction().getProjectId() %></s:param> - </s:url> - <form action="${addQuotation}" method="post"> - <fieldset> - <legend> - <s:text name="chorem.billy.quotation" /> - </legend> - <s:textfield key="chorem.billy.quotation.reference" name="reference" labelSeparator=": " /> - <br /> - <s:textarea key="chorem.billy.quotation.description" name="description" cols="50" rows="10" labelposition="top" labelSeparator=": " /> - <br /> - <s:textfield key="chorem.billy.quotation.amount" name="amount" labelSeparator=": " size="6" /> - <br /> - <s:textfield key="chorem.billy.quotation.vta" name="vta" labelSeparator=": " size="2" />% - <br /> - <s:textfield key="chorem.billy.quotation.postedDate" name="postedDate" labelSeparator=": " size="7" value="%{dayDate}" /> - <br /> - <label for="supplierId" class="label"><s:text name="chorem.billy.quotation.supplier" />: </label> - <select name="supplierId" id="supplierId"> - <% - List<EmployeeFull> employees = QuotationAction.getAction().getAllEmployees(); - - for (EmployeeFull employee : employees) { - %> - <option value="<%= employee.getEmployee().getWikittyId() %>"><%= employee.getCompany().getName() %> - <%= employee.getPerson().getLastName() %> <%= employee.getPerson().getFirstName() %> (<%= JspUtils.dateFormat(employee.getPerson().getBirthDate()) %>)</option> - <% } %> - </select> - <br /> - <label for="customerId" class="label"><s:text name="chorem.billy.quotation.customer" />: </label> - <select name="customerId" id="customerId"> - <% - for (EmployeeFull employee : employees) { - %> - <option value="<%= employee.getEmployee().getWikittyId() %>"><%= employee.getCompany().getName() %> - <%= employee.getPerson().getLastName() %> <%= employee.getPerson().getFirstName() %> (<%= JspUtils.dateFormat(employee.getPerson().getBirthDate()) %>)</option> - <% } %> - </select> - <br /> - <br /> - <s:submit key="chorem.billy.quotation.add" name="submit" /> - </fieldset> - </form> - </body> + <head> + <title><s:text name="chorem.billy.quotation.add" /></title> + <s:head /> + </head> + <body> + <h2> + <s:text name="chorem.billy.quotation.addToProject"> + <s:param><%= QuotationAction.getAction().getProjectName() %></s:param> + </s:text> + </h2> + <s:actionerror /> + <s:url action="addQuotation" var="addQuotation"> + <s:param name="projectId"><%= QuotationAction.getAction().getProjectId() %></s:param> + </s:url> + <form action="${addQuotation}" method="post"> + <fieldset> + <legend> + <s:text name="chorem.billy.quotation" /> + </legend> + <s:textfield key="chorem.billy.quotation.type" name="type" labelSeparator=": " /> + <br /> + <s:textfield key="chorem.billy.quotation.reference" name="reference" labelSeparator=": " /> + <br /> + <s:textarea key="chorem.billy.quotation.description" name="description" cols="50" rows="10" labelposition="top" labelSeparator=": " /> + <br /> + <s:textfield key="chorem.billy.quotation.amount" name="amount" labelSeparator=": " size="6" /> + <br /> + <s:textfield key="chorem.billy.quotation.vta" name="vta" labelSeparator=": " size="2" />% + <br /> + <s:textfield key="chorem.billy.quotation.beginDate" name="beginDate" labelSeparator=": " size="7" value="%{dayDate}" /> + <br /> + <s:textfield key="chorem.billy.quotation.endDate" name="endDate" labelSeparator=": " size="7" value="%{dayDate}" /> + <br /> + <s:textfield key="chorem.billy.quotation.postedDate" name="postedDate" labelSeparator=": " size="7" value="%{dayDate}" /> + <br /> + <s:textfield key="chorem.billy.quotation.conversionHope" name="conversionHope" labelSeparator=": " /> + <br /> + <label for="supplierId" class="label"><s:text name="chorem.billy.quotation.supplier" />: </label> + <select name="supplierId" id="supplierId"> + <% + List<EmployeeFull> employees = QuotationAction.getAction().getAllEmployees(); + + for (EmployeeFull employee : employees) { + %> + <option value="<%= employee.getEmployee().getWikittyId() %>"><%= employee.getCompany().getName() %> - <%= employee.getPerson().getLastName() %> <%= employee.getPerson().getFirstName() %> (<%= JspUtils.dateFormat(employee.getPerson().getBirthDate()) %>)</option> + <% } %> + </select> + <br /> + <label for="customerId" class="label"><s:text name="chorem.billy.quotation.customer" />: </label> + <select name="customerId" id="customerId"> + <% + for (EmployeeFull employee : employees) { + %> + <option value="<%= employee.getEmployee().getWikittyId() %>"><%= employee.getCompany().getName() %> - <%= employee.getPerson().getLastName() %> <%= employee.getPerson().getFirstName() %> (<%= JspUtils.dateFormat(employee.getPerson().getBirthDate()) %>)</option> + <% } %> + </select> + <br /> + <br /> + <s:submit key="chorem.billy.quotation.add" name="submit" /> + </fieldset> + </form> + </body> </html> Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/quotationDetails.jsp =================================================================== --- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/quotationDetails.jsp 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/quotationDetails.jsp 2011-11-06 17:01:34 UTC (rev 128) @@ -7,25 +7,27 @@ <html xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" xmlns:jsp="http://java.sun.com/JSP/Page"> - <head> - <title> - <s:text name="chorem.billy.quotationDetails.title"> - <s:param><%= QuotationAction.getAction().getReference() %></s:param> - </s:text> - </title> - <s:head /> - </head> - <body> - <h2> - <s:text name="chorem.billy.quotation"> - <s:param><%= QuotationAction.getAction().getReference() %></s:param> - </s:text> - </h2> - <s:url action="modifyQuotation" var="modifyQuotation"> - <s:param name="quotationId"><%= QuotationAction.getAction().getQuotationId() %></s:param> - </s:url> - <form action="${modifyQuotation}" method="post"> - <p> + <head> + <title> + <s:text name="chorem.billy.quotationDetails.title"> + <s:param><%= QuotationAction.getAction().getReference() %></s:param> + </s:text> + </title> + <s:head /> + </head> + <body> + <h2> + <s:text name="chorem.billy.quotation"> + <s:param><%= QuotationAction.getAction().getReference() %></s:param> + </s:text> + </h2> + <s:url action="modifyQuotation" var="modifyQuotation"> + <s:param name="quotationId"><%= QuotationAction.getAction().getQuotationId() %></s:param> + </s:url> + <form action="${modifyQuotation}" method="post"> + <p> + <s:textfield name="type" key="chorem.billy.quotation.type" labelSeparator=": "/> + <br /> <s:textarea name="description" key="chorem.billy.quotation.description" cols="50" rows="10" labelposition="top" labelSeparator=": " /> <br /> <br /> @@ -33,59 +35,74 @@ <br /> <s:textfield name="vta" key="chorem.billy.quotation.vta" labelSeparator=": " size="2" />% <br /> + <s:textfield name="beginDate" key="chorem.billy.quotation.beginDate" labelSeparator=": " size="7" /> + <br /> + <s:textfield name="endDate" key="chorem.billy.quotation.endDate" labelSeparator=": " size="7" /> + <br /> <s:textfield name="postedDate" key="chorem.billy.quotation.postedDate" labelSeparator=": " size="7" /> <br /> - <% EmployeeFull supplier = QuotationAction.getAction().getSupplier(); %> + <s:textfield name="conversionHope" key="chorem.billy.quotation.conversionHope" labelSeparator=": " size="2" /> + <br /> + <% EmployeeFull supplier = QuotationAction.getAction().getSupplier(); + if (supplier != null) { + %> <s:url namespace="/bonzoms" action="companyDetails" var="companyDetails"> <s:param name="companyId"><%= supplier.getCompany().getWikittyId() %></s:param> </s:url> <s:text name="chorem.billy.quotation.supplier" />: <a href="${companyDetails}"><%= supplier.getCompany().getName() %></a> - <%= supplier.getPerson().getLastName() %> <%= supplier.getPerson().getFirstName() %> (<%= JspUtils.dateFormat(supplier.getPerson().getBirthDate()) %>) <br /> - <% EmployeeFull customer = QuotationAction.getAction().getCustomer(); %> + <% + } + EmployeeFull customer = QuotationAction.getAction().getCustomer(); + if (customer != null) { + %> <s:url namespace="/bonzoms" action="companyDetails" var="companyDetails"> - <s:param name="companyId"><%= supplier.getCompany().getWikittyId() %></s:param> + <s:param name="companyId"><%= customer.getCompany().getWikittyId() %></s:param> </s:url> <s:text name="chorem.billy.quotation.customer" />: <a href="${companyDetails}"><%= customer.getCompany().getName() %></a> - <%= customer.getPerson().getLastName() %> <%= customer.getPerson().getFirstName() %> (<%= JspUtils.dateFormat(customer.getPerson().getBirthDate()) %>) <br /> + <% + } + %> <s:submit key="chorem.misc.modify" name="modify" /> - </p> - </form> - <p> - <br /> - <br /> - <% - ProjectOrder projectOrder = QuotationAction.getAction().getProjectOrder(); - - if (projectOrder != null) { - %> - <s:text name="chorem.billy.quotation.projectOrder" /> - <br /> - <s:url namespace="/gepeto" action="projectOrderDetails" var="projectOrderDetails"> - <s:param name="projectOrderId"><%= projectOrder.getWikittyId() %></s:param> - </s:url> - <a href="${projectOrderDetails}"> - <s:text name="chorem.gepeto.projectDetails.projectOrder"> - <s:param> - <%= JspUtils.dateFormat(projectOrder.getBeginDate()) %> - </s:param> - <s:param> - <%= JspUtils.dateFormat(projectOrder.getEndDate()) %> - </s:param> - </s:text> - </a> - <br /> - <% } else { %> - <s:url namespace="/gepeto" action="addProjectOrderInput" var="addProjectOrder"> - <s:param name="quotationId"><%= QuotationAction.getAction().getQuotationId() %></s:param> - </s:url> - <a href="${addProjectOrder}"><s:text name="chorem.billy.quotation.addProjectOrder" /></a> - <br /> - <% } %> - <br /> - <s:url namespace="/gepeto" action="projectDetails" var="projectDetails"> - <s:param name="projectId"><%= QuotationAction.getAction().getProjectId() %></s:param> - </s:url> - <a href="${projectDetails}"><s:text name="chorem.billy.quotation.backToProjectDetails" /></a> - </p> - </body> + </p> + </form> + <p> + <br /> + <br /> + <% + ProjectOrder projectOrder = QuotationAction.getAction().getProjectOrder(); + + if (projectOrder != null) { + %> + <s:text name="chorem.billy.quotation.projectOrder" /> + <br /> + <s:url namespace="/gepeto" action="projectOrderDetails" var="projectOrderDetails"> + <s:param name="projectOrderId"><%= projectOrder.getWikittyId() %></s:param> + </s:url> + <a href="${projectOrderDetails}"> + <s:text name="chorem.gepeto.projectDetails.projectOrder"> + <s:param> + <%= JspUtils.dateFormat(projectOrder.getBeginDate()) %> + </s:param> + <s:param> + <%= JspUtils.dateFormat(projectOrder.getEndDate()) %> + </s:param> + </s:text> + </a> + <br /> + <% } else { %> + <s:url namespace="/gepeto" action="addProjectOrderInput" var="addProjectOrder"> + <s:param name="quotationId"><%= QuotationAction.getAction().getQuotationId() %></s:param> + </s:url> + <a href="${addProjectOrder}"><s:text name="chorem.billy.quotation.addProjectOrder" /></a> + <br /> + <% } %> + <br /> + <s:url namespace="/gepeto" action="projectDetails" var="projectDetails"> + <s:param name="projectId"><%= QuotationAction.getAction().getProjectId() %></s:param> + </s:url> + <a href="${projectDetails}"><s:text name="chorem.billy.quotation.backToProjectDetails" /></a> + </p> + </body> </html> Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/companies.jsp =================================================================== --- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/companies.jsp 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/companies.jsp 2011-11-06 17:01:34 UTC (rev 128) @@ -1,3 +1,4 @@ +<%@page import="org.apache.commons.lang.StringUtils"%> <%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> <%@page import="java.util.List" %> <%@page import="org.chorem.entities.Company" %> @@ -3,25 +4,49 @@ <%@page import="org.chorem.bonzoms.action.CompanyAction" %> <%@taglib prefix="s" uri="/struts-tags" %> +<%@taglib prefix="sj" uri="/struts-jquery-tags"%> +<%@taglib prefix="sjg" uri="/struts-jquery-grid-tags"%> <html xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" xmlns:jsp="http://java.sun.com/JSP/Page"> - <head> - <title><s:text name="chorem.bonzoms.companies" /></title> - <s:head /> - </head> - <body> - <h2><s:text name="chorem.bonzoms.companies" /></h2> - <% - List<Company> companies = CompanyAction.getAction().getAllCompanies(); - - for (Company company : companies) { - %> - <s:url namespace="/bonzoms" action="companyDetails" var="companyDetails"> - <s:param name="companyId"><%= company.getWikittyId() %></s:param> - </s:url> - <a href="${companyDetails}"><%= company.getName() %></a><br /> - <% - } - %> - </body> + <head> + <title><s:text name="chorem.bonzoms.companies" /></title> + </head> + <body> + <h2><s:text name="chorem.bonzoms.companies" /></h2> + + <s:url id="companyDetails" namespace="/bonzoms" action="companyDetails"/> + <script type="text/javascript"> + function formatCompanyNameLink(cellvalue, options, rowObject) { + return "<a href='<s:property value="companyDetails"/>?companyId="+rowObject.wikittyId+"'>" + cellvalue + "</a>"; + } + </script> + + <s:form> + <s:textfield name="searchString"></s:textfield> + <s:submit></s:submit> + </s:form> + + <s:url id="remoteurl" namespace="/" action="EntitySearchJson" escapeAmp="false"> + <s:param name="searchString"><%=StringUtils.defaultString(request.getParameter("searchString"))%></s:param> + <s:param name="wikittyExtension">org.chorem.entities.Company</s:param> + </s:url> + + <sjg:grid + id="gridtable" + dataType="json" + href="%{remoteurl}" + pager="true" + gridModel="gridModel" + rowList="10,20,50,100" + rowNum="20" + rownumbers="false" + autowidth="true" + sortname="name" + sortorder="asc"> + + <sjg:gridColumn name="name" title="Nom" formatter="formatCompanyNameLink"/> + <sjg:gridColumn name="type" title="Type"/> + </sjg:grid> + + </body> </html> Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/menu.jsp =================================================================== --- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/menu.jsp 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/menu.jsp 2011-11-06 17:01:34 UTC (rev 128) @@ -2,9 +2,9 @@ <div id="menu"> <ul> - <li><s:a action="addCompanyInput"><s:text name="chorem.bonzoms.company.add" /></s:a></li> - <li><s:a action="addPersonInput"><s:text name="chorem.bonzoms.person.add" /></s:a></li> - <li><s:a action="companies"><s:text name="chorem.bonzoms.company.list" /></s:a></li> - <li><s:a action="persons"><s:text name="chorem.bonzoms.person.list" /></s:a></li> + <li><s:a action="companies"><s:text name="chorem.bonzoms.company.list" /></s:a></li> + <li><s:a action="persons"><s:text name="chorem.bonzoms.person.list" /></s:a></li> + <li><s:a action="addCompanyInput"><s:text name="chorem.bonzoms.company.add" /></s:a></li> + <li><s:a action="addPersonInput"><s:text name="chorem.bonzoms.person.add" /></s:a></li> </ul> </div> Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/persons.jsp =================================================================== --- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/persons.jsp 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/persons.jsp 2011-11-06 17:01:34 UTC (rev 128) @@ -1,3 +1,4 @@ +<%@page import="org.apache.commons.lang.StringUtils"%> <%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> <%@page import="java.util.List" %> <%@page import="org.chorem.entities.Person" %> @@ -3,25 +4,94 @@ <%@page import="org.chorem.bonzoms.action.PersonAction" %> <%@taglib prefix="s" uri="/struts-tags" %> +<%@taglib prefix="sj" uri="/struts-jquery-tags"%> +<%@taglib prefix="sjg" uri="/struts-jquery-grid-tags"%> <html xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" xmlns:jsp="http://java.sun.com/JSP/Page"> - <head> - <title><s:text name="chorem.bonzoms.persons" /></title> - <s:head /> - </head> - <body> - <h2><s:text name="chorem.bonzoms.persons" /></h2> - <% - List<Person> persons = PersonAction.getAction().getAllPersons(); - - for (Person person : persons) { - %> - <s:url namespace="/bonzoms" action="personDetails" var="personDetails"> - <s:param name="personId"><%= person.getWikittyId() %></s:param> - </s:url> - <a href="${personDetails}"><%= person.getFirstName() %> <%= person.getLastName() %></a><br /> - <% - } - %> - </body> + <head> + <title><s:text name="chorem.bonzoms.persons" /></title> + </head> + <body> + <h2><s:text name="chorem.bonzoms.persons" /></h2> + + <s:url id="remoteurlFulltextSearch" namespace="/" action="EntitySearchJson" escapeAmp="false"> + <s:param name="wikittyExtension">org.chorem.entities.Person</s:param> + </s:url> + + <s:url id="remoteurl" namespace="/" action="EntitySearchJson" escapeAmp="false"> + <s:param name="fulltextSearch"><%=StringUtils.defaultString(request.getParameter("fulltextSearch"))%></s:param> + <s:param name="wikittyExtension">org.chorem.entities.Person</s:param> + </s:url> + + <s:url id="personDetails" namespace="/bonzoms" action="personDetails"/> + + <script type="text/javascript"> + function formatPersonNameLink(cellvalue, options, rowObject) { + return "<a href='<s:property value="personDetails"/>?personId="+rowObject.wikittyId+"'>" + cellvalue + "</a>"; + } + + var timeoutHnd; + function doSearch() { + if(timeoutHnd) { + clearTimeout(timeoutHnd) + } + timeoutHnd = setTimeout(gridReload, 500) + } + + function gridReload() { + var filter = jQuery("#fulltextSearch").val(); + var gridUrl = "<s:property value="remoteurlFulltextSearch" escapeHtml="false"/>&fulltextSearch="+filter; + jQuery("#gridtable").jqGrid('setGridParam',{url:gridUrl,page:1}).trigger("reloadGrid"); + } + </script> + + <s:form> + <s:textfield id="fulltextSearch" name="fulltextSearch" onkeydown="doSearch()"></s:textfield> + <s:submit></s:submit> + </s:form> + + <s:url id="editurl" namespace="/" action="EntitySearchJson" escapeAmp="false"> + </s:url> + + <sjg:grid + id="gridtable" + dataType="json" + href="%{remoteurl}" + gridModel="gridModel" + rowList="10,20,50,100" + rowNum="20" + rownumbers="true" + autowidth="true" + sortname="Person.lastName" + sortorder="asc" + pager="true" + viewrecords="true" + + filter="true" + multiselect="true" + + footerrow="true" + userDataOnFooter="{'Person.lastName':'titi', firsName:'Toto'}" + + editurl="%{editurl}" + editinline="false" + + navigator="true" + navigatorAdd="true" + navigatorEdit="true" + navigatorDelete="true" + navigatorView="true" + navigatorSearch="true" + navigatorAddOptions="{height:280,reloadAfterSubmit:true}" + navigatorEditOptions="{height:280,reloadAfterSubmit:true}" + navigatorDeleteOptions="{height:280,reloadAfterSubmit:true}" + navigatorSearchOptions="{multipleSearch:true,sopt:['eq','ne','cn','nc','bw','bn','ew','en','lt','le','gt','ge','nu','nn','in','ni']}" + > + + <sjg:gridColumn name="wikittyId" hidden="true" key="true" title="id"/> + <sjg:gridColumn href="%{personDetails}" name="lastName" index="Person.lastName" title="Nom" editable="true" formatter="formatPersonNameLink"/> + <sjg:gridColumn name="firstName" index="Person.firstName" title="Prénom" editable="true"/> + </sjg:grid> + + </body> </html> Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/common/inc/header.jsp =================================================================== --- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/common/inc/header.jsp 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/common/inc/header.jsp 2011-11-06 17:01:34 UTC (rev 128) @@ -4,5 +4,5 @@ <div id="header" xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" xmlns:jsp="http://java.sun.com/JSP/Page"> - <s:a namespace="/bonzoms" action="home">Bonzoms</s:a> - <s:a namespace="/cash" action="home">Ca$h</s:a> - <s:a namespace="/billy" action="home">billy</s:a> - <s:a namespace="/gepeto" action="home">gepeto</s:a> + <s:a namespace="/" action="home">Home</s:a> - <s:a namespace="/bonzoms" action="home">Bonzoms</s:a> - <s:a namespace="/cash" action="home">Ca$h</s:a> - <s:a namespace="/billy" action="home">billy</s:a> - <s:a namespace="/gepeto" action="home">gepeto</s:a> </div> \ No newline at end of file Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/projectsByYear.jsp =================================================================== --- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/projectsByYear.jsp 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/projectsByYear.jsp 2011-11-06 17:01:34 UTC (rev 128) @@ -81,6 +81,7 @@ List<Project> projects = ProjectAction.getAction().getProjectsWithoutProjectOrderByYear(); for (Project project : projects) { + if (project != null) { %> <tr> <s:url action="projectDetails" var="projectDetails"> @@ -88,7 +89,10 @@ </s:url> <td><a href="${projectDetails}"><%= project.getName() %></a></td> </tr> - <% } %> + <% + } + } + %> </tbody> </table> <br /> Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2011-10-28 21:26:42 UTC (rev 127) +++ trunk/pom.xml 2011-11-06 17:01:34 UTC (rev 128) @@ -57,11 +57,13 @@ <projectId>chorem</projectId> <eugenePluginVersion>2.3.2</eugenePluginVersion> - <nuitonUtilsVersion>2.2-SNAPSHOT</nuitonUtilsVersion> + <nuitonUtilsVersion>2.3</nuitonUtilsVersion> + <nuitonWebVersion>1.3</nuitonWebVersion> <nuitonI18nVersion>2.3.1</nuitonI18nVersion> - <wikittyVersion>3.0.5</wikittyVersion> + <wikittyVersion>3.3-SNAPSHOT</wikittyVersion> <slf4jVersion>1.6.1</slf4jVersion> - <struts2Version>2.2.1.1</struts2Version> + <struts2Version>2.2.3</struts2Version> + <struts2jqueryVersion>3.1.0</struts2jqueryVersion> <xWorkCoreVersion>2.1.6</xWorkCoreVersion> <javaxMailVersion>1.4.3</javaxMailVersion> <servletApiVersion>2.5</servletApiVersion> @@ -88,6 +90,12 @@ </dependency> <dependency> + <groupId>org.nuiton.web</groupId> + <artifactId>nuiton-struts2</artifactId> + <version>${nuitonWebVersion}</version> + </dependency> + + <dependency> <groupId>org.nuiton.i18n</groupId> <artifactId>nuiton-i18n</artifactId> <version>${nuitonI18nVersion}</version> @@ -105,7 +113,25 @@ <version>${struts2Version}</version> </dependency> + <dependency> + <groupId>org.apache.struts</groupId> + <artifactId>struts2-json-plugin</artifactId> + <version>${struts2Version}</version> + </dependency> + + <dependency> + <groupId>com.jgeppert.struts2.jquery</groupId> + <artifactId>struts2-jquery-plugin</artifactId> + <version>${struts2jqueryVersion}</version> + </dependency> + <dependency> + <groupId>com.jgeppert.struts2.jquery</groupId> + <artifactId>struts2-jquery-grid-plugin</artifactId> + <version>${struts2jqueryVersion}</version> + </dependency> + + <dependency> <groupId>com.opensymphony</groupId> <artifactId>xwork-core</artifactId> <version>${xWorkCoreVersion}</version> @@ -131,14 +157,14 @@ <dependency> <groupId>org.nuiton.wikitty</groupId> - <artifactId>wikitty-jdbc-impl</artifactId> + <artifactId>wikitty-jdbc</artifactId> <version>${wikittyVersion}</version> <scope>runtime</scope> </dependency> <dependency> <groupId>org.nuiton.wikitty</groupId> - <artifactId>wikitty-solr-impl</artifactId> + <artifactId>wikitty-solr</artifactId> <version>${wikittyVersion}</version> </dependency> Added: trunk/src/site/chorem-cdc.txt =================================================================== --- trunk/src/site/chorem-cdc.txt (rev 0) +++ trunk/src/site/chorem-cdc.txt 2011-11-06 17:01:34 UTC (rev 128) @@ -0,0 +1,105 @@ +====== Chorem ====== + +Chorem est composé de plusieurs modules + * gestion de contacts + * gestion de resources + * gestion des emprunts (livres, switch, machine, ...) + * gestion des demandes d'achat + * gestion de rendez-vous + * gestion commercial + * gestion de congés + * gestion de projet + * suivie d'intervention client + * ... + +====== Besoin Intranet ====== + + - Gestion des salariés : + * données administratives (wiki) + * CV (OOo include wiki) + * congés/absences (interface spe mais wiki + dev envoie de mail) + * bilan RTT / CP (interface spe mais wiki) + * photo (wiki) + - Gestion des missions (salarié/indépendant) + * saisie du compte rendu d'activité mensuel (CRA) (wiki) + * ordres de mission (wiki) + * notes de frais (interface spe mais wiki) + * synthèse mensuelle sur mission (wiki) + * suivis de mission avec client (wiki) + - Espace commun + * abonnement mailing list (wiki) + * messagerie instantanée / blog / forum (wiki) + * trombinoscope (wiki) + * liens (PEE, Comité Ese...) (wiki) + * base documentaire (wiki) + * boîte à idées (wiki) + - Espace privé + * administration du site + * prospection commerciale (appli spe + interaction wiki) + +===== Gestion de contacts ===== + +La gestion de contacts permet de créer des informations pour des sociétés ou pour des personnes physiques. Les personnes faisant partie d'une ou de plusieurs sociétés. + +Elle doit permettre de renseigner les informations les plus commune: adresse, téléphone, mail, context de la 1ère rencontre. + +Pour les sociétés un outil de graph sera utilisé pour la saisie de la hiérarchie des personnes constituant la société. + +Les personnes pourront aussi avoir un coût horaire. + +===== Gestion de ressources ===== + +La gestion de ressources doit permettre de faire l'inventaire de tout ce qui est dans la société: ordinateur, libre, salle, voiture, vidéo-projecteur, ... + +Chaque ressource peut avoir un coût d'achat ou d'entretien. + +Elle doit aussi permettre à des contacts de faire des réservation de ces resources pour une date et une durée donner, ou faire un emprunt d'une ressource. + +===== Gestion des emprunts ===== + +La gestion des emprunts est peut-être à fusioner avec la gestion des ressources. + +Il doit permettre d'indiquer qui à emprunté un livre, à partir de quelle date, à quelle date il pense le rendre, et à quelle date le livre à réellement été rendu. + +===== Gestion des demandes d'achat ===== + +Ce module doit permettre au personne de demander l'achat de matériel, de livre, de ressource. + +Une personne fait la demande, avec une explication de la motivation de l'achat et la date limite pour laquelle il doit disposer de ce qu'il a demandé, il indique si possible le coût, et le lieu ou l'achat peut-être fait. + +D'autre personne peuvent voté contre ou pour en argumentant. + +===== Gestion de rendez-vous ===== + +La gestion de rendez-vous doit permettre de prendre des rendez-vous pour privé ou public. Un rendez-vous peut mettre en jeu un ou plusieurs contact et une ou plusieurs resources. Les personnes doivent être notifié du rendez-vous dès sa création, ils ont moyen de le refuser ou de l'accepter. Une fois un rendez-vous accepté la personne recevra un mail ou l'application chorem l'avertira du rendez-vous quelque temps avant celui-ci. + +===== Gestion commercial ===== + +La gestion commercial doit permettre le suivi client et propect. Avec un historique de tout ce qui à été fait et dit avec ce client au niveau commercial. + +===== Gestion de congés ===== + +La gestion de congés doit permettre à chaque personne de poser des congés, qui seront validé par un supérieur. + +===== Gestion de projet ===== + +La gestion de projet doit permettre toute la gestion du cycle de vie du projet: + * Cahier des charges + * développement + * test + * bug report + +Un projet aura un temps estimé et un prix de vente. + +Le projet sera divisé en tâches qui auront chacune une durée estimée, une date de début ou une contraite de début (après tel autre tâche ou avant tel autre tâche) et des personnes affectées à la tâche. + +Une fois fini chaque tâche devra se voir affecté une durée réelle de travaille pour chaque personne qui ayant participé à la tâche. + +Il sera alors possible pour chaque projet de voir la différence entre le temps estimé au départ et le temps réel passé, de calculer le coût de revient, de faire un graph de Gantt pour les tâches. + +===== Gestion de facturation ===== + +La gestion de facturation utilise les informations sur les projets pour permettre l'édition automatique des factures lorsqu'un lot est terminé. Il doit aussi permettre de suivre l'avancement du paiement: + * date d'expédition de la facture + * rappelle automatique des factures non encore payé + * génération de lettre de relance Added: trunk/src/site/requisite.txt =================================================================== --- trunk/src/site/requisite.txt (rev 0) +++ trunk/src/site/requisite.txt 2011-11-06 17:01:34 UTC (rev 128) @@ -0,0 +1,5 @@ +Contact +======= +Avoir un champs langue sur le contact, qui permet d'indiquer la langue +préférée de communication avec ce client. Ceci permettra d'éditer les +documents dans la langue du client pour lui envoyer (facture, ....)
participants (1)
-
bpoussin@users.chorem.org