Author: bpoussin Date: 2013-02-23 19:22:33 +0100 (Sat, 23 Feb 2013) New Revision: 316 Url: http://chorem.org/projects/chorem/repository/revisions/316 Log: petites amelioration Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/AdminAction.java trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSummary.jsp trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/report.jsp Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/AdminAction.java =================================================================== --- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/AdminAction.java 2013-02-23 02:47:03 UTC (rev 315) +++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/AdminAction.java 2013-02-23 18:22:33 UTC (rev 316) @@ -70,21 +70,20 @@ GenericAction g = new GenericAction(); g.setContextable(contextable); return g.view(client, conf.getWikittyId(), null); - // la ligne suivante ne fonctionne pas (probleme de nombre d'argument) -// return renderAction("GenericAction.view", -// "client", client, "id", conf.getWikittyId(), "extension", null ); } public Render reindex(ChoremClient client) { client.syncSearchEngine(); - return renderSuccess(); + getContext().addInfoMessage("message", "Database reindexed"); + + return renderRedirect("/"); } public Render doImport(ChoremClient client, UploadFile file) throws FileNotFoundException { WikittyImportExportService ies = new WikittyImportExportService(client); Reader in = new BufferedReader(new FileReader(file.getFile())); ies.syncImport(WikittyImportExportService.FORMAT.CSV, in); - return renderSuccess(); + return renderRedirect("/admin/importExport"); } public Render doExport(ChoremClient client, String query) { Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java =================================================================== --- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java 2013-02-23 02:47:03 UTC (rev 315) +++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java 2013-02-23 18:22:33 UTC (rev 316) @@ -327,12 +327,16 @@ Date firstDay = DateUtil.setFirstDayOfYear(dates.get("firstDate")); Date lastDay = DateUtil.setLastDayOfYear(dates.get("lastDate")); + firstDay = DateUtil.setMinTimeOfDay(firstDay); + lastDay = DateUtil.setMaxTimeOfDay(lastDay); + log.debug(String.format("date: %s", dates)); Map<Date, Map<String, Object>> result = new TreeMap<Date, Map<String, Object>>(); Date currentFirst = firstDay; Date currentLast = DateUtil.setLastDayOfYear(firstDay); + currentLast = DateUtil.setMaxTimeOfDay(currentLast); while (currentLast.compareTo(lastDay) <= 0) { Map<String, Object> values = getDebtIncome(client, currentFirst, currentLast, companyId); @@ -355,7 +359,10 @@ Date firstDayYear = DateUtil.setFirstDayOfYear(now); Date lastYearNow = DateUtils.addYears(now, -1); Date lastYearFirstDay = DateUtil.setFirstDayOfYear(lastYearNow); - + + firstDayYear = DateUtil.setMinTimeOfDay(firstDayYear); + lastYearFirstDay = DateUtil.setMinTimeOfDay(lastYearFirstDay); + String companyId = client.getConfiguration().getDefaultCompany(); // toutes les depenses depuis le debut de l'annee @@ -372,7 +379,7 @@ .select().sum(Invoice.FQ_FIELD_FINANCIALTRANSACTION_AMOUNT) .and() .exteq(FinancialTransaction.EXT_FINANCIALTRANSACTION) - .not().eq(Invoice.FQ_FIELD_INVOICE_STATUS, InvoiceStatus.CANCELED.name()) + .ne(Invoice.FQ_FIELD_INVOICE_STATUS, InvoiceStatus.CANCELED.name()) .lt(Invoice.FQ_FIELD_FINANCIALTRANSACTION_EXPECTEDDATE, inOneWeek) .isNull(Invoice.FQ_FIELD_FINANCIALTRANSACTION_PAYMENTDATE) .containsOne(Invoice.FQ_FIELD_FINANCIALTRANSACTION_PAYER) @@ -384,7 +391,7 @@ .select().sum(Invoice.FQ_FIELD_FINANCIALTRANSACTION_AMOUNT) .and() .exteq(FinancialTransaction.EXT_FINANCIALTRANSACTION) - .not().eq(Invoice.FQ_FIELD_INVOICE_STATUS, InvoiceStatus.CANCELED.name()) + .ne(Invoice.FQ_FIELD_INVOICE_STATUS, InvoiceStatus.CANCELED.name()) .lt(Invoice.FQ_FIELD_FINANCIALTRANSACTION_EXPECTEDDATE, now) .isNull(Invoice.FQ_FIELD_FINANCIALTRANSACTION_PAYMENTDATE) .containsOne(Invoice.FQ_FIELD_FINANCIALTRANSACTION_BENEFICIARY) @@ -706,15 +713,16 @@ WikittyQuery invoiceQuery = new WikittyQueryMaker().and() .parse(filter) .parse(query) - .exteq(Invoice.EXT_INVOICE) + .exteq(FinancialTransaction.EXT_FINANCIALTRANSACTION) + .ne(Invoice.FQ_FIELD_INVOICE_STATUS, InvoiceStatus.CANCELED.name()) .or() - .bw(Invoice.FQ_FIELD_FINANCIALTRANSACTION_EMITTEDDATE, start, end) - .isNull(Invoice.FQ_FIELD_FINANCIALTRANSACTION_EMITTEDDATE) - .bw(Invoice.FQ_FIELD_FINANCIALTRANSACTION_EXPECTEDDATE, start, end) - .bw(Invoice.FQ_FIELD_FINANCIALTRANSACTION_PAYMENTDATE, start, end) + .bw(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_EMITTEDDATE, start, end) + .isNull(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_EMITTEDDATE) + .bw(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_EXPECTEDDATE, start, end) + .bw(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_PAYMENTDATE, start, end) .end().setLimit(WikittyQuery.MAX); - ChoremQueryHelper.addSort(client, invoiceQuery, Invoice.EXT_INVOICE); + ChoremQueryHelper.addSort(client, invoiceQuery, FinancialTransaction.EXT_FINANCIALTRANSACTION); WikittyQueryResult<Invoice> invoices = client.findAllByQuery(Invoice.class, invoiceQuery); @@ -800,6 +808,9 @@ start = DateUtil.setFirstDayOfMonth(start); end = DateUtil.setLastDayOfMonth(end); + start = DateUtil.setMinTimeOfDay(start); + end = DateUtil.setMaxTimeOfDay(end); + // La somme des factures que la company doit payer jusqu'a la date demandee WikittyQuery debt = new ChoremQueryMaker() .select() Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSummary.jsp =================================================================== --- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSummary.jsp 2013-02-23 02:47:03 UTC (rev 315) +++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSummary.jsp 2013-02-23 18:22:33 UTC (rev 316) @@ -41,7 +41,7 @@ factures à payer</a> pour un montant de <f:formatNumber type="currency" value="${invoiceDebt}"/></li> <li>Il y a ${invoiceIncomeNb} - <a href='<c:url value="/report?report=invoiceIncome&query=FinancialTransaction.paymentDate=null and FinancialTransaction.expectedDate<${now}"/>'> + <a href='<c:url value="/report?report=invoiceIncome&start=01/01/2000&end=01/01/2222&query=FinancialTransaction.paymentDate=null and FinancialTransaction.expectedDate<${now}"/>'> factures impayées</a> pour un montant de <f:formatNumber type="currency" value="${invoiceIncome}"/></li> <li>Il y a ${touchNb} <a href='<c:url value="/wikitty/search?query=${touchQueryString}"/>'> Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/report.jsp =================================================================== --- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/report.jsp 2013-02-23 02:47:03 UTC (rev 315) +++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/report.jsp 2013-02-23 18:22:33 UTC (rev 316) @@ -26,9 +26,9 @@ <form class="well form-inline"> <input type="hidden" name="report" value="${report}"/> - <input class="datepicker input-small" type="text" name="start" value="${start}" placeholder="date from"/> - <input class="datepicker input-small" type="text" name="end" value="${end}" placeholder="date to"/> - <input class="input-xxlarge" type="text" name="query" value="${query}" placeholder="filter query"/> + <input class="datepicker input-small" type="text" name="start" value="${fn:escapeXml(start)}" placeholder="date from"/> + <input class="datepicker input-small" type="text" name="end" value="${fn:escapeXml(end)}" placeholder="date to"/> + <input class="input-xxlarge" type="text" name="query" value="${fn:escapeXml(query)}" placeholder="filter query"/> <input type="submit" class="btn"/> </form>