Refactor source code to use personal timesheet instead of monthly timesheet
FEA: ItEr77S07PersonalTimesheetsPeriodictyConfiguration
This commit is contained in:
parent
2ea3c63385
commit
3394f41aa2
40 changed files with 329 additions and 314 deletions
|
|
@ -109,7 +109,7 @@ public class Configuration extends BaseEntity {
|
||||||
private String currencyCode = "EUR";
|
private String currencyCode = "EUR";
|
||||||
private String currencySymbol = "€";
|
private String currencySymbol = "€";
|
||||||
|
|
||||||
private TypeOfWorkHours monthlyTimesheetsTypeOfWorkHours;
|
private TypeOfWorkHours personalTimesheetsTypeOfWorkHours;
|
||||||
|
|
||||||
private PersonalTimesheetsPeriodicityEnum personalTimesheetsPeriodicity = PersonalTimesheetsPeriodicityEnum.MONTHLY;
|
private PersonalTimesheetsPeriodicityEnum personalTimesheetsPeriodicity = PersonalTimesheetsPeriodicityEnum.MONTHLY;
|
||||||
|
|
||||||
|
|
@ -452,13 +452,13 @@ public class Configuration extends BaseEntity {
|
||||||
this.currencySymbol = currencySymbol;
|
this.currencySymbol = currencySymbol;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TypeOfWorkHours getMonthlyTimesheetsTypeOfWorkHours() {
|
public TypeOfWorkHours getPersonalTimesheetsTypeOfWorkHours() {
|
||||||
return monthlyTimesheetsTypeOfWorkHours;
|
return personalTimesheetsTypeOfWorkHours;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMonthlyTimesheetsTypeOfWorkHours(
|
public void setPersonalTimesheetsTypeOfWorkHours(
|
||||||
TypeOfWorkHours typeOfWorkHours) {
|
TypeOfWorkHours typeOfWorkHours) {
|
||||||
monthlyTimesheetsTypeOfWorkHours = typeOfWorkHours;
|
personalTimesheetsTypeOfWorkHours = typeOfWorkHours;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PersonalTimesheetsPeriodicityEnum getPersonalTimesheetsPeriodicity() {
|
public PersonalTimesheetsPeriodicityEnum getPersonalTimesheetsPeriodicity() {
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,11 @@ package org.libreplan.business.common.entities;
|
||||||
import org.libreplan.business.IDataBootstrap;
|
import org.libreplan.business.IDataBootstrap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contract for {@link MonthlyTimesheetsTypeOfWorkHoursBootstrap}.
|
* Contract for {@link PersonalTimesheetsTypeOfWorkHoursBootstrap}.
|
||||||
*
|
*
|
||||||
* @author Manuel Rego Casasnovas <mrego@igalia.com>
|
* @author Manuel Rego Casasnovas <mrego@igalia.com>
|
||||||
*/
|
*/
|
||||||
public interface IMonthlyTimesheetsTypeOfWorkHoursBootstrap extends
|
public interface IPersonalTimesheetsTypeOfWorkHoursBootstrap extends
|
||||||
IDataBootstrap {
|
IDataBootstrap {
|
||||||
|
|
||||||
void loadRequiredData();
|
void loadRequiredData();
|
||||||
|
|
@ -32,7 +32,7 @@ import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fills the attribute {@link Configuration#monthlyTimesheetsTypeOfWorkHours}
|
* Fills the attribute {@link Configuration#personalTimesheetsTypeOfWorkHours}
|
||||||
* with a default value.<br />
|
* with a default value.<br />
|
||||||
*
|
*
|
||||||
* If possible it uses the "Default" {@link TypeOfWorkHours}, but if it doesn't
|
* If possible it uses the "Default" {@link TypeOfWorkHours}, but if it doesn't
|
||||||
|
|
@ -47,8 +47,8 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
@Component
|
@Component
|
||||||
@Scope("singleton")
|
@Scope("singleton")
|
||||||
@BootstrapOrder(1)
|
@BootstrapOrder(1)
|
||||||
public class MonthlyTimesheetsTypeOfWorkHoursBootstrap implements
|
public class PersonalTimesheetsTypeOfWorkHoursBootstrap implements
|
||||||
IMonthlyTimesheetsTypeOfWorkHoursBootstrap {
|
IPersonalTimesheetsTypeOfWorkHoursBootstrap {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IConfigurationDAO configurationDAO;
|
private IConfigurationDAO configurationDAO;
|
||||||
|
|
@ -73,7 +73,7 @@ public class MonthlyTimesheetsTypeOfWorkHoursBootstrap implements
|
||||||
typeOfWorkHours = typeOfWorkHoursDAO.findActive().get(0);
|
typeOfWorkHours = typeOfWorkHoursDAO.findActive().get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
configuration.setMonthlyTimesheetsTypeOfWorkHours(typeOfWorkHours);
|
configuration.setPersonalTimesheetsTypeOfWorkHours(typeOfWorkHours);
|
||||||
configurationDAO.save(configuration);
|
configurationDAO.save(configuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -148,7 +148,7 @@ public class TypeOfWorkHoursDAO extends IntegrationEntityDAO<TypeOfWorkHours>
|
||||||
public void checkIsReferencedByOtherEntities(TypeOfWorkHours type) throws ValidationException {
|
public void checkIsReferencedByOtherEntities(TypeOfWorkHours type) throws ValidationException {
|
||||||
checkHasHourCost(type);
|
checkHasHourCost(type);
|
||||||
checkHasWorkReportLine(type);
|
checkHasWorkReportLine(type);
|
||||||
checkIsMonthlyTimesheetsTypeOfWorkHours(type);
|
checkIsPersonalTimesheetsTypeOfWorkHours(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkHasWorkReportLine(TypeOfWorkHours type) {
|
private void checkHasWorkReportLine(TypeOfWorkHours type) {
|
||||||
|
|
@ -174,13 +174,13 @@ public class TypeOfWorkHoursDAO extends IntegrationEntityDAO<TypeOfWorkHours>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkIsMonthlyTimesheetsTypeOfWorkHours(TypeOfWorkHours type) {
|
private void checkIsPersonalTimesheetsTypeOfWorkHours(TypeOfWorkHours type) {
|
||||||
Configuration configuration = configurationDAO.getConfiguration();
|
Configuration configuration = configurationDAO.getConfiguration();
|
||||||
if (configuration.getMonthlyTimesheetsTypeOfWorkHours().getId()
|
if (configuration.getPersonalTimesheetsTypeOfWorkHours().getId()
|
||||||
.equals(type.getId())) {
|
.equals(type.getId())) {
|
||||||
throw ValidationException
|
throw ValidationException
|
||||||
.invalidValue(
|
.invalidValue(
|
||||||
"Cannot delete the type of work hours. It is configured as type of work hours for monthly timesheets.",
|
"Cannot delete the type of work hours. It is configured as type of work hours for personal timesheets.",
|
||||||
type);
|
type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -144,10 +144,10 @@ public class TypeOfWorkHours extends IntegrationEntity implements IHumanIdentifi
|
||||||
}
|
}
|
||||||
|
|
||||||
@AssertTrue(message = "type of work hours for personal timesheets cannot be disabled")
|
@AssertTrue(message = "type of work hours for personal timesheets cannot be disabled")
|
||||||
public boolean checkMonthlyTimesheetsTypeOfWorkHoursNotDisabled() {
|
public boolean checkPersonalTimesheetsTypeOfWorkHoursNotDisabled() {
|
||||||
if (!isNewObject() && !getEnabled()) {
|
if (!isNewObject() && !getEnabled()) {
|
||||||
TypeOfWorkHours typeOfWorkHours = Registry.getConfigurationDAO()
|
TypeOfWorkHours typeOfWorkHours = Registry.getConfigurationDAO()
|
||||||
.getConfiguration().getMonthlyTimesheetsTypeOfWorkHours();
|
.getConfiguration().getPersonalTimesheetsTypeOfWorkHours();
|
||||||
if (typeOfWorkHours.getId().equals(getId())) {
|
if (typeOfWorkHours.getId().equals(getId())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,13 +48,13 @@ public interface IWorkReportDAO extends IIntegrationEntityDAO<WorkReport> {
|
||||||
int getLastReportYear();
|
int getLastReportYear();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the {@link WorkReport} of the predefined type monthly timesheet
|
* Returns the {@link WorkReport} of the predefined type personal timesheet
|
||||||
* for the given <code>resource</code> in the specified <code>date</code>
|
* for the given <code>resource</code> in the specified <code>date</code>
|
||||||
* depending on the configured <code>periodicity</code>.<br />
|
* depending on the configured <code>periodicity</code>.<br />
|
||||||
*
|
*
|
||||||
* If there isn't any, it returns <code>null</code>.
|
* If there isn't any, it returns <code>null</code>.
|
||||||
*/
|
*/
|
||||||
WorkReport getMonthlyTimesheetWorkReport(Resource resource, LocalDate date,
|
WorkReport getPersonalTimesheetWorkReport(Resource resource, LocalDate date,
|
||||||
PersonalTimesheetsPeriodicityEnum periodicity);
|
PersonalTimesheetsPeriodicityEnum periodicity);
|
||||||
|
|
||||||
boolean isAnyPersonalTimesheetAlreadySaved();
|
boolean isAnyPersonalTimesheetAlreadySaved();
|
||||||
|
|
|
||||||
|
|
@ -141,12 +141,12 @@ public class WorkReportDAO extends IntegrationEntityDAO<WorkReport>
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public WorkReport getMonthlyTimesheetWorkReport(Resource resource,
|
public WorkReport getPersonalTimesheetWorkReport(Resource resource,
|
||||||
LocalDate date, PersonalTimesheetsPeriodicityEnum periodicity) {
|
LocalDate date, PersonalTimesheetsPeriodicityEnum periodicity) {
|
||||||
WorkReportType workReportType;
|
WorkReportType workReportType;
|
||||||
try {
|
try {
|
||||||
workReportType = workReportTypeDAO
|
workReportType = workReportTypeDAO
|
||||||
.findUniqueByName(PredefinedWorkReportTypes.MONTHLY_TIMESHEETS
|
.findUniqueByName(PredefinedWorkReportTypes.PERSONAL_TIMESHEETS
|
||||||
.getName());
|
.getName());
|
||||||
} catch (NonUniqueResultException e) {
|
} catch (NonUniqueResultException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
|
@ -156,13 +156,13 @@ public class WorkReportDAO extends IntegrationEntityDAO<WorkReport>
|
||||||
|
|
||||||
Criteria criteria = getSession().createCriteria(WorkReport.class);
|
Criteria criteria = getSession().createCriteria(WorkReport.class);
|
||||||
criteria.add(Restrictions.eq("workReportType", workReportType));
|
criteria.add(Restrictions.eq("workReportType", workReportType));
|
||||||
List<WorkReport> monthlyTimesheets = criteria.add(
|
List<WorkReport> personalTimesheets = criteria.add(
|
||||||
Restrictions.eq("resource", resource)).list();
|
Restrictions.eq("resource", resource)).list();
|
||||||
|
|
||||||
LocalDate start = periodicity.getStart(date);
|
LocalDate start = periodicity.getStart(date);
|
||||||
LocalDate end = periodicity.getEnd(date);
|
LocalDate end = periodicity.getEnd(date);
|
||||||
|
|
||||||
for (WorkReport workReport : monthlyTimesheets) {
|
for (WorkReport workReport : personalTimesheets) {
|
||||||
Set<WorkReportLine> workReportLines = workReport
|
Set<WorkReportLine> workReportLines = workReport
|
||||||
.getWorkReportLines();
|
.getWorkReportLines();
|
||||||
if (workReportLines.size() > 0) {
|
if (workReportLines.size() > 0) {
|
||||||
|
|
@ -184,7 +184,7 @@ public class WorkReportDAO extends IntegrationEntityDAO<WorkReport>
|
||||||
WorkReportType workReportType;
|
WorkReportType workReportType;
|
||||||
try {
|
try {
|
||||||
workReportType = workReportTypeDAO
|
workReportType = workReportTypeDAO
|
||||||
.findUniqueByName(PredefinedWorkReportTypes.MONTHLY_TIMESHEETS
|
.findUniqueByName(PredefinedWorkReportTypes.PERSONAL_TIMESHEETS
|
||||||
.getName());
|
.getName());
|
||||||
} catch (NonUniqueResultException e) {
|
} catch (NonUniqueResultException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ package org.libreplan.business.workreports.entities;
|
||||||
*/
|
*/
|
||||||
public enum PredefinedWorkReportTypes {
|
public enum PredefinedWorkReportTypes {
|
||||||
DEFAULT("Default", false, false, false),
|
DEFAULT("Default", false, false, false),
|
||||||
MONTHLY_TIMESHEETS("Personal timesheets", false, true, false);
|
PERSONAL_TIMESHEETS("Personal timesheets", false, true, false);
|
||||||
|
|
||||||
private WorkReportType workReportType;
|
private WorkReportType workReportType;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -471,8 +471,8 @@ public class WorkReport extends IntegrationEntity implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@AssertTrue(message = "only one timesheet line per day and task is allowed in personal timesheets")
|
@AssertTrue(message = "only one timesheet line per day and task is allowed in personal timesheets")
|
||||||
public boolean checkConstraintOnlyOneWorkReportLinePerDayAndOrderElementInMonthlyTimesheet() {
|
public boolean checkConstraintOnlyOneWorkReportLinePerDayAndOrderElementInPersonalTimesheet() {
|
||||||
if (!getWorkReportType().isMonthlyTimesheetsType()) {
|
if (!getWorkReportType().isPersonalTimesheetsType()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -492,9 +492,9 @@ public class WorkReport extends IntegrationEntity implements
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@AssertTrue(message = "In personal timesheets, all timesheet lines should be in the same month")
|
@AssertTrue(message = "In personal timesheets, all timesheet lines should be in the same period")
|
||||||
public boolean checkConstraintAllWorkReportLinesInTheSameMonthInMonthlyTimesheet() {
|
public boolean checkConstraintAllWorkReportLinesInTheSamePeriodInPersonalTimesheet() {
|
||||||
if (!getWorkReportType().isMonthlyTimesheetsType()) {
|
if (!getWorkReportType().isPersonalTimesheetsType()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -517,8 +517,8 @@ public class WorkReport extends IntegrationEntity implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@AssertTrue(message = "resource has to be bound to a user in personal timesheets")
|
@AssertTrue(message = "resource has to be bound to a user in personal timesheets")
|
||||||
public boolean checkConstraintResourceIsBoundInMonthlyTimesheet() {
|
public boolean checkConstraintResourceIsBoundInPersonalTimesheet() {
|
||||||
if (!getWorkReportType().isMonthlyTimesheetsType()) {
|
if (!getWorkReportType().isPersonalTimesheetsType()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -524,11 +524,11 @@ public class WorkReportType extends IntegrationEntity implements IHumanIdentifia
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMonthlyTimesheetsType() {
|
public boolean isPersonalTimesheetsType() {
|
||||||
if (StringUtils.isBlank(name)) {
|
if (StringUtils.isBlank(name)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return name.equals(PredefinedWorkReportTypes.MONTHLY_TIMESHEETS
|
return name.equals(PredefinedWorkReportTypes.PERSONAL_TIMESHEETS
|
||||||
.getName());
|
.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
* If there is no work report types, it creates a default work report type.<br />
|
* If there is no work report types, it creates a default work report type.<br />
|
||||||
*
|
*
|
||||||
* Even if there are already some work report types defined, it creates a work
|
* Even if there are already some work report types defined, it creates a work
|
||||||
* report type for monthly timesheets if it is not present in the database yet.
|
* report type for personal timesheets if it is not present in the database yet.
|
||||||
*
|
*
|
||||||
* @author Ignacio Díaz Teijido <ignacio.diaz@cafedered.com>
|
* @author Ignacio Díaz Teijido <ignacio.diaz@cafedered.com>
|
||||||
* @author Manuel Rego Casasnovas <rego@igalia.com>
|
* @author Manuel Rego Casasnovas <rego@igalia.com>
|
||||||
|
|
@ -59,7 +59,7 @@ public class WorkReportTypeBootstrap implements IWorkReportTypeBootstrap {
|
||||||
createAndSaveWorkReportType(predefinedWorkReportType);
|
createAndSaveWorkReportType(predefinedWorkReportType);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
createMonthlyTimesheetsWorkReportTypeIfNeeded();
|
createPersonalTimesheetsWorkReportTypeIfNeeded();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -74,15 +74,15 @@ public class WorkReportTypeBootstrap implements IWorkReportTypeBootstrap {
|
||||||
workReportTypeDAO.save(workReportType);
|
workReportTypeDAO.save(workReportType);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createMonthlyTimesheetsWorkReportTypeIfNeeded() {
|
private void createPersonalTimesheetsWorkReportTypeIfNeeded() {
|
||||||
try {
|
try {
|
||||||
workReportTypeDAO
|
workReportTypeDAO
|
||||||
.findUniqueByName(PredefinedWorkReportTypes.MONTHLY_TIMESHEETS
|
.findUniqueByName(PredefinedWorkReportTypes.PERSONAL_TIMESHEETS
|
||||||
.getName());
|
.getName());
|
||||||
} catch (NonUniqueResultException e) {
|
} catch (NonUniqueResultException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
} catch (InstanceNotFoundException e) {
|
} catch (InstanceNotFoundException e) {
|
||||||
createAndSaveWorkReportType(PredefinedWorkReportTypes.MONTHLY_TIMESHEETS);
|
createAndSaveWorkReportType(PredefinedWorkReportTypes.PERSONAL_TIMESHEETS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,4 +39,21 @@
|
||||||
</update>
|
</update>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
|
|
||||||
|
<changeSet id="rename-column-from-monthly-to-personal-in-configuration"
|
||||||
|
author="mrego">
|
||||||
|
<comment>
|
||||||
|
Rename column monthly_timesheets_type_of_work_hours to
|
||||||
|
personal_timesheets_type_of_work_hours in configuration table
|
||||||
|
</comment>
|
||||||
|
<dropForeignKeyConstraint baseTableName="configuration"
|
||||||
|
constraintName="configuration_type_of_work_hours_fkey"/>
|
||||||
|
<renameColumn tableName="configuration"
|
||||||
|
oldColumnName="monthly_timesheets_type_of_work_hours"
|
||||||
|
newColumnName="personal_timesheets_type_of_work_hours"
|
||||||
|
columnDataType="BIGINT" />
|
||||||
|
<addForeignKeyConstraint constraintName="configuration_type_of_work_hours_fkey"
|
||||||
|
baseTableName="configuration" baseColumnNames="personal_timesheets_type_of_work_hours"
|
||||||
|
referencedTableName="type_of_work_hours" referencedColumnNames="id" />
|
||||||
|
</changeSet>
|
||||||
|
|
||||||
</databaseChangeLog>
|
</databaseChangeLog>
|
||||||
|
|
|
||||||
|
|
@ -79,8 +79,8 @@
|
||||||
<property name="currencyCode" not-null="true" column="currency_code" />
|
<property name="currencyCode" not-null="true" column="currency_code" />
|
||||||
<property name="currencySymbol" not-null="true" column="currency_symbol" />
|
<property name="currencySymbol" not-null="true" column="currency_symbol" />
|
||||||
|
|
||||||
<many-to-one name="monthlyTimesheetsTypeOfWorkHours" cascade="none"
|
<many-to-one name="personalTimesheetsTypeOfWorkHours" cascade="none"
|
||||||
column="monthly_timesheets_type_of_work_hours" />
|
column="personal_timesheets_type_of_work_hours" />
|
||||||
|
|
||||||
<property name="personalTimesheetsPeriodicity" column="personal_timesheets_periodicity">
|
<property name="personalTimesheetsPeriodicity" column="personal_timesheets_periodicity">
|
||||||
<type name="org.hibernate.type.EnumType">
|
<type name="org.hibernate.type.EnumType">
|
||||||
|
|
|
||||||
|
|
@ -870,13 +870,13 @@ public class ConfigurationController extends GenericForwardComposer {
|
||||||
configurationModel.setCurrency(currencyCode);
|
configurationModel.setCurrency(currencyCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TypeOfWorkHours getMonthlyTimesheetsTypeOfWorkHours() {
|
public TypeOfWorkHours getPersonalTimesheetsTypeOfWorkHours() {
|
||||||
return configurationModel.getMonthlyTimesheetsTypeOfWorkHours();
|
return configurationModel.getPersonalTimesheetsTypeOfWorkHours();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMonthlyTimesheetsTypeOfWorkHours(
|
public void setPersonalTimesheetsTypeOfWorkHours(
|
||||||
TypeOfWorkHours typeOfWorkHours) {
|
TypeOfWorkHours typeOfWorkHours) {
|
||||||
configurationModel.setMonthlyTimesheetsTypeOfWorkHours(typeOfWorkHours);
|
configurationModel.setPersonalTimesheetsTypeOfWorkHours(typeOfWorkHours);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PersonalTimesheetsPeriodicityEnum> getPersonalTimesheetsPeriodicities() {
|
public List<PersonalTimesheetsPeriodicityEnum> getPersonalTimesheetsPeriodicities() {
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@ public class ConfigurationModel implements IConfigurationModel {
|
||||||
|
|
||||||
private void forceLoad(Configuration configuration) {
|
private void forceLoad(Configuration configuration) {
|
||||||
forceLoad(configuration.getDefaultCalendar());
|
forceLoad(configuration.getDefaultCalendar());
|
||||||
forceLoad(configuration.getMonthlyTimesheetsTypeOfWorkHours());
|
forceLoad(configuration.getPersonalTimesheetsTypeOfWorkHours());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void forceLoad(BaseCalendar calendar) {
|
private void forceLoad(BaseCalendar calendar) {
|
||||||
|
|
@ -627,15 +627,15 @@ public class ConfigurationModel implements IConfigurationModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TypeOfWorkHours getMonthlyTimesheetsTypeOfWorkHours() {
|
public TypeOfWorkHours getPersonalTimesheetsTypeOfWorkHours() {
|
||||||
return configuration.getMonthlyTimesheetsTypeOfWorkHours();
|
return configuration.getPersonalTimesheetsTypeOfWorkHours();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setMonthlyTimesheetsTypeOfWorkHours(
|
public void setPersonalTimesheetsTypeOfWorkHours(
|
||||||
TypeOfWorkHours typeOfWorkHours) {
|
TypeOfWorkHours typeOfWorkHours) {
|
||||||
if (configuration != null) {
|
if (configuration != null) {
|
||||||
configuration.setMonthlyTimesheetsTypeOfWorkHours(typeOfWorkHours);
|
configuration.setPersonalTimesheetsTypeOfWorkHours(typeOfWorkHours);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -169,9 +169,9 @@ public interface IConfigurationModel {
|
||||||
|
|
||||||
void setCurrency(String currencyCode);
|
void setCurrency(String currencyCode);
|
||||||
|
|
||||||
TypeOfWorkHours getMonthlyTimesheetsTypeOfWorkHours();
|
TypeOfWorkHours getPersonalTimesheetsTypeOfWorkHours();
|
||||||
|
|
||||||
void setMonthlyTimesheetsTypeOfWorkHours(TypeOfWorkHours typeOfWorkHours);
|
void setPersonalTimesheetsTypeOfWorkHours(TypeOfWorkHours typeOfWorkHours);
|
||||||
|
|
||||||
PersonalTimesheetsPeriodicityEnum getPersonalTimesheetsPeriodicity();
|
PersonalTimesheetsPeriodicityEnum getPersonalTimesheetsPeriodicity();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,12 +25,12 @@ import org.libreplan.web.common.entrypoints.EntryPoint;
|
||||||
import org.libreplan.web.common.entrypoints.EntryPoints;
|
import org.libreplan.web.common.entrypoints.EntryPoints;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Entry points for monthly timesheet creation/edition window
|
* Entry points for personal timesheet creation/edition window
|
||||||
*
|
*
|
||||||
* @author Manuel Rego Casasnovas <mrego@igalia.com>
|
* @author Manuel Rego Casasnovas <mrego@igalia.com>
|
||||||
*/
|
*/
|
||||||
@EntryPoints(page = "/myaccount/monthlyTimesheet.zul", registerAs = "monthlyTimesheetController")
|
@EntryPoints(page = "/myaccount/personalTimesheet.zul", registerAs = "personalTimesheetController")
|
||||||
public interface IMonthlyTimesheetController {
|
public interface IPersonalTimesheetController {
|
||||||
|
|
||||||
@EntryPoint("date")
|
@EntryPoint("date")
|
||||||
void goToCreateOrEditForm(LocalDate date);
|
void goToCreateOrEditForm(LocalDate date);
|
||||||
|
|
@ -32,40 +32,38 @@ import org.libreplan.business.workingday.EffortDuration;
|
||||||
import org.libreplan.business.workreports.entities.WorkReport;
|
import org.libreplan.business.workreports.entities.WorkReport;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for creation/edition of a monthly timesheet model
|
* Interface for creation/edition of a personal timesheet model
|
||||||
*
|
*
|
||||||
* @author Manuel Rego Casasnovas <mrego@igalia.com>
|
* @author Manuel Rego Casasnovas <mrego@igalia.com>
|
||||||
*/
|
*/
|
||||||
public interface IMonthlyTimesheetModel {
|
public interface IPersonalTimesheetModel {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Edits the monthly timesheet for the specified <code>date</code> and
|
* Edits the personal timesheet for the specified <code>date</code> and
|
||||||
* resource bound to current user or creates a new one if it doesn't exist
|
* resource bound to current user or creates a new one if it doesn't exist
|
||||||
* yet.
|
* yet.
|
||||||
*/
|
*/
|
||||||
void initCreateOrEdit(LocalDate date);
|
void initCreateOrEdit(LocalDate date);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Edits the monthly timesheet for the specified <code>date</code> and
|
* Edits the personal timesheet for the specified <code>date</code> and
|
||||||
* resource bound to the {@link Worker} specified by the
|
* resource bound to the {@link Worker} specified by the
|
||||||
* <code>resource</code> or creates a new one if it doesn't exist yet.
|
* <code>resource</code> or creates a new one if it doesn't exist yet.
|
||||||
*/
|
*/
|
||||||
void initCreateOrEdit(LocalDate date, Resource resource);
|
void initCreateOrEdit(LocalDate date, Resource resource);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the date of the monthly timesheet (only year and month should
|
* Returns the date of the personal timesheet.
|
||||||
* take into account as the day is not important to define a monthly
|
|
||||||
* timesheet).
|
|
||||||
*/
|
*/
|
||||||
LocalDate getDate();
|
LocalDate getDate();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the first day of the month of the current monthly timesheet.
|
* Returns the first day of the current personal timesheet.
|
||||||
*/
|
*/
|
||||||
LocalDate getFirstDay();
|
LocalDate getFirstDay();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the last day of the month of the current monthly timesheet.
|
* Returns the last day of the current personal timesheet.
|
||||||
*/
|
*/
|
||||||
LocalDate getLastDate();
|
LocalDate getLastDate();
|
||||||
|
|
||||||
|
|
@ -81,45 +79,45 @@ public interface IMonthlyTimesheetModel {
|
||||||
List<OrderElement> getOrderElements();
|
List<OrderElement> getOrderElements();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the {@link EffortDuration} in the current monthly timesheet for
|
* Returns the {@link EffortDuration} in the current personal timesheet for
|
||||||
* the specified <code>orderElement</code> and <code>date</code>.
|
* the specified <code>orderElement</code> and <code>date</code>.
|
||||||
*/
|
*/
|
||||||
EffortDuration getEffortDuration(OrderElement orderElement, LocalDate date);
|
EffortDuration getEffortDuration(OrderElement orderElement, LocalDate date);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the {@link EffortDuration} in the current monthly timesheet for the
|
* Sets the {@link EffortDuration} in the current personal timesheet for the
|
||||||
* specified <code>orderElement</code> and <code>date</code>.<br />
|
* specified <code>orderElement</code> and <code>date</code>.<br />
|
||||||
*
|
*
|
||||||
* Marks the current monthly timesheet as modified.
|
* Marks the current personal timesheet as modified.
|
||||||
*/
|
*/
|
||||||
void setEffortDuration(OrderElement orderElement, LocalDate date,
|
void setEffortDuration(OrderElement orderElement, LocalDate date,
|
||||||
EffortDuration effortDuration);
|
EffortDuration effortDuration);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save {@link WorkReport} for the monthly timesheet.
|
* Save {@link WorkReport} for the personal timesheet.
|
||||||
*/
|
*/
|
||||||
void save();
|
void save();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancel changes in {@link WorkReport} for the monthly timesheet.
|
* Cancel changes in {@link WorkReport} for the personal timesheet.
|
||||||
*/
|
*/
|
||||||
void cancel();
|
void cancel();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the {@link EffortDuration} in the current monthly timesheet for
|
* Returns the {@link EffortDuration} in the current personal timesheet for
|
||||||
* the specified <code>orderElement</code>.
|
* the specified <code>orderElement</code>.
|
||||||
*/
|
*/
|
||||||
EffortDuration getEffortDuration(OrderElement orderElement);
|
EffortDuration getEffortDuration(OrderElement orderElement);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the {@link EffortDuration} for all the {@link OrderElement
|
* Returns the {@link EffortDuration} for all the {@link OrderElement
|
||||||
* OrderElements} in the current monthly timesheet in the specified
|
* OrderElements} in the current personal timesheet in the specified
|
||||||
* <code>date</code>.
|
* <code>date</code>.
|
||||||
*/
|
*/
|
||||||
EffortDuration getEffortDuration(LocalDate date);
|
EffortDuration getEffortDuration(LocalDate date);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the total {@link EffortDuration} for the currently monthly
|
* Returns the total {@link EffortDuration} for the currently personal
|
||||||
* timesheet.
|
* timesheet.
|
||||||
*/
|
*/
|
||||||
EffortDuration getTotalEffortDuration();
|
EffortDuration getTotalEffortDuration();
|
||||||
|
|
@ -131,7 +129,7 @@ public interface IMonthlyTimesheetModel {
|
||||||
EffortDuration getResourceCapacity(LocalDate date);
|
EffortDuration getResourceCapacity(LocalDate date);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the <code>orderElement</code> to the current monthly timehseet.
|
* Adds the <code>orderElement</code> to the current personal timehseet.
|
||||||
*/
|
*/
|
||||||
void addOrderElement(OrderElement orderElement);
|
void addOrderElement(OrderElement orderElement);
|
||||||
|
|
||||||
|
|
@ -142,22 +140,22 @@ public interface IMonthlyTimesheetModel {
|
||||||
Order getOrder(OrderElement orderElement);
|
Order getOrder(OrderElement orderElement);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns <code>true</code> if current monthly timesheet has been modified
|
* Returns <code>true</code> if current personal timesheet has been modified
|
||||||
* by the user.
|
* by the user.
|
||||||
*/
|
*/
|
||||||
boolean isModified();
|
boolean isModified();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if current monthly timesheet is the first month, that means the
|
* Checks if current personal timesheet is the first period, that means the
|
||||||
* first activation period of the resource.
|
* first activation period of the resource.
|
||||||
*/
|
*/
|
||||||
boolean isFirstMonth();
|
boolean isFirstPeriod();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if current monthly timesheet is the last month, that means the
|
* Checks if current personal timesheet is the last period, that means the
|
||||||
* next month of current date.
|
* next month of current date.
|
||||||
*/
|
*/
|
||||||
boolean isLastMonth();
|
boolean isLastPeriod();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the value for the specified <code>orderElement</code> in
|
* Returns true if the value for the specified <code>orderElement</code> in
|
||||||
|
|
@ -167,7 +165,7 @@ public interface IMonthlyTimesheetModel {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns <code>true</code> or <code>false</code> depending on if it's
|
* Returns <code>true</code> or <code>false</code> depending on if it's
|
||||||
* editing a monthly timesheet of the current user or not.<br />
|
* editing a personal timesheet of the current user or not.<br />
|
||||||
*
|
*
|
||||||
* That means if you entered via:
|
* That means if you entered via:
|
||||||
* <ul>
|
* <ul>
|
||||||
|
|
@ -179,29 +177,29 @@ public interface IMonthlyTimesheetModel {
|
||||||
boolean isCurrentUser();
|
boolean isCurrentUser();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns <code>true</code> if the resource of the current monthly
|
* Returns <code>true</code> if the resource of the current personal
|
||||||
* timesheet has any effort reported in other {@link WorkReport WorkReports}
|
* timesheet has any effort reported in other {@link WorkReport WorkReports}
|
||||||
* in the month of the timesheet.
|
* in the period of the timesheet.
|
||||||
*/
|
*/
|
||||||
boolean hasOtherReports();
|
boolean hasOtherReports();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the {@link EffortDuration} of the specified
|
* Returns the {@link EffortDuration} of the specified
|
||||||
* <code>orderElement</code> from other {@link WorkReport WorkReports} for
|
* <code>orderElement</code> from other {@link WorkReport WorkReports} for
|
||||||
* the current resource in the month of the timesheet.<br />
|
* the current resource in the period of the timesheet.<br />
|
||||||
*/
|
*/
|
||||||
EffortDuration getOtherEffortDuration(OrderElement orderElement);
|
EffortDuration getOtherEffortDuration(OrderElement orderElement);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the {@link EffortDuration} in the specified <code>date</code>
|
* Returns the {@link EffortDuration} in the specified <code>date</code>
|
||||||
* from other {@link WorkReport WorkReports} for the current resource in the
|
* from other {@link WorkReport WorkReports} for the current resource in the
|
||||||
* month of the timesheet.
|
* period of the timesheet.
|
||||||
*/
|
*/
|
||||||
EffortDuration getOtherEffortDuration(LocalDate date);
|
EffortDuration getOtherEffortDuration(LocalDate date);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the total {@link EffortDuration} from other {@link WorkReport
|
* Returns the total {@link EffortDuration} from other {@link WorkReport
|
||||||
* WorkReports} for the current resource in the month of the timesheet.
|
* WorkReports} for the current resource in the period of the timesheet.
|
||||||
*/
|
*/
|
||||||
EffortDuration getTotalOtherEffortDuration();
|
EffortDuration getTotalOtherEffortDuration();
|
||||||
|
|
||||||
|
|
@ -28,25 +28,25 @@ import org.libreplan.business.users.entities.User;
|
||||||
import org.libreplan.business.workreports.entities.WorkReport;
|
import org.libreplan.business.workreports.entities.WorkReport;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for "Monthly timesheets" area model
|
* Interface for "Personal timesheets" area model
|
||||||
*
|
*
|
||||||
* @author Manuel Rego Casasnovas <mrego@igalia.com>
|
* @author Manuel Rego Casasnovas <mrego@igalia.com>
|
||||||
*/
|
*/
|
||||||
public interface IMonthlyTimesheetsAreaModel {
|
public interface IPersonalTimesheetsAreaModel {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the list of {@link MonthlyTimesheetDTO MonthlyTimesheets} for the
|
* Returns the list of {@link PersonalTimesheetDTO PersonalTimesheetDTOs}
|
||||||
* resource bound to current {@link User}.<br />
|
* for the resource bound to current {@link User}.<br />
|
||||||
*
|
*
|
||||||
* There's no need that a {@link WorkReport} is saved in order to a
|
* There's no need that a {@link WorkReport} is saved in order to a
|
||||||
* {@link MonthlyTimesheetDTO} exists for a month.<br />
|
* {@link PersonalTimesheetDTO} exists for a period.<br />
|
||||||
*
|
*
|
||||||
* The list of {@link MonthlyTimesheetDTO MonthlyTimesheets} will be since the
|
* The list of {@link PersonalTimesheetDTO PersonalTimesheetDTOs} will be
|
||||||
* date the resource is activated in the system (checking
|
* since the date the resource is activated in the system (checking
|
||||||
* {@link CalendarAvailability} for the resource) to next month of current
|
* {@link CalendarAvailability} for the resource) to next month of current
|
||||||
* date.
|
* date.
|
||||||
*/
|
*/
|
||||||
List<MonthlyTimesheetDTO> getMonthlyTimesheets();
|
List<PersonalTimesheetDTO> getPersonalTimesheets();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of different {@link OrderElement OrderElements} with
|
* Returns the number of different {@link OrderElement OrderElements} with
|
||||||
|
|
@ -54,7 +54,7 @@ public class MyTasksAreaController extends GenericForwardComposer {
|
||||||
private IMyTasksAreaModel myTasksAreaModel;
|
private IMyTasksAreaModel myTasksAreaModel;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IMonthlyTimesheetController monthlyTimesheetController;
|
private IPersonalTimesheetController personalTimesheetController;
|
||||||
|
|
||||||
private RowRenderer tasksRenderer = new RowRenderer() {
|
private RowRenderer tasksRenderer = new RowRenderer() {
|
||||||
|
|
||||||
|
|
@ -112,11 +112,11 @@ public class MyTasksAreaController extends GenericForwardComposer {
|
||||||
EventListener trackTimeButtonListener = new EventListener() {
|
EventListener trackTimeButtonListener = new EventListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(Event event) throws Exception {
|
public void onEvent(Event event) throws Exception {
|
||||||
monthlyTimesheetController
|
personalTimesheetController
|
||||||
.goToCreateOrEditForm(getMonthlyTimesheetDateForTask(task));
|
.goToCreateOrEditForm(getPersonalTimesheetDateForTask(task));
|
||||||
}
|
}
|
||||||
|
|
||||||
private LocalDate getMonthlyTimesheetDateForTask(Task task) {
|
private LocalDate getPersonalTimesheetDateForTask(Task task) {
|
||||||
LocalDate start = task.getStartAsLocalDate();
|
LocalDate start = task.getStartAsLocalDate();
|
||||||
LocalDate end = task.getEndAsLocalDate();
|
LocalDate end = task.getEndAsLocalDate();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -67,20 +67,20 @@ import org.zkoss.zul.Textbox;
|
||||||
import org.zkoss.zul.api.Grid;
|
import org.zkoss.zul.api.Grid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controller for creation/edition of a monthly timesheet
|
* Controller for creation/edition of a personal timesheet
|
||||||
*
|
*
|
||||||
* @author Manuel Rego Casasnovas <mrego@igalia.com>
|
* @author Manuel Rego Casasnovas <mrego@igalia.com>
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class MonthlyTimesheetController extends GenericForwardComposer
|
public class PersonalTimesheetController extends GenericForwardComposer
|
||||||
implements IMonthlyTimesheetController {
|
implements IPersonalTimesheetController {
|
||||||
|
|
||||||
private final static String EFFORT_DURATION_TEXTBOX_WIDTH = "30px";
|
private final static String EFFORT_DURATION_TEXTBOX_WIDTH = "30px";
|
||||||
private final static String TOTAL_DURATION_TEXTBOX_WIDTH = "50px";
|
private final static String TOTAL_DURATION_TEXTBOX_WIDTH = "50px";
|
||||||
|
|
||||||
private final static String WORK_REPORTS_URL = "/workreports/workReport.zul";
|
private final static String WORK_REPORTS_URL = "/workreports/workReport.zul";
|
||||||
|
|
||||||
private IMonthlyTimesheetModel monthlyTimesheetModel;
|
private IPersonalTimesheetModel personalTimesheetModel;
|
||||||
|
|
||||||
private IURLHandlerRegistry URLHandlerRegistry;
|
private IURLHandlerRegistry URLHandlerRegistry;
|
||||||
|
|
||||||
|
|
@ -90,15 +90,15 @@ public class MonthlyTimesheetController extends GenericForwardComposer
|
||||||
|
|
||||||
private BandboxSearch orderElementBandboxSearch;
|
private BandboxSearch orderElementBandboxSearch;
|
||||||
|
|
||||||
private Button previousMonth;
|
private Button previousPeriod;
|
||||||
|
|
||||||
private Button nextMonth;
|
private Button nextPeriod;
|
||||||
|
|
||||||
private Component messagesContainer;
|
private Component messagesContainer;
|
||||||
|
|
||||||
private IMessagesForUser messagesForUser;
|
private IMessagesForUser messagesForUser;
|
||||||
|
|
||||||
private Label summaryTotalMonthlyTimesheet;
|
private Label summaryTotalPersonalTimesheet;
|
||||||
|
|
||||||
private Label summaryTotalOther;
|
private Label summaryTotalOther;
|
||||||
|
|
||||||
|
|
@ -111,7 +111,7 @@ public class MonthlyTimesheetController extends GenericForwardComposer
|
||||||
private Label summaryTotalExtra;
|
private Label summaryTotalExtra;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IMonthlyTimesheetController monthlyTimesheetController;
|
private IPersonalTimesheetController personalTimesheetController;
|
||||||
|
|
||||||
private RowRenderer rowRenderer = new RowRenderer() {
|
private RowRenderer rowRenderer = new RowRenderer() {
|
||||||
|
|
||||||
|
|
@ -120,14 +120,14 @@ public class MonthlyTimesheetController extends GenericForwardComposer
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(Row row, Object data) throws Exception {
|
public void render(Row row, Object data) throws Exception {
|
||||||
MonthlyTimesheetRow monthlyTimesheetRow = (MonthlyTimesheetRow) data;
|
PersonalTimesheetRow personalTimesheetRow = (PersonalTimesheetRow) data;
|
||||||
|
|
||||||
initMonthlyTimesheetDates();
|
initPersonalTimesheetDates();
|
||||||
|
|
||||||
switch (monthlyTimesheetRow.getType()) {
|
switch (personalTimesheetRow.getType()) {
|
||||||
case ORDER_ELEMENT:
|
case ORDER_ELEMENT:
|
||||||
renderOrderElementRow(row,
|
renderOrderElementRow(row,
|
||||||
monthlyTimesheetRow.getOrderElemement());
|
personalTimesheetRow.getOrderElemement());
|
||||||
break;
|
break;
|
||||||
case OTHER:
|
case OTHER:
|
||||||
renderOtherRow(row);
|
renderOtherRow(row);
|
||||||
|
|
@ -146,24 +146,24 @@ public class MonthlyTimesheetController extends GenericForwardComposer
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
"Unknown MonthlyTimesheetRow type: "
|
"Unknown PersonalTimesheetRow type: "
|
||||||
+ monthlyTimesheetRow.getType());
|
+ personalTimesheetRow.getType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initMonthlyTimesheetDates() {
|
private void initPersonalTimesheetDates() {
|
||||||
first = monthlyTimesheetModel.getFirstDay();
|
first = personalTimesheetModel.getFirstDay();
|
||||||
last = monthlyTimesheetModel.getLastDate();
|
last = personalTimesheetModel.getLastDate();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderOrderElementRow(Row row, OrderElement orderElement) {
|
private void renderOrderElementRow(Row row, OrderElement orderElement) {
|
||||||
Util.appendLabel(row, monthlyTimesheetModel.getOrder(orderElement)
|
Util.appendLabel(row, personalTimesheetModel.getOrder(orderElement)
|
||||||
.getName());
|
.getName());
|
||||||
Util.appendLabel(row, orderElement.getName());
|
Util.appendLabel(row, orderElement.getName());
|
||||||
|
|
||||||
appendInputsForDays(row, orderElement);
|
appendInputsForDays(row, orderElement);
|
||||||
|
|
||||||
if (monthlyTimesheetModel.hasOtherReports()) {
|
if (personalTimesheetModel.hasOtherReports()) {
|
||||||
appendOtherColumn(row, orderElement);
|
appendOtherColumn(row, orderElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -182,7 +182,7 @@ public class MonthlyTimesheetController extends GenericForwardComposer
|
||||||
Util.bind(textbox, new Util.Getter<String>() {
|
Util.bind(textbox, new Util.Getter<String>() {
|
||||||
@Override
|
@Override
|
||||||
public String get() {
|
public String get() {
|
||||||
EffortDuration effortDuration = monthlyTimesheetModel
|
EffortDuration effortDuration = personalTimesheetModel
|
||||||
.getEffortDuration(orderElement, textboxDate);
|
.getEffortDuration(orderElement, textboxDate);
|
||||||
return effortDurationToString(effortDuration);
|
return effortDurationToString(effortDuration);
|
||||||
}
|
}
|
||||||
|
|
@ -194,7 +194,7 @@ public class MonthlyTimesheetController extends GenericForwardComposer
|
||||||
throw new WrongValueException(textbox,
|
throw new WrongValueException(textbox,
|
||||||
_("Invalid Effort Duration"));
|
_("Invalid Effort Duration"));
|
||||||
}
|
}
|
||||||
monthlyTimesheetModel.setEffortDuration(orderElement,
|
personalTimesheetModel.setEffortDuration(orderElement,
|
||||||
textboxDate, effortDuration);
|
textboxDate, effortDuration);
|
||||||
markAsModified(textbox);
|
markAsModified(textbox);
|
||||||
updateTotals(orderElement, textboxDate);
|
updateTotals(orderElement, textboxDate);
|
||||||
|
|
@ -212,13 +212,13 @@ public class MonthlyTimesheetController extends GenericForwardComposer
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (monthlyTimesheetModel
|
if (personalTimesheetModel
|
||||||
.wasModified(orderElement, textboxDate)) {
|
.wasModified(orderElement, textboxDate)) {
|
||||||
markAsModified(textbox);
|
markAsModified(textbox);
|
||||||
}
|
}
|
||||||
|
|
||||||
Cell cell = getCenteredCell(textbox);
|
Cell cell = getCenteredCell(textbox);
|
||||||
if (monthlyTimesheetModel.getResourceCapacity(day).isZero()) {
|
if (personalTimesheetModel.getResourceCapacity(day).isZero()) {
|
||||||
setBackgroundNonCapacityCell(cell);
|
setBackgroundNonCapacityCell(cell);
|
||||||
}
|
}
|
||||||
row.appendChild(cell);
|
row.appendChild(cell);
|
||||||
|
|
@ -232,7 +232,7 @@ public class MonthlyTimesheetController extends GenericForwardComposer
|
||||||
|
|
||||||
private void appendOtherColumn(Row row, final OrderElement orderElement) {
|
private void appendOtherColumn(Row row, final OrderElement orderElement) {
|
||||||
Textbox other = getDisabledTextbox(getOtherRowTextboxId(orderElement));
|
Textbox other = getDisabledTextbox(getOtherRowTextboxId(orderElement));
|
||||||
other.setValue(effortDurationToString(monthlyTimesheetModel.getOtherEffortDuration(orderElement)));
|
other.setValue(effortDurationToString(personalTimesheetModel.getOtherEffortDuration(orderElement)));
|
||||||
row.appendChild(getCenteredCell(other));
|
row.appendChild(getCenteredCell(other));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -242,9 +242,9 @@ public class MonthlyTimesheetController extends GenericForwardComposer
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateTotalColumn(OrderElement orderElement) {
|
private void updateTotalColumn(OrderElement orderElement) {
|
||||||
EffortDuration effort = monthlyTimesheetModel
|
EffortDuration effort = personalTimesheetModel
|
||||||
.getEffortDuration(orderElement);
|
.getEffortDuration(orderElement);
|
||||||
effort = effort.plus(monthlyTimesheetModel
|
effort = effort.plus(personalTimesheetModel
|
||||||
.getOtherEffortDuration(orderElement));
|
.getOtherEffortDuration(orderElement));
|
||||||
|
|
||||||
Textbox textbox = (Textbox) timesheet
|
Textbox textbox = (Textbox) timesheet
|
||||||
|
|
@ -272,7 +272,7 @@ public class MonthlyTimesheetController extends GenericForwardComposer
|
||||||
for (LocalDate day = first; day.compareTo(last) <= 0; day = day
|
for (LocalDate day = first; day.compareTo(last) <= 0; day = day
|
||||||
.plusDays(1)) {
|
.plusDays(1)) {
|
||||||
Cell cell = getCenteredCell(getDisabledTextbox(getTotalColumnTextboxId(day)));
|
Cell cell = getCenteredCell(getDisabledTextbox(getTotalColumnTextboxId(day)));
|
||||||
if (monthlyTimesheetModel.getResourceCapacity(day).isZero()) {
|
if (personalTimesheetModel.getResourceCapacity(day).isZero()) {
|
||||||
setBackgroundNonCapacityCell(cell);
|
setBackgroundNonCapacityCell(cell);
|
||||||
}
|
}
|
||||||
row.appendChild(cell);
|
row.appendChild(cell);
|
||||||
|
|
@ -282,9 +282,9 @@ public class MonthlyTimesheetController extends GenericForwardComposer
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateTotalRow(LocalDate date) {
|
private void updateTotalRow(LocalDate date) {
|
||||||
EffortDuration effort = monthlyTimesheetModel
|
EffortDuration effort = personalTimesheetModel
|
||||||
.getEffortDuration(date);
|
.getEffortDuration(date);
|
||||||
effort = effort.plus(monthlyTimesheetModel
|
effort = effort.plus(personalTimesheetModel
|
||||||
.getOtherEffortDuration(date));
|
.getOtherEffortDuration(date));
|
||||||
|
|
||||||
Textbox textbox = (Textbox) timesheet
|
Textbox textbox = (Textbox) timesheet
|
||||||
|
|
@ -294,7 +294,7 @@ public class MonthlyTimesheetController extends GenericForwardComposer
|
||||||
|
|
||||||
private void appendTotalColumn(Row row) {
|
private void appendTotalColumn(Row row) {
|
||||||
Cell totalCell = getCenteredCell(getDisabledTextbox(getTotalTextboxId()));
|
Cell totalCell = getCenteredCell(getDisabledTextbox(getTotalTextboxId()));
|
||||||
if (monthlyTimesheetModel.hasOtherReports()) {
|
if (personalTimesheetModel.hasOtherReports()) {
|
||||||
totalCell.setColspan(2);
|
totalCell.setColspan(2);
|
||||||
}
|
}
|
||||||
row.appendChild(totalCell);
|
row.appendChild(totalCell);
|
||||||
|
|
@ -302,9 +302,9 @@ public class MonthlyTimesheetController extends GenericForwardComposer
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateTotalColumn() {
|
private void updateTotalColumn() {
|
||||||
EffortDuration effort = monthlyTimesheetModel
|
EffortDuration effort = personalTimesheetModel
|
||||||
.getTotalEffortDuration();
|
.getTotalEffortDuration();
|
||||||
effort = effort.plus(monthlyTimesheetModel
|
effort = effort.plus(personalTimesheetModel
|
||||||
.getTotalOtherEffortDuration());
|
.getTotalOtherEffortDuration());
|
||||||
|
|
||||||
Textbox textbox = (Textbox) timesheet
|
Textbox textbox = (Textbox) timesheet
|
||||||
|
|
@ -322,12 +322,12 @@ public class MonthlyTimesheetController extends GenericForwardComposer
|
||||||
|
|
||||||
for (LocalDate day = first; day.compareTo(last) <= 0; day = day
|
for (LocalDate day = first; day.compareTo(last) <= 0; day = day
|
||||||
.plusDays(1)) {
|
.plusDays(1)) {
|
||||||
EffortDuration other = monthlyTimesheetModel
|
EffortDuration other = personalTimesheetModel
|
||||||
.getOtherEffortDuration(day);
|
.getOtherEffortDuration(day);
|
||||||
|
|
||||||
Cell cell = getCenteredCell(getDisabledTextbox(
|
Cell cell = getCenteredCell(getDisabledTextbox(
|
||||||
getOtherColumnTextboxId(day), other));
|
getOtherColumnTextboxId(day), other));
|
||||||
if (monthlyTimesheetModel.getResourceCapacity(day).isZero()) {
|
if (personalTimesheetModel.getResourceCapacity(day).isZero()) {
|
||||||
setBackgroundNonCapacityCell(cell);
|
setBackgroundNonCapacityCell(cell);
|
||||||
}
|
}
|
||||||
row.appendChild(cell);
|
row.appendChild(cell);
|
||||||
|
|
@ -351,12 +351,12 @@ public class MonthlyTimesheetController extends GenericForwardComposer
|
||||||
|
|
||||||
for (LocalDate day = first; day.compareTo(last) <= 0; day = day
|
for (LocalDate day = first; day.compareTo(last) <= 0; day = day
|
||||||
.plusDays(1)) {
|
.plusDays(1)) {
|
||||||
EffortDuration capacity = monthlyTimesheetModel
|
EffortDuration capacity = personalTimesheetModel
|
||||||
.getResourceCapacity(day);
|
.getResourceCapacity(day);
|
||||||
|
|
||||||
Cell cell = getCenteredCell(getDisabledTextbox(
|
Cell cell = getCenteredCell(getDisabledTextbox(
|
||||||
getCapcityColumnTextboxId(day), capacity));
|
getCapcityColumnTextboxId(day), capacity));
|
||||||
if (monthlyTimesheetModel.getResourceCapacity(day).isZero()) {
|
if (personalTimesheetModel.getResourceCapacity(day).isZero()) {
|
||||||
setBackgroundNonCapacityCell(cell);
|
setBackgroundNonCapacityCell(cell);
|
||||||
}
|
}
|
||||||
row.appendChild(cell);
|
row.appendChild(cell);
|
||||||
|
|
@ -366,7 +366,7 @@ public class MonthlyTimesheetController extends GenericForwardComposer
|
||||||
|
|
||||||
Cell totalCapacityCell = getCenteredCell(getDisabledTextbox(
|
Cell totalCapacityCell = getCenteredCell(getDisabledTextbox(
|
||||||
getTotalCapacityTextboxId(), totalCapacity));
|
getTotalCapacityTextboxId(), totalCapacity));
|
||||||
if (monthlyTimesheetModel.hasOtherReports()) {
|
if (personalTimesheetModel.hasOtherReports()) {
|
||||||
totalCapacityCell.setColspan(2);
|
totalCapacityCell.setColspan(2);
|
||||||
}
|
}
|
||||||
row.appendChild(totalCapacityCell);
|
row.appendChild(totalCapacityCell);
|
||||||
|
|
@ -382,7 +382,7 @@ public class MonthlyTimesheetController extends GenericForwardComposer
|
||||||
for (LocalDate day = first; day.compareTo(last) <= 0; day = day
|
for (LocalDate day = first; day.compareTo(last) <= 0; day = day
|
||||||
.plusDays(1)) {
|
.plusDays(1)) {
|
||||||
Cell cell = getCenteredCell(getDisabledTextbox(getExtraColumnTextboxId(day)));
|
Cell cell = getCenteredCell(getDisabledTextbox(getExtraColumnTextboxId(day)));
|
||||||
if (monthlyTimesheetModel.getResourceCapacity(day).isZero()) {
|
if (personalTimesheetModel.getResourceCapacity(day).isZero()) {
|
||||||
setBackgroundNonCapacityCell(cell);
|
setBackgroundNonCapacityCell(cell);
|
||||||
}
|
}
|
||||||
row.appendChild(cell);
|
row.appendChild(cell);
|
||||||
|
|
@ -414,7 +414,7 @@ public class MonthlyTimesheetController extends GenericForwardComposer
|
||||||
|
|
||||||
private void appendTotalExtra(Row row) {
|
private void appendTotalExtra(Row row) {
|
||||||
Cell totalExtraCell = getCenteredCell(getDisabledTextbox(getTotalExtraTextboxId()));
|
Cell totalExtraCell = getCenteredCell(getDisabledTextbox(getTotalExtraTextboxId()));
|
||||||
if (monthlyTimesheetModel.hasOtherReports()) {
|
if (personalTimesheetModel.hasOtherReports()) {
|
||||||
totalExtraCell.setColspan(2);
|
totalExtraCell.setColspan(2);
|
||||||
}
|
}
|
||||||
row.appendChild(totalExtraCell);
|
row.appendChild(totalExtraCell);
|
||||||
|
|
@ -478,7 +478,7 @@ public class MonthlyTimesheetController extends GenericForwardComposer
|
||||||
|
|
||||||
checkUserComesFromEntryPointsOrSendForbiddenCode();
|
checkUserComesFromEntryPointsOrSendForbiddenCode();
|
||||||
|
|
||||||
URLHandlerRegistry.getRedirectorFor(IMonthlyTimesheetController.class)
|
URLHandlerRegistry.getRedirectorFor(IPersonalTimesheetController.class)
|
||||||
.register(this, page);
|
.register(this, page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -517,7 +517,7 @@ public class MonthlyTimesheetController extends GenericForwardComposer
|
||||||
Util.sendForbiddenStatusCodeInHttpServletResponse();
|
Util.sendForbiddenStatusCodeInHttpServletResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
monthlyTimesheetModel.initCreateOrEdit(date);
|
personalTimesheetModel.initCreateOrEdit(date);
|
||||||
initTimesheet(date);
|
initTimesheet(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -528,7 +528,7 @@ public class MonthlyTimesheetController extends GenericForwardComposer
|
||||||
Util.sendForbiddenStatusCodeInHttpServletResponse();
|
Util.sendForbiddenStatusCodeInHttpServletResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
monthlyTimesheetModel.initCreateOrEdit(date, resource);
|
personalTimesheetModel.initCreateOrEdit(date, resource);
|
||||||
initTimesheet(date);
|
initTimesheet(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -549,7 +549,7 @@ public class MonthlyTimesheetController extends GenericForwardComposer
|
||||||
private void createColumns(LocalDate date) {
|
private void createColumns(LocalDate date) {
|
||||||
createProjectAndTaskColumns();
|
createProjectAndTaskColumns();
|
||||||
createColumnsForDays(date);
|
createColumnsForDays(date);
|
||||||
if (monthlyTimesheetModel.hasOtherReports()) {
|
if (personalTimesheetModel.hasOtherReports()) {
|
||||||
createOtherColumn();
|
createOtherColumn();
|
||||||
}
|
}
|
||||||
createTotalColumn();
|
createTotalColumn();
|
||||||
|
|
@ -568,9 +568,9 @@ public class MonthlyTimesheetController extends GenericForwardComposer
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createColumnsForDays(LocalDate date) {
|
private void createColumnsForDays(LocalDate date) {
|
||||||
LocalDate start = monthlyTimesheetModel
|
LocalDate start = personalTimesheetModel
|
||||||
.getPersonalTimesheetsPeriodicity().getStart(date);
|
.getPersonalTimesheetsPeriodicity().getStart(date);
|
||||||
LocalDate end = monthlyTimesheetModel
|
LocalDate end = personalTimesheetModel
|
||||||
.getPersonalTimesheetsPeriodicity().getEnd(date);
|
.getPersonalTimesheetsPeriodicity().getEnd(date);
|
||||||
|
|
||||||
for (LocalDate day = start; day.compareTo(end) <= 0; day = day
|
for (LocalDate day = start; day.compareTo(end) <= 0; day = day
|
||||||
|
|
@ -599,23 +599,23 @@ public class MonthlyTimesheetController extends GenericForwardComposer
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTimesheetString() {
|
public String getTimesheetString() {
|
||||||
return monthlyTimesheetModel.getTimesheetString();
|
return personalTimesheetModel.getTimesheetString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getResource() {
|
public String getResource() {
|
||||||
return monthlyTimesheetModel.getWorker().getShortDescription();
|
return personalTimesheetModel.getWorker().getShortDescription();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MonthlyTimesheetRow> getRows() {
|
public List<PersonalTimesheetRow> getRows() {
|
||||||
List<MonthlyTimesheetRow> result = MonthlyTimesheetRow
|
List<PersonalTimesheetRow> result = PersonalTimesheetRow
|
||||||
.wrap(monthlyTimesheetModel
|
.wrap(personalTimesheetModel
|
||||||
.getOrderElements());
|
.getOrderElements());
|
||||||
if (monthlyTimesheetModel.hasOtherReports()) {
|
if (personalTimesheetModel.hasOtherReports()) {
|
||||||
result.add(MonthlyTimesheetRow.createOtherRow());
|
result.add(PersonalTimesheetRow.createOtherRow());
|
||||||
}
|
}
|
||||||
result.add(MonthlyTimesheetRow.createTotalRow());
|
result.add(PersonalTimesheetRow.createTotalRow());
|
||||||
result.add(MonthlyTimesheetRow.createCapacityRow());
|
result.add(PersonalTimesheetRow.createCapacityRow());
|
||||||
result.add(MonthlyTimesheetRow.createExtraRow());
|
result.add(PersonalTimesheetRow.createExtraRow());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -624,31 +624,31 @@ public class MonthlyTimesheetController extends GenericForwardComposer
|
||||||
}
|
}
|
||||||
|
|
||||||
public void save() {
|
public void save() {
|
||||||
monthlyTimesheetModel.save();
|
personalTimesheetModel.save();
|
||||||
String url = CustomTargetUrlResolver.USER_DASHBOARD_URL
|
String url = CustomTargetUrlResolver.USER_DASHBOARD_URL
|
||||||
+ "?timesheet_saved=" + monthlyTimesheetModel.getDate();
|
+ "?timesheet_saved=" + personalTimesheetModel.getDate();
|
||||||
if (!monthlyTimesheetModel.isCurrentUser()) {
|
if (!personalTimesheetModel.isCurrentUser()) {
|
||||||
url = WORK_REPORTS_URL + "?timesheet_saved=true";
|
url = WORK_REPORTS_URL + "?timesheet_saved=true";
|
||||||
}
|
}
|
||||||
Executions.getCurrent().sendRedirect(url);
|
Executions.getCurrent().sendRedirect(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveAndContinue() {
|
public void saveAndContinue() {
|
||||||
monthlyTimesheetModel.save();
|
personalTimesheetModel.save();
|
||||||
if (monthlyTimesheetModel.isCurrentUser()) {
|
if (personalTimesheetModel.isCurrentUser()) {
|
||||||
goToCreateOrEditForm(monthlyTimesheetModel.getDate());
|
goToCreateOrEditForm(personalTimesheetModel.getDate());
|
||||||
} else {
|
} else {
|
||||||
goToCreateOrEditFormForResource(monthlyTimesheetModel.getDate(),
|
goToCreateOrEditFormForResource(personalTimesheetModel.getDate(),
|
||||||
monthlyTimesheetModel.getWorker());
|
personalTimesheetModel.getWorker());
|
||||||
}
|
}
|
||||||
messagesForUser.showMessage(Level.INFO, _("Personal timesheet saved"));
|
messagesForUser.showMessage(Level.INFO, _("Personal timesheet saved"));
|
||||||
Util.reloadBindings(timesheet);
|
Util.reloadBindings(timesheet);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cancel() {
|
public void cancel() {
|
||||||
monthlyTimesheetModel.cancel();
|
personalTimesheetModel.cancel();
|
||||||
String url = CustomTargetUrlResolver.USER_DASHBOARD_URL;
|
String url = CustomTargetUrlResolver.USER_DASHBOARD_URL;
|
||||||
if (!monthlyTimesheetModel.isCurrentUser()) {
|
if (!personalTimesheetModel.isCurrentUser()) {
|
||||||
url = WORK_REPORTS_URL;
|
url = WORK_REPORTS_URL;
|
||||||
}
|
}
|
||||||
Executions.getCurrent().sendRedirect(url);
|
Executions.getCurrent().sendRedirect(url);
|
||||||
|
|
@ -658,56 +658,56 @@ public class MonthlyTimesheetController extends GenericForwardComposer
|
||||||
OrderElement orderElement = (OrderElement) orderElementBandboxSearch
|
OrderElement orderElement = (OrderElement) orderElementBandboxSearch
|
||||||
.getSelectedElement();
|
.getSelectedElement();
|
||||||
if (orderElement != null) {
|
if (orderElement != null) {
|
||||||
monthlyTimesheetModel.addOrderElement(orderElement);
|
personalTimesheetModel.addOrderElement(orderElement);
|
||||||
orderElementBandboxSearch.setSelectedElement(null);
|
orderElementBandboxSearch.setSelectedElement(null);
|
||||||
Util.reloadBindings(timesheet);
|
Util.reloadBindings(timesheet);
|
||||||
adjustFrozenWidth();
|
adjustFrozenWidth();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFirstMonth() {
|
public boolean isFirstPeriod() {
|
||||||
return monthlyTimesheetModel.isFirstMonth();
|
return personalTimesheetModel.isFirstPeriod();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLastMonth() {
|
public boolean isLastPeriod() {
|
||||||
return monthlyTimesheetModel.isLastMonth();
|
return personalTimesheetModel.isLastPeriod();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void previousMonth() {
|
public void previousPeriod() {
|
||||||
if (monthlyTimesheetModel.isModified()) {
|
if (personalTimesheetModel.isModified()) {
|
||||||
throw new WrongValueException(
|
throw new WrongValueException(
|
||||||
previousMonth,
|
previousPeriod,
|
||||||
_("There are unsaved changes in the current personal timesheet, please save before moving"));
|
_("There are unsaved changes in the current personal timesheet, please save before moving"));
|
||||||
}
|
}
|
||||||
sendToMonthlyTimesheet(monthlyTimesheetModel.getPrevious());
|
sendToPersonalTimesheet(personalTimesheetModel.getPrevious());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void nextMonth() {
|
public void nextPeriod() {
|
||||||
if (monthlyTimesheetModel.isModified()) {
|
if (personalTimesheetModel.isModified()) {
|
||||||
throw new WrongValueException(
|
throw new WrongValueException(
|
||||||
nextMonth,
|
nextPeriod,
|
||||||
_("There are unsaved changes in the current personal timesheet, please save before moving"));
|
_("There are unsaved changes in the current personal timesheet, please save before moving"));
|
||||||
}
|
}
|
||||||
|
|
||||||
sendToMonthlyTimesheet(monthlyTimesheetModel.getNext());
|
sendToPersonalTimesheet(personalTimesheetModel.getNext());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendToMonthlyTimesheet(final LocalDate date) {
|
private void sendToPersonalTimesheet(final LocalDate date) {
|
||||||
String capturePath = EntryPointsHandler.capturePath(new ICapture() {
|
String capturePath = EntryPointsHandler.capturePath(new ICapture() {
|
||||||
@Override
|
@Override
|
||||||
public void capture() {
|
public void capture() {
|
||||||
monthlyTimesheetController.goToCreateOrEditForm(date);
|
personalTimesheetController.goToCreateOrEditForm(date);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Executions.getCurrent().sendRedirect(capturePath);
|
Executions.getCurrent().sendRedirect(capturePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCurrentUser() {
|
public boolean isCurrentUser() {
|
||||||
return monthlyTimesheetModel.isCurrentUser();
|
return personalTimesheetModel.isCurrentUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isNotCurrentUser() {
|
public boolean isNotCurrentUser() {
|
||||||
return !monthlyTimesheetModel.isCurrentUser();
|
return !personalTimesheetModel.isCurrentUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getTotalRowTextboxId(final OrderElement orderElement) {
|
private static String getTotalRowTextboxId(final OrderElement orderElement) {
|
||||||
|
|
@ -783,7 +783,7 @@ public class MonthlyTimesheetController extends GenericForwardComposer
|
||||||
public void updateSummary() {
|
public void updateSummary() {
|
||||||
EffortDuration total = getEffortDurationFromTextbox(getTotalTextboxId());
|
EffortDuration total = getEffortDurationFromTextbox(getTotalTextboxId());
|
||||||
EffortDuration other = EffortDuration.zero();
|
EffortDuration other = EffortDuration.zero();
|
||||||
if (monthlyTimesheetModel.hasOtherReports()) {
|
if (personalTimesheetModel.hasOtherReports()) {
|
||||||
other = getEffortDurationFromTextbox(getTotalOtherTextboxId());
|
other = getEffortDurationFromTextbox(getTotalOtherTextboxId());
|
||||||
}
|
}
|
||||||
EffortDuration capacity = getEffortDurationFromTextbox(getTotalCapacityTextboxId());
|
EffortDuration capacity = getEffortDurationFromTextbox(getTotalCapacityTextboxId());
|
||||||
|
|
@ -795,8 +795,8 @@ public class MonthlyTimesheetController extends GenericForwardComposer
|
||||||
extra = total.minus(capacity);
|
extra = total.minus(capacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (monthlyTimesheetModel.hasOtherReports()) {
|
if (personalTimesheetModel.hasOtherReports()) {
|
||||||
summaryTotalMonthlyTimesheet
|
summaryTotalPersonalTimesheet
|
||||||
.setValue(timesheet.toFormattedString());
|
.setValue(timesheet.toFormattedString());
|
||||||
summaryTotalOther.setValue(other.toFormattedString());
|
summaryTotalOther.setValue(other.toFormattedString());
|
||||||
}
|
}
|
||||||
|
|
@ -813,64 +813,64 @@ public class MonthlyTimesheetController extends GenericForwardComposer
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasOtherReports() {
|
public boolean hasOtherReports() {
|
||||||
return monthlyTimesheetModel.hasOtherReports();
|
return personalTimesheetModel.hasOtherReports();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple class to represent the the rows in the monthly timesheet grid.<br />
|
* Simple class to represent the the rows in the personal timesheet grid.<br />
|
||||||
*
|
*
|
||||||
* This is used to mark the special rows like capacity and total.
|
* This is used to mark the special rows like capacity and total.
|
||||||
*/
|
*/
|
||||||
class MonthlyTimesheetRow {
|
class PersonalTimesheetRow {
|
||||||
enum MonthlyTimesheetRowType {
|
enum PersonalTimesheetRowType {
|
||||||
ORDER_ELEMENT, OTHER, CAPACITY, TOTAL, EXTRA
|
ORDER_ELEMENT, OTHER, CAPACITY, TOTAL, EXTRA
|
||||||
};
|
};
|
||||||
|
|
||||||
private MonthlyTimesheetRowType type;
|
private PersonalTimesheetRowType type;
|
||||||
private OrderElement orderElemement;
|
private OrderElement orderElemement;
|
||||||
|
|
||||||
public static MonthlyTimesheetRow createOrderElementRow(
|
public static PersonalTimesheetRow createOrderElementRow(
|
||||||
OrderElement orderElemement) {
|
OrderElement orderElemement) {
|
||||||
MonthlyTimesheetRow row = new MonthlyTimesheetRow(
|
PersonalTimesheetRow row = new PersonalTimesheetRow(
|
||||||
MonthlyTimesheetRowType.ORDER_ELEMENT);
|
PersonalTimesheetRowType.ORDER_ELEMENT);
|
||||||
Assert.notNull(orderElemement);
|
Assert.notNull(orderElemement);
|
||||||
row.orderElemement = orderElemement;
|
row.orderElemement = orderElemement;
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MonthlyTimesheetRow createOtherRow() {
|
public static PersonalTimesheetRow createOtherRow() {
|
||||||
return new MonthlyTimesheetRow(MonthlyTimesheetRowType.OTHER);
|
return new PersonalTimesheetRow(PersonalTimesheetRowType.OTHER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MonthlyTimesheetRow createCapacityRow() {
|
public static PersonalTimesheetRow createCapacityRow() {
|
||||||
return new MonthlyTimesheetRow(MonthlyTimesheetRowType.CAPACITY);
|
return new PersonalTimesheetRow(PersonalTimesheetRowType.CAPACITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MonthlyTimesheetRow createTotalRow() {
|
public static PersonalTimesheetRow createTotalRow() {
|
||||||
return new MonthlyTimesheetRow(MonthlyTimesheetRowType.TOTAL);
|
return new PersonalTimesheetRow(PersonalTimesheetRowType.TOTAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MonthlyTimesheetRow createExtraRow() {
|
public static PersonalTimesheetRow createExtraRow() {
|
||||||
return new MonthlyTimesheetRow(MonthlyTimesheetRowType.EXTRA);
|
return new PersonalTimesheetRow(PersonalTimesheetRowType.EXTRA);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<MonthlyTimesheetRow> wrap(
|
public static List<PersonalTimesheetRow> wrap(
|
||||||
List<OrderElement> orderElements) {
|
List<OrderElement> orderElements) {
|
||||||
List<MonthlyTimesheetRow> result = new ArrayList<MonthlyTimesheetRow>();
|
List<PersonalTimesheetRow> result = new ArrayList<PersonalTimesheetRow>();
|
||||||
for (OrderElement each : orderElements) {
|
for (OrderElement each : orderElements) {
|
||||||
result.add(createOrderElementRow(each));
|
result.add(createOrderElementRow(each));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private MonthlyTimesheetRow(MonthlyTimesheetRowType type) {
|
private PersonalTimesheetRow(PersonalTimesheetRowType type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MonthlyTimesheetRowType getType() {
|
public PersonalTimesheetRowType getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -27,14 +27,14 @@ import org.libreplan.business.workingday.EffortDuration;
|
||||||
import org.libreplan.business.workreports.entities.WorkReport;
|
import org.libreplan.business.workreports.entities.WorkReport;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple class to represent the monthly timesheets to be shown in the list.<br />
|
* Simple class to represent the personal timesheets to be shown in the list.<br />
|
||||||
*
|
*
|
||||||
* This is only a utility class for the UI, everything will be saved using
|
* This is only a utility class for the UI, everything will be saved using
|
||||||
* {@link WorkReport} class.
|
* {@link WorkReport} class.
|
||||||
*
|
*
|
||||||
* @author Manuel Rego Casasnovas <mrego@igalia.com>
|
* @author Manuel Rego Casasnovas <mrego@igalia.com>
|
||||||
*/
|
*/
|
||||||
public class MonthlyTimesheetDTO {
|
public class PersonalTimesheetDTO {
|
||||||
|
|
||||||
private LocalDate date;
|
private LocalDate date;
|
||||||
|
|
||||||
|
|
@ -50,18 +50,18 @@ public class MonthlyTimesheetDTO {
|
||||||
* @param date
|
* @param date
|
||||||
* The date of the timesheet.
|
* The date of the timesheet.
|
||||||
* @param workReport
|
* @param workReport
|
||||||
* The work report of the monthly timesheet, it could be
|
* The work report of the personal timesheet, it could be
|
||||||
* <code>null</code> if it doesn't exist yet.
|
* <code>null</code> if it doesn't exist yet.
|
||||||
* @param resourceCapacity
|
* @param resourceCapacity
|
||||||
* The capacity of the resource bound to current user in the
|
* The capacity of the resource bound to current user in the
|
||||||
* month of this timesheet.
|
* period of this timesheet.
|
||||||
* @param totalHours
|
* @param totalHours
|
||||||
* Total hours worked by the resource bound to the current user
|
* Total hours worked by the resource bound to the current user
|
||||||
* in the monthly timesheet
|
* in the personal timesheet
|
||||||
* @param tasksNumber
|
* @param tasksNumber
|
||||||
* Number of tasks in the monthly timesheet
|
* Number of tasks in the personal timesheet
|
||||||
*/
|
*/
|
||||||
MonthlyTimesheetDTO(LocalDate date, WorkReport workReport,
|
PersonalTimesheetDTO(LocalDate date, WorkReport workReport,
|
||||||
EffortDuration resourceCapacity, EffortDuration totalHours,
|
EffortDuration resourceCapacity, EffortDuration totalHours,
|
||||||
int tasksNumber) {
|
int tasksNumber) {
|
||||||
this.date = date;
|
this.date = date;
|
||||||
|
|
@ -68,14 +68,14 @@ import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Model for creation/edition of a monthly timesheet
|
* Model for creation/edition of a personal timesheet
|
||||||
*
|
*
|
||||||
* @author Manuel Rego Casasnovas <mrego@igalia.com>
|
* @author Manuel Rego Casasnovas <mrego@igalia.com>
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
|
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
|
||||||
@OnConcurrentModification(goToPage = "/myaccount/userDashboard.zul")
|
@OnConcurrentModification(goToPage = "/myaccount/userDashboard.zul")
|
||||||
public class MonthlyTimesheetModel implements IMonthlyTimesheetModel {
|
public class PersonalTimesheetModel implements IPersonalTimesheetModel {
|
||||||
|
|
||||||
private User user;
|
private User user;
|
||||||
|
|
||||||
|
|
@ -200,13 +200,13 @@ public class MonthlyTimesheetModel implements IMonthlyTimesheetModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initWorkReport() {
|
private void initWorkReport() {
|
||||||
// Get work report representing this monthly timesheet
|
// Get work report representing this personal timesheet
|
||||||
workReport = workReportDAO.getMonthlyTimesheetWorkReport(
|
workReport = workReportDAO.getPersonalTimesheetWorkReport(
|
||||||
user.getWorker(), date, periodicity);
|
user.getWorker(), date, periodicity);
|
||||||
if (workReport == null) {
|
if (workReport == null) {
|
||||||
// If it doesn't exist yet create a new one
|
// If it doesn't exist yet create a new one
|
||||||
workReport = WorkReport
|
workReport = WorkReport
|
||||||
.create(getMonthlyTimesheetsWorkReportType());
|
.create(getPersonalTimesheetsWorkReportType());
|
||||||
workReport
|
workReport
|
||||||
.setCode(entitySequenceDAO
|
.setCode(entitySequenceDAO
|
||||||
.getNextEntityCodeWithoutTransaction(EntityNameEnum.WORK_REPORT));
|
.getNextEntityCodeWithoutTransaction(EntityNameEnum.WORK_REPORT));
|
||||||
|
|
@ -216,10 +216,10 @@ public class MonthlyTimesheetModel implements IMonthlyTimesheetModel {
|
||||||
forceLoad(workReport.getWorkReportType());
|
forceLoad(workReport.getWorkReportType());
|
||||||
}
|
}
|
||||||
|
|
||||||
private WorkReportType getMonthlyTimesheetsWorkReportType() {
|
private WorkReportType getPersonalTimesheetsWorkReportType() {
|
||||||
try {
|
try {
|
||||||
WorkReportType workReportType = workReportTypeDAO
|
WorkReportType workReportType = workReportTypeDAO
|
||||||
.findUniqueByName(PredefinedWorkReportTypes.MONTHLY_TIMESHEETS
|
.findUniqueByName(PredefinedWorkReportTypes.PERSONAL_TIMESHEETS
|
||||||
.getName());
|
.getName());
|
||||||
return workReportType;
|
return workReportType;
|
||||||
} catch (NonUniqueResultException e) {
|
} catch (NonUniqueResultException e) {
|
||||||
|
|
@ -418,7 +418,7 @@ public class MonthlyTimesheetModel implements IMonthlyTimesheetModel {
|
||||||
|
|
||||||
private TypeOfWorkHours getTypeOfWorkHours() {
|
private TypeOfWorkHours getTypeOfWorkHours() {
|
||||||
return configurationDAO.getConfiguration()
|
return configurationDAO.getConfiguration()
|
||||||
.getMonthlyTimesheetsTypeOfWorkHours();
|
.getPersonalTimesheetsTypeOfWorkHours();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -429,7 +429,7 @@ public class MonthlyTimesheetModel implements IMonthlyTimesheetModel {
|
||||||
// Do nothing.
|
// Do nothing.
|
||||||
// A new work report if it doesn't have work report lines is not
|
// A new work report if it doesn't have work report lines is not
|
||||||
// saved as it will not be possible to find it later with
|
// saved as it will not be possible to find it later with
|
||||||
// WorkReportDAO.getMonthlyTimesheetWorkReport() method.
|
// WorkReportDAO.getPersonalTimesheetWorkReport() method.
|
||||||
} else {
|
} else {
|
||||||
sumChargedEffortDAO
|
sumChargedEffortDAO
|
||||||
.updateRelatedSumChargedEffortWithWorkReportLineSet(workReport
|
.updateRelatedSumChargedEffortWithWorkReportLineSet(workReport
|
||||||
|
|
@ -508,7 +508,7 @@ public class MonthlyTimesheetModel implements IMonthlyTimesheetModel {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
public boolean isFirstMonth() {
|
public boolean isFirstPeriod() {
|
||||||
LocalDate activationDate = getWorker().getCalendar()
|
LocalDate activationDate = getWorker().getCalendar()
|
||||||
.getFistCalendarAvailability().getStartDate();
|
.getFistCalendarAvailability().getStartDate();
|
||||||
return firstDay.equals(periodicity.getStart(activationDate));
|
return firstDay.equals(periodicity.getStart(activationDate));
|
||||||
|
|
@ -516,7 +516,7 @@ public class MonthlyTimesheetModel implements IMonthlyTimesheetModel {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
public boolean isLastMonth() {
|
public boolean isLastPeriod() {
|
||||||
return firstDay.equals(periodicity.getStart(new LocalDate()
|
return firstDay.equals(periodicity.getStart(new LocalDate()
|
||||||
.plusMonths(1)));
|
.plusMonths(1)));
|
||||||
}
|
}
|
||||||
|
|
@ -568,7 +568,7 @@ public class MonthlyTimesheetModel implements IMonthlyTimesheetModel {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTimesheetString() {
|
public String getTimesheetString() {
|
||||||
return MonthlyTimesheetDTO.toString(periodicity, date);
|
return PersonalTimesheetDTO.toString(periodicity, date);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -32,39 +32,39 @@ import org.zkoss.zul.Row;
|
||||||
import org.zkoss.zul.RowRenderer;
|
import org.zkoss.zul.RowRenderer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controller for "Monthly timesheets" area in the user dashboard window
|
* Controller for "Personal timesheets" area in the user dashboard window
|
||||||
*
|
*
|
||||||
* @author Manuel Rego Casasnovas <mrego@igalia.com>
|
* @author Manuel Rego Casasnovas <mrego@igalia.com>
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class MonthlyTimesheetsAreaController extends GenericForwardComposer {
|
public class PersonalTimesheetsAreaController extends GenericForwardComposer {
|
||||||
|
|
||||||
private IMonthlyTimesheetsAreaModel monthlyTimesheetsAreaModel;
|
private IPersonalTimesheetsAreaModel personalTimesheetsAreaModel;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IMonthlyTimesheetController monthlyTimesheetController;
|
private IPersonalTimesheetController personalTimesheetController;
|
||||||
|
|
||||||
private RowRenderer monthlyTimesheetsRenderer = new RowRenderer() {
|
private RowRenderer personalTimesheetsRenderer = new RowRenderer() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(Row row, Object data) throws Exception {
|
public void render(Row row, Object data) throws Exception {
|
||||||
final MonthlyTimesheetDTO monthlyTimesheet = (MonthlyTimesheetDTO) data;
|
final PersonalTimesheetDTO personalTimesheet = (PersonalTimesheetDTO) data;
|
||||||
row.setValue(monthlyTimesheet);
|
row.setValue(personalTimesheet);
|
||||||
|
|
||||||
Util.appendLabel(row, monthlyTimesheet
|
Util.appendLabel(row, personalTimesheet
|
||||||
.toString(monthlyTimesheetsAreaModel
|
.toString(personalTimesheetsAreaModel
|
||||||
.getPersonalTimesheetsPeriodicity()));
|
.getPersonalTimesheetsPeriodicity()));
|
||||||
Util.appendLabel(row, monthlyTimesheet.getResourceCapacity()
|
Util.appendLabel(row, personalTimesheet.getResourceCapacity()
|
||||||
.toFormattedString());
|
.toFormattedString());
|
||||||
Util.appendLabel(row, monthlyTimesheet.getTotalHours()
|
Util.appendLabel(row, personalTimesheet.getTotalHours()
|
||||||
.toFormattedString());
|
.toFormattedString());
|
||||||
Util.appendLabel(row, monthlyTimesheet.getTasksNumber() + "");
|
Util.appendLabel(row, personalTimesheet.getTasksNumber() + "");
|
||||||
|
|
||||||
Util.appendOperationsAndOnClickEvent(row, new EventListener() {
|
Util.appendOperationsAndOnClickEvent(row, new EventListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(Event event) throws Exception {
|
public void onEvent(Event event) throws Exception {
|
||||||
monthlyTimesheetController.goToCreateOrEditForm(monthlyTimesheet
|
personalTimesheetController.goToCreateOrEditForm(personalTimesheet
|
||||||
.getDate());
|
.getDate());
|
||||||
}
|
}
|
||||||
}, null);
|
}, null);
|
||||||
|
|
@ -78,12 +78,12 @@ public class MonthlyTimesheetsAreaController extends GenericForwardComposer {
|
||||||
comp.setAttribute("controller", this);
|
comp.setAttribute("controller", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MonthlyTimesheetDTO> getMonthlyTimesheets() {
|
public List<PersonalTimesheetDTO> getPersonalTimesheets() {
|
||||||
return monthlyTimesheetsAreaModel.getMonthlyTimesheets();
|
return personalTimesheetsAreaModel.getPersonalTimesheets();
|
||||||
}
|
}
|
||||||
|
|
||||||
public RowRenderer getMonthlyTimesheetsRenderer() {
|
public RowRenderer getPersonalTimesheetsRenderer() {
|
||||||
return monthlyTimesheetsRenderer;
|
return personalTimesheetsRenderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -46,13 +46,13 @@ import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Model for for "Monthly timesheets" area in the user dashboard window
|
* Model for for "Personal timesheets" area in the user dashboard window
|
||||||
*
|
*
|
||||||
* @author Manuel Rego Casasnovas <mrego@igalia.com>
|
* @author Manuel Rego Casasnovas <mrego@igalia.com>
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
|
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
|
||||||
public class MonthlyTimesheetsAreaModel implements IMonthlyTimesheetsAreaModel {
|
public class PersonalTimesheetsAreaModel implements IPersonalTimesheetsAreaModel {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IWorkReportDAO workReportDAO;
|
private IWorkReportDAO workReportDAO;
|
||||||
|
|
@ -62,7 +62,7 @@ public class MonthlyTimesheetsAreaModel implements IMonthlyTimesheetsAreaModel {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
public List<MonthlyTimesheetDTO> getMonthlyTimesheets() {
|
public List<PersonalTimesheetDTO> getPersonalTimesheets() {
|
||||||
User user = UserUtil.getUserFromSession();
|
User user = UserUtil.getUserFromSession();
|
||||||
if (!user.isBound()) {
|
if (!user.isBound()) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
|
|
@ -72,21 +72,21 @@ public class MonthlyTimesheetsAreaModel implements IMonthlyTimesheetsAreaModel {
|
||||||
|
|
||||||
LocalDate activationDate = getActivationDate(user.getWorker());
|
LocalDate activationDate = getActivationDate(user.getWorker());
|
||||||
LocalDate currentDate = new LocalDate();
|
LocalDate currentDate = new LocalDate();
|
||||||
return getMonthlyTimesheets(user.getWorker(), activationDate,
|
return getPersonalTimesheets(user.getWorker(), activationDate,
|
||||||
currentDate.plusMonths(1), getPersonalTimesheetsPeriodicity());
|
currentDate.plusMonths(1), getPersonalTimesheetsPeriodicity());
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<MonthlyTimesheetDTO> getMonthlyTimesheets(Resource resource,
|
private List<PersonalTimesheetDTO> getPersonalTimesheets(Resource resource,
|
||||||
LocalDate start, LocalDate end,
|
LocalDate start, LocalDate end,
|
||||||
PersonalTimesheetsPeriodicityEnum periodicity) {
|
PersonalTimesheetsPeriodicityEnum periodicity) {
|
||||||
start = periodicity.getStart(start);
|
start = periodicity.getStart(start);
|
||||||
end = periodicity.getEnd(end);
|
end = periodicity.getEnd(end);
|
||||||
int items = periodicity.getItemsBetween(start, end);
|
int items = periodicity.getItemsBetween(start, end);
|
||||||
|
|
||||||
List<MonthlyTimesheetDTO> result = new ArrayList<MonthlyTimesheetDTO>();
|
List<PersonalTimesheetDTO> result = new ArrayList<PersonalTimesheetDTO>();
|
||||||
|
|
||||||
// In decreasing order to provide a list sorted with the more recent
|
// In decreasing order to provide a list sorted with the more recent
|
||||||
// monthly timesheets at the beginning
|
// personal timesheets at the beginning
|
||||||
for (int i = items; i >= 0; i--) {
|
for (int i = items; i >= 0; i--) {
|
||||||
LocalDate date = periodicity.getDateForItemFromDate(i, start);
|
LocalDate date = periodicity.getDateForItemFromDate(i, start);
|
||||||
|
|
||||||
|
|
@ -99,7 +99,7 @@ public class MonthlyTimesheetsAreaModel implements IMonthlyTimesheetsAreaModel {
|
||||||
tasksNumber = getNumberOfOrderElementsWithTrackedTime(workReport);
|
tasksNumber = getNumberOfOrderElementsWithTrackedTime(workReport);
|
||||||
}
|
}
|
||||||
|
|
||||||
result.add(new MonthlyTimesheetDTO(date, workReport,
|
result.add(new PersonalTimesheetDTO(date, workReport,
|
||||||
getResourceCapcity(resource, date, periodicity), hours,
|
getResourceCapcity(resource, date, periodicity), hours,
|
||||||
tasksNumber));
|
tasksNumber));
|
||||||
}
|
}
|
||||||
|
|
@ -109,7 +109,7 @@ public class MonthlyTimesheetsAreaModel implements IMonthlyTimesheetsAreaModel {
|
||||||
|
|
||||||
private WorkReport getWorkReport(Resource resource, LocalDate date,
|
private WorkReport getWorkReport(Resource resource, LocalDate date,
|
||||||
PersonalTimesheetsPeriodicityEnum periodicity) {
|
PersonalTimesheetsPeriodicityEnum periodicity) {
|
||||||
WorkReport workReport = workReportDAO.getMonthlyTimesheetWorkReport(
|
WorkReport workReport = workReportDAO.getPersonalTimesheetWorkReport(
|
||||||
resource, date, periodicity);
|
resource, date, periodicity);
|
||||||
forceLoad(workReport);
|
forceLoad(workReport);
|
||||||
return workReport;
|
return workReport;
|
||||||
|
|
@ -35,7 +35,7 @@ import org.zkoss.zk.ui.util.GenericForwardComposer;
|
||||||
* Controller for user dashboard window.<br />
|
* Controller for user dashboard window.<br />
|
||||||
*
|
*
|
||||||
* At this moment it's only used to show a message to user after saving a
|
* At this moment it's only used to show a message to user after saving a
|
||||||
* monthly timesheet.
|
* personal timesheet.
|
||||||
*
|
*
|
||||||
* @author Manuel Rego Casasnovas <mrego@igalia.com>
|
* @author Manuel Rego Casasnovas <mrego@igalia.com>
|
||||||
*/
|
*/
|
||||||
|
|
@ -55,13 +55,13 @@ public class UserDashboardController extends GenericForwardComposer {
|
||||||
String timesheetSave = Executions.getCurrent().getParameter(
|
String timesheetSave = Executions.getCurrent().getParameter(
|
||||||
"timesheet_saved");
|
"timesheet_saved");
|
||||||
if (!StringUtils.isBlank(timesheetSave)) {
|
if (!StringUtils.isBlank(timesheetSave)) {
|
||||||
String monthlyTimesheet = MonthlyTimesheetDTO.toString(Registry
|
String personalTimesheet = PersonalTimesheetDTO.toString(Registry
|
||||||
.getConfigurationDAO()
|
.getConfigurationDAO()
|
||||||
.getConfigurationWithReadOnlyTransaction()
|
.getConfigurationWithReadOnlyTransaction()
|
||||||
.getPersonalTimesheetsPeriodicity(), new LocalDate(
|
.getPersonalTimesheetsPeriodicity(), new LocalDate(
|
||||||
timesheetSave));
|
timesheetSave));
|
||||||
messagesForUser.showMessage(Level.INFO,
|
messagesForUser.showMessage(Level.INFO,
|
||||||
_("Personal timesheet \"{0}\" saved", monthlyTimesheet));
|
_("Personal timesheet \"{0}\" saved", personalTimesheet));
|
||||||
}
|
}
|
||||||
|
|
||||||
String expenseSheetSaved = Executions.getCurrent().getParameter(
|
String expenseSheetSaved = Executions.getCurrent().getParameter(
|
||||||
|
|
|
||||||
|
|
@ -239,9 +239,9 @@ public interface IWorkReportModel extends IIntegrationEntityModel {
|
||||||
List<Worker> getBoundWorkers();
|
List<Worker> getBoundWorkers();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if a {@link WorkReport} is or not a monthly timesheet.
|
* Checks if a {@link WorkReport} is or not a personal timesheet.
|
||||||
*/
|
*/
|
||||||
boolean isMonthlyTimesheet(WorkReport workReport);
|
boolean isPersonalTimesheet(WorkReport workReport);
|
||||||
|
|
||||||
WorkReportLine getFirstWorkReportLine();
|
WorkReportLine getFirstWorkReportLine();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,11 +52,11 @@ public interface IWorkReportTypeModel extends IIntegrationEntityModel {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the {@link List} of {@link WorkReportType WorkReportTypes} except
|
* Gets the {@link List} of {@link WorkReportType WorkReportTypes} except
|
||||||
* the {@link WorkReportType} used for monthly timesheets.
|
* the {@link WorkReportType} used for personal timesheets.
|
||||||
*
|
*
|
||||||
* @return A {@link List} of {@link WorkReportType}
|
* @return A {@link List} of {@link WorkReportType}
|
||||||
*/
|
*/
|
||||||
List<WorkReportType> getWorkReportTypesExceptMonthlyTimeSheets();
|
List<WorkReportType> getWorkReportTypesExceptPersonalTimeSheets();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores the current {@link WorkReportType}.
|
* Stores the current {@link WorkReportType}.
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ import org.libreplan.web.common.components.NewDataSortableGrid;
|
||||||
import org.libreplan.web.common.components.bandboxsearch.BandboxSearch;
|
import org.libreplan.web.common.components.bandboxsearch.BandboxSearch;
|
||||||
import org.libreplan.web.common.entrypoints.EntryPointsHandler;
|
import org.libreplan.web.common.entrypoints.EntryPointsHandler;
|
||||||
import org.libreplan.web.common.entrypoints.IURLHandlerRegistry;
|
import org.libreplan.web.common.entrypoints.IURLHandlerRegistry;
|
||||||
import org.libreplan.web.users.dashboard.IMonthlyTimesheetController;
|
import org.libreplan.web.users.dashboard.IPersonalTimesheetController;
|
||||||
import org.zkoss.ganttz.IPredicate;
|
import org.zkoss.ganttz.IPredicate;
|
||||||
import org.zkoss.ganttz.util.ComponentsFinder;
|
import org.zkoss.ganttz.util.ComponentsFinder;
|
||||||
import org.zkoss.zk.ui.Component;
|
import org.zkoss.zk.ui.Component;
|
||||||
|
|
@ -157,13 +157,13 @@ public class WorkReportCRUDController extends GenericForwardComposer implements
|
||||||
private Datebox filterFinishDate;
|
private Datebox filterFinishDate;
|
||||||
|
|
||||||
@javax.annotation.Resource
|
@javax.annotation.Resource
|
||||||
private IMonthlyTimesheetController monthlyTimesheetController;
|
private IPersonalTimesheetController personalTimesheetController;
|
||||||
|
|
||||||
private Popup monthlyTimesheetsPopup;
|
private Popup personalTimesheetsPopup;
|
||||||
|
|
||||||
private Datebox monthlyTimesheetsDatebox;
|
private Datebox personalTimesheetsDatebox;
|
||||||
|
|
||||||
private BandboxSearch monthlyTimesheetsBandboxSearch;
|
private BandboxSearch personalTimesheetsBandboxSearch;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doAfterCompose(Component comp) throws Exception {
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
|
@ -171,7 +171,7 @@ public class WorkReportCRUDController extends GenericForwardComposer implements
|
||||||
listWorkReportLines = (NewDataSortableGrid) createWindow
|
listWorkReportLines = (NewDataSortableGrid) createWindow
|
||||||
.getFellowIfAny("listWorkReportLines");
|
.getFellowIfAny("listWorkReportLines");
|
||||||
messagesForUser = new MessagesForUser(messagesContainer);
|
messagesForUser = new MessagesForUser(messagesContainer);
|
||||||
showMessageIfMonthlyTimesheetWasSaved();
|
showMessageIfPersonalTimesheetWasSaved();
|
||||||
|
|
||||||
comp.setAttribute("controller", this);
|
comp.setAttribute("controller", this);
|
||||||
goToList();
|
goToList();
|
||||||
|
|
@ -185,7 +185,7 @@ public class WorkReportCRUDController extends GenericForwardComposer implements
|
||||||
handler.register(this, page);
|
handler.register(this, page);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showMessageIfMonthlyTimesheetWasSaved() {
|
private void showMessageIfPersonalTimesheetWasSaved() {
|
||||||
String timesheetSave = Executions.getCurrent().getParameter(
|
String timesheetSave = Executions.getCurrent().getParameter(
|
||||||
"timesheet_saved");
|
"timesheet_saved");
|
||||||
if (!StringUtils.isBlank(timesheetSave)) {
|
if (!StringUtils.isBlank(timesheetSave)) {
|
||||||
|
|
@ -598,8 +598,8 @@ public class WorkReportCRUDController extends GenericForwardComposer implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void goToCreateForm(WorkReportType workReportType) {
|
public void goToCreateForm(WorkReportType workReportType) {
|
||||||
if (workReportType.isMonthlyTimesheetsType()) {
|
if (workReportType.isPersonalTimesheetsType()) {
|
||||||
monthlyTimesheetsPopup.open(listTypeToAssign);
|
personalTimesheetsPopup.open(listTypeToAssign);
|
||||||
} else {
|
} else {
|
||||||
cameBackList = false;
|
cameBackList = false;
|
||||||
workReportModel.initCreate(workReportType);
|
workReportModel.initCreate(workReportType);
|
||||||
|
|
@ -617,8 +617,8 @@ public class WorkReportCRUDController extends GenericForwardComposer implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void goToEditForm(WorkReport workReport) {
|
public void goToEditForm(WorkReport workReport) {
|
||||||
if (workReportModel.isMonthlyTimesheet(workReport)) {
|
if (workReportModel.isPersonalTimesheet(workReport)) {
|
||||||
goToEditMonthlyTimeSheet(workReport);
|
goToEditPersonalTimeSheet(workReport);
|
||||||
} else {
|
} else {
|
||||||
workReportModel.initEdit(workReport);
|
workReportModel.initEdit(workReport);
|
||||||
createWindow.setTitle(_("Edit Timesheet"));
|
createWindow.setTitle(_("Edit Timesheet"));
|
||||||
|
|
@ -629,11 +629,11 @@ public class WorkReportCRUDController extends GenericForwardComposer implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void goToEditMonthlyTimeSheet(WorkReport workReport) {
|
private void goToEditPersonalTimeSheet(WorkReport workReport) {
|
||||||
workReportModel.initEdit(workReport);
|
workReportModel.initEdit(workReport);
|
||||||
Date date = workReportModel.getFirstWorkReportLine().getDate();
|
Date date = workReportModel.getFirstWorkReportLine().getDate();
|
||||||
Resource resource = workReport.getResource();
|
Resource resource = workReport.getResource();
|
||||||
monthlyTimesheetController.goToCreateOrEditFormForResource(
|
personalTimesheetController.goToCreateOrEditFormForResource(
|
||||||
LocalDate.fromDateFields(date), resource);
|
LocalDate.fromDateFields(date), resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -682,12 +682,12 @@ public class WorkReportCRUDController extends GenericForwardComposer implements
|
||||||
listTypeToAssign = (Listbox) window.getFellow("listTypeToAssign");
|
listTypeToAssign = (Listbox) window.getFellow("listTypeToAssign");
|
||||||
filterStartDate = (Datebox) window.getFellow("filterStartDate");
|
filterStartDate = (Datebox) window.getFellow("filterStartDate");
|
||||||
filterFinishDate = (Datebox) window.getFellow("filterFinishDate");
|
filterFinishDate = (Datebox) window.getFellow("filterFinishDate");
|
||||||
monthlyTimesheetsPopup = (Popup) window
|
personalTimesheetsPopup = (Popup) window
|
||||||
.getFellow("monthlyTimesheetsPopup");
|
.getFellow("personalTimesheetsPopup");
|
||||||
monthlyTimesheetsDatebox = (Datebox) window
|
personalTimesheetsDatebox = (Datebox) window
|
||||||
.getFellow("monthlyTimesheetsDatebox");
|
.getFellow("personalTimesheetsDatebox");
|
||||||
monthlyTimesheetsBandboxSearch = (BandboxSearch) window
|
personalTimesheetsBandboxSearch = (BandboxSearch) window
|
||||||
.getFellow("monthlyTimesheetsBandboxSearch");
|
.getFellow("personalTimesheetsBandboxSearch");
|
||||||
clearFilterDates();
|
clearFilterDates();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1616,20 +1616,20 @@ public class WorkReportCRUDController extends GenericForwardComposer implements
|
||||||
return workReportModel.getBoundWorkers();
|
return workReportModel.getBoundWorkers();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createOrEditMonthlyTimesheet() {
|
public void createOrEditPersonalTimesheet() {
|
||||||
Date date = monthlyTimesheetsDatebox.getValue();
|
Date date = personalTimesheetsDatebox.getValue();
|
||||||
if (date == null) {
|
if (date == null) {
|
||||||
throw new WrongValueException(monthlyTimesheetsDatebox,
|
throw new WrongValueException(personalTimesheetsDatebox,
|
||||||
_("Please set a date"));
|
_("Please set a date"));
|
||||||
}
|
}
|
||||||
Resource resource = (Resource) monthlyTimesheetsBandboxSearch
|
Resource resource = (Resource) personalTimesheetsBandboxSearch
|
||||||
.getSelectedElement();
|
.getSelectedElement();
|
||||||
if (resource == null) {
|
if (resource == null) {
|
||||||
throw new WrongValueException(monthlyTimesheetsBandboxSearch,
|
throw new WrongValueException(personalTimesheetsBandboxSearch,
|
||||||
_("Please select a worker"));
|
_("Please select a worker"));
|
||||||
}
|
}
|
||||||
|
|
||||||
monthlyTimesheetController.goToCreateOrEditFormForResource(
|
personalTimesheetController.goToCreateOrEditFormForResource(
|
||||||
LocalDate.fromDateFields(date), resource);
|
LocalDate.fromDateFields(date), resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ public class WorkReportDTO {
|
||||||
|
|
||||||
WorkReportType workReportType = workReport.getWorkReportType();
|
WorkReportType workReportType = workReport.getWorkReportType();
|
||||||
this.type = workReportType.getName();
|
this.type = workReportType.getName();
|
||||||
if (workReportType.isMonthlyTimesheetsType()) {
|
if (workReportType.isPersonalTimesheetsType()) {
|
||||||
this.type += " - " + workReport.getResource().getShortDescription();
|
this.type += " - " + workReport.getResource().getShortDescription();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -629,11 +629,11 @@ public class WorkReportModel extends IntegrationEntityModel implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
public boolean isMonthlyTimesheet(WorkReport workReport) {
|
public boolean isPersonalTimesheet(WorkReport workReport) {
|
||||||
try {
|
try {
|
||||||
return workReportTypeDAO.find(
|
return workReportTypeDAO.find(
|
||||||
workReport.getWorkReportType().getId())
|
workReport.getWorkReportType().getId())
|
||||||
.isMonthlyTimesheetsType();
|
.isPersonalTimesheetsType();
|
||||||
} catch (InstanceNotFoundException e) {
|
} catch (InstanceNotFoundException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ import org.libreplan.web.common.MessagesForUser;
|
||||||
import org.libreplan.web.common.components.Autocomplete;
|
import org.libreplan.web.common.components.Autocomplete;
|
||||||
import org.libreplan.web.common.components.bandboxsearch.BandboxSearch;
|
import org.libreplan.web.common.components.bandboxsearch.BandboxSearch;
|
||||||
import org.libreplan.web.security.SecurityUtils;
|
import org.libreplan.web.security.SecurityUtils;
|
||||||
import org.libreplan.web.users.dashboard.IMonthlyTimesheetController;
|
import org.libreplan.web.users.dashboard.IPersonalTimesheetController;
|
||||||
import org.zkoss.ganttz.IPredicate;
|
import org.zkoss.ganttz.IPredicate;
|
||||||
import org.zkoss.zk.ui.Component;
|
import org.zkoss.zk.ui.Component;
|
||||||
import org.zkoss.zk.ui.WrongValueException;
|
import org.zkoss.zk.ui.WrongValueException;
|
||||||
|
|
@ -109,7 +109,7 @@ public class WorkReportQueryController extends GenericForwardComposer {
|
||||||
private IWorkReportCRUDControllerEntryPoints workReportCRUD;
|
private IWorkReportCRUDControllerEntryPoints workReportCRUD;
|
||||||
|
|
||||||
@javax.annotation.Resource
|
@javax.annotation.Resource
|
||||||
private IMonthlyTimesheetController monthlyTimesheetController;
|
private IPersonalTimesheetController personalTimesheetController;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doAfterCompose(Component comp) throws Exception {
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
|
@ -329,9 +329,9 @@ public class WorkReportQueryController extends GenericForwardComposer {
|
||||||
if (SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_TIMESHEETS)) {
|
if (SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_TIMESHEETS)) {
|
||||||
workReportCRUD.goToEditForm(workReport);
|
workReportCRUD.goToEditForm(workReport);
|
||||||
} else if (SecurityUtils.isUserInRole(UserRole.ROLE_BOUND_USER)
|
} else if (SecurityUtils.isUserInRole(UserRole.ROLE_BOUND_USER)
|
||||||
&& workReportModel.isMonthlyTimesheet(workReport)
|
&& workReportModel.isPersonalTimesheet(workReport)
|
||||||
&& belongsToCurrentUser(line)) {
|
&& belongsToCurrentUser(line)) {
|
||||||
monthlyTimesheetController
|
personalTimesheetController
|
||||||
.goToCreateOrEditForm(line.getLocalDate());
|
.goToCreateOrEditForm(line.getLocalDate());
|
||||||
} else {
|
} else {
|
||||||
messagesForUser.showMessage(Level.WARNING,
|
messagesForUser.showMessage(Level.WARNING,
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ public class WorkReportTypeCRUDController extends BaseCRUDController<WorkReportT
|
||||||
private OrderedFieldsAndLabelsRowRenderer orderedFieldsAndLabesRowRenderer = new OrderedFieldsAndLabelsRowRenderer();
|
private OrderedFieldsAndLabelsRowRenderer orderedFieldsAndLabesRowRenderer = new OrderedFieldsAndLabelsRowRenderer();
|
||||||
|
|
||||||
public List<WorkReportType> getWorkReportTypes() {
|
public List<WorkReportType> getWorkReportTypes() {
|
||||||
return workReportTypeModel.getWorkReportTypesExceptMonthlyTimeSheets();
|
return workReportTypeModel.getWorkReportTypesExceptPersonalTimeSheets();
|
||||||
}
|
}
|
||||||
|
|
||||||
public WorkReportType getWorkReportType() {
|
public WorkReportType getWorkReportType() {
|
||||||
|
|
|
||||||
|
|
@ -118,11 +118,11 @@ public class WorkReportTypeModel extends IntegrationEntityModel implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
public List<WorkReportType> getWorkReportTypesExceptMonthlyTimeSheets() {
|
public List<WorkReportType> getWorkReportTypesExceptPersonalTimeSheets() {
|
||||||
List<WorkReportType> list = workReportTypeDAO.list(WorkReportType.class);
|
List<WorkReportType> list = workReportTypeDAO.list(WorkReportType.class);
|
||||||
try {
|
try {
|
||||||
list.remove(workReportTypeDAO
|
list.remove(workReportTypeDAO
|
||||||
.findUniqueByName(PredefinedWorkReportTypes.MONTHLY_TIMESHEETS
|
.findUniqueByName(PredefinedWorkReportTypes.PERSONAL_TIMESHEETS
|
||||||
.getName()));
|
.getName()));
|
||||||
} catch (NonUniqueResultException e) {
|
} catch (NonUniqueResultException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
|
@ -151,9 +151,9 @@ public class WorkReportTypeModel extends IntegrationEntityModel implements
|
||||||
@Override
|
@Override
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
public void initEdit(WorkReportType workReportType) {
|
public void initEdit(WorkReportType workReportType) {
|
||||||
if (workReportType.isMonthlyTimesheetsType()) {
|
if (workReportType.isPersonalTimesheetsType()) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Monthly timesheets timesheet template cannot be edited");
|
"Personal timesheets timesheet template cannot be edited");
|
||||||
}
|
}
|
||||||
|
|
||||||
setListing(false);
|
setListing(false);
|
||||||
|
|
@ -220,9 +220,9 @@ public class WorkReportTypeModel extends IntegrationEntityModel implements
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void confirmRemove(WorkReportType workReportType) {
|
public void confirmRemove(WorkReportType workReportType) {
|
||||||
if (workReportType.isMonthlyTimesheetsType()) {
|
if (workReportType.isPersonalTimesheetsType()) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Monthly timesheets timesheet template cannot be removed");
|
"Personal timesheets timesheet template cannot be removed");
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@
|
||||||
<label value="${i18n:_('Hours type for personal timesheets')}" />
|
<label value="${i18n:_('Hours type for personal timesheets')}" />
|
||||||
<bandboxSearch
|
<bandboxSearch
|
||||||
finder="TypeOfWorkHoursBandboxFinder"
|
finder="TypeOfWorkHoursBandboxFinder"
|
||||||
selectedElement="@{configurationController.monthlyTimesheetsTypeOfWorkHours, access='both'}" />
|
selectedElement="@{configurationController.personalTimesheetsTypeOfWorkHours, access='both'}" />
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<label value="${i18n:_('Personal timesheets peridocity')}" />
|
<label value="${i18n:_('Personal timesheets peridocity')}" />
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,11 @@
|
||||||
<http://www.gnu.org/licenses/>.
|
<http://www.gnu.org/licenses/>.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<groupbox apply="org.libreplan.web.users.dashboard.MonthlyTimesheetsAreaController">
|
<groupbox apply="org.libreplan.web.users.dashboard.PersonalTimesheetsAreaController">
|
||||||
<caption label="${i18n:_('Personal timesheets')}" />
|
<caption label="${i18n:_('Personal timesheets')}" />
|
||||||
|
|
||||||
<grid model="@{controller.monthlyTimesheets}" mold="paging"
|
<grid model="@{controller.personalTimesheets}" mold="paging"
|
||||||
pageSize="10" rowRenderer="@{controller.monthlyTimesheetsRenderer}"
|
pageSize="10" rowRenderer="@{controller.personalTimesheetsRenderer}"
|
||||||
sclass="clickable-rows">
|
sclass="clickable-rows">
|
||||||
<columns sizable="true">
|
<columns sizable="true">
|
||||||
<column label="${i18n:_('Date')}"
|
<column label="${i18n:_('Date')}"
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
<?link rel="stylesheet" type="text/css" href="/common/css/user_dashboard.css"?>
|
<?link rel="stylesheet" type="text/css" href="/common/css/user_dashboard.css"?>
|
||||||
|
|
||||||
<zk>
|
<zk>
|
||||||
<window apply="org.libreplan.web.users.dashboard.MonthlyTimesheetController"
|
<window apply="org.libreplan.web.users.dashboard.PersonalTimesheetController"
|
||||||
self="@{define(content)}" title="${i18n:_('Personal timesheet')}">
|
self="@{define(content)}" title="${i18n:_('Personal timesheet')}">
|
||||||
|
|
||||||
<div id="messagesContainer" />
|
<div id="messagesContainer" />
|
||||||
|
|
@ -50,18 +50,18 @@
|
||||||
<label value="${i18n:_('Date')}" />
|
<label value="${i18n:_('Date')}" />
|
||||||
<hbox align="pack">
|
<hbox align="pack">
|
||||||
<div visible="@{controller.currentUser}">
|
<div visible="@{controller.currentUser}">
|
||||||
<button id="previousMonth"
|
<button id="previousPeriod"
|
||||||
image="/common/img/ico_step_left.png" sclass="icono"
|
image="/common/img/ico_step_left.png" sclass="icono"
|
||||||
onClick="controller.previousMonth();"
|
onClick="controller.previousPeriod();"
|
||||||
tooltiptext="${i18n:_('Previous')}"
|
tooltiptext="${i18n:_('Previous')}"
|
||||||
disabled="@{controller.firstMonth}" />
|
disabled="@{controller.firstPeriod}" />
|
||||||
</div>
|
</div>
|
||||||
<label value="@{controller.timesheetString}" />
|
<label value="@{controller.timesheetString}" />
|
||||||
<div visible="@{controller.currentUser}">
|
<div visible="@{controller.currentUser}">
|
||||||
<button id="nextMonth"
|
<button id="nextPeriod"
|
||||||
onClick="controller.nextMonth();" image="/common/img/ico_step_right.png"
|
onClick="controller.nextPeriod();" image="/common/img/ico_step_right.png"
|
||||||
tooltiptext="${i18n:_('Next')}" sclass="icono"
|
tooltiptext="${i18n:_('Next')}" sclass="icono"
|
||||||
disabled="@{controller.lastMonth}" />
|
disabled="@{controller.lastPeriod}" />
|
||||||
</div>
|
</div>
|
||||||
</hbox>
|
</hbox>
|
||||||
</row>
|
</row>
|
||||||
|
|
@ -82,7 +82,7 @@
|
||||||
<rows>
|
<rows>
|
||||||
<row visible="@{controller.hasOtherReports}">
|
<row visible="@{controller.hasOtherReports}">
|
||||||
<label value="${i18n:_('Total personal timesheet')}" />
|
<label value="${i18n:_('Total personal timesheet')}" />
|
||||||
<label id="summaryTotalMonthlyTimesheet" />
|
<label id="summaryTotalPersonalTimesheet" />
|
||||||
</row>
|
</row>
|
||||||
<row visible="@{controller.hasOtherReports}">
|
<row visible="@{controller.hasOtherReports}">
|
||||||
<label value="${i18n:_('Total other')}" />
|
<label value="${i18n:_('Total other')}" />
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
<?link rel="stylesheet" type="text/css" href="/common/css/libreplan_zk.css"?>
|
<?link rel="stylesheet" type="text/css" href="/common/css/libreplan_zk.css"?>
|
||||||
|
|
||||||
<?component name="my-tasks-area" inline="true" macroURI="_myTasksArea.zul"?>
|
<?component name="my-tasks-area" inline="true" macroURI="_myTasksArea.zul"?>
|
||||||
<?component name="monthly-timesheets-area" inline="true" macroURI="_monthlyTimesheetsArea.zul"?>
|
<?component name="personal-timesheets-area" inline="true" macroURI="_personalTimesheetsArea.zul"?>
|
||||||
<?component name="expenses-area" inline="true" macroURI="_expensesArea.zul"?>
|
<?component name="expenses-area" inline="true" macroURI="_expensesArea.zul"?>
|
||||||
|
|
||||||
<zk>
|
<zk>
|
||||||
|
|
@ -39,7 +39,7 @@
|
||||||
|
|
||||||
<my-tasks-area />
|
<my-tasks-area />
|
||||||
|
|
||||||
<monthly-timesheets-area />
|
<personal-timesheets-area />
|
||||||
|
|
||||||
<expenses-area />
|
<expenses-area />
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@
|
||||||
onClick="controller.onCreateNewWorkReport()"/>
|
onClick="controller.onCreateNewWorkReport()"/>
|
||||||
</hbox>
|
</hbox>
|
||||||
</div>
|
</div>
|
||||||
<popup id="monthlyTimesheetsPopup" width="300px">
|
<popup id="personalTimesheetsPopup" width="300px">
|
||||||
<grid>
|
<grid>
|
||||||
<columns>
|
<columns>
|
||||||
<column width="50px"/>
|
<column width="50px"/>
|
||||||
|
|
@ -116,11 +116,11 @@
|
||||||
<rows>
|
<rows>
|
||||||
<row>
|
<row>
|
||||||
<label value="${i18n:_('Date')}" />
|
<label value="${i18n:_('Date')}" />
|
||||||
<datebox id="monthlyTimesheetsDatebox" />
|
<datebox id="personalTimesheetsDatebox" />
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<label value="${i18n:_('Worker')}" />
|
<label value="${i18n:_('Worker')}" />
|
||||||
<bandboxSearch id="monthlyTimesheetsBandboxSearch"
|
<bandboxSearch id="personalTimesheetsBandboxSearch"
|
||||||
finder="ResourceBandboxFinder"
|
finder="ResourceBandboxFinder"
|
||||||
model="@{controller.boundWorkers}"
|
model="@{controller.boundWorkers}"
|
||||||
widthBandbox="200px"
|
widthBandbox="200px"
|
||||||
|
|
@ -128,7 +128,7 @@
|
||||||
</row>
|
</row>
|
||||||
</rows>
|
</rows>
|
||||||
</grid>
|
</grid>
|
||||||
<button onClick="controller.createOrEditMonthlyTimesheet();"
|
<button onClick="controller.createOrEditPersonalTimesheet();"
|
||||||
label="${i18n:_('Go to personal timesheet')}" />
|
label="${i18n:_('Go to personal timesheet')}" />
|
||||||
</popup>
|
</popup>
|
||||||
</window>
|
</window>
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ import org.junit.runner.RunWith;
|
||||||
import org.libreplan.business.common.IAdHocTransactionService;
|
import org.libreplan.business.common.IAdHocTransactionService;
|
||||||
import org.libreplan.business.common.IOnTransaction;
|
import org.libreplan.business.common.IOnTransaction;
|
||||||
import org.libreplan.business.common.entities.IConfigurationBootstrap;
|
import org.libreplan.business.common.entities.IConfigurationBootstrap;
|
||||||
import org.libreplan.business.common.entities.IMonthlyTimesheetsTypeOfWorkHoursBootstrap;
|
import org.libreplan.business.common.entities.IPersonalTimesheetsTypeOfWorkHoursBootstrap;
|
||||||
import org.libreplan.business.common.exceptions.InstanceNotFoundException;
|
import org.libreplan.business.common.exceptions.InstanceNotFoundException;
|
||||||
import org.libreplan.business.costcategories.daos.ITypeOfWorkHoursDAO;
|
import org.libreplan.business.costcategories.daos.ITypeOfWorkHoursDAO;
|
||||||
import org.libreplan.business.costcategories.entities.ITypeOfWorkHoursBootstrap;
|
import org.libreplan.business.costcategories.entities.ITypeOfWorkHoursBootstrap;
|
||||||
|
|
@ -86,7 +86,7 @@ public class TypeOfWorkHoursServiceTest {
|
||||||
private ITypeOfWorkHoursBootstrap typeOfWorkHoursBootstrap;
|
private ITypeOfWorkHoursBootstrap typeOfWorkHoursBootstrap;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IMonthlyTimesheetsTypeOfWorkHoursBootstrap monthlyTimesheetsTypeOfWorkHoursBootstrap;
|
private IPersonalTimesheetsTypeOfWorkHoursBootstrap personalTimesheetsTypeOfWorkHoursBootstrap;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void loadRequiredData() {
|
public void loadRequiredData() {
|
||||||
|
|
@ -96,7 +96,7 @@ public class TypeOfWorkHoursServiceTest {
|
||||||
public Void execute() {
|
public Void execute() {
|
||||||
configurationBootstrap.loadRequiredData();
|
configurationBootstrap.loadRequiredData();
|
||||||
typeOfWorkHoursBootstrap.loadRequiredData();
|
typeOfWorkHoursBootstrap.loadRequiredData();
|
||||||
monthlyTimesheetsTypeOfWorkHoursBootstrap.loadRequiredData();
|
personalTimesheetsTypeOfWorkHoursBootstrap.loadRequiredData();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue