include the hour, minute precision in the communication date received

from customers.

FEA: ItEr75S32AnA15S04UpdateDeliveringDateInSubcontracting
This commit is contained in:
Susana Montes Pedreira 2012-03-29 10:58:48 +01:00
parent 4a9bb627c9
commit c075e4434a
3 changed files with 55 additions and 6 deletions

View file

@ -0,0 +1,47 @@
/*
* This file is part of LibrePlan
*
* Copyright (C) 2012 WirelessGalicia, S.L.
*
* 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 Affero 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/>.
*/
package org.libreplan.web.common.typeconverters;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.zkoss.zk.ui.Component;
import org.zkoss.zkplus.databind.TypeConverter;
/**
* Converter for the type java.util.Date with an hour minute precision
*
* @author Susana Montes Pedreira <smontes@wirelessgalicia.com>
*
*/
public class DateTimeConverter implements TypeConverter {
@Override
public Object coerceToBean(Object arg0, Component arg1) {
return null;
}
@Override
public Object coerceToUi(Object object, Component component) {
return object != null ? (new SimpleDateFormat("dd/MM/yyyy HH:mm"))
.format((Date) object) : new String("");
}
}

View file

@ -21,7 +21,6 @@ package org.libreplan.web.subcontract;
import static org.libreplan.web.I18nHelper._;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@ -141,21 +140,24 @@ public class CustomerCommunicationCRUDController extends GenericForwardComposer
appendLabel(row, toString(type));
appendLabel(row, customerCommunication.getOrder().getName());
appendLabel(row, toString(customerCommunication.getDeadline()));
appendLabel(row,
toString(customerCommunication.getDeadline(), "dd/MM/yyyy"));
appendLabel(row, customerCommunication.getOrder().getCode());
appendLabel(row, customerCommunication.getOrder()
.getCustomerReference());
appendLabel(row,
toString(customerCommunication.getCommunicationDate()));
toString(customerCommunication.getCommunicationDate(),
"dd/MM/yyyy HH:mm"));
appendCheckbox(row, customerCommunication);
appendOperations(row, customerCommunication);
}
private String toString(Date date) {
private String toString(Date date, String precision) {
if (date == null) {
return "";
}
return new SimpleDateFormat("dd/MM/yyyy", Locales.getCurrent()).format(date);
return new SimpleDateFormat(precision, Locales.getCurrent())
.format(date);
}
private String toString(Object object) {

View file

@ -229,7 +229,7 @@
<rows>
<row self="@{each='deliverDate'}" value="@{deliverDate}">
<label value="@{deliverDate.deliverDate, converter='org.libreplan.web.common.typeconverters.DateConverter'}" />
<label value="@{deliverDate.saveDate, converter='org.libreplan.web.common.typeconverters.DateConverter'}" />
<label value="@{deliverDate.saveDate, converter='org.libreplan.web.common.typeconverters.DateTimeConverter'}" />
</row>
</rows>
</grid>