IDEMPIERE-832 not shows the new request created in the Calendar
This commit is contained in:
parent
964d9e7c52
commit
81d3a4e570
|
@ -0,0 +1,21 @@
|
|||
-- Apr 8, 2013 2:05:44 PM COT
|
||||
-- IDEMPIERE-832 , not shows the new request created in the Calendar
|
||||
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Org_ID,Created,AD_Client_ID) VALUES ('I','Complete Plan, must be greater that Start Plan',200171,'D','aa911a40-6c9d-42fa-8a9c-1d95b86013eb','DateCompletePlan','Y',TO_DATE('2013-04-08 14:05:42','YYYY-MM-DD HH24:MI:SS'),100,100,0,TO_DATE('2013-04-08 14:05:42','YYYY-MM-DD HH24:MI:SS'),0)
|
||||
;
|
||||
|
||||
-- Apr 8, 2013 2:05:44 PM COT
|
||||
-- IDEMPIERE-832 , not shows the new request created in the Calendar
|
||||
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200171 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
|
||||
;
|
||||
|
||||
-- Apr 8, 2013 2:07:56 PM COT
|
||||
-- IDEMPIERE-832 , not shows the new request created in the Calendar
|
||||
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Org_ID,Created,AD_Client_ID) VALUES ('I','Start Time, must be less than End Time',200172,'D','f0740826-d6c9-4606-821c-6b3b147b1a18','CheckTime','Y',TO_DATE('2013-04-08 14:07:55','YYYY-MM-DD HH24:MI:SS'),100,100,0,TO_DATE('2013-04-08 14:07:55','YYYY-MM-DD HH24:MI:SS'),0)
|
||||
;
|
||||
|
||||
-- Apr 8, 2013 2:07:56 PM COT
|
||||
-- IDEMPIERE-832 , not shows the new request created in the Calendar
|
||||
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200172 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201304081425_IDEMPIERE-832.sql') FROM dual;
|
|
@ -0,0 +1,22 @@
|
|||
-- Apr 8, 2013 2:05:44 PM COT
|
||||
-- IDEMPIERE-832 , not shows the new request created in the Calendar
|
||||
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Org_ID,Created,AD_Client_ID) VALUES ('I','Complete Plan, must be greater that Start Plan',200171,'D','aa911a40-6c9d-42fa-8a9c-1d95b86013eb','DateCompletePlan','Y',TO_TIMESTAMP('2013-04-08 14:05:42','YYYY-MM-DD HH24:MI:SS'),100,100,0,TO_TIMESTAMP('2013-04-08 14:05:42','YYYY-MM-DD HH24:MI:SS'),0)
|
||||
;
|
||||
|
||||
-- Apr 8, 2013 2:05:44 PM COT
|
||||
-- IDEMPIERE-832 , not shows the new request created in the Calendar
|
||||
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200171 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
|
||||
;
|
||||
|
||||
-- Apr 8, 2013 2:07:56 PM COT
|
||||
-- IDEMPIERE-832 , not shows the new request created in the Calendar
|
||||
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Org_ID,Created,AD_Client_ID) VALUES ('I','Start Time, must be less than End Time',200172,'D','f0740826-d6c9-4606-821c-6b3b147b1a18','CheckTime','Y',TO_TIMESTAMP('2013-04-08 14:07:55','YYYY-MM-DD HH24:MI:SS'),100,100,0,TO_TIMESTAMP('2013-04-08 14:07:55','YYYY-MM-DD HH24:MI:SS'),0)
|
||||
;
|
||||
|
||||
-- Apr 8, 2013 2:07:56 PM COT
|
||||
-- IDEMPIERE-832 , not shows the new request created in the Calendar
|
||||
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200172 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201304081425_IDEMPIERE-832.sql') FROM dual;
|
||||
|
|
@ -254,10 +254,7 @@ public class DPCalendar extends DashboardPanel implements EventListener<Event>,
|
|||
}
|
||||
|
||||
if (dateStartPlan != null && dateCompletePlan != null) {
|
||||
|
||||
boolean isBeginFullDay = false;
|
||||
boolean isEndFullDay = false;
|
||||
|
||||
|
||||
Calendar calBegin = Calendar.getInstance();
|
||||
calBegin.setTime(dateStartPlan);
|
||||
if (startTime != null) {
|
||||
|
@ -268,18 +265,15 @@ public class DPCalendar extends DashboardPanel implements EventListener<Event>,
|
|||
calBegin.set(Calendar.SECOND, 0);
|
||||
calBegin.set(Calendar.MILLISECOND, 0);
|
||||
|
||||
if(calBegin.get(Calendar.HOUR_OF_DAY) == 0 && calBegin.get(Calendar.MINUTE) == 0)
|
||||
isBeginFullDay = true;
|
||||
} else {
|
||||
calBegin.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calBegin.set(Calendar.MINUTE, 0);
|
||||
calBegin.set(Calendar.SECOND, 0);
|
||||
calBegin.set(Calendar.MILLISECOND, 0);
|
||||
isBeginFullDay = true;
|
||||
}
|
||||
|
||||
Calendar calEnd = Calendar.getInstance();
|
||||
calEnd.setTime(dateStartPlan);
|
||||
calEnd.setTime(dateCompletePlan);
|
||||
if (endTime != null) {
|
||||
Calendar cal1 = Calendar.getInstance();
|
||||
cal1.setTimeInMillis(endTime.getTime());
|
||||
|
@ -288,66 +282,25 @@ public class DPCalendar extends DashboardPanel implements EventListener<Event>,
|
|||
calEnd.set(Calendar.SECOND, 0);
|
||||
calEnd.set(Calendar.MILLISECOND, 0);
|
||||
|
||||
if(calEnd.get(Calendar.HOUR_OF_DAY) == 0 && calEnd.get(Calendar.MINUTE) == 0)
|
||||
isEndFullDay = true;
|
||||
} else {
|
||||
calEnd.add(Calendar.HOUR_OF_DAY, 24);
|
||||
isEndFullDay = true;
|
||||
}
|
||||
|
||||
ADCalendarEvent event = new ADCalendarEvent();
|
||||
event.setR_Request_ID(R_Request_ID);
|
||||
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(dateCompletePlan);
|
||||
if (endTime != null) {
|
||||
Calendar cal1 = Calendar.getInstance();
|
||||
cal1.setTimeInMillis(endTime.getTime());
|
||||
cal.set(Calendar.HOUR_OF_DAY, cal1.get(Calendar.HOUR_OF_DAY));
|
||||
cal.set(Calendar.MINUTE, cal1.get(Calendar.MINUTE));
|
||||
cal.set(Calendar.SECOND, 0);
|
||||
cal.set(Calendar.MILLISECOND, 0);
|
||||
} else {
|
||||
cal.add(Calendar.HOUR_OF_DAY, 24);
|
||||
}
|
||||
dateCompletePlan.setTime(cal.getTimeInMillis());
|
||||
event.setBeginDate(calBegin.getTime());
|
||||
event.setEndDate(calEnd.getTime());
|
||||
|
||||
if(isBeginFullDay && isEndFullDay)
|
||||
{
|
||||
ADCalendarEvent event = new ADCalendarEvent();
|
||||
event.setR_Request_ID(R_Request_ID);
|
||||
|
||||
event.setBeginDate(calBegin.getTime());
|
||||
event.setEndDate(cal.getTime());
|
||||
|
||||
if(event.getBeginDate().compareTo(event.getEndDate()) >= 0)
|
||||
continue;
|
||||
if(event.getBeginDate().compareTo(event.getEndDate()) >= 0)
|
||||
continue;
|
||||
|
||||
event.setContent(summary);
|
||||
event.setHeaderColor(headerColor);
|
||||
event.setContentColor(contentColor);
|
||||
event.setR_RequestType_ID(R_RequestType_ID);
|
||||
event.setLocked(true);
|
||||
events.add(event);
|
||||
}
|
||||
else
|
||||
{
|
||||
for(; calBegin.getTime().compareTo(dateCompletePlan) <= 0; calBegin.add(Calendar.DATE, 1), calEnd.add(Calendar.DATE, 1))
|
||||
{
|
||||
ADCalendarEvent event = new ADCalendarEvent();
|
||||
event.setR_Request_ID(R_Request_ID);
|
||||
|
||||
event.setBeginDate(calBegin.getTime());
|
||||
event.setEndDate(calEnd.getTime());
|
||||
|
||||
if(event.getBeginDate().compareTo(event.getEndDate()) >= 0)
|
||||
continue;
|
||||
|
||||
event.setContent(summary);
|
||||
event.setHeaderColor(headerColor);
|
||||
event.setContentColor(contentColor);
|
||||
event.setR_RequestType_ID(R_RequestType_ID);
|
||||
event.setLocked(true);
|
||||
events.add(event);
|
||||
}
|
||||
}
|
||||
event.setContent(summary);
|
||||
event.setHeaderColor(headerColor);
|
||||
event.setContentColor(contentColor);
|
||||
event.setR_RequestType_ID(R_RequestType_ID);
|
||||
event.setLocked(true);
|
||||
events.add(event);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
package org.adempiere.webui.dashboard;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Calendar;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
|
@ -232,11 +233,13 @@ public class RequestWindow extends Window implements EventListener<Event> {
|
|||
rows.appendChild(row);
|
||||
row.appendChild(lblStartTime.rightAlign());
|
||||
row.appendChild(tbxStartTime);
|
||||
tbxStartTime.setWidth("40%");
|
||||
|
||||
row = new Row();
|
||||
rows.appendChild(row);
|
||||
row.appendChild(lblEndTime.rightAlign());
|
||||
row.appendChild(tbxEndTime);
|
||||
tbxEndTime.setWidth("40%");
|
||||
|
||||
Borderlayout borderlayout = new Borderlayout();
|
||||
appendChild(borderlayout);
|
||||
|
@ -277,7 +280,11 @@ public class RequestWindow extends Window implements EventListener<Event> {
|
|||
throw new WrongValueException(salesRepField.getComponent(), fillMandatory);
|
||||
if (entryConfidentialField.getValue() == null || entryConfidentialField.getValue().equals(""))
|
||||
throw new WrongValueException(entryConfidentialField.getComponent(), fillMandatory);
|
||||
|
||||
if (dbxStartPlan.getValue().compareTo(dbxCompletePlan.getValue()) > 0)
|
||||
throw new WrongValueException(dbxCompletePlan, Msg.translate(Env.getCtx(), "DateCompletePlan"));
|
||||
if (checkTime() && (dbxStartPlan.getValue().compareTo(dbxCompletePlan.getValue()) == 0))
|
||||
throw new WrongValueException(tbxStartTime, Msg.translate(Env.getCtx(), "CheckTime"));
|
||||
|
||||
MRequest request = new MRequest(Env.getCtx(), 0, null);
|
||||
request.setAD_Org_ID(Env.getAD_Org_ID(Env.getCtx()));
|
||||
request.setDueType((String) dueTypeField.getValue());
|
||||
|
@ -309,4 +316,17 @@ public class RequestWindow extends Window implements EventListener<Event> {
|
|||
else if (e.getTarget() == confirmPanel.getButton(ConfirmPanel.A_CANCEL))
|
||||
this.detach();
|
||||
}
|
||||
|
||||
//Check, Start time is not >= End time, when Start Plan == Complete Plan
|
||||
private boolean checkTime()
|
||||
{
|
||||
Calendar cal =Calendar.getInstance();
|
||||
cal.setTimeInMillis(tbxStartTime.getValue().getTime());
|
||||
Calendar cal2 = Calendar.getInstance();
|
||||
cal2.setTimeInMillis(tbxEndTime.getValue().getTime());
|
||||
if ((cal.get(Calendar.HOUR_OF_DAY) >= cal2.get(Calendar.HOUR_OF_DAY)))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue