IDEMPIERE-791 Dates used in request calendar not visible in request

This commit is contained in:
Richard Morales 2013-05-29 15:56:56 -05:00
parent bac21921ee
commit 4221d1907a
3 changed files with 131 additions and 11 deletions

View File

@ -0,0 +1,52 @@
-- Apr 10, 2013 9:58:31 AM COT
-- IDEMPIERE-791, Dates used in request calendar not visible in request
INSERT INTO AD_Field (ColumnSpan,SortNo,IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,EntityType,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,CreatedBy,Updated,IsActive,IsDisplayedGrid,SeqNoGrid,XPosition,IsQuickEntry,AD_Client_ID,NumLines) VALUES (1,0,'N',402,0,'N','N',14726,560,'Y',201896,'N','Date when the task is planned to be complete','D','Planned Completion Date','Complete Plan','5180aa2f-2af0-4421-ae30-02328180bafe','Y','N',100,0,TO_DATE('2013-04-10 09:58:30','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2013-04-10 09:58:30','YYYY-MM-DD HH24:MI:SS'),'Y','Y',540,1,'N',0,1)
;
-- Apr 10, 2013 9:58:31 AM COT
-- IDEMPIERE-791, Dates used in request calendar not visible in request
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Field_Trl_UU ) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=201896 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- Apr 10, 2013 10:03:54 AM COT
-- IDEMPIERE-791, Dates used in request calendar not visible in request
INSERT INTO AD_Field (ColumnSpan,SortNo,IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,EntityType,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,CreatedBy,Updated,IsActive,IsDisplayedGrid,SeqNoGrid,XPosition,IsQuickEntry,AD_Client_ID,NumLines) VALUES (1,0,'N',402,0,'N','N',14734,570,'Y',201897,'N','Date when you plan to start','D','Planned Start Date','Start Plan','c318610c-187c-467a-885f-457b8d0d5209','Y','N',100,0,TO_DATE('2013-04-10 10:03:53','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2013-04-10 10:03:53','YYYY-MM-DD HH24:MI:SS'),'Y','Y',550,1,'N',0,1)
;
-- Apr 10, 2013 10:03:54 AM COT
-- IDEMPIERE-791, Dates used in request calendar not visible in request
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Field_Trl_UU ) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=201897 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- Apr 10, 2013 10:07:11 AM COT
-- IDEMPIERE-791, Dates used in request calendar not visible in request
UPDATE AD_Field SET SeqNo=130, IsDisplayed='Y', XPosition=1,Updated=TO_DATE('2013-04-10 10:07:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201897
;
-- Apr 10, 2013 10:07:11 AM COT
-- IDEMPIERE-791, Dates used in request calendar not visible in request
UPDATE AD_Field SET SeqNo=140, IsDisplayed='Y', XPosition=4,Updated=TO_DATE('2013-04-10 10:07:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201896
;
-- Apr 10, 2013 10:07:45 AM COT
-- IDEMPIERE-791, Dates used in request calendar not visible in request
UPDATE AD_Column SET AD_Reference_ID=16,Updated=TO_DATE('2013-04-10 10:07:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=14726
;
-- Apr 10, 2013 10:07:59 AM COT
-- IDEMPIERE-791, Dates used in request calendar not visible in request
UPDATE AD_Column SET AD_Reference_ID=16,Updated=TO_DATE('2013-04-10 10:07:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=14734
;
-- Apr 10, 2013 10:08:56 AM COT
-- IDEMPIERE-791, Dates used in request calendar not visible in request
UPDATE AD_Field SET ColumnSpan=2, SeqNo=130,Updated=TO_DATE('2013-04-10 10:08:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201897
;
-- Apr 10, 2013 10:08:56 AM COT
-- IDEMPIERE-791, Dates used in request calendar not visible in request
UPDATE AD_Field SET ColumnSpan=2, SeqNo=140,Updated=TO_DATE('2013-04-10 10:08:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201896
;
SELECT register_migration_script('201304101012_IDEMPIERE-791.sql') FROM dual;

View File

@ -0,0 +1,52 @@
-- Apr 10, 2013 9:58:31 AM COT
-- IDEMPIERE-791, Dates used in request calendar not visible in request
INSERT INTO AD_Field (ColumnSpan,SortNo,IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,EntityType,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,CreatedBy,Updated,IsActive,IsDisplayedGrid,SeqNoGrid,XPosition,IsQuickEntry,AD_Client_ID,NumLines) VALUES (1,0,'N',402,0,'N','N',14726,560,'Y',201896,'N','Date when the task is planned to be complete','D','Planned Completion Date','Complete Plan','5180aa2f-2af0-4421-ae30-02328180bafe','Y','N',100,0,TO_TIMESTAMP('2013-04-10 09:58:30','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2013-04-10 09:58:30','YYYY-MM-DD HH24:MI:SS'),'Y','Y',540,1,'N',0,1)
;
-- Apr 10, 2013 9:58:31 AM COT
-- IDEMPIERE-791, Dates used in request calendar not visible in request
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Field_Trl_UU ) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=201896 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- Apr 10, 2013 10:03:54 AM COT
-- IDEMPIERE-791, Dates used in request calendar not visible in request
INSERT INTO AD_Field (ColumnSpan,SortNo,IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,EntityType,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,CreatedBy,Updated,IsActive,IsDisplayedGrid,SeqNoGrid,XPosition,IsQuickEntry,AD_Client_ID,NumLines) VALUES (1,0,'N',402,0,'N','N',14734,570,'Y',201897,'N','Date when you plan to start','D','Planned Start Date','Start Plan','c318610c-187c-467a-885f-457b8d0d5209','Y','N',100,0,TO_TIMESTAMP('2013-04-10 10:03:53','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2013-04-10 10:03:53','YYYY-MM-DD HH24:MI:SS'),'Y','Y',550,1,'N',0,1)
;
-- Apr 10, 2013 10:03:54 AM COT
-- IDEMPIERE-791, Dates used in request calendar not visible in request
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Field_Trl_UU ) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=201897 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- Apr 10, 2013 10:07:11 AM COT
-- IDEMPIERE-791, Dates used in request calendar not visible in request
UPDATE AD_Field SET SeqNo=130, IsDisplayed='Y', XPosition=1,Updated=TO_TIMESTAMP('2013-04-10 10:07:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201897
;
-- Apr 10, 2013 10:07:11 AM COT
-- IDEMPIERE-791, Dates used in request calendar not visible in request
UPDATE AD_Field SET SeqNo=140, IsDisplayed='Y', XPosition=4,Updated=TO_TIMESTAMP('2013-04-10 10:07:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201896
;
-- Apr 10, 2013 10:07:45 AM COT
-- IDEMPIERE-791, Dates used in request calendar not visible in request
UPDATE AD_Column SET AD_Reference_ID=16,Updated=TO_TIMESTAMP('2013-04-10 10:07:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=14726
;
-- Apr 10, 2013 10:07:59 AM COT
-- IDEMPIERE-791, Dates used in request calendar not visible in request
UPDATE AD_Column SET AD_Reference_ID=16,Updated=TO_TIMESTAMP('2013-04-10 10:07:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=14734
;
-- Apr 10, 2013 10:08:56 AM COT
-- IDEMPIERE-791, Dates used in request calendar not visible in request
UPDATE AD_Field SET ColumnSpan=2, SeqNo=130,Updated=TO_TIMESTAMP('2013-04-10 10:08:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201897
;
-- Apr 10, 2013 10:08:56 AM COT
-- IDEMPIERE-791, Dates used in request calendar not visible in request
UPDATE AD_Field SET ColumnSpan=2, SeqNo=140,Updated=TO_TIMESTAMP('2013-04-10 10:08:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201896
;
SELECT register_migration_script('201304101012_IDEMPIERE-791.sql') FROM dual;

View File

@ -75,6 +75,7 @@ public class RequestWindow extends Window implements EventListener<Event> {
private ConfirmPanel confirmPanel;
private Window parent;
private Calendar calBegin,calEnd;
public RequestWindow(CalendarsEvent ce, Window parent) {
@ -282,7 +283,7 @@ public class RequestWindow extends Window implements EventListener<Event> {
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))
if (checkTime())
throw new WrongValueException(tbxStartTime, Msg.translate(Env.getCtx(), "CheckTime"));
MRequest request = new MRequest(Env.getCtx(), 0, null);
@ -294,10 +295,10 @@ public class RequestWindow extends Window implements EventListener<Event> {
request.setConfidentialType((String) confidentialField.getValue());
request.setSalesRep_ID((Integer) salesRepField.getValue());
request.setConfidentialTypeEntry((String) entryConfidentialField.getValue());
request.setDateStartPlan(new Timestamp(dbxStartPlan.getValue().getTime()));
request.setDateCompletePlan(new Timestamp(dbxCompletePlan.getValue().getTime()));
request.setStartTime(new Timestamp(tbxStartTime.getValue().getTime()));
request.setEndTime(new Timestamp(tbxEndTime.getValue().getTime()));
request.setDateStartPlan(new Timestamp(calBegin.getTimeInMillis()));
request.setDateCompletePlan(new Timestamp(calEnd.getTimeInMillis()));
request.setStartTime(new Timestamp(calBegin.getTimeInMillis()));
request.setEndTime(new Timestamp(calEnd.getTimeInMillis()));
if (request.save())
{
@ -320,13 +321,28 @@ public class RequestWindow extends Window implements EventListener<Event> {
//Check, Start time is not >= End time, when Start Plan == Complete Plan
private boolean checkTime()
{
Calendar cal =Calendar.getInstance();
cal.setTimeInMillis(tbxStartTime.getValue().getTime());
calBegin = Calendar.getInstance();
calBegin.setTime(dbxStartPlan.getValue());
Calendar cal1 = Calendar.getInstance();
cal1.setTimeInMillis(tbxStartTime.getValue().getTime());
calBegin.set(Calendar.HOUR_OF_DAY, cal1.get(Calendar.HOUR_OF_DAY));
calBegin.set(Calendar.MINUTE, cal1.get(Calendar.MINUTE));
calBegin.set(Calendar.SECOND, 0);
calBegin.set(Calendar.MILLISECOND, 0);
calEnd = Calendar.getInstance();
calEnd.setTime(dbxCompletePlan.getValue());
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
cal2.setTimeInMillis(tbxEndTime.getValue().getTime());
calEnd.set(Calendar.HOUR_OF_DAY, cal2.get(Calendar.HOUR_OF_DAY));
calEnd.set(Calendar.MINUTE, cal2.get(Calendar.MINUTE));
calEnd.set(Calendar.SECOND, 0);
calEnd.set(Calendar.MILLISECOND, 0);
if ((cal1.get(Calendar.HOUR_OF_DAY) >= cal2.get(Calendar.HOUR_OF_DAY)) && (dbxStartPlan.getValue().compareTo(dbxCompletePlan.getValue()) == 0)) {
return true;
} else {
return false;
}
}
}