hg merge 74e4fd07adbb

This commit is contained in:
Carlos Ruiz 2012-10-19 14:52:26 -05:00
commit ee00a36ae6
81 changed files with 5642 additions and 1375 deletions

View File

@ -19,7 +19,7 @@ CREATE OR REPLACE VIEW AD_FIELD_V AS
c.IsAutocomplete, COALESCE(f.IsAllowCopy, c.IsAllowCopy) AS IsAllowCopy, c.IsAutocomplete, COALESCE(f.IsAllowCopy, c.IsAllowCopy) AS IsAllowCopy,
f.isdisplayedgrid, f.isdisplayedgrid,
f.seqnogrid, f.seqnogrid,
c.seqnoselection, f.xposition, f.columnspan, f.numlines c.seqnoselection, f.xposition, f.columnspan, f.numlines, c.isToolbarButton
FROM AD_FIELD f FROM AD_FIELD f
INNER JOIN AD_TAB t ON (f.AD_Tab_ID = t.AD_Tab_ID) INNER JOIN AD_TAB t ON (f.AD_Tab_ID = t.AD_Tab_ID)
LEFT OUTER JOIN AD_FIELDGROUP fg ON (f.AD_FieldGroup_ID = fg.AD_FieldGroup_ID) LEFT OUTER JOIN AD_FIELDGROUP fg ON (f.AD_FieldGroup_ID = fg.AD_FieldGroup_ID)

View File

@ -18,7 +18,7 @@ CREATE OR REPLACE VIEW AD_FIELD_VT AS
c.IsAutocomplete, COALESCE(f.IsAllowCopy, c.IsAllowCopy) AS IsAllowCopy, c.IsAutocomplete, COALESCE(f.IsAllowCopy, c.IsAllowCopy) AS IsAllowCopy,
f.isdisplayedgrid, f.isdisplayedgrid,
f.seqnogrid, f.seqnogrid,
c.seqnoselection, f.xposition, f.columnspan, f.numlines c.seqnoselection, f.xposition, f.columnspan, f.numlines, c.isToolbarButton
FROM AD_FIELD f FROM AD_FIELD f
INNER JOIN AD_FIELD_TRL trl ON (f.AD_Field_ID = trl.AD_Field_ID) INNER JOIN AD_FIELD_TRL trl ON (f.AD_Field_ID = trl.AD_Field_ID)
INNER JOIN AD_TAB t ON (f.AD_Tab_ID = t.AD_Tab_ID) INNER JOIN AD_TAB t ON (f.AD_Tab_ID = t.AD_Tab_ID)

View File

@ -0,0 +1,8 @@
CREATE OR REPLACE VIEW ad_sessioninfo_v AS
SELECT s.ad_session_id,0 as ad_client_id,0 as ad_org_id, s.isactive,
s.created, s.createdby, s.updated, s.updatedby, s.websession,
s.remote_addr, s.remote_host, s.ad_role_id, s.logindate, s.ad_session_uu,
s.servername, s.ad_client_id AS login_client_id,createdby as ad_user_id,s.ad_org_id as login_org_id,s.ad_session_id as ad_sessioninfo_v_id,
s.ad_session_uu as ad_sessioninfo_v_uu
FROM ad_session s
WHERE s.processed = 'N';

View File

@ -15,7 +15,7 @@ CREATE OR REPLACE VIEW ad_field_v AS
COALESCE(f.IsAllowCopy, c.IsAllowCopy) AS IsAllowCopy, COALESCE(f.IsAllowCopy, c.IsAllowCopy) AS IsAllowCopy,
f.isdisplayedgrid, f.isdisplayedgrid,
f.seqnogrid, f.seqnogrid,
c.seqnoselection, f.xposition, f.columnspan, f.numlines c.seqnoselection, f.xposition, f.columnspan, f.numlines, c.isToolbarButton
FROM ad_field f FROM ad_field f
JOIN ad_tab t ON f.ad_tab_id = t.ad_tab_id JOIN ad_tab t ON f.ad_tab_id = t.ad_tab_id
LEFT JOIN ad_fieldgroup fg ON f.ad_fieldgroup_id = fg.ad_fieldgroup_id LEFT JOIN ad_fieldgroup fg ON f.ad_fieldgroup_id = fg.ad_fieldgroup_id

View File

@ -10,7 +10,7 @@ CREATE OR REPLACE VIEW ad_field_vt AS
COALESCE(f.IsAllowCopy, c.IsAllowCopy) AS IsAllowCopy, COALESCE(f.IsAllowCopy, c.IsAllowCopy) AS IsAllowCopy,
f.isdisplayedgrid, f.isdisplayedgrid,
f.seqnogrid, f.seqnogrid,
c.seqnoselection, f.xposition, f.columnspan, f.numlines c.seqnoselection, f.xposition, f.columnspan, f.numlines, c.isToolbarButton
FROM ad_field f FROM ad_field f
JOIN ad_field_trl trl ON f.ad_field_id = trl.ad_field_id JOIN ad_field_trl trl ON f.ad_field_id = trl.ad_field_id
JOIN ad_tab t ON f.ad_tab_id = t.ad_tab_id JOIN ad_tab t ON f.ad_tab_id = t.ad_tab_id

View File

@ -0,0 +1,8 @@
CREATE OR REPLACE VIEW ad_sessioninfo_v AS
SELECT s.ad_session_id, 0::numeric(10,0) AS ad_client_id, 0::numeric(10,0) AS ad_org_id, s.isactive,
s.created, s.createdby, s.updated, s.updatedby, s.websession,
s.remote_addr, s.remote_host, s.ad_role_id, s.logindate, s.ad_session_uu,
s.servername, s.ad_client_id AS login_client_id,createdby as ad_user_id,s.ad_org_id as login_org_id,s.ad_session_id as ad_sessioninfo_v_id,
s.ad_session_uu as ad_sessioninfo_v_uu
FROM ad_session s
WHERE s.processed = 'N'::bpchar;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,365 @@
-- Oct 19, 2012 2:04:03 PM MYT
-- IDEMPIERE-234 Configure Toolbar
INSERT INTO AD_Element (ColumnName,AD_Client_ID,Created,Updated,EntityType,PrintName,AD_Element_UU,AD_Element_ID,Help,Name,Description,AD_Org_ID,CreatedBy,UpdatedBy,IsActive) VALUES ('IsToolbarButton',0,TO_DATE('2012-10-19 14:04:01','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2012-10-19 14:04:01','YYYY-MM-DD HH24:MI:SS'),'D','Toolbar Button','3c610247-e801-43ff-a7f7-9540f04150fa',200187,'There IsToolbarButton check box indicates if this column button is part of the toolbar''s process button popup list or render as field.','Toolbar Button','Add the column button to the toolbar',0,100,100,'Y')
;
-- Oct 19, 2012 2:04:03 PM MYT
-- IDEMPIERE-234 Configure Toolbar
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, PO_Description,PO_Help,PrintName,PO_Name,PO_PrintName,Help,Name,Description, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Element_Trl_UU ) SELECT l.AD_Language,t.AD_Element_ID, t.PO_Description,t.PO_Help,t.PrintName,t.PO_Name,t.PO_PrintName,t.Help,t.Name,t.Description, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=200187 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- Oct 19, 2012 2:06:09 PM MYT
-- IDEMPIERE-234 Configure Toolbar
INSERT INTO AD_Column (Version,AD_Table_ID,EntityType,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,CreatedBy,Updated,AD_Org_ID,IsActive,IsAutocomplete,IsAllowLogging,Created,IsUpdateable,AD_Column_UU,IsAlwaysUpdateable,Help,IsAllowCopy,UpdatedBy,DefaultValue,IsEncrypted,ColumnName,Description,Name,AD_Client_ID,AD_Column_ID,SeqNoSelection) VALUES (1,101,'D','Y','N','N',0,'N',1,'N',20,'N','N',200187,100,TO_DATE('2012-10-19 14:06:08','YYYY-MM-DD HH24:MI:SS'),0,'Y','N','Y',TO_DATE('2012-10-19 14:06:08','YYYY-MM-DD HH24:MI:SS'),'Y','0a289e70-0e89-449c-b748-f337a6bff84e','N','There IsToolbarButton check box indicates if this column button is part of the toolbar''s process button popup list or render as field.','Y',100,'Y','N','IsToolbarButton','Add the column button to the toolbar','Toolbar Button',0,200703,0)
;
-- Oct 19, 2012 2:06:09 PM MYT
-- IDEMPIERE-234 Configure Toolbar
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Column_Trl_UU ) SELECT l.AD_Language,t.AD_Column_ID, 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_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200703 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 19, 2012 2:09:23 PM MYT
-- IDEMPIERE-234 Configure Toolbar
INSERT INTO AD_Field (SortNo,IsEncrypted,AD_Tab_ID,IsSameLine,IsHeading,AD_Column_ID,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,UpdatedBy,AD_Org_ID,Created,AD_Client_ID,Help,CreatedBy,Updated,EntityType,IsDisplayed,IsFieldOnly,IsDisplayedGrid,SeqNoGrid,AD_Field_UU,DisplayLength,DisplayLogic,Description,Name,IsActive,XPosition,ColumnSpan,NumLines) VALUES (0,'N',101,'N','N',200703,420,'Y',200648,'N',100,0,TO_DATE('2012-10-19 14:09:21','YYYY-MM-DD HH24:MI:SS'),0,'There IsToolbarButton check box indicates if this column button is part of the toolbar''s process button popup list or render as field.',100,TO_DATE('2012-10-19 14:09:21','YYYY-MM-DD HH24:MI:SS'),'D','Y','N','Y',400,'452b8d03-a4f0-4597-a30c-24e525f90590',0,'@AD_Reference_ID@=28','Add the column button to the toolbar','Toolbar Button','Y',2,1,1)
;
-- Oct 19, 2012 2:09:23 PM MYT
-- IDEMPIERE-234 Configure Toolbar
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=200648 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)
;
-- Oct 19, 2012 2:09:37 PM MYT
-- IDEMPIERE-234 Configure Toolbar
ALTER TABLE AD_Column ADD IsToolbarButton CHAR(1) DEFAULT 'Y' CHECK (IsToolbarButton IN ('Y','N')) NOT NULL
;
UPDATE AD_Column SET IsToolbarButton='N' WHERE AD_Reference_ID != 28;
CREATE OR REPLACE VIEW AD_FIELD_V AS
SELECT t.AD_Window_ID, f.AD_Tab_ID, f.AD_Field_ID, tbl.AD_Table_ID, f.AD_Column_ID,
f.NAME, f.Description, f.Help, f.IsDisplayed, f.DisplayLogic, f.DisplayLength,
f.SeqNo, f.SortNo, f.IsSameLine, f.IsHeading, f.IsFieldOnly, f.IsReadOnly,
f.IsEncrypted AS IsEncryptedField, f.ObscureType,
c.ColumnName, c.ColumnSQL, c.FieldLength, c.VFormat,
COALESCE(f.DefaultValue, c.DefaultValue) AS DefaultValue,
c.IsKey, c.IsParent,
COALESCE(f.IsMandatory, c.IsMandatory) AS IsMandatory,
c.IsIdentifier, c.IsTranslated, COALESCE(f.AD_Reference_Value_ID, c.AD_Reference_Value_ID) AS AD_Reference_Value_ID,
c.Callout, COALESCE(f.AD_Reference_ID, c.AD_Reference_ID) AS AD_Reference_ID,
COALESCE(f.AD_Val_Rule_ID, c.AD_Val_Rule_ID) AS AD_Val_Rule_ID, c.AD_Process_ID, c.IsAlwaysUpdateable,
c.ReadOnlyLogic, c.MandatoryLogic, c.IsUpdateable, c.IsEncrypted AS IsEncryptedColumn,
c.IsSelectionColumn,
tbl.TableName, c.ValueMin, c.ValueMax,
fg.NAME AS FieldGroup, vr.Code AS ValidationCode,
f.Included_Tab_ID, fg.FieldGroupType, fg.IsCollapsedByDefault,
COALESCE(f.InfoFactoryClass, c.InfoFactoryClass) as InfoFactoryClass,
c.IsAutocomplete, COALESCE(f.IsAllowCopy, c.IsAllowCopy) AS IsAllowCopy,
f.isdisplayedgrid,
f.seqnogrid,
c.seqnoselection, f.xposition, f.columnspan, f.numlines, c.isToolbarButton
FROM AD_FIELD f
INNER JOIN AD_TAB t ON (f.AD_Tab_ID = t.AD_Tab_ID)
LEFT OUTER JOIN AD_FIELDGROUP fg ON (f.AD_FieldGroup_ID = fg.AD_FieldGroup_ID)
LEFT OUTER JOIN AD_COLUMN c ON (f.AD_Column_ID = c.AD_Column_ID)
INNER JOIN AD_TABLE tbl ON (c.AD_Table_ID = tbl.AD_Table_ID)
INNER JOIN AD_REFERENCE r ON (c.AD_Reference_ID = r.AD_Reference_ID)
LEFT OUTER JOIN AD_VAL_RULE vr ON (vr.AD_Val_Rule_ID = COALESCE(f.AD_Val_Rule_ID, c.AD_Val_Rule_ID))
WHERE f.IsActive = 'Y'
AND c.IsActive = 'Y';
CREATE OR REPLACE VIEW AD_FIELD_VT AS
SELECT trl.AD_LANGUAGE, t.AD_Window_ID, f.AD_Tab_ID, f.AD_Field_ID, tbl.AD_Table_ID, f.AD_Column_ID,
trl.NAME, trl.Description, trl.Help, f.IsDisplayed, f.DisplayLogic, f.DisplayLength,
f.SeqNo, f.SortNo, f.IsSameLine, f.IsHeading, f.IsFieldOnly, f.IsReadOnly,
f.IsEncrypted AS IsEncryptedField, f.ObscureType,
c.ColumnName, c.ColumnSQL, c.FieldLength, c.VFormat,
COALESCE(f.DefaultValue, c.DefaultValue) AS DefaultValue,
c.IsKey, c.IsParent,
COALESCE(f.IsMandatory, c.IsMandatory) AS IsMandatory,
c.IsIdentifier, c.IsTranslated, COALESCE(f.AD_Reference_Value_ID, c.AD_Reference_Value_ID) AS AD_Reference_Value_ID,
c.Callout, COALESCE(f.AD_Reference_ID, c.AD_Reference_ID) AS AD_Reference_ID,
COALESCE(f.AD_Val_Rule_ID, c.AD_Val_Rule_ID) as AD_Val_Rule_ID, c.AD_Process_ID, c.IsAlwaysUpdateable,
c.ReadOnlyLogic, c.MandatoryLogic, c.IsUpdateable, c.IsEncrypted AS IsEncryptedColumn, c.IsSelectionColumn,
tbl.TableName, c.ValueMin, c.ValueMax,
fgt.NAME AS FieldGroup, vr.Code AS ValidationCode,
f.Included_Tab_ID, fg.FieldGroupType, fg.IsCollapsedByDefault,
COALESCE(f.InfoFactoryClass, c.InfoFactoryClass) as InfoFactoryClass,
c.IsAutocomplete, COALESCE(f.IsAllowCopy, c.IsAllowCopy) AS IsAllowCopy,
f.isdisplayedgrid,
f.seqnogrid,
c.seqnoselection, f.xposition, f.columnspan, f.numlines, c.isToolbarButton
FROM AD_FIELD f
INNER JOIN AD_FIELD_TRL trl ON (f.AD_Field_ID = trl.AD_Field_ID)
INNER JOIN AD_TAB t ON (f.AD_Tab_ID = t.AD_Tab_ID)
LEFT OUTER JOIN AD_FIELDGROUP fg ON (f.AD_FieldGroup_ID = fg.AD_FieldGroup_ID)
LEFT OUTER JOIN AD_FIELDGROUP_TRL fgt ON
(f.AD_FieldGroup_ID = fgt.AD_FieldGroup_ID AND trl.AD_LANGUAGE=fgt.AD_LANGUAGE)
LEFT OUTER JOIN AD_COLUMN c ON (f.AD_Column_ID = c.AD_Column_ID)
INNER JOIN AD_TABLE tbl ON (c.AD_Table_ID = tbl.AD_Table_ID)
INNER JOIN AD_REFERENCE r ON (c.AD_Reference_ID = r.AD_Reference_ID)
LEFT OUTER JOIN AD_VAL_RULE vr ON (vr.AD_Val_Rule_ID=COALESCE(f.AD_Val_Rule_ID, c.AD_Val_Rule_ID))
WHERE f.IsActive = 'Y'
AND c.IsActive = 'Y';
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=200,IsDisplayed='Y' WHERE AD_Field_ID=200648
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=210,IsDisplayed='Y' WHERE AD_Field_ID=54403
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=220,IsDisplayed='Y' WHERE AD_Field_ID=2574
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=230,IsDisplayed='Y' WHERE AD_Field_ID=2573
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=240,IsDisplayed='Y' WHERE AD_Field_ID=160
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=250,IsDisplayed='Y' WHERE AD_Field_ID=161
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=260,IsDisplayed='Y' WHERE AD_Field_ID=162
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=270,IsDisplayed='Y' WHERE AD_Field_ID=166
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=280,IsDisplayed='Y' WHERE AD_Field_ID=2370
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=290,IsDisplayed='Y' WHERE AD_Field_ID=169
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=300,IsDisplayed='Y' WHERE AD_Field_ID=10128
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=310,IsDisplayed='Y' WHERE AD_Field_ID=4941
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=320,IsDisplayed='Y' WHERE AD_Field_ID=50188
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=330,IsDisplayed='Y' WHERE AD_Field_ID=168
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=340,IsDisplayed='Y' WHERE AD_Field_ID=159
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=350,IsDisplayed='Y' WHERE AD_Field_ID=825
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=360,IsDisplayed='Y' WHERE AD_Field_ID=4940
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=370,IsDisplayed='Y' WHERE AD_Field_ID=200288
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=380,IsDisplayed='Y' WHERE AD_Field_ID=167
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=390,IsDisplayed='Y' WHERE AD_Field_ID=5121
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=400,IsDisplayed='Y' WHERE AD_Field_ID=56317
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=410,IsDisplayed='Y' WHERE AD_Field_ID=62467
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=420,IsDisplayed='Y' WHERE AD_Field_ID=5122
;
-- Oct 19, 2012 8:18:29 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET XPosition=1,Updated=TO_DATE('2012-10-19 20:18:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=54403
;
-- Oct 19, 2012 8:24:01 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=190,IsDisplayed='Y' WHERE AD_Field_ID=200648
;
-- Oct 19, 2012 8:24:01 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=200,IsDisplayed='Y' WHERE AD_Field_ID=171
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=170,IsDisplayedGrid='Y' WHERE AD_Field_ID=56374
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=180,IsDisplayedGrid='Y' WHERE AD_Field_ID=2526
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=190,IsDisplayedGrid='Y' WHERE AD_Field_ID=200648
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=200,IsDisplayedGrid='Y' WHERE AD_Field_ID=171
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=210,IsDisplayedGrid='Y' WHERE AD_Field_ID=54403
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=220,IsDisplayedGrid='Y' WHERE AD_Field_ID=2574
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=230,IsDisplayedGrid='Y' WHERE AD_Field_ID=2573
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=240,IsDisplayedGrid='Y' WHERE AD_Field_ID=160
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=250,IsDisplayedGrid='Y' WHERE AD_Field_ID=161
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=260,IsDisplayedGrid='Y' WHERE AD_Field_ID=162
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=270,IsDisplayedGrid='Y' WHERE AD_Field_ID=166
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=280,IsDisplayedGrid='Y' WHERE AD_Field_ID=2370
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=290,IsDisplayedGrid='Y' WHERE AD_Field_ID=169
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=300,IsDisplayedGrid='Y' WHERE AD_Field_ID=10128
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=310,IsDisplayedGrid='Y' WHERE AD_Field_ID=4941
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=320,IsDisplayedGrid='Y' WHERE AD_Field_ID=50188
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=330,IsDisplayedGrid='Y' WHERE AD_Field_ID=168
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=340,IsDisplayedGrid='Y' WHERE AD_Field_ID=159
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=350,IsDisplayedGrid='Y' WHERE AD_Field_ID=825
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=360,IsDisplayedGrid='Y' WHERE AD_Field_ID=4940
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=370,IsDisplayedGrid='Y' WHERE AD_Field_ID=167
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=380,IsDisplayedGrid='Y' WHERE AD_Field_ID=5121
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=390,IsDisplayedGrid='Y' WHERE AD_Field_ID=56317
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=400,IsDisplayedGrid='Y' WHERE AD_Field_ID=62467
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=410,IsDisplayedGrid='Y' WHERE AD_Field_ID=5122
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=420,IsDisplayedGrid='Y' WHERE AD_Field_ID=200288
;
SELECT register_migration_script('938_IDEMPIERE-234.sql') FROM dual
;

View File

@ -0,0 +1,62 @@
-- Oct 19, 2012 4:08:01 PM SGT
-- IDEMPIERE-392 Redesign payment button
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','Failed to create payment',200077,'D','da079a31-b0e8-4e39-8d06-5861235240cd','PaymentNotCreated','Y',TO_DATE('2012-10-19 16:08:00','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-10-19 16:08:00','YYYY-MM-DD HH24:MI:SS'))
;
-- Oct 19, 2012 4:08:05 PM SGT
-- IDEMPIERE-392 Redesign payment button
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=200077 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)
;
-- Oct 19, 2012 4:08:20 PM SGT
-- IDEMPIERE-392 Redesign payment button
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','Failed to cancel payment',200078,'D','147fef6f-7a60-4579-9b20-2bcb1836cbbb','PaymentNotCancelled','Y',TO_DATE('2012-10-19 16:08:20','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-10-19 16:08:20','YYYY-MM-DD HH24:MI:SS'))
;
-- Oct 19, 2012 4:08:20 PM SGT
-- IDEMPIERE-392 Redesign payment button
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=200078 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)
;
-- Oct 19, 2012 4:09:32 PM SGT
-- IDEMPIERE-392 Redesign payment button
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','Failed to create cash',200079,'D','2a395bb4-e2cc-4c5c-ad6c-e5d96bb8b16e','CashNotCancelled','Y',TO_DATE('2012-10-19 16:09:31','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-10-19 16:09:31','YYYY-MM-DD HH24:MI:SS'))
;
-- Oct 19, 2012 4:09:32 PM SGT
-- IDEMPIERE-392 Redesign payment button
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=200079 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)
;
-- Oct 19, 2012 4:09:57 PM SGT
-- IDEMPIERE-392 Redesign payment button
UPDATE AD_Message SET MsgText='Failed to cancel cash',Updated=TO_DATE('2012-10-19 16:09:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=200079
;
-- Oct 19, 2012 4:09:57 PM SGT
-- IDEMPIERE-392 Redesign payment button
UPDATE AD_Message_Trl SET IsTranslated='N' WHERE AD_Message_ID=200079
;
-- Oct 19, 2012 4:10:18 PM SGT
-- IDEMPIERE-392 Redesign payment button
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','Failed to create cash',200080,'D','9a1b19b9-03a4-4a94-a4be-3c330e6ef800','CashNotCreated','Y',TO_DATE('2012-10-19 16:10:18','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-10-19 16:10:18','YYYY-MM-DD HH24:MI:SS'))
;
-- Oct 19, 2012 4:10:18 PM SGT
-- IDEMPIERE-392 Redesign payment button
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=200080 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)
;
-- Oct 19, 2012 4:10:55 PM SGT
-- IDEMPIERE-392 Redesign payment button
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','Card not processed',200081,'D','743abddc-b21d-4317-b959-9e7dba185313','CardNotProcessed','Y',TO_DATE('2012-10-19 16:10:55','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-10-19 16:10:55','YYYY-MM-DD HH24:MI:SS'))
;
-- Oct 19, 2012 4:10:55 PM SGT
-- IDEMPIERE-392 Redesign payment button
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=200081 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('940_IDEMPIERE-392.sql') FROM dual
;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,351 @@
-- Oct 19, 2012 2:04:03 PM MYT
-- IDEMPIERE-234 Configure Toolbar
INSERT INTO AD_Element (ColumnName,AD_Client_ID,Created,Updated,EntityType,PrintName,AD_Element_UU,AD_Element_ID,Help,Name,Description,AD_Org_ID,CreatedBy,UpdatedBy,IsActive) VALUES ('IsToolbarButton',0,TO_TIMESTAMP('2012-10-19 14:04:01','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2012-10-19 14:04:01','YYYY-MM-DD HH24:MI:SS'),'D','Toolbar Button','3c610247-e801-43ff-a7f7-9540f04150fa',200187,'There IsToolbarButton check box indicates if this column button is part of the toolbar''s process button popup list or render as field.','Toolbar Button','Add the column button to the toolbar',0,100,100,'Y')
;
-- Oct 19, 2012 2:04:03 PM MYT
-- IDEMPIERE-234 Configure Toolbar
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, PO_Description,PO_Help,PrintName,PO_Name,PO_PrintName,Help,Name,Description, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Element_Trl_UU ) SELECT l.AD_Language,t.AD_Element_ID, t.PO_Description,t.PO_Help,t.PrintName,t.PO_Name,t.PO_PrintName,t.Help,t.Name,t.Description, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=200187 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- Oct 19, 2012 2:06:09 PM MYT
-- IDEMPIERE-234 Configure Toolbar
INSERT INTO AD_Column (Version,AD_Table_ID,EntityType,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,CreatedBy,Updated,AD_Org_ID,IsActive,IsAutocomplete,IsAllowLogging,Created,IsUpdateable,AD_Column_UU,IsAlwaysUpdateable,Help,IsAllowCopy,UpdatedBy,DefaultValue,IsEncrypted,ColumnName,Description,Name,AD_Client_ID,AD_Column_ID,SeqNoSelection) VALUES (1,101,'D','Y','N','N',0,'N',1,'N',20,'N','N',200187,100,TO_TIMESTAMP('2012-10-19 14:06:08','YYYY-MM-DD HH24:MI:SS'),0,'Y','N','Y',TO_TIMESTAMP('2012-10-19 14:06:08','YYYY-MM-DD HH24:MI:SS'),'Y','0a289e70-0e89-449c-b748-f337a6bff84e','N','There IsToolbarButton check box indicates if this column button is part of the toolbar''s process button popup list or render as field.','Y',100,'Y','N','IsToolbarButton','Add the column button to the toolbar','Toolbar Button',0,200703,0)
;
-- Oct 19, 2012 2:06:09 PM MYT
-- IDEMPIERE-234 Configure Toolbar
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Column_Trl_UU ) SELECT l.AD_Language,t.AD_Column_ID, 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_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200703 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 19, 2012 2:09:23 PM MYT
-- IDEMPIERE-234 Configure Toolbar
INSERT INTO AD_Field (SortNo,IsEncrypted,AD_Tab_ID,IsSameLine,IsHeading,AD_Column_ID,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,UpdatedBy,AD_Org_ID,Created,AD_Client_ID,Help,CreatedBy,Updated,EntityType,IsDisplayed,IsFieldOnly,IsDisplayedGrid,SeqNoGrid,AD_Field_UU,DisplayLength,DisplayLogic,Description,Name,IsActive,XPosition,ColumnSpan,NumLines) VALUES (0,'N',101,'N','N',200703,420,'Y',200648,'N',100,0,TO_TIMESTAMP('2012-10-19 14:09:21','YYYY-MM-DD HH24:MI:SS'),0,'There IsToolbarButton check box indicates if this column button is part of the toolbar''s process button popup list or render as field.',100,TO_TIMESTAMP('2012-10-19 14:09:21','YYYY-MM-DD HH24:MI:SS'),'D','Y','N','Y',400,'452b8d03-a4f0-4597-a30c-24e525f90590',0,'@AD_Reference_ID@=28','Add the column button to the toolbar','Toolbar Button','Y',2,1,1)
;
-- Oct 19, 2012 2:09:23 PM MYT
-- IDEMPIERE-234 Configure Toolbar
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=200648 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)
;
-- Oct 19, 2012 2:09:37 PM MYT
-- IDEMPIERE-234 Configure Toolbar
ALTER TABLE AD_Column ADD COLUMN IsToolbarButton CHAR(1) DEFAULT 'Y' CHECK (IsToolbarButton IN ('Y','N')) NOT NULL
;
UPDATE AD_Column SET IsToolbarButton='N' WHERE AD_Reference_ID != 28;
CREATE OR REPLACE VIEW ad_field_v AS
SELECT t.ad_window_id, f.ad_tab_id, f.ad_field_id, tbl.ad_table_id, f.ad_column_id,
f.name, f.description, f.help, f.isdisplayed, f.displaylogic, f.displaylength, f.seqno,
f.sortno, f.issameline, f.isheading, f.isfieldonly, f.isreadonly, f.isencrypted AS isencryptedfield,
f.obscuretype, c.columnname, c.columnsql, c.fieldlength, c.vformat,
COALESCE(f.defaultvalue, c.defaultvalue) AS defaultvalue, c.iskey, c.isparent,
COALESCE(f.ismandatory, c.ismandatory) AS ismandatory, c.isidentifier, c.istranslated,
COALESCE(f.ad_reference_value_id, c.ad_reference_value_id) AS ad_reference_value_id, c.callout,
COALESCE(f.ad_reference_id, c.ad_reference_id) AS ad_reference_id,
COALESCE(f.ad_val_rule_id, c.ad_val_rule_id) AS ad_val_rule_id, c.ad_process_id,
c.isalwaysupdateable, c.readonlylogic, c.mandatorylogic, c.isupdateable,
c.isencrypted AS isencryptedcolumn, c.isselectioncolumn, tbl.tablename, c.valuemin, c.valuemax,
fg.name AS fieldgroup, vr.code AS validationcode, f.included_tab_id, fg.fieldgrouptype, fg.iscollapsedbydefault,
COALESCE(f.infofactoryclass, c.infofactoryclass) AS infofactoryclass, c.isautocomplete,
COALESCE(f.IsAllowCopy, c.IsAllowCopy) AS IsAllowCopy,
f.isdisplayedgrid,
f.seqnogrid,
c.seqnoselection, f.xposition, f.columnspan, f.numlines, c.isToolbarButton
FROM ad_field f
JOIN ad_tab t ON f.ad_tab_id = t.ad_tab_id
LEFT JOIN ad_fieldgroup fg ON f.ad_fieldgroup_id = fg.ad_fieldgroup_id
LEFT JOIN ad_column c ON f.ad_column_id = c.ad_column_id
JOIN ad_table tbl ON c.ad_table_id = tbl.ad_table_id
JOIN ad_reference r ON c.ad_reference_id = r.ad_reference_id
LEFT JOIN ad_val_rule vr ON vr.ad_val_rule_id = COALESCE(f.ad_val_rule_id, c.ad_val_rule_id)
WHERE f.isactive = 'Y'::bpchar AND c.isactive = 'Y'::bpchar;
CREATE OR REPLACE VIEW ad_field_vt AS
SELECT trl.ad_language, t.ad_window_id, f.ad_tab_id, f.ad_field_id, tbl.ad_table_id, f.ad_column_id, trl.name, trl.description,
trl.help, f.isdisplayed, f.displaylogic, f.displaylength, f.seqno, f.sortno, f.issameline, f.isheading, f.isfieldonly, f.isreadonly,
f.isencrypted AS isencryptedfield, f.obscuretype, c.columnname, c.columnsql, c.fieldlength, c.vformat, COALESCE(f.defaultvalue, c.defaultvalue) AS defaultvalue,
c.iskey, c.isparent, COALESCE(f.ismandatory, c.ismandatory) AS ismandatory, c.isidentifier, c.istranslated,
COALESCE(f.ad_reference_value_id, c.ad_reference_value_id) AS ad_reference_value_id, c.callout, COALESCE(f.ad_reference_id, c.ad_reference_id) AS ad_reference_id,
COALESCE(f.ad_val_rule_id, c.ad_val_rule_id) AS ad_val_rule_id, c.ad_process_id, c.isalwaysupdateable, c.readonlylogic, c.mandatorylogic, c.isupdateable,
c.isencrypted AS isencryptedcolumn, c.isselectioncolumn, tbl.tablename, c.valuemin, c.valuemax, fgt.name AS fieldgroup, vr.code AS validationcode,
f.included_tab_id, fg.fieldgrouptype, fg.iscollapsedbydefault, COALESCE(f.infofactoryclass, c.infofactoryclass) AS infofactoryclass, c.isautocomplete,
COALESCE(f.IsAllowCopy, c.IsAllowCopy) AS IsAllowCopy,
f.isdisplayedgrid,
f.seqnogrid,
c.seqnoselection, f.xposition, f.columnspan, f.numlines, c.isToolbarButton
FROM ad_field f
JOIN ad_field_trl trl ON f.ad_field_id = trl.ad_field_id
JOIN ad_tab t ON f.ad_tab_id = t.ad_tab_id
LEFT JOIN ad_fieldgroup fg ON f.ad_fieldgroup_id = fg.ad_fieldgroup_id
LEFT JOIN ad_fieldgroup_trl fgt ON f.ad_fieldgroup_id = fgt.ad_fieldgroup_id AND trl.ad_language::text = fgt.ad_language::text
LEFT JOIN ad_column c ON f.ad_column_id = c.ad_column_id
JOIN ad_table tbl ON c.ad_table_id = tbl.ad_table_id
JOIN ad_reference r ON c.ad_reference_id = r.ad_reference_id
LEFT JOIN ad_val_rule vr ON vr.ad_val_rule_id = COALESCE(f.ad_val_rule_id, c.ad_val_rule_id)
WHERE f.isactive = 'Y'::bpchar AND c.isactive = 'Y'::bpchar;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=200,IsDisplayed='Y' WHERE AD_Field_ID=200648
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=210,IsDisplayed='Y' WHERE AD_Field_ID=54403
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=220,IsDisplayed='Y' WHERE AD_Field_ID=2574
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=230,IsDisplayed='Y' WHERE AD_Field_ID=2573
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=240,IsDisplayed='Y' WHERE AD_Field_ID=160
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=250,IsDisplayed='Y' WHERE AD_Field_ID=161
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=260,IsDisplayed='Y' WHERE AD_Field_ID=162
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=270,IsDisplayed='Y' WHERE AD_Field_ID=166
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=280,IsDisplayed='Y' WHERE AD_Field_ID=2370
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=290,IsDisplayed='Y' WHERE AD_Field_ID=169
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=300,IsDisplayed='Y' WHERE AD_Field_ID=10128
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=310,IsDisplayed='Y' WHERE AD_Field_ID=4941
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=320,IsDisplayed='Y' WHERE AD_Field_ID=50188
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=330,IsDisplayed='Y' WHERE AD_Field_ID=168
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=340,IsDisplayed='Y' WHERE AD_Field_ID=159
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=350,IsDisplayed='Y' WHERE AD_Field_ID=825
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=360,IsDisplayed='Y' WHERE AD_Field_ID=4940
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=370,IsDisplayed='Y' WHERE AD_Field_ID=200288
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=380,IsDisplayed='Y' WHERE AD_Field_ID=167
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=390,IsDisplayed='Y' WHERE AD_Field_ID=5121
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=400,IsDisplayed='Y' WHERE AD_Field_ID=56317
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=410,IsDisplayed='Y' WHERE AD_Field_ID=62467
;
-- Oct 19, 2012 8:15:51 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=420,IsDisplayed='Y' WHERE AD_Field_ID=5122
;
-- Oct 19, 2012 8:18:29 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET XPosition=1,Updated=TO_TIMESTAMP('2012-10-19 20:18:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=54403
;
-- Oct 19, 2012 8:24:01 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=190,IsDisplayed='Y' WHERE AD_Field_ID=200648
;
-- Oct 19, 2012 8:24:01 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNo=200,IsDisplayed='Y' WHERE AD_Field_ID=171
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=170,IsDisplayedGrid='Y' WHERE AD_Field_ID=56374
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=180,IsDisplayedGrid='Y' WHERE AD_Field_ID=2526
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=190,IsDisplayedGrid='Y' WHERE AD_Field_ID=200648
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=200,IsDisplayedGrid='Y' WHERE AD_Field_ID=171
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=210,IsDisplayedGrid='Y' WHERE AD_Field_ID=54403
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=220,IsDisplayedGrid='Y' WHERE AD_Field_ID=2574
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=230,IsDisplayedGrid='Y' WHERE AD_Field_ID=2573
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=240,IsDisplayedGrid='Y' WHERE AD_Field_ID=160
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=250,IsDisplayedGrid='Y' WHERE AD_Field_ID=161
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=260,IsDisplayedGrid='Y' WHERE AD_Field_ID=162
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=270,IsDisplayedGrid='Y' WHERE AD_Field_ID=166
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=280,IsDisplayedGrid='Y' WHERE AD_Field_ID=2370
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=290,IsDisplayedGrid='Y' WHERE AD_Field_ID=169
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=300,IsDisplayedGrid='Y' WHERE AD_Field_ID=10128
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=310,IsDisplayedGrid='Y' WHERE AD_Field_ID=4941
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=320,IsDisplayedGrid='Y' WHERE AD_Field_ID=50188
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=330,IsDisplayedGrid='Y' WHERE AD_Field_ID=168
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=340,IsDisplayedGrid='Y' WHERE AD_Field_ID=159
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=350,IsDisplayedGrid='Y' WHERE AD_Field_ID=825
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=360,IsDisplayedGrid='Y' WHERE AD_Field_ID=4940
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=370,IsDisplayedGrid='Y' WHERE AD_Field_ID=167
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=380,IsDisplayedGrid='Y' WHERE AD_Field_ID=5121
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=390,IsDisplayedGrid='Y' WHERE AD_Field_ID=56317
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=400,IsDisplayedGrid='Y' WHERE AD_Field_ID=62467
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=410,IsDisplayedGrid='Y' WHERE AD_Field_ID=5122
;
-- Oct 19, 2012 8:25:00 PM MYT
-- IDEMPIERE-234 Configure Toolbar
UPDATE AD_Field SET SeqNoGrid=420,IsDisplayedGrid='Y' WHERE AD_Field_ID=200288
;
SELECT register_migration_script('938_IDEMPIERE-234.sql') FROM dual
;

View File

@ -0,0 +1,62 @@
-- Oct 19, 2012 4:08:01 PM SGT
-- IDEMPIERE-392 Redesign payment button
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','Failed to create payment',200077,'D','da079a31-b0e8-4e39-8d06-5861235240cd','PaymentNotCreated','Y',TO_TIMESTAMP('2012-10-19 16:08:00','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-10-19 16:08:00','YYYY-MM-DD HH24:MI:SS'))
;
-- Oct 19, 2012 4:08:05 PM SGT
-- IDEMPIERE-392 Redesign payment button
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=200077 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)
;
-- Oct 19, 2012 4:08:20 PM SGT
-- IDEMPIERE-392 Redesign payment button
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','Failed to cancel payment',200078,'D','147fef6f-7a60-4579-9b20-2bcb1836cbbb','PaymentNotCancelled','Y',TO_TIMESTAMP('2012-10-19 16:08:20','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-10-19 16:08:20','YYYY-MM-DD HH24:MI:SS'))
;
-- Oct 19, 2012 4:08:20 PM SGT
-- IDEMPIERE-392 Redesign payment button
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=200078 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)
;
-- Oct 19, 2012 4:09:32 PM SGT
-- IDEMPIERE-392 Redesign payment button
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','Failed to create cash',200079,'D','2a395bb4-e2cc-4c5c-ad6c-e5d96bb8b16e','CashNotCancelled','Y',TO_TIMESTAMP('2012-10-19 16:09:31','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-10-19 16:09:31','YYYY-MM-DD HH24:MI:SS'))
;
-- Oct 19, 2012 4:09:32 PM SGT
-- IDEMPIERE-392 Redesign payment button
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=200079 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)
;
-- Oct 19, 2012 4:09:57 PM SGT
-- IDEMPIERE-392 Redesign payment button
UPDATE AD_Message SET MsgText='Failed to cancel cash',Updated=TO_TIMESTAMP('2012-10-19 16:09:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=200079
;
-- Oct 19, 2012 4:09:57 PM SGT
-- IDEMPIERE-392 Redesign payment button
UPDATE AD_Message_Trl SET IsTranslated='N' WHERE AD_Message_ID=200079
;
-- Oct 19, 2012 4:10:18 PM SGT
-- IDEMPIERE-392 Redesign payment button
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','Failed to create cash',200080,'D','9a1b19b9-03a4-4a94-a4be-3c330e6ef800','CashNotCreated','Y',TO_TIMESTAMP('2012-10-19 16:10:18','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-10-19 16:10:18','YYYY-MM-DD HH24:MI:SS'))
;
-- Oct 19, 2012 4:10:18 PM SGT
-- IDEMPIERE-392 Redesign payment button
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=200080 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)
;
-- Oct 19, 2012 4:10:55 PM SGT
-- IDEMPIERE-392 Redesign payment button
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','Card not processed',200081,'D','743abddc-b21d-4317-b959-9e7dba185313','CardNotProcessed','Y',TO_TIMESTAMP('2012-10-19 16:10:55','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-10-19 16:10:55','YYYY-MM-DD HH24:MI:SS'))
;
-- Oct 19, 2012 4:10:55 PM SGT
-- IDEMPIERE-392 Redesign payment button
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=200081 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('940_IDEMPIERE-392.sql') FROM dual
;

View File

@ -1,3 +1,16 @@
/******************************************************************************
* Copyright (C) 2012 Elaine Tan *
* Copyright (C) 2012 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.adempiere.util; package org.adempiere.util;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -12,6 +25,11 @@ import org.compiere.model.MBPartner;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.DB; import org.compiere.util.DB;
/**
*
* @author Elaine
*
*/
public class PaymentUtil { public class PaymentUtil {
private static final CLogger logger = CLogger.getCLogger(PaymentUtil.class); private static final CLogger logger = CLogger.getCLogger(PaymentUtil.class);

View File

@ -1970,4 +1970,9 @@ public class GridField
return m_vo.NumLines; return m_vo.NumLines;
} }
public boolean isToolbarButton()
{
return m_vo.displayType == DisplayType.Button && m_vo.IsToolbarButton;
}
} // MField } // MField

View File

@ -204,6 +204,8 @@ public class GridFieldVO implements Serializable
vo.ColumnSpan=rs.getInt(i); vo.ColumnSpan=rs.getInt(i);
else if (columnName.equalsIgnoreCase("NumLines")) else if (columnName.equalsIgnoreCase("NumLines"))
vo.NumLines=rs.getInt(i); vo.NumLines=rs.getInt(i);
else if (columnName.equalsIgnoreCase("IsToolbarButton"))
vo.IsToolbarButton = "Y".equals(rs.getString(i));
} }
if (vo.Header == null) if (vo.Header == null)
vo.Header = vo.ColumnName; vo.Header = vo.ColumnName;
@ -537,6 +539,8 @@ public class GridFieldVO implements Serializable
public boolean IsAutocomplete = false; public boolean IsAutocomplete = false;
/* Allow copy - IDEMPIERE-67 - Carlos Ruiz - globalqss */ /* Allow copy - IDEMPIERE-67 - Carlos Ruiz - globalqss */
public boolean IsAllowCopy = false; public boolean IsAllowCopy = false;
/** Toolbar Button **/
public boolean IsToolbarButton = false;
/** /**
* Set Context including contained elements * Set Context including contained elements

View File

@ -2657,7 +2657,9 @@ public class GridTable extends AbstractTableModel
{ {
if (!m_inserting && !m_changed && m_rowChanged < 0) if (!m_inserting && !m_changed && m_rowChanged < 0)
{ {
if (log.isLoggable(Level.FINE))
log.fine("Nothing to ignore"); log.fine("Nothing to ignore");
m_newRow = -1;
return; return;
} }
log.info("Inserting=" + m_inserting); log.info("Inserting=" + m_inserting);

View File

@ -480,6 +480,19 @@ public interface I_AD_Column
*/ */
public String getIsSyncDatabase(); public String getIsSyncDatabase();
/** Column name IsToolbarButton */
public static final String COLUMNNAME_IsToolbarButton = "IsToolbarButton";
/** Set Toolbar Button.
* Add the column button to the toolbar
*/
public void setIsToolbarButton (boolean IsToolbarButton);
/** Get Toolbar Button.
* Add the column button to the toolbar
*/
public boolean isToolbarButton();
/** Column name IsTranslated */ /** Column name IsTranslated */
public static final String COLUMNNAME_IsTranslated = "IsTranslated"; public static final String COLUMNNAME_IsTranslated = "IsTranslated";
@ -556,6 +569,19 @@ public interface I_AD_Column
*/ */
public int getSeqNo(); public int getSeqNo();
/** Column name SeqNoSelection */
public static final String COLUMNNAME_SeqNoSelection = "SeqNoSelection";
/** Set Selection Column Sequence.
* Selection Column Sequence
*/
public void setSeqNoSelection (int SeqNoSelection);
/** Get Selection Column Sequence.
* Selection Column Sequence
*/
public int getSeqNoSelection();
/** Column name Updated */ /** Column name Updated */
public static final String COLUMNNAME_Updated = "Updated"; public static final String COLUMNNAME_Updated = "Updated";

View File

@ -211,6 +211,14 @@ public class MColumn extends X_AD_Column
} }
} }
if (displayType != DisplayType.Button)
{
if (isToolbarButton())
{
setIsToolbarButton(false);
}
}
/** Views are not updateable /** Views are not updateable
UPDATE AD_Column c UPDATE AD_Column c
SET IsUpdateable='N', IsAlwaysUpdateable='N' SET IsUpdateable='N', IsAlwaysUpdateable='N'

View File

@ -850,7 +850,10 @@ public final class MPayment extends X_C_Payment
} }
} }
if (m_mBankAccountProcessor != null) if (m_mBankAccountProcessor != null)
{
setC_BankAccount_ID (m_mBankAccountProcessor.getC_BankAccount_ID()); setC_BankAccount_ID (m_mBankAccountProcessor.getC_BankAccount_ID());
setC_PaymentProcessor_ID (m_mBankAccountProcessor.getC_PaymentProcessor_ID());
}
// //
return m_mBankAccountProcessor != null; return m_mBankAccountProcessor != null;
} // setPaymentProcessor } // setPaymentProcessor

View File

@ -1,3 +1,16 @@
/******************************************************************************
* Copyright (C) 2012 Elaine Tan *
* Copyright (C) 2012 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.compiere.model; package org.compiere.model;
import java.io.Serializable; import java.io.Serializable;
@ -14,8 +27,18 @@ import org.compiere.util.Env;
import org.compiere.util.NamePair; import org.compiere.util.NamePair;
import org.compiere.util.ValueNamePair; import org.compiere.util.ValueNamePair;
/**
*
* @author Elaine
*
*/
public class MPaymentLookup extends Lookup implements Serializable { public class MPaymentLookup extends Lookup implements Serializable {
/**
*
*/
private static final long serialVersionUID = -6863672221350217533L;
private static final int PAYMENT_RULE_REFERENCE_ID = 195; private static final int PAYMENT_RULE_REFERENCE_ID = 195;
/** Context */ /** Context */

View File

@ -61,7 +61,7 @@ public class MPaymentProcessor extends X_C_PaymentProcessor
* @param trxName transaction * @param trxName transaction
* @return Array of BankAccount[0] & PaymentProcessor[1] or null * @return Array of BankAccount[0] & PaymentProcessor[1] or null
*/ */
protected static MBankAccountProcessor[] find (Properties ctx, public static MBankAccountProcessor[] find (Properties ctx,
String tender, String CCType, String tender, String CCType,
int AD_Client_ID, int C_Currency_ID, BigDecimal Amt, String trxName) int AD_Client_ID, int C_Currency_ID, BigDecimal Amt, String trxName)
{ {

View File

@ -32,7 +32,7 @@ public class X_AD_Column extends PO implements I_AD_Column, I_Persistent
/** /**
* *
*/ */
private static final long serialVersionUID = 20110918L; private static final long serialVersionUID = 20121019L;
/** Standard Constructor */ /** Standard Constructor */
public X_AD_Column (Properties ctx, int AD_Column_ID, String trxName) public X_AD_Column (Properties ctx, int AD_Column_ID, String trxName)
@ -60,6 +60,8 @@ public class X_AD_Column extends PO implements I_AD_Column, I_Persistent
setIsMandatory (false); setIsMandatory (false);
setIsParent (false); setIsParent (false);
setIsSelectionColumn (false); setIsSelectionColumn (false);
setIsToolbarButton (true);
// Y
setIsTranslated (false); setIsTranslated (false);
setIsUpdateable (true); setIsUpdateable (true);
// Y // Y
@ -742,6 +744,30 @@ public class X_AD_Column extends PO implements I_AD_Column, I_Persistent
return (String)get_Value(COLUMNNAME_IsSyncDatabase); return (String)get_Value(COLUMNNAME_IsSyncDatabase);
} }
/** Set Toolbar Button.
@param IsToolbarButton
Add the column button to the toolbar
*/
public void setIsToolbarButton (boolean IsToolbarButton)
{
set_Value (COLUMNNAME_IsToolbarButton, Boolean.valueOf(IsToolbarButton));
}
/** Get Toolbar Button.
@return Add the column button to the toolbar
*/
public boolean isToolbarButton ()
{
Object oo = get_Value(COLUMNNAME_IsToolbarButton);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Translated. /** Set Translated.
@param IsTranslated @param IsTranslated
This column is translated This column is translated
@ -858,6 +884,26 @@ public class X_AD_Column extends PO implements I_AD_Column, I_Persistent
return ii.intValue(); return ii.intValue();
} }
/** Set Selection Column Sequence.
@param SeqNoSelection
Selection Column Sequence
*/
public void setSeqNoSelection (int SeqNoSelection)
{
set_Value (COLUMNNAME_SeqNoSelection, Integer.valueOf(SeqNoSelection));
}
/** Get Selection Column Sequence.
@return Selection Column Sequence
*/
public int getSeqNoSelection ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_SeqNoSelection);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Max. Value. /** Set Max. Value.
@param ValueMax @param ValueMax
Maximum Value for a field Maximum Value for a field

View File

@ -1,3 +1,16 @@
/******************************************************************************
* Copyright (C) 2012 Elaine Tan *
* Copyright (C) 2012 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.compiere.grid; package org.compiere.grid;
import java.awt.GridBagConstraints; import java.awt.GridBagConstraints;
@ -23,7 +36,11 @@ import org.compiere.util.Env;
import org.compiere.util.KeyNamePair; import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg; import org.compiere.util.Msg;
/**
*
* @author Elaine
*
*/
public class VPaymentFormCash extends PaymentFormCash implements ActionListener { public class VPaymentFormCash extends PaymentFormCash implements ActionListener {
private VPaymentFormDialog dialog; private VPaymentFormDialog dialog;
@ -209,7 +226,7 @@ public class VPaymentFormCash extends PaymentFormCash implements ActionListener
else if (processMsg != null) else if (processMsg != null)
ADialog.info(getWindowNo(), dialog, "PaymentCreated", processMsg); ADialog.info(getWindowNo(), dialog, "PaymentCreated", processMsg);
return true; return ok;
} }
@Override @Override

View File

@ -1,3 +1,16 @@
/******************************************************************************
* Copyright (C) 2012 Elaine Tan *
* Copyright (C) 2012 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.compiere.grid; package org.compiere.grid;
import java.awt.Dimension; import java.awt.Dimension;
@ -6,6 +19,8 @@ import java.awt.GridBagLayout;
import java.awt.Insets; import java.awt.Insets;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Enumeration; import java.util.Enumeration;
@ -14,6 +29,7 @@ import org.adempiere.plaf.AdempierePLAF;
import org.compiere.apps.ADialog; import org.compiere.apps.ADialog;
import org.compiere.grid.ed.VNumber; import org.compiere.grid.ed.VNumber;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
import org.compiere.model.MBankAccountProcessor;
import org.compiere.model.MConversionRate; import org.compiere.model.MConversionRate;
import org.compiere.model.MPaymentValidate; import org.compiere.model.MPaymentValidate;
import org.compiere.swing.CButton; import org.compiere.swing.CButton;
@ -24,7 +40,12 @@ import org.compiere.util.Env;
import org.compiere.util.KeyNamePair; import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg; import org.compiere.util.Msg;
public class VPaymentFormCheck extends PaymentFormCheck implements ActionListener { /**
*
* @author Elaine
*
*/
public class VPaymentFormCheck extends PaymentFormCheck implements ActionListener, FocusListener {
private VPaymentFormDialog dialog; private VPaymentFormDialog dialog;
@ -64,6 +85,7 @@ public class VPaymentFormCheck extends PaymentFormCheck implements ActionListene
sRoutingField.setPreferredSize(new Dimension(70, 21)); sRoutingField.setPreferredSize(new Dimension(70, 21));
sStatus.setText(" "); sStatus.setText(" ");
sOnline.setText(Msg.getMsg(Env.getCtx(), "Online")); sOnline.setText(Msg.getMsg(Env.getCtx(), "Online"));
sOnline.addActionListener(this);
dialog.getPanel().add(sBankAccountLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0 dialog.getPanel().add(sBankAccountLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 0, 2, 0), 0, 0)); ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 0, 2, 0), 0, 0));
dialog.getPanel().add(sBankAccountCombo, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0 dialog.getPanel().add(sBankAccountCombo, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0
@ -76,6 +98,7 @@ public class VPaymentFormCheck extends PaymentFormCheck implements ActionListene
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 0, 5, 0), 0, 0)); ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 0, 5, 0), 0, 0));
dialog.getPanel().add(sAmountField, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0 dialog.getPanel().add(sAmountField, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 5, 5, 5), 0, 0)); ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 5, 5, 5), 0, 0));
sAmountField.addFocusListener(this);
dialog.getPanel().add(sRoutingLabel, new GridBagConstraints(0, 3, 1, 2, 0.0, 0.0 dialog.getPanel().add(sRoutingLabel, new GridBagConstraints(0, 3, 1, 2, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 2, 0), 0, 0)); ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 2, 0), 0, 0));
dialog.getPanel().add(sRoutingField, new GridBagConstraints(1, 3, 2, 1, 0.0, 0.0 dialog.getPanel().add(sRoutingField, new GridBagConstraints(1, 3, 2, 1, 0.0, 0.0
@ -133,19 +156,63 @@ public class VPaymentFormCheck extends PaymentFormCheck implements ActionListene
// Set Selection // Set Selection
if (selectedBankAccount != null) if (selectedBankAccount != null)
sBankAccountCombo.setSelectedItem(selectedBankAccount); sBankAccountCombo.setSelectedItem(selectedBankAccount);
boolean exist = isBankAccountProcessorExist(m_C_Currency_ID, (BigDecimal) sAmountField.getValue());
sOnline.setVisible(exist);
if (exist)
updateOnlineButton();
} }
public void actionPerformed(ActionEvent e) public void actionPerformed(ActionEvent e)
{ {
if (e.getSource() == sCurrencyCombo) if (e.getSource() == sCurrencyCombo)
{ {
int C_Currency_ID = 0;
KeyNamePair pp = (KeyNamePair)sCurrencyCombo.getSelectedItem(); KeyNamePair pp = (KeyNamePair)sCurrencyCombo.getSelectedItem();
if (pp != null)
C_Currency_ID = pp.getKey();
BigDecimal amt = MConversionRate.convert(Env.getCtx(), BigDecimal amt = MConversionRate.convert(Env.getCtx(),
m_Amount, m_C_Currency_ID, pp.getKey(), m_AD_Client_ID, m_AD_Org_ID); m_Amount, m_C_Currency_ID, C_Currency_ID, m_AD_Client_ID, m_AD_Org_ID);
sAmountField.setValue(amt); sAmountField.setValue(amt);
updateOnlineButton();
}
else if (e.getSource() == sOnline)
processOnline();
}
@Override
public void focusGained(FocusEvent e) {
}
@Override
public void focusLost(FocusEvent e) {
if (e.getSource() == sAmountField)
updateOnlineButton();
}
private void updateOnlineButton()
{
int C_Currency_ID = 0;
KeyNamePair pp = (KeyNamePair)sCurrencyCombo.getSelectedItem();
if (pp != null)
C_Currency_ID = pp.getKey();
BigDecimal PayAmt = (BigDecimal) sAmountField.getValue();
if (C_Currency_ID > 0 && PayAmt != null)
{
MBankAccountProcessor bankAccountProcessor = getBankAccountProcessor(C_Currency_ID, PayAmt);
sOnline.setEnabled(bankAccountProcessor != null);
setBankAccountProcessor(bankAccountProcessor);
}
else
{
sOnline.setEnabled(false);
setBankAccountProcessor(null);
} }
// else if (e.getSource() == sOnline)
// processOnline();
} }
@Override @Override
@ -203,7 +270,7 @@ public class VPaymentFormCheck extends PaymentFormCheck implements ActionListene
else if (processMsg != null) else if (processMsg != null)
ADialog.info(getWindowNo(), dialog, "PaymentCreated", m_mPayment.getDocumentNo()); ADialog.info(getWindowNo(), dialog, "PaymentCreated", m_mPayment.getDocumentNo());
return true; return ok;
} }
@Override @Override

View File

@ -1,3 +1,16 @@
/******************************************************************************
* Copyright (C) 2012 Elaine Tan *
* Copyright (C) 2012 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.compiere.grid; package org.compiere.grid;
import java.awt.Dimension; import java.awt.Dimension;
@ -6,11 +19,15 @@ import java.awt.GridBagLayout;
import java.awt.Insets; import java.awt.Insets;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.math.BigDecimal; import java.math.BigDecimal;
import org.compiere.apps.ADialog; import org.compiere.apps.ADialog;
import org.compiere.grid.ed.VNumber; import org.compiere.grid.ed.VNumber;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
import org.compiere.model.MBankAccountProcessor;
import org.compiere.model.MPaymentProcessor;
import org.compiere.swing.CButton; import org.compiere.swing.CButton;
import org.compiere.swing.CComboBox; import org.compiere.swing.CComboBox;
import org.compiere.swing.CLabel; import org.compiere.swing.CLabel;
@ -19,7 +36,12 @@ import org.compiere.util.Env;
import org.compiere.util.Msg; import org.compiere.util.Msg;
import org.compiere.util.ValueNamePair; import org.compiere.util.ValueNamePair;
public class VPaymentFormCreditCard extends PaymentFormCreditCard implements ActionListener { /**
*
* @author Elaine
*
*/
public class VPaymentFormCreditCard extends PaymentFormCreditCard implements ActionListener, FocusListener {
private VPaymentFormDialog dialog; private VPaymentFormDialog dialog;
@ -65,6 +87,7 @@ public class VPaymentFormCreditCard extends PaymentFormCreditCard implements Act
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 0, 2, 0), 0, 0)); ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 0, 2, 0), 0, 0));
dialog.getPanel().add(kTypeCombo, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0 dialog.getPanel().add(kTypeCombo, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0)); ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0));
kTypeCombo.addActionListener(this);
dialog.getPanel().add(kNumberLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0 dialog.getPanel().add(kNumberLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 0, 2, 0), 0, 0)); ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 0, 2, 0), 0, 0));
dialog.getPanel().add(kNumberField, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0 dialog.getPanel().add(kNumberField, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0
@ -81,6 +104,7 @@ public class VPaymentFormCreditCard extends PaymentFormCreditCard implements Act
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 0, 5, 0), 0, 0)); ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 0, 5, 0), 0, 0));
dialog.getPanel().add(kAmountField, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0 dialog.getPanel().add(kAmountField, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 5, 5, 5), 0, 0)); ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 5, 5, 5), 0, 0));
kAmountField.addFocusListener(this);
dialog.getPanel().add(kApprovalLabel, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0 dialog.getPanel().add(kApprovalLabel, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 0), 0, 0)); ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 0), 0, 0));
dialog.getPanel().add(kApprovalField, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0 dialog.getPanel().add(kApprovalField, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0
@ -124,12 +148,66 @@ public class VPaymentFormCreditCard extends PaymentFormCreditCard implements Act
// Set Selection // Set Selection
if (selectedCreditCard != null) if (selectedCreditCard != null)
kTypeCombo.setSelectedItem(selectedCreditCard); kTypeCombo.setSelectedItem(selectedCreditCard);
if (m_mPayment.isApproved())
{
kOnline.setVisible(true);
kOnline.setEnabled(false);
MBankAccountProcessor bankAccountProcessor = new MBankAccountProcessor(m_mPayment.getCtx(), m_mPayment.getC_BankAccount_ID(), m_mPayment.getC_PaymentProcessor_ID(), null);
setBankAccountProcessor(bankAccountProcessor);
}
else
{
boolean exist = isBankAccountProcessorExist("", (BigDecimal) kAmountField.getValue());
kOnline.setVisible(exist);
if (exist)
updateOnlineButton();
}
} }
public void actionPerformed(ActionEvent e) public void actionPerformed(ActionEvent e)
{ {
if (e.getSource() == kOnline) if (e.getSource() == kOnline)
processOnline(); processOnline();
else if (e.getSource() == kTypeCombo)
updateOnlineButton();
}
@Override
public void focusGained(FocusEvent e) {
}
@Override
public void focusLost(FocusEvent e) {
if (e.getSource() == kAmountField)
updateOnlineButton();
}
private void updateOnlineButton()
{
String CCType = null;
ValueNamePair vp = (ValueNamePair)kTypeCombo.getSelectedItem();
if (vp != null)
CCType = vp.getValue();
BigDecimal PayAmt = (BigDecimal) kAmountField.getValue();
if (CCType != null && PayAmt != null)
{
MBankAccountProcessor bankAccountProcessor = getBankAccountProcessor(CCType, PayAmt);
kOnline.setEnabled(bankAccountProcessor != null);
setBankAccountProcessor(bankAccountProcessor);
MPaymentProcessor paymentProcessor = new MPaymentProcessor(Env.getCtx(), bankAccountProcessor.getC_PaymentProcessor_ID(), null);
kApprovalField.setReadWrite(paymentProcessor.isRequireVV());
}
else
{
kOnline.setEnabled(false);
setBankAccountProcessor(null);
}
} }
@Override @Override
@ -150,7 +228,7 @@ public class VPaymentFormCreditCard extends PaymentFormCreditCard implements Act
else if (processMsg != null) else if (processMsg != null)
ADialog.info(getWindowNo(), dialog, "PaymentCreated", processMsg); ADialog.info(getWindowNo(), dialog, "PaymentCreated", processMsg);
return true; return ok;
} }

View File

@ -1,3 +1,16 @@
/******************************************************************************
* Copyright (C) 2012 Elaine Tan *
* Copyright (C) 2012 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.compiere.grid; package org.compiere.grid;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -15,10 +28,19 @@ import org.compiere.swing.CPanel;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Msg; import org.compiere.util.Msg;
/**
*
* @author Elaine
*
*/
public class VPaymentFormDialog extends CDialog implements ActionListener public class VPaymentFormDialog extends CDialog implements ActionListener
{ {
/**
*
*/
private static final long serialVersionUID = 6249016140530436885L;
private PaymentForm paymentForm; private PaymentForm paymentForm;
private int windowNo; // private int windowNo;
private CPanel mainPanel = new CPanel(); private CPanel mainPanel = new CPanel();
private BorderLayout mainLayout = new BorderLayout(); private BorderLayout mainLayout = new BorderLayout();
@ -32,7 +54,7 @@ public class VPaymentFormDialog extends CDialog implements ActionListener
super(AEnv.getWindow(windowNo), Msg.getMsg(Env.getCtx(), "Payment"), true); super(AEnv.getWindow(windowNo), Msg.getMsg(Env.getCtx(), "Payment"), true);
this.paymentForm = paymentForm; this.paymentForm = paymentForm;
this.windowNo = windowNo; // this.windowNo = windowNo;
try { try {
jbInit(); jbInit();

View File

@ -0,0 +1,159 @@
/******************************************************************************
* Copyright (C) 2012 Elaine Tan *
* Copyright (C) 2012 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.compiere.grid;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import org.adempiere.plaf.AdempierePLAF;
import org.compiere.apps.ADialog;
import org.compiere.model.GridTab;
import org.compiere.model.MBankAccountProcessor;
import org.compiere.swing.CButton;
import org.compiere.swing.CComboBox;
import org.compiere.swing.CLabel;
import org.compiere.swing.CTextField;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg;
/**
*
* @author Elaine
*
*/
public abstract class VPaymentFormDirect extends PaymentFormDirect implements ActionListener {
private VPaymentFormDialog dialog;
private CLabel tAccountLabel = new CLabel();
private CComboBox tAccountCombo = new CComboBox();
private CButton tOnline = new CButton();
private CTextField tRoutingField = new CTextField();
private CTextField tNumberField = new CTextField();
private CLabel tStatus = new CLabel();
private CLabel tRoutingText = new CLabel();
private CLabel tNumberText = new CLabel();
public VPaymentFormDirect(int windowNo, GridTab mTab, boolean isDebit) {
super(windowNo, mTab, isDebit);
dialog = new VPaymentFormDialog(this, windowNo);
init();
}
public void init() {
GridBagLayout tPanelLayout = new GridBagLayout();
dialog.getPanel().setLayout(tPanelLayout);
tAccountLabel.setText(Msg.translate(Env.getCtx(), "C_BP_BankAccount_ID"));
tRoutingField.setColumns(8);
tNumberField.setColumns(10);
tRoutingText.setText(Msg.translate(Env.getCtx(), "RoutingNo"));
tNumberText.setText(Msg.translate(Env.getCtx(), "AccountNo"));
tOnline.setText(Msg.getMsg(Env.getCtx(), "Online"));
tOnline.addActionListener(this);
tStatus.setText(" ");
dialog.getPanel().add(tAccountLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 0), 0, 0));
dialog.getPanel().add(tAccountCombo, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
dialog.getPanel().add(tRoutingField, new GridBagConstraints(1, 1, 2, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 0, 5), 0, 0));
dialog.getPanel().add(tNumberField, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 0, 5), 0, 0));
dialog.getPanel().add(tStatus, new GridBagConstraints(0, 3, 2, 1, 0.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
dialog.getPanel().add(tRoutingText, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 0, 0), 0, 0));
dialog.getPanel().add(tNumberText, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 0, 0), 0, 0));
dialog.getPanel().add(tOnline, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
}
@Override
public void loadData() {
if (m_C_Payment_ID != 0)
{
tRoutingField.setText(m_mPayment.getRoutingNo());
tNumberField.setText(m_mPayment.getAccountNo());
tStatus.setText(m_mPayment.getR_PnRef());
}
ArrayList<KeyNamePair> list = getBPBankAccountList();
for (KeyNamePair pp : list)
tAccountCombo.addItem(pp);
boolean exist = isBankAccountProcessorExist();
tOnline.setVisible(exist);
MBankAccountProcessor bankAccountProcessor = getBankAccountProcessor();
setBankAccountProcessor(bankAccountProcessor);
}
public void actionPerformed(ActionEvent e)
{
if (e.getSource() == tOnline)
processOnline();
}
@Override
public boolean checkMandatory() {
/***********************
* Mandatory Data Check
*/
boolean dataOK = true;
KeyNamePair bpba = (KeyNamePair)tAccountCombo.getSelectedItem();
if (bpba == null)
{
tAccountCombo.setBackground(AdempierePLAF.getFieldBackground_Error());
ADialog.error(getWindowNo(), dialog, "PaymentBPBankNotFound");
dataOK = false;
}
//
log.config("OK=" + dataOK);
return dataOK;
}
@Override
public boolean saveChangesInTrx(String trxName) {
boolean ok = save(0, tRoutingField.getText(), tNumberField.getText());
if (!ok)
ADialog.error(getWindowNo(), dialog, "PaymentError", processMsg);
else if (processMsg != null)
ADialog.info(getWindowNo(), dialog, "PaymentCreated", m_mPayment.getDocumentNo());
return ok;
}
@Override
public void showWindow()
{
dialog.setVisible(true);
}
@Override
public void closeWindow()
{
dialog.dispose();
}
@Override
public Object getWindow() {
return dialog;
}
}

View File

@ -1,11 +1,29 @@
/******************************************************************************
* Copyright (C) 2012 Elaine Tan *
* Copyright (C) 2012 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.compiere.grid; package org.compiere.grid;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
public class VPaymentFormDirectDebit extends VPaymentFormDirectDeposit { /**
*
* @author Elaine
*
*/
public class VPaymentFormDirectDebit extends VPaymentFormDirect {
public VPaymentFormDirectDebit(int WindowNo, GridTab mTab) { public VPaymentFormDirectDebit(int windowNo, GridTab mTab) {
super(WindowNo, mTab); super(windowNo, mTab, true);
} }
} }

View File

@ -1,125 +1,28 @@
/******************************************************************************
* Copyright (C) 2012 Elaine Tan *
* Copyright (C) 2012 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.compiere.grid; package org.compiere.grid;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.util.ArrayList;
import org.adempiere.plaf.AdempierePLAF;
import org.compiere.apps.ADialog;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
import org.compiere.swing.CButton;
import org.compiere.swing.CComboBox;
import org.compiere.swing.CLabel;
import org.compiere.swing.CTextField;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg;
public class VPaymentFormDirectDeposit extends PaymentFormDirectDeposit { /**
*
private VPaymentFormDialog dialog; * @author Elaine
*
private CLabel tAccountLabel = new CLabel(); */
private CComboBox tAccountCombo = new CComboBox(); public class VPaymentFormDirectDeposit extends VPaymentFormDirect {
private CButton tOnline = new CButton();
private CTextField tRoutingField = new CTextField();
private CTextField tNumberField = new CTextField();
private CLabel tStatus = new CLabel();
private CLabel tRoutingText = new CLabel();
private CLabel tNumberText = new CLabel();
public VPaymentFormDirectDeposit(int windowNo, GridTab mTab) { public VPaymentFormDirectDeposit(int windowNo, GridTab mTab) {
super(windowNo, mTab); super(windowNo, mTab, false);
dialog = new VPaymentFormDialog(this, windowNo);
init();
}
public void init() {
GridBagLayout tPanelLayout = new GridBagLayout();
dialog.getPanel().setLayout(tPanelLayout);
tAccountLabel.setText(Msg.translate(Env.getCtx(), "C_BP_BankAccount_ID"));
tRoutingField.setColumns(8);
tNumberField.setColumns(10);
tRoutingText.setText(Msg.translate(Env.getCtx(), "RoutingNo"));
tNumberText.setText(Msg.translate(Env.getCtx(), "AccountNo"));
tOnline.setText(Msg.getMsg(Env.getCtx(), "Online"));
tStatus.setText(" ");
dialog.getPanel().add(tAccountLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 0), 0, 0));
dialog.getPanel().add(tAccountCombo, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
dialog.getPanel().add(tRoutingField, new GridBagConstraints(1, 1, 2, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 0, 5), 0, 0));
dialog.getPanel().add(tNumberField, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 0, 5), 0, 0));
dialog.getPanel().add(tStatus, new GridBagConstraints(0, 3, 2, 1, 0.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
dialog.getPanel().add(tRoutingText, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 0, 0), 0, 0));
dialog.getPanel().add(tNumberText, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 0, 0), 0, 0));
dialog.getPanel().add(tOnline, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
}
@Override
public void loadData() {
if (m_C_Payment_ID != 0)
{
tRoutingField.setText(m_mPayment.getRoutingNo());
tNumberField.setText(m_mPayment.getAccountNo());
tStatus.setText(m_mPayment.getR_PnRef());
}
ArrayList<KeyNamePair> list = getBankAccountList();
for (KeyNamePair pp : list)
tAccountCombo.addItem(pp);
}
@Override
public boolean checkMandatory() {
/***********************
* Mandatory Data Check
*/
boolean dataOK = true;
KeyNamePair bpba = (KeyNamePair)tAccountCombo.getSelectedItem();
if (bpba == null)
{
tAccountCombo.setBackground(AdempierePLAF.getFieldBackground_Error());
ADialog.error(getWindowNo(), dialog, "PaymentBPBankNotFound");
dataOK = false;
}
//
log.config("OK=" + dataOK);
return dataOK;
}
@Override
public boolean saveChangesInTrx(String trxName) {
boolean ok = save();
if (!ok)
ADialog.error(getWindowNo(), dialog, "PaymentError", processMsg);
else if (processMsg != null)
ADialog.info(getWindowNo(), dialog, "PaymentCreated", m_mPayment.getDocumentNo());
return true;
}
@Override
public void showWindow()
{
dialog.setVisible(true);
}
@Override
public void closeWindow()
{
dialog.dispose();
}
@Override
public Object getWindow() {
return dialog;
} }
} }

View File

@ -1,11 +1,30 @@
/******************************************************************************
* Copyright (C) 2012 Elaine Tan *
* Copyright (C) 2012 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.compiere.grid; package org.compiere.grid;
import java.util.HashMap; import java.util.HashMap;
import java.util.logging.Level; import java.util.logging.Level;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
import org.compiere.model.MInvoice;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
/**
*
* @author Elaine
*
*/
public class VPaymentFormFactory { public class VPaymentFormFactory {
/** Static Logger */ /** Static Logger */
private static CLogger s_log = CLogger.getCLogger (VPaymentFormFactory.class); private static CLogger s_log = CLogger.getCLogger (VPaymentFormFactory.class);
@ -27,13 +46,13 @@ public class VPaymentFormFactory {
{ {
// Register defaults: // Register defaults:
s_registeredClasses = new HashMap<String, Class<? extends IPaymentForm>>(); s_registeredClasses = new HashMap<String, Class<? extends IPaymentForm>>();
s_registeredClasses.put(PaymentFormCash.PAYMENTRULE, VPaymentFormCash.class); s_registeredClasses.put(MInvoice.PAYMENTRULE_Cash, VPaymentFormCash.class);
s_registeredClasses.put(PaymentFormCheck.PAYMENTRULE, VPaymentFormCheck.class); s_registeredClasses.put(MInvoice.PAYMENTRULE_Check, VPaymentFormCheck.class);
s_registeredClasses.put(PaymentFormCreditCard.PAYMENTRULE, VPaymentFormCreditCard.class); s_registeredClasses.put(MInvoice.PAYMENTRULE_CreditCard, VPaymentFormCreditCard.class);
s_registeredClasses.put(PaymentFormDirectDebit.PAYMENTRULE, VPaymentFormDirectDebit.class); s_registeredClasses.put(MInvoice.PAYMENTRULE_DirectDebit, VPaymentFormDirectDebit.class);
s_registeredClasses.put(PaymentFormDirectDeposit.PAYMENTRULE, VPaymentFormDirectDeposit.class); s_registeredClasses.put(MInvoice.PAYMENTRULE_DirectDeposit, VPaymentFormDirectDeposit.class);
s_registeredClasses.put(PaymentFormMixedPOS.PAYMENTRULE, VPaymentFormMixedPOS.class); s_registeredClasses.put(MInvoice.PAYMENTRULE_MixedPOSPayment, VPaymentFormMixedPOS.class);
s_registeredClasses.put(PaymentFormOnCredit.PAYMENTRULE, VPaymentFormOnCredit.class); s_registeredClasses.put(MInvoice.PAYMENTRULE_OnCredit, VPaymentFormOnCredit.class);
} }
public static IPaymentForm create (int windowNo, GridTab mTab, String paymentRule) public static IPaymentForm create (int windowNo, GridTab mTab, String paymentRule)

View File

@ -1,7 +1,25 @@
/******************************************************************************
* Copyright (C) 2012 Elaine Tan *
* Copyright (C) 2012 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.compiere.grid; package org.compiere.grid;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
/**
*
* @author Elaine
*
*/
public class VPaymentFormMixedPOS extends PaymentFormMixedPOS { public class VPaymentFormMixedPOS extends PaymentFormMixedPOS {
private VPaymentFormDialog dialog; private VPaymentFormDialog dialog;

View File

@ -1,3 +1,16 @@
/******************************************************************************
* Copyright (C) 2012 Elaine Tan *
* Copyright (C) 2012 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.compiere.grid; package org.compiere.grid;
import java.awt.GridBagConstraints; import java.awt.GridBagConstraints;
@ -12,6 +25,11 @@ import org.compiere.util.Env;
import org.compiere.util.KeyNamePair; import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg; import org.compiere.util.Msg;
/**
*
* @author Elaine
*
*/
public class VPaymentFormOnCredit extends PaymentFormOnCredit { public class VPaymentFormOnCredit extends PaymentFormOnCredit {
private VPaymentFormDialog dialog; private VPaymentFormDialog dialog;

View File

@ -1,3 +1,16 @@
/******************************************************************************
* Copyright (C) 2012 Elaine Tan *
* Copyright (C) 2012 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.compiere.grid.ed; package org.compiere.grid.ed;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -27,8 +40,17 @@ import org.compiere.util.DisplayType;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.NamePair; import org.compiere.util.NamePair;
/**
*
* @author Elaine
*
*/
public class VPaymentEditor extends JComponent implements VEditor, ActionListener, FocusListener { public class VPaymentEditor extends JComponent implements VEditor, ActionListener, FocusListener {
/**
*
*/
private static final long serialVersionUID = -1840246214698245287L;
/** Logger */ /** Logger */
private static CLogger log = CLogger.getCLogger(VPaymentEditor.class); private static CLogger log = CLogger.getCLogger(VPaymentEditor.class);
/** Search: The Button to open Editor */ /** Search: The Button to open Editor */

View File

@ -0,0 +1,76 @@
package org.adempiere.webui;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Hashtable;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
import org.compiere.model.MSession;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.WebUtil;
public class LoggedSessionListener implements HttpSessionListener, ServletContextListener{
private static Hashtable<String, HttpSession> AD_SessionList = new Hashtable<String, HttpSession>();
@Override
public void sessionCreated(HttpSessionEvent evt) {
AD_SessionList.put(evt.getSession().getId(), evt.getSession());
}
@Override
public void sessionDestroyed(HttpSessionEvent evt) {
HttpSession currSess = evt.getSession();
if(AD_SessionList.containsKey(currSess.getId())){
String serverName = WebUtil.getServerName();
removeADSession(currSess.getId(),serverName);
AD_SessionList.remove(currSess.getId());
}
}
@Override
public void contextDestroyed(ServletContextEvent arg0) {
DestroyAllSession();
}
@Override
public void contextInitialized(ServletContextEvent arg0) {
DestroyAllSession();
}
public void DestroyAllSession() {
String serverName = WebUtil.getServerName();
String sql = "UPDATE AD_Session SET processed = 'Y' WHERE processed ='N' AND servername = '"+serverName+"'";
Statement stmt = DB.createStatement();
try{
stmt.executeUpdate(sql);
}catch (Exception e) {
System.out.println("UpdateSession: "+e);
}
}
public void removeADSession(String sessionID, String serverName) {
StringBuilder sql = new StringBuilder("SELECT * FROM AD_Session WHERE websession = '");
sql.append(sessionID)
.append("' AND servername = '")
.append(serverName).append("' AND processed = 'N'");
Statement stmt = DB.createStatement();
try{
ResultSet rs = stmt.executeQuery(sql.toString());
if(rs.next()){
MSession mSession = new MSession(Env.getCtx(), rs, null);
mSession.setProcessed(true);
mSession.save();
}
}catch (Exception e) {
System.out.println("UpdateSession: "+e);
}
}
}

View File

@ -165,7 +165,7 @@ public class WArchive implements EventListener
else // all Reports else // all Reports
av.query(true, m_AD_Table_ID, 0); av.query(true, m_AD_Table_ID, 0);
form.setAttribute(Window.MODE_KEY, Window.MODE_EMBEDDED); form.setAttribute(Window.MODE_KEY, form.getWindowMode());
SessionManager.getAppDesktop().showWindow(form); SessionManager.getAppDesktop().showWindow(form);
} }
} }

View File

@ -139,6 +139,7 @@ public class ADSortTab extends Panel implements IADTabpanel
private boolean uiCreated; private boolean uiCreated;
private boolean active = false; private boolean active = false;
private boolean isChanged; private boolean isChanged;
private boolean detailPaneMode;
/** /**
* Dynamic Init * Dynamic Init
@ -698,15 +699,6 @@ public class ADSortTab extends Panel implements IADTabpanel
} }
} // saveData } // saveData
/* (non-Javadoc)
* @see org.compiere.grid.APanelTab#unregisterPanel()
*/
public void unregisterPanel ()
{
saveData();
adWindowPanel = null;
} // dispose
/** /**
* List Item * List Item
* @author Teo Sarca * @author Teo Sarca
@ -929,7 +921,32 @@ public class ADSortTab extends Panel implements IADTabpanel
@Override @Override
public void setDetailPaneMode(boolean detailMode, boolean vflex) { public void setDetailPaneMode(boolean detailMode, boolean vflex) {
this.detailPaneMode = detailMode;
this.setVflex(Boolean.toString(vflex)); this.setVflex(Boolean.toString(vflex));
} }
public boolean isDetailPaneMode() {
return this.detailPaneMode;
}
@Override
public GridView getGridView() {
return null;
}
@Override
public boolean needSave(boolean rowChange, boolean onlyRealChange) {
return isChanged();
}
@Override
public boolean dataSave(boolean onSaveEvent) {
if (isChanged()) {
saveData();
return isChanged() == false;
} else {
return true;
}
}
} //ADSortTab } //ADSortTab

View File

@ -98,6 +98,14 @@ import org.zkoss.zul.impl.XulElement;
public class ADTabpanel extends Div implements Evaluatee, EventListener<Event>, public class ADTabpanel extends Div implements Evaluatee, EventListener<Event>,
DataStatusListener, IADTabpanel DataStatusListener, IADTabpanel
{ {
public static final String ON_SWITCH_VIEW_EVENT = "onSwitchView";
public static final String ON_ACTIVATE_EVENT = "onActivate";
public static final String ON_DYNAMIC_DISPLAY_EVENT = "onDynamicDisplay";
private static final String ATTR_ON_ACTIVATE_POSTED = "org.adempiere.webui.adwindow.ADTabpanel.onActivatePosted";
/** /**
* *
*/ */
@ -151,6 +159,8 @@ DataStatusListener, IADTabpanel
private Component detailPane; private Component detailPane;
private boolean detailPaneMode;
public static final String ON_TOGGLE_EVENT = "onToggle"; public static final String ON_TOGGLE_EVENT = "onToggle";
public ADTabpanel() public ADTabpanel()
@ -163,6 +173,13 @@ DataStatusListener, IADTabpanel
initComponents(); initComponents();
addEventListener(ON_DEFER_SET_SELECTED_NODE, this); addEventListener(ON_DEFER_SET_SELECTED_NODE, this);
addEventListener(WPaymentEditor.ON_SAVE_PAYMENT, this); addEventListener(WPaymentEditor.ON_SAVE_PAYMENT, this);
addEventListener(ON_ACTIVATE_EVENT, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
removeAttribute(ATTR_ON_ACTIVATE_POSTED);
}
});
} }
private void initComponents() private void initComponents()
@ -380,6 +397,22 @@ DataStatusListener, IADTabpanel
if (!field.isDisplayed()) if (!field.isDisplayed())
continue; continue;
if (field.isToolbarButton()) {
WButtonEditor editor = (WButtonEditor) WebEditorFactory.getEditor(gridTab, field, false);
if (editor != null) {
if (windowPanel != null)
editor.addActionListener(windowPanel);
editor.setGridTab(this.getGridTab());
editor.setADTabpanel(this);
field.addPropertyChangeListener(editor);
editors.add(editor);
editorComps.add(editor.getComponent());
continue;
}
}
// field group // field group
String fieldGroup = field.getFieldGroup(); String fieldGroup = field.getFieldGroup();
if (!Util.isEmpty(fieldGroup) && !fieldGroup.equals(currentFieldGroup)) // group changed if (!Util.isEmpty(fieldGroup) && !fieldGroup.equals(currentFieldGroup)) // group changed
@ -586,7 +619,7 @@ DataStatusListener, IADTabpanel
for (WEditor comp : editors) for (WEditor comp : editors)
{ {
GridField mField = comp.getGridField(); GridField mField = comp.getGridField();
if (mField != null && mField.getIncluded_Tab_ID() <= 0) if (mField != null)
{ {
if (mField.isDisplayed(true)) // check context if (mField.isDisplayed(true)) // check context
{ {
@ -680,6 +713,11 @@ DataStatusListener, IADTabpanel
group.setOpen(false); group.setOpen(false);
} }
if (listPanel.isVisible()) {
listPanel.dynamicDisplay(col);
}
Events.sendEvent(this, new Event(ON_DYNAMIC_DISPLAY_EVENT, this));
logger.config(gridTab.toString() + " - fini - " + (col<=0 ? "complete" : "seletive")); logger.config(gridTab.toString() + " - fini - " + (col<=0 ? "complete" : "seletive"));
} // dynamicDisplay } // dynamicDisplay
@ -796,6 +834,14 @@ DataStatusListener, IADTabpanel
*/ */
public void activate(boolean activate) public void activate(boolean activate)
{ {
if (activate) {
if (getAttribute(ATTR_ON_ACTIVATE_POSTED) != null) {
return;
}
setAttribute(ATTR_ON_ACTIVATE_POSTED, Boolean.TRUE);
}
active = activate; active = activate;
if (listPanel.isVisible()) { if (listPanel.isVisible()) {
if (activate) if (activate)
@ -813,8 +859,8 @@ DataStatusListener, IADTabpanel
setSelectedNode(gridTab.getRecord_ID()); setSelectedNode(gridTab.getRecord_ID());
} }
Event event = new Event("onActivate", this, activate); Event event = new Event(ON_ACTIVATE_EVENT, this, activate);
Events.sendEvent(event); Events.postEvent(event);
} }
/** /**
@ -1060,7 +1106,7 @@ DataStatusListener, IADTabpanel
if (details != null) if (details != null)
addDetails(details); addDetails(details);
Events.sendEvent(this, new Event("onSwitchView", this)); Events.sendEvent(this, new Event(ON_SWITCH_VIEW_EVENT, this));
} }
class ZoomListener implements EventListener { class ZoomListener implements EventListener {
@ -1132,6 +1178,7 @@ DataStatusListener, IADTabpanel
* *
* @return GridPanel * @return GridPanel
*/ */
@Override
public GridView getGridView() { public GridView getGridView() {
return listPanel; return listPanel;
} }
@ -1142,6 +1189,7 @@ DataStatusListener, IADTabpanel
@Override @Override
public void setDetailPaneMode(boolean detailPaneMode, boolean vflex) { public void setDetailPaneMode(boolean detailPaneMode, boolean vflex) {
this.detailPaneMode = detailPaneMode;
if (detailPaneMode) { if (detailPaneMode) {
detailPane = null; detailPane = null;
this.setVflex("true"); this.setVflex("true");
@ -1150,5 +1198,41 @@ DataStatusListener, IADTabpanel
} }
listPanel.setDetailPaneMode(detailPaneMode, vflex); listPanel.setDetailPaneMode(detailPaneMode, vflex);
} }
/**
* Get all visible button editors
* @return List<WButtonEditor>
*/
public List<WButtonEditor> getToolbarButtons() {
List<WButtonEditor> buttonList = new ArrayList<WButtonEditor>();
if (isGridView()) {
buttonList = listPanel.getToolbarButtons();
} else {
for(WEditor editor : editors) {
if (editor instanceof WButtonEditor && editor.getComponent() != null
&& editor.getComponent().isVisible()
&& editor.getGridField() != null
&& editor.getGridField().isToolbarButton()) {
buttonList.add((WButtonEditor) editor);
}
}
}
return buttonList;
}
@Override
public boolean needSave(boolean rowChange, boolean onlyRealChange) {
return getGridTab().needSave(rowChange, onlyRealChange);
}
@Override
public boolean dataSave(boolean onSaveEvent) {
return getGridTab().dataSave(onSaveEvent);
}
@Override
public boolean isDetailPaneMode() {
return this.detailPaneMode;
}
} }

View File

@ -87,6 +87,8 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
private ToolBarButton btnExport; private ToolBarButton btnExport;
private ToolBarButton btnProcess;
private HashMap<String, ToolBarButton> buttons = new HashMap<String, ToolBarButton>(); private HashMap<String, ToolBarButton> buttons = new HashMap<String, ToolBarButton>();
// private ToolBarButton btnExit; // private ToolBarButton btnExit;
@ -163,6 +165,9 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
btnCustomize= createButton("Customize", "Customize", "Customize"); btnCustomize= createButton("Customize", "Customize", "Customize");
btnCustomize.setDisabled(false); btnCustomize.setDisabled(false);
btnProcess= createButton("Process", "Process", "Process");
btnProcess.setDisabled(false);
// Help and Exit should always be enabled // Help and Exit should always be enabled
btnHelp.setDisabled(false); btnHelp.setDisabled(false);
@ -574,4 +579,10 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
ToolBarMenuRestictionLoaded = true; ToolBarMenuRestictionLoaded = true;
} }
public void enableProcessButton(boolean b) {
if (btnProcess != null) {
btnProcess.setDisabled(!b);
}
}
} }

View File

@ -533,6 +533,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
else else
{ {
ADTabpanel fTabPanel = new ADTabpanel(); ADTabpanel fTabPanel = new ADTabpanel();
fTabPanel.addEventListener(ADTabpanel.ON_DYNAMIC_DISPLAY_EVENT, this);
gTab.addDataStatusListener(this); gTab.addDataStatusListener(this);
fTabPanel.init(this, curWindowNo, gTab, gridWindow); fTabPanel.init(this, curWindowNo, gTab, gridWindow);
adTabbox.addTab(gTab, fTabPanel); adTabbox.addTab(gTab, fTabPanel);
@ -943,6 +944,13 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
onModalClose(dialog.getProcessInfo()); onModalClose(dialog.getProcessInfo());
onRefresh(false, false); onRefresh(false, false);
} }
else if (ADTabpanel.ON_DYNAMIC_DISPLAY_EVENT.equals(event.getName()))
{
ADTabpanel adtab = (ADTabpanel) event.getTarget();
if (adtab == adTabbox.getSelectedTabpanel()) {
toolbar.enableProcessButton(adtab.getToolbarButtons().size() > 0);
}
}
} }
private void setActiveTab(final int newTabIndex, final Callback<Boolean> callback) { private void setActiveTab(final int newTabIndex, final Callback<Boolean> callback) {
@ -1126,6 +1134,9 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
if (adTabbox.getSelectedGridTab() != null && adTabbox.getSelectedGridTab().isQueryActive()) if (adTabbox.getSelectedGridTab() != null && adTabbox.getSelectedGridTab().isQueryActive())
dbInfo = "[ " + dbInfo + " ]"; dbInfo = "[ " + dbInfo + " ]";
breadCrumb.setStatusDB(dbInfo, e); breadCrumb.setStatusDB(dbInfo, e);
} else if (adTabbox.getSelectedDetailADTabpanel() == null)
{
return;
} }
// Set Message / Info // Set Message / Info
@ -1485,6 +1496,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
} }
private void doOnFind() { private void doOnFind() {
adTabbox.dataIgnore();
// Gets Fields from AD_Field_v // Gets Fields from AD_Field_v
GridField[] findFields = adTabbox.getSelectedGridTab().getFields(); GridField[] findFields = adTabbox.getSelectedGridTab().getFields();
if (findWindow == null || !findWindow.validate(adTabbox.getSelectedGridTab().getWindowNo(), adTabbox.getSelectedGridTab().getName(), if (findWindow == null || !findWindow.validate(adTabbox.getSelectedGridTab().getWindowNo(), adTabbox.getSelectedGridTab().getName(),
@ -1614,10 +1627,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
if (dirtyTabpanel != null && dirtyTabpanel instanceof ADSortTab) if (dirtyTabpanel != null && dirtyTabpanel instanceof ADSortTab)
{ {
ADSortTab sortTab = (ADSortTab) dirtyTabpanel; ADSortTab sortTab = (ADSortTab) dirtyTabpanel;
if (onNavigationEvent)
sortTab.unregisterPanel();
else
sortTab.saveData(); sortTab.saveData();
if (!onNavigationEvent) if (!onNavigationEvent)
{ {
toolbar.enableSave(sortTab.isChanged()); // set explicitly toolbar.enableSave(sortTab.isChanged()); // set explicitly
@ -2439,7 +2450,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
pi.setAD_Client_ID (Env.getAD_Client_ID(ctx)); pi.setAD_Client_ID (Env.getAD_Client_ID(ctx));
ADForm form = ADForm.openForm(adFormID); ADForm form = ADForm.openForm(adFormID);
form.setProcessInfo(pi); form.setProcessInfo(pi);
form.setAttribute(Window.MODE_KEY, Window.MODE_EMBEDDED); form.setAttribute(Window.MODE_KEY, form.getWindowMode());
form.setAttribute(Window.INSERT_POSITION_KEY, Window.INSERT_NEXT); form.setAttribute(Window.INSERT_POSITION_KEY, Window.INSERT_NEXT);
SessionManager.getAppDesktop().showWindow(form); SessionManager.getAppDesktop().showWindow(form);
onRefresh(false, false); onRefresh(false, false);
@ -2510,6 +2521,9 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
public IADTabpanel findADTabpanel(WButtonEditor button) { public IADTabpanel findADTabpanel(WButtonEditor button) {
IADTabpanel adtab = null; IADTabpanel adtab = null;
if (button.getADTabpanel() != null)
return button.getADTabpanel();
Component c = button.getComponent(); Component c = button.getComponent();
while (c != null) { while (c != null) {
if (c instanceof IADTabpanel) { if (c instanceof IADTabpanel) {
@ -2632,4 +2646,16 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
} }
CustomizeGridViewDialog.showCustomize(0, adTabbox.getSelectedGridTab().getAD_Tab_ID(), columnsWidth,gridFieldIds,tabPanel.getGridView()); CustomizeGridViewDialog.showCustomize(0, adTabbox.getSelectedGridTab().getAD_Tab_ID(), columnsWidth,gridFieldIds,tabPanel.getGridView());
} }
/**
* @see org.adempiere.webui.event.ToolbarListener#onProcess()
*/
@Override
public void onProcess() {
ProcessButtonPopup popup = new ProcessButtonPopup();
ADTabpanel adtab = (ADTabpanel) adTabbox.getSelectedTabpanel();
popup.render(adtab.getToolbarButtons());
LayoutUtils.openPopupWindow(toolbar.getButton("Process"), popup, "after_start");
}
} }

View File

@ -41,6 +41,7 @@ import org.zkoss.zk.ui.HtmlBasedComponent;
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Menuitem; import org.zkoss.zul.Menuitem;
import org.zkoss.zul.Vlayout; import org.zkoss.zul.Vlayout;
@ -53,10 +54,6 @@ import org.zkoss.zul.Vlayout;
*/ */
public class CompositeADTabbox extends AbstractADTabbox public class CompositeADTabbox extends AbstractADTabbox
{ {
private static final String ON_SWITCH_VIEW_EVENT = "onSwitchView";
private static final String ON_ACTIVATE_EVENT = "onActivate";
public static final String ON_SELECTION_CHANGED_EVENT = "onSelectionChanged"; public static final String ON_SELECTION_CHANGED_EVENT = "onSelectionChanged";
public static final String ADTAB_INDEX_ATTRIBUTE = "adtab.index"; public static final String ADTAB_INDEX_ATTRIBUTE = "adtab.index";
@ -87,6 +84,8 @@ public class CompositeADTabbox extends AbstractADTabbox
@Override @Override
public void onEvent(Event event) throws Exception { public void onEvent(Event event) throws Exception {
if (DetailPane.ON_EDIT_EVENT.equals(event.getName())) { if (DetailPane.ON_EDIT_EVENT.equals(event.getName())) {
if (headerTab.getGridTab().isNew()) return;
final int row = detailPane.getSelectedADTabpanel() != null final int row = detailPane.getSelectedADTabpanel() != null
? detailPane.getSelectedADTabpanel().getGridTab().getCurrentRow() ? detailPane.getSelectedADTabpanel().getGridTab().getCurrentRow()
: 0; : 0;
@ -99,6 +98,8 @@ public class CompositeADTabbox extends AbstractADTabbox
}); });
} }
else if (DetailPane.ON_NEW_EVENT.equals(event.getName())) { else if (DetailPane.ON_NEW_EVENT.equals(event.getName())) {
if (headerTab.getGridTab().isNew()) return;
final int row = detailPane.getSelectedADTabpanel() != null final int row = detailPane.getSelectedADTabpanel() != null
? detailPane.getSelectedADTabpanel().getGridTab().getCurrentRow() ? detailPane.getSelectedADTabpanel().getGridTab().getCurrentRow()
: 0; : 0;
@ -113,6 +114,8 @@ public class CompositeADTabbox extends AbstractADTabbox
}); });
} }
else if (DetailPane.ON_DELETE_EVENT.equals(event.getName())) { else if (DetailPane.ON_DELETE_EVENT.equals(event.getName())) {
if (headerTab.getGridTab().isNew()) return;
final IADTabpanel tabPanel = detailPane.getSelectedADTabpanel(); final IADTabpanel tabPanel = detailPane.getSelectedADTabpanel();
if (tabPanel != null && tabPanel.getGridTab().getRowCount() > 0 if (tabPanel != null && tabPanel.getGridTab().getRowCount() > 0
&& tabPanel.getGridTab().getCurrentRow() >= 0) { && tabPanel.getGridTab().getCurrentRow() >= 0) {
@ -137,6 +140,7 @@ public class CompositeADTabbox extends AbstractADTabbox
protected void onEditDetail(int row) { protected void onEditDetail(int row) {
int oldIndex = selectedIndex; int oldIndex = selectedIndex;
IADTabpanel selectedPanel = detailPane.getSelectedADTabpanel(); IADTabpanel selectedPanel = detailPane.getSelectedADTabpanel();
if (selectedPanel == null) return;
int newIndex = (Integer)selectedPanel.getAttribute(ADTAB_INDEX_ATTRIBUTE); int newIndex = (Integer)selectedPanel.getAttribute(ADTAB_INDEX_ATTRIBUTE);
Event selectionChanged = new Event(ON_SELECTION_CHANGED_EVENT, layout, new Object[]{oldIndex, newIndex}); Event selectionChanged = new Event(ON_SELECTION_CHANGED_EVENT, layout, new Object[]{oldIndex, newIndex});
@ -198,7 +202,7 @@ public class CompositeADTabbox extends AbstractADTabbox
tabPanel.setAttribute(ADTAB_INDEX_ATTRIBUTE, tabPanelList.size()-1); tabPanel.setAttribute(ADTAB_INDEX_ATTRIBUTE, tabPanelList.size()-1);
tabPanel.addEventListener(ON_ACTIVATE_EVENT, new EventListener<Event>() { tabPanel.addEventListener(ADTabpanel.ON_ACTIVATE_EVENT, new EventListener<Event>() {
@Override @Override
public void onEvent(Event event) throws Exception { public void onEvent(Event event) throws Exception {
Boolean b = (Boolean) event.getData(); Boolean b = (Boolean) event.getData();
@ -226,7 +230,7 @@ public class CompositeADTabbox extends AbstractADTabbox
int oldIndex = (Integer) event.getData(); int oldIndex = (Integer) event.getData();
if (oldIndex != detailPane.getSelectedIndex()) { if (oldIndex != detailPane.getSelectedIndex()) {
IADTabpanel prevTabPanel = detailPane.getADTabpanel(oldIndex); IADTabpanel prevTabPanel = detailPane.getADTabpanel(oldIndex);
if (prevTabPanel != null && prevTabPanel.getGridTab().needSave(true, true)) { if (prevTabPanel != null && prevTabPanel.needSave(true, true)) {
final int newIndex = detailPane.getSelectedIndex(); final int newIndex = detailPane.getSelectedIndex();
detailPane.setSelectedIndex(oldIndex); detailPane.setSelectedIndex(oldIndex);
adWindowPanel.saveAndNavigate(new Callback<Boolean>() { adWindowPanel.saveAndNavigate(new Callback<Boolean>() {
@ -239,6 +243,7 @@ public class CompositeADTabbox extends AbstractADTabbox
} }
}); });
} else { } else {
detailPane.setSelectedIndex(detailPane.getSelectedIndex());
onActivateDetail(tabPanel); onActivateDetail(tabPanel);
} }
} else { } else {
@ -247,7 +252,7 @@ public class CompositeADTabbox extends AbstractADTabbox
} }
}); });
tabPanel.addEventListener(ON_SWITCH_VIEW_EVENT, new EventListener<Event>() { tabPanel.addEventListener(ADTabpanel.ON_SWITCH_VIEW_EVENT, new EventListener<Event>() {
@Override @Override
public void onEvent(Event event) throws Exception { public void onEvent(Event event) throws Exception {
@ -277,16 +282,26 @@ public class CompositeADTabbox extends AbstractADTabbox
} }
}); });
if (tabPanel.getGridView() != null) {
tabPanel.getGridView().addEventListener(DetailPane.ON_EDIT_EVENT, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
GridView gridView = (GridView) event.getTarget();
if (gridView.getParent() == headerTab) {
adWindowPanel.onToggle();
}
}
});
}
if (layout.getChildren().isEmpty()) { if (layout.getChildren().isEmpty()) {
layout.appendChild(tabPanel); layout.appendChild(tabPanel);
headerTab = tabPanel; headerTab = tabPanel;
updateBreadCrumb(); updateBreadCrumb();
} else if (tabLabel.tabLevel <= 1) { } else if (tabLabel.tabLevel <= 1) {
boolean activate = false;
if (detailPane.getParent() == null) { if (detailPane.getParent() == null) {
ADTabpanel adtabpanel = (ADTabpanel) headerTab; ADTabpanel adtabpanel = (ADTabpanel) headerTab;
adtabpanel.addDetails(detailPane); adtabpanel.addDetails(detailPane);
activate = true;
} else } else
tabPanel.setVisible(false); tabPanel.setVisible(false);
detailPane.setHflex("1"); detailPane.setHflex("1");
@ -294,8 +309,6 @@ public class CompositeADTabbox extends AbstractADTabbox
detailPane.addADTabpanel(tabPanel, tabLabel); detailPane.addADTabpanel(tabPanel, tabLabel);
tabPanel.setDetailPaneMode(true, isUseVflexForDetailPane()); tabPanel.setDetailPaneMode(true, isUseVflexForDetailPane());
detailPane.setVflex(Boolean.toString(isUseVflexForDetailPane())); detailPane.setVflex(Boolean.toString(isUseVflexForDetailPane()));
if (activate)
activateDetailADTabpanel();
} else { } else {
detailPane.addADTabpanel(tabPanel, tabLabel, false); detailPane.addADTabpanel(tabPanel, tabLabel, false);
tabPanel.setDetailPaneMode(true, isUseVflexForDetailPane()); tabPanel.setDetailPaneMode(true, isUseVflexForDetailPane());
@ -306,14 +319,6 @@ public class CompositeADTabbox extends AbstractADTabbox
htmlComponent.setWidth("100%"); htmlComponent.setWidth("100%");
tabPanel.getGridTab().addDataStatusListener(new SyncDataStatusListener(tabPanel)); tabPanel.getGridTab().addDataStatusListener(new SyncDataStatusListener(tabPanel));
if (detailPane.getTabcount() > 1) {
int selectedIndex = detailPane.getSelectedIndex();
updateTabState();
if (detailPane.getSelectedIndex() != selectedIndex) {
activateDetailADTabpanel();
}
}
} }
private void activateDetailADTabpanel() { private void activateDetailADTabpanel() {
@ -403,6 +408,8 @@ public class CompositeADTabbox extends AbstractADTabbox
} else if (tabLevel > currentLevel ){ } else if (tabLevel > currentLevel ){
detailPane.addADTabpanel(tabPanel, tabLabel, false); detailPane.addADTabpanel(tabPanel, tabLabel, false);
tabPanel.setDetailPaneMode(true, isUseVflexForDetailPane()); tabPanel.setDetailPaneMode(true, isUseVflexForDetailPane());
} else {
break;
} }
} }
@ -411,8 +418,11 @@ public class CompositeADTabbox extends AbstractADTabbox
adtabpanel.addDetails(detailPane); adtabpanel.addDetails(detailPane);
detailPane.setVflex(Boolean.toString(isUseVflexForDetailPane())); detailPane.setVflex(Boolean.toString(isUseVflexForDetailPane()));
detailPane.setSelectedIndex(0); detailPane.setSelectedIndex(0);
activateDetailADTabpanel();
} }
headerTab.setDetailPaneMode(false, isUseVflexForDetailPane());
updateBreadCrumb(); updateBreadCrumb();
} }
@ -518,7 +528,7 @@ public class CompositeADTabbox extends AbstractADTabbox
//refresh current row //refresh current row
detailTab.getGridTab().dataRefresh(false); detailTab.getGridTab().dataRefresh(false);
//keep focus //keep focus
onDetailRecord(); Clients.scrollIntoView(detailTab);
return; return;
} }
@ -530,7 +540,6 @@ public class CompositeADTabbox extends AbstractADTabbox
if (!parentColumnNames.contains(field.getColumnName())) if (!parentColumnNames.contains(field.getColumnName()))
Env.setContext(Env.getCtx(), field.getWindowNo(), field.getColumnName(), ""); Env.setContext(Env.getCtx(), field.getWindowNo(), field.getColumnName(), "");
} }
detailTab.query(false, 0, 0);
detailTab.activate(true); detailTab.activate(true);
detailTab.setDetailPaneMode(true, isUseVflexForDetailPane()); detailTab.setDetailPaneMode(true, isUseVflexForDetailPane());
detailPane.setVflex(Boolean.toString(isUseVflexForDetailPane())); detailPane.setVflex(Boolean.toString(isUseVflexForDetailPane()));
@ -563,13 +572,13 @@ public class CompositeADTabbox extends AbstractADTabbox
@Override @Override
public boolean needSave(boolean rowChange, boolean onlyRealChange) { public boolean needSave(boolean rowChange, boolean onlyRealChange) {
boolean b = headerTab.getGridTab().needSave(rowChange, onlyRealChange); boolean b = headerTab.needSave(rowChange, onlyRealChange);
if (b) if (b)
return b; return b;
IADTabpanel detailPanel = getSelectedDetailADTabpanel(); IADTabpanel detailPanel = getSelectedDetailADTabpanel();
if (detailPanel != null) { if (detailPanel != null) {
b = detailPanel.getGridTab().needSave(rowChange, onlyRealChange); b = detailPanel.needSave(rowChange, onlyRealChange);
} }
return b; return b;
@ -593,14 +602,14 @@ public class CompositeADTabbox extends AbstractADTabbox
@Override @Override
public boolean dataSave(boolean onSaveEvent) { public boolean dataSave(boolean onSaveEvent) {
IADTabpanel detail = getSelectedDetailADTabpanel(); IADTabpanel detail = getSelectedDetailADTabpanel();
if (detail != null && !detail.getGridTab().isSortTab() && detail.getGridTab().needSave(true, true)) { if (detail != null && detail.needSave(true, true)) {
Execution execution = Executions.getCurrent(); Execution execution = Executions.getCurrent();
if (execution != null) { if (execution != null) {
execution.setAttribute(getClass().getName()+".dataAction", detail.getUuid()); execution.setAttribute(getClass().getName()+".dataAction", detail.getUuid());
} }
return detail.getGridTab().dataSave(onSaveEvent); return detail.dataSave(onSaveEvent);
} }
return headerTab.getGridTab().isSortTab() ? true : headerTab.getGridTab().dataSave(onSaveEvent); return headerTab.dataSave(onSaveEvent);
} }
@Override @Override
@ -611,13 +620,9 @@ public class CompositeADTabbox extends AbstractADTabbox
@Override @Override
public IADTabpanel getDirtyADTabpanel() { public IADTabpanel getDirtyADTabpanel() {
IADTabpanel detail = getSelectedDetailADTabpanel(); IADTabpanel detail = getSelectedDetailADTabpanel();
if (detail != null && detail.getGridTab().needSave(true, true)) { if (detail != null && detail.needSave(true, true)) {
return detail; return detail;
} else if (detail != null && detail instanceof ADSortTab && ((ADSortTab)detail).isChanged()) { } else if (headerTab.needSave(true, true)) {
return detail;
} else if (headerTab.getGridTab().needSave(true, true)) {
return headerTab;
} else if (headerTab instanceof ADSortTab && ((ADSortTab)headerTab).isChanged()) {
return headerTab; return headerTab;
} }
@ -637,6 +642,8 @@ public class CompositeADTabbox extends AbstractADTabbox
if (tabPanel instanceof ADSortTab) { if (tabPanel instanceof ADSortTab) {
detailPane.invalidate(); detailPane.invalidate();
detailPane.updateToolbar(false, true); detailPane.updateToolbar(false, true);
} else {
tabPanel.dynamicDisplay(0);
} }
} }
@ -655,6 +662,9 @@ public class CompositeADTabbox extends AbstractADTabbox
@Override @Override
public void updateDetailPaneToolbar(boolean changed, boolean readOnly) { public void updateDetailPaneToolbar(boolean changed, boolean readOnly) {
if (headerTab.getGridTab().isNew() || headerTab.getGridTab().getRowCount() == 0)
detailPane.disableToolbar();
else
detailPane.updateToolbar(changed, readOnly); detailPane.updateToolbar(changed, readOnly);
} }
@ -665,7 +675,7 @@ public class CompositeADTabbox extends AbstractADTabbox
IADTabpanel adtab = detailPane.getADTabpanel(i); IADTabpanel adtab = detailPane.getADTabpanel(i);
int index = (Integer) adtab.getAttribute(ADTAB_INDEX_ATTRIBUTE); int index = (Integer) adtab.getAttribute(ADTAB_INDEX_ATTRIBUTE);
if (index == tabIndex) { if (index == tabIndex) {
if (!detailPane.isTabVisible(i)) { if (!detailPane.isTabVisible(i) || !detailPane.isTabEnabled(i)) {
return; return;
} }
if (i != detailPane.getSelectedIndex()) { if (i != detailPane.getSelectedIndex()) {

View File

@ -51,6 +51,7 @@ public class DetailPane extends Panel implements EventListener<Event> {
private static final String DELETE_IMAGE = "/images/Delete16.png"; private static final String DELETE_IMAGE = "/images/Delete16.png";
private static final String EDIT_IMAGE = "/images/EditRecord16.png"; private static final String EDIT_IMAGE = "/images/EditRecord16.png";
private static final String NEW_IMAGE = "/images/New16.png"; private static final String NEW_IMAGE = "/images/New16.png";
private static final String PROCESS_IMAGE = "/images/Process16.png";
/** /**
* generated serial id * generated serial id
@ -140,19 +141,36 @@ public class DetailPane extends Panel implements EventListener<Event> {
tab.setLabel(tabLabel.label); tab.setLabel(tabLabel.label);
if (!enabled) { if (!enabled) {
tab.setDisabled(true); tab.setDisabled(true);
tab.setSclass("adwindow-detailpane-sub-tab");
} }
tab.addEventListener(Events.ON_DOUBLE_CLICK, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
Tab tab = (Tab) event.getTarget();
if (!tab.isSelected())
return;
org.zkoss.zul.Tabpanel zkTabpanel = tab.getLinkedPanel();
IADTabpanel adtab = null;
for(Component c : zkTabpanel.getChildren()) {
if (c instanceof IADTabpanel) {
adtab = (IADTabpanel) c;
break;
}
}
if (adtab != null && adtab.isDetailPaneMode()) {
onEdit();
}
}
});
Tabpanels tabpanels = tabbox.getTabpanels(); Tabpanels tabpanels = tabbox.getTabpanels();
if (tabpanels == null) { if (tabpanels == null) {
tabpanels = new Tabpanels(); tabpanels = new Tabpanels();
//TODO: is this style needed ?
tabpanels.setStyle("min-height: 200px; overflow-y: visible;");
tabpanels.setWidth("100%"); tabpanels.setWidth("100%");
tabbox.appendChild(tabpanels); tabbox.appendChild(tabpanels);
} }
Tabpanel tp = new Tabpanel(); Tabpanel tp = new Tabpanel();
//TODO: is this style needed
tp.setStyle("min-height: 180px; overflow-y: visible; width: 99%; margin: auto;");
tabpanels.appendChild(tp); tabpanels.appendChild(tp);
tp.setStyle("background-color: #fff"); tp.setStyle("background-color: #fff");
ToolBar toolbar = new ToolBar(); ToolBar toolbar = new ToolBar();
@ -194,6 +212,19 @@ public class DetailPane extends Panel implements EventListener<Event> {
}); });
button.setTooltiptext(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Delete"))); button.setTooltiptext(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Delete")));
if (!tabPanel.getGridTab().isSortTab()) {
button = new ToolBarButton();
button.setImage(PROCESS_IMAGE);
toolbar.appendChild(button);
button.addEventListener(Events.ON_CLICK, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
onProcess(event.getTarget());
}
});
button.setTooltiptext(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Process")));
}
Hbox messageContainer = new Hbox(); Hbox messageContainer = new Hbox();
messageContainer.setPack("end"); messageContainer.setPack("end");
messageContainer.setAlign("center"); messageContainer.setAlign("center");
@ -206,6 +237,25 @@ public class DetailPane extends Panel implements EventListener<Event> {
tabPanel.setAttribute("AD_Tab_ID", tabLabel.AD_Tab_ID); tabPanel.setAttribute("AD_Tab_ID", tabLabel.AD_Tab_ID);
tp.appendChild(tabPanel); tp.appendChild(tabPanel);
if (tabPanel.getGridView() != null) {
tabPanel.addEventListener(ADTabpanel.ON_DYNAMIC_DISPLAY_EVENT, this);
tabPanel.getGridView().addEventListener(ON_EDIT_EVENT, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
GridView gridView = (GridView) event.getTarget();
if (gridView.isDetailPaneMode())
onEdit();
}
});
}
}
protected void onProcess(Component button) {
ProcessButtonPopup popup = new ProcessButtonPopup();
ADTabpanel adtab = (ADTabpanel) getSelectedADTabpanel();
popup.render(adtab.getToolbarButtons());
LayoutUtils.openPopupWindow(button, popup, "after_start");
} }
public void setEventListener(EventListener<Event> listener) { public void setEventListener(EventListener<Event> listener) {
@ -247,6 +297,7 @@ public class DetailPane extends Panel implements EventListener<Event> {
public void setStatusMessage(String status, boolean error) { public void setStatusMessage(String status, boolean error) {
IADTabpanel tabPanel = getSelectedADTabpanel(); IADTabpanel tabPanel = getSelectedADTabpanel();
if (tabPanel == null) return;
Hbox messageContainer = messageContainers.get(tabPanel.getAttribute("AD_Tab_ID")); Hbox messageContainer = messageContainers.get(tabPanel.getAttribute("AD_Tab_ID"));
Execution execution = Executions.getCurrent(); Execution execution = Executions.getCurrent();
@ -323,12 +374,16 @@ public class DetailPane extends Panel implements EventListener<Event> {
@Override @Override
public void onEvent(Event event) throws Exception { public void onEvent(Event event) throws Exception {
if (event.getName().equals(Events.ON_CLICK)) {
Component messageContainer = event.getTarget().getParent(); Component messageContainer = event.getTarget().getParent();
Boolean error = (Boolean) messageContainer.getAttribute(STATUS_ERROR_ATTRIBUTE); Boolean error = (Boolean) messageContainer.getAttribute(STATUS_ERROR_ATTRIBUTE);
String status = (String) messageContainer.getAttribute(STATUS_TEXT_ATTRIBUTE); String status = (String) messageContainer.getAttribute(STATUS_TEXT_ATTRIBUTE);
createPopupContent(status); createPopupContent(status);
showPopup(error, messageContainer); showPopup(error, messageContainer);
} else if (event.getName().equals(ADTabpanel.ON_DYNAMIC_DISPLAY_EVENT)) {
updateProcessToolbar();
}
} }
protected void createPopupContent(String status) { protected void createPopupContent(String status) {
@ -394,23 +449,41 @@ public class DetailPane extends Panel implements EventListener<Event> {
} }
boolean enableNew = !changed && insertRecord && !adtab.getGridTab().isSortTab(); boolean enableNew = !changed && insertRecord && !adtab.getGridTab().isSortTab();
boolean enableDelete = !changed && !readOnly && !adtab.getGridTab().isSortTab(); boolean enableDelete = !changed && !readOnly && !adtab.getGridTab().isSortTab();
int newBtn = 0;
int deleteBtn = 0;
for(Component c : toolbar.getChildren()) { for(Component c : toolbar.getChildren()) {
if (c instanceof ToolBarButton) { if (c instanceof ToolBarButton) {
ToolBarButton btn = (ToolBarButton) c; ToolBarButton btn = (ToolBarButton) c;
if (NEW_IMAGE.equals(btn.getImage())) { if (NEW_IMAGE.equals(btn.getImage())) {
btn.setDisabled(!enableNew); btn.setDisabled(!enableNew);
newBtn++;
} else if (DELETE_IMAGE.equals(btn.getImage())) { } else if (DELETE_IMAGE.equals(btn.getImage())) {
btn.setDisabled(!enableDelete); btn.setDisabled(!enableDelete);
deleteBtn++;
} }
if (newBtn > 0 && deleteBtn > 0) }
}
}
private void updateProcessToolbar() {
int index = getSelectedIndex();
if (index < 0 || index >= getTabcount()) return;
Tabpanel tabpanel = tabbox.getTabpanel(index);
Toolbar toolbar = (Toolbar) tabpanel.getFirstChild();
IADTabpanel adtab = getADTabpanel(index);
for(Component c : toolbar.getChildren()) {
if (c instanceof ToolBarButton) {
ToolBarButton btn = (ToolBarButton) c;
if (PROCESS_IMAGE.equals(btn.getImage())) {
if (adtab.getGridTab().isSortTab()) {
btn.setDisabled(true);
} else {
btn.setDisabled(((ADTabpanel)adtab).getToolbarButtons().isEmpty());
}
break; break;
} }
} }
} }
}
public void onEdit() throws Exception { public void onEdit() throws Exception {
Event openEvent = new Event(ON_EDIT_EVENT, DetailPane.this); Event openEvent = new Event(ON_EDIT_EVENT, DetailPane.this);
@ -453,4 +526,18 @@ public class DetailPane extends Panel implements EventListener<Event> {
Tab tab = (Tab) tabbox.getTabs().getChildren().get(i); Tab tab = (Tab) tabbox.getTabs().getChildren().get(i);
tab.setDisabled(!enabled); tab.setDisabled(!enabled);
} }
public void disableToolbar() {
int index = getSelectedIndex();
if (index < 0 || index >= getTabcount()) return;
Tabpanel tabpanel = tabbox.getTabpanel(index);
Toolbar toolbar = (Toolbar) tabpanel.getFirstChild();
for(Component c : toolbar.getChildren()) {
if (c instanceof ToolBarButton) {
ToolBarButton btn = (ToolBarButton) c;
btn.setDisabled(true);
}
}
}
} }

View File

@ -39,7 +39,9 @@ import org.compiere.model.GridField;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
import org.compiere.util.DisplayType; import org.compiere.util.DisplayType;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.util.NamePair; import org.compiere.util.NamePair;
import org.compiere.util.Util;
import org.zkoss.zk.au.out.AuFocus; import org.zkoss.zk.au.out.AuFocus;
import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.HtmlBasedComponent; import org.zkoss.zk.ui.HtmlBasedComponent;
@ -74,6 +76,7 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
private int windowNo; private int windowNo;
private GridTabDataBinder dataBinder; private GridTabDataBinder dataBinder;
private Map<GridField, WEditor> editors = new LinkedHashMap<GridField, WEditor>(); private Map<GridField, WEditor> editors = new LinkedHashMap<GridField, WEditor>();
private Map<GridField, WEditor> toolbarEditors = new LinkedHashMap<GridField, WEditor>();
private Paging paging; private Paging paging;
private Map<String, Map<Object, String>> lookupCache = null; private Map<String, Map<Object, String>> lookupCache = null;
@ -86,6 +89,7 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
private boolean editing = false; private boolean editing = false;
private int currentRowIndex = -1; private int currentRowIndex = -1;
private AbstractADWindowContent m_windowPanel; private AbstractADWindowContent m_windowPanel;
private ActionListener buttonListener;
/** /**
* *
@ -113,9 +117,10 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
private void prepareFieldEditor(GridField gridField, WEditor editor) { private void prepareFieldEditor(GridField gridField, WEditor editor) {
if (editor instanceof WButtonEditor) if (editor instanceof WButtonEditor)
{ {
if (m_windowPanel != null) if (buttonListener != null)
{ {
((WButtonEditor)editor).addActionListener(m_windowPanel); ((WButtonEditor)editor).removeActionListener(buttonListener);
((WButtonEditor)editor).addActionListener(buttonListener);
} }
else else
{ {
@ -229,16 +234,7 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
editor.setValue(gridTab.getValue(rowIndex, gridField.getColumnName())); editor.setValue(gridTab.getValue(rowIndex, gridField.getColumnName()));
editor.setReadWrite(gridField.isEditable(gridRowCtx, true,true)); editor.setReadWrite(gridField.isEditable(gridRowCtx, true,true));
editor.getComponent().setAttribute("grid.row.index", rowIndex); editor.getComponent().setAttribute("grid.row.index", rowIndex);
editor.addActionListener(new ActionListener() { editor.addActionListener(buttonListener);
public void actionPerformed(ActionEvent event) {
WButtonEditor editor = (WButtonEditor) event.getSource();
int rowIndex = (Integer) editor.getComponent().getAttribute("grid.row.index");
int newRowIndex = gridTab.navigate(rowIndex);
if (newRowIndex == rowIndex) {
m_windowPanel.actionPerformed(event);
}
}
});
component = editor.getComponent(); component = editor.getComponent();
} else { } else {
String text = getDisplayText(value, gridField); String text = getDisplayText(value, gridField);
@ -281,6 +277,13 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
return editorList; return editorList;
} }
public List<WEditor> getToolbarEditors() {
List<WEditor> editorList = new ArrayList<WEditor>();
if (!toolbarEditors.isEmpty())
editorList.addAll(toolbarEditors.values());
return editorList;
}
/** /**
* @param paging * @param paging
*/ */
@ -398,16 +401,33 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
Cell cell = new Cell(); Cell cell = new Cell();
cell.setWidth("10px"); cell.setWidth("10px");
cell.addEventListener(Events.ON_CLICK, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
Cell cell = (Cell) event.getTarget();
if (cell.getSclass() != null && cell.getSclass().indexOf("row-indicator-seld") >= 0)
Events.sendEvent(gridPanel, new Event(DetailPane.ON_EDIT_EVENT, gridPanel));
else
Events.sendEvent(event.getTarget().getParent(), event);
}
});
cell.setTooltiptext(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "EditRecord")));
//TODO: checkbox for selection and batch action ( delete, export, complete, etc ) //TODO: checkbox for selection and batch action ( delete, export, complete, etc )
// cell.appendChild(new Checkbox()); // cell.appendChild(new Checkbox());
row.appendChild(cell); row.appendChild(cell);
int colIndex = -1; int colIndex = -1;
for (int i = 0; i < columnCount; i++) { for (int i = 0; i < columnCount; i++) {
if (editors.get(gridPanelFields[i]) == null) if (editors.get(gridPanelFields[i]) == null) {
editors.put(gridPanelFields[i], WebEditorFactory.getEditor(gridPanelFields[i], true)); WEditor editor = WebEditorFactory.getEditor(gridPanelFields[i], true);
editors.put(gridPanelFields[i], editor);
if (editor instanceof WButtonEditor) {
((WButtonEditor)editor).addActionListener(buttonListener);
}
}
if (!gridPanelFields[i].isDisplayedGrid()) { if (!gridPanelFields[i].isDisplayedGrid() || gridPanelFields[i].isToolbarButton()) {
continue; continue;
} }
colIndex ++; colIndex ++;
@ -436,6 +456,16 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
row.appendChild(div); row.appendChild(div);
} }
for (GridField gridField : gridTabFields) {
if (gridField.isToolbarButton() && gridField.isDisplayed()) {
if (toolbarEditors.get(gridField) == null) {
WButtonEditor editor = (WButtonEditor) WebEditorFactory.getEditor(gridField, true);
toolbarEditors.put(gridField, editor);
editor.addActionListener(buttonListener);
}
}
}
if (rowIndex == gridTab.getCurrentRow()) { if (rowIndex == gridTab.getCurrentRow()) {
setCurrentRow(row); setCurrentRow(row);
} }
@ -450,13 +480,13 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
Cell cell = (Cell) currentRow.getFirstChild(); Cell cell = (Cell) currentRow.getFirstChild();
if (cell != null) { if (cell != null) {
cell.setStyle("background-color: transparent"); cell.setStyle("background-color: transparent");
cell.setSclass(null); cell.setSclass("row-indicator");
} }
} }
currentRow = row; currentRow = row;
Cell cell = (Cell) currentRow.getFirstChild(); Cell cell = (Cell) currentRow.getFirstChild();
if (cell != null) { if (cell != null) {
cell.setSclass("current-row-indicator"); cell.setSclass("row-indicator-seld");
} }
currentRowIndex = gridTab.getCurrentRow(); currentRowIndex = gridTab.getCurrentRow();
@ -499,7 +529,7 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
//skip indicator column //skip indicator column
int colIndex = 0; int colIndex = 0;
for (int i = 0; i < columnCount; i++) { for (int i = 0; i < columnCount; i++) {
if (!gridPanelFields[i].isDisplayedGrid()) { if (!gridPanelFields[i].isDisplayedGrid() || gridPanelFields[i].isToolbarButton()) {
continue; continue;
} }
colIndex ++; colIndex ++;
@ -665,6 +695,24 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
* @param windowPanel * @param windowPanel
*/ */
public void setADWindowPanel(AbstractADWindowContent windowPanel) { public void setADWindowPanel(AbstractADWindowContent windowPanel) {
if (this.m_windowPanel == windowPanel)
return;
this.m_windowPanel = windowPanel; this.m_windowPanel = windowPanel;
buttonListener = new ActionListener() {
public void actionPerformed(ActionEvent event) {
WButtonEditor editor = (WButtonEditor) event.getSource();
Integer rowIndex = (Integer) editor.getComponent().getAttribute("grid.row.index");
if (rowIndex != null) {
int newRowIndex = gridTab.navigate(rowIndex);
if (newRowIndex == rowIndex) {
m_windowPanel.actionPerformed(event);
}
} else {
m_windowPanel.actionPerformed(event);
}
}
};
} }
} }

View File

@ -28,6 +28,7 @@ import org.adempiere.webui.component.Columns;
import org.adempiere.webui.component.EditorBox; import org.adempiere.webui.component.EditorBox;
import org.adempiere.webui.component.Grid; import org.adempiere.webui.component.Grid;
import org.adempiere.webui.component.NumberBox; import org.adempiere.webui.component.NumberBox;
import org.adempiere.webui.editor.WButtonEditor;
import org.adempiere.webui.editor.WEditor; import org.adempiere.webui.editor.WEditor;
import org.adempiere.webui.event.TouchEventHelper; import org.adempiere.webui.event.TouchEventHelper;
import org.adempiere.webui.util.SortComparator; import org.adempiere.webui.util.SortComparator;
@ -119,6 +120,8 @@ public class GridView extends Vbox implements EventListener<Event>
private Borderlayout borderLayout; private Borderlayout borderLayout;
private boolean detailPaneMode;
public GridView() public GridView()
{ {
this(0); this(0);
@ -191,6 +194,7 @@ public class GridView extends Vbox implements EventListener<Event>
} }
public void setDetailPaneMode(boolean detailPaneMode, boolean vflex) { public void setDetailPaneMode(boolean detailPaneMode, boolean vflex) {
this.detailPaneMode = detailPaneMode;
if (detailPaneMode) { if (detailPaneMode) {
pageSize = DEFAULT_DETAIL_PAGE_SIZE; pageSize = DEFAULT_DETAIL_PAGE_SIZE;
updatePaging(); updatePaging();
@ -221,6 +225,10 @@ public class GridView extends Vbox implements EventListener<Event>
} }
} }
public boolean isDetailPaneMode() {
return this.detailPaneMode;
}
private void updatePaging() { private void updatePaging() {
if (paging != null && paging.getPageSize() != pageSize) { if (paging != null && paging.getPageSize() != pageSize) {
paging.setPageSize(pageSize); paging.setPageSize(pageSize);
@ -264,7 +272,7 @@ public class GridView extends Vbox implements EventListener<Event>
int AD_Field_ID = Integer.parseInt(fieldIdStr); int AD_Field_ID = Integer.parseInt(fieldIdStr);
for(GridField gridField : tmpFields) { for(GridField gridField : tmpFields) {
if (gridField.getAD_Field_ID() == AD_Field_ID) { if (gridField.getAD_Field_ID() == AD_Field_ID) {
if(gridField.isDisplayedGrid()) if(gridField.isDisplayedGrid() && !gridField.isToolbarButton())
fieldList.add(gridField); fieldList.add(gridField);
break; break;
@ -282,7 +290,7 @@ public class GridView extends Vbox implements EventListener<Event>
ArrayList<GridField> gridFieldList = new ArrayList<GridField>(); ArrayList<GridField> gridFieldList = new ArrayList<GridField>();
for(GridField field:tmpFields){ for(GridField field:tmpFields){
if(field.isDisplayedGrid()){ if(field.isDisplayedGrid() && !field.isToolbarButton()) {
gridFieldList.add(field); gridFieldList.add(field);
} }
} }
@ -435,14 +443,14 @@ public class GridView extends Vbox implements EventListener<Event>
columns.appendChild(indicator); columns.appendChild(indicator);
listbox.appendChild(columns); listbox.appendChild(columns);
columns.setSizable(true); columns.setSizable(true);
columns.setMenupopup("auto"); columns.setMenupopup("none");
columns.setColumnsgroup(false); columns.setColumnsgroup(false);
Map<Integer, String> colnames = new HashMap<Integer, String>(); Map<Integer, String> colnames = new HashMap<Integer, String>();
int index = 0; int index = 0;
for (int i = 0; i < numColumns; i++) for (int i = 0; i < numColumns; i++)
{ {
if (gridField[i].isDisplayedGrid()) if (gridField[i].isDisplayedGrid() && !gridField[i].isToolbarButton())
{ {
colnames.put(index, gridField[i].getHeader()); colnames.put(index, gridField[i].getHeader());
index++; index++;
@ -759,6 +767,9 @@ public class GridView extends Vbox implements EventListener<Event>
return; return;
} }
if (renderer.getEditors().isEmpty())
listbox.onInitRender();
// Selective // Selective
if (col > 0) if (col > 0)
{ {
@ -774,10 +785,16 @@ public class GridView extends Vbox implements EventListener<Event>
boolean noData = gridTab.getRowCount() == 0; boolean noData = gridTab.getRowCount() == 0;
List<WEditor> list = renderer.getEditors(); List<WEditor> list = renderer.getEditors();
dynamicDisplayEditors(noData, list);
list = renderer.getToolbarEditors();
dynamicDisplayEditors(noData, list); // all components
}
private void dynamicDisplayEditors(boolean noData, List<WEditor> list) {
for (WEditor comp : list) for (WEditor comp : list)
{ {
GridField mField = comp.getGridField(); GridField mField = comp.getGridField();
if (mField != null && mField.getIncluded_Tab_ID() <= 0) if (mField != null)
{ {
if (noData) if (noData)
{ {
@ -792,7 +809,7 @@ public class GridView extends Vbox implements EventListener<Event>
comp.setVisible(mField.isDisplayedGrid()); comp.setVisible(mField.isDisplayedGrid());
} }
} // all components }
} }
/** /**
@ -892,4 +909,18 @@ public class GridView extends Vbox implements EventListener<Event>
} }
return details; return details;
} }
public List<WButtonEditor> getToolbarButtons() {
List<WButtonEditor> buttonList = new ArrayList<WButtonEditor>();
List<WEditor> editors = renderer.getToolbarEditors();
for(WEditor editor : editors) {
if (editor instanceof WButtonEditor && editor.getComponent() != null && editor.getComponent().isVisible()) {
WButtonEditor btnEditor = (WButtonEditor) editor;
buttonList.add(btnEditor);
editor.setValue(editor.getGridField().getValue());
btnEditor.setADTabpanel((IADTabpanel) this.getParent());
}
}
return buttonList;
}
} }

View File

@ -120,4 +120,12 @@ public interface IADTabpanel extends Component, Evaluatee {
public boolean isActive(); public boolean isActive();
public void setDetailPaneMode(boolean detailMode, boolean vflex); public void setDetailPaneMode(boolean detailMode, boolean vflex);
public boolean isDetailPaneMode();
public abstract GridView getGridView();
public boolean needSave(boolean rowChange, boolean onlyRealChange);
public boolean dataSave(boolean onSaveEvent);
} }

View File

@ -0,0 +1,42 @@
/**
*
*/
package org.adempiere.webui.adwindow;
import java.util.List;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.editor.WButtonEditor;
import org.zkoss.zul.Vbox;
/**
* @author hengsin
*
*/
public class ProcessButtonPopup extends Window {
/**
* generated serial id
*/
private static final long serialVersionUID = 304878472233552113L;
public void render(List<WButtonEditor> editors) {
setSclass("toolbar-popup-window");
//setWidth("250px");
setHflex("min");
setBorder("normal");
Vbox vbox = new Vbox();
appendChild(vbox);
vbox.setSclass("toolbar-popup-window-cnt");
vbox.setAlign("stretch");
for(WButtonEditor editor : editors) {
if (editor.getComponent().getPage() != null) {
editor.getComponent().detach();
}
vbox.appendChild(editor.getComponent());
}
}
}

View File

@ -1,3 +1,16 @@
/******************************************************************************
* Copyright (C) 2012 Elaine Tan *
* Copyright (C) 2012 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.adempiere.webui.apps.form; package org.adempiere.webui.apps.form;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -28,6 +41,11 @@ import org.compiere.util.Msg;
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
/**
*
* @author Elaine
*
*/
public class WPaymentFormCash extends PaymentFormCash implements EventListener<Event> { public class WPaymentFormCash extends PaymentFormCash implements EventListener<Event> {
private WPaymentFormWindow window; private WPaymentFormWindow window;
@ -224,7 +242,7 @@ public class WPaymentFormCash extends PaymentFormCash implements EventListener<E
else if (processMsg != null) else if (processMsg != null)
FDialog.info(getWindowNo(), window, "PaymentCreated", processMsg); FDialog.info(getWindowNo(), window, "PaymentCreated", processMsg);
return true; return ok;
} }
@Override @Override

View File

@ -1,3 +1,16 @@
/******************************************************************************
* Copyright (C) 2012 Elaine Tan *
* Copyright (C) 2012 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.adempiere.webui.apps.form; package org.adempiere.webui.apps.form;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -14,6 +27,7 @@ import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.ListItem; import org.adempiere.webui.component.ListItem;
import org.adempiere.webui.component.Listbox; import org.adempiere.webui.component.Listbox;
import org.adempiere.webui.component.ListboxFactory; import org.adempiere.webui.component.ListboxFactory;
import org.adempiere.webui.component.Panel;
import org.adempiere.webui.component.Row; import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows; import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Textbox; import org.adempiere.webui.component.Textbox;
@ -21,16 +35,24 @@ import org.adempiere.webui.editor.WNumberEditor;
import org.adempiere.webui.window.FDialog; import org.adempiere.webui.window.FDialog;
import org.compiere.grid.PaymentFormCheck; import org.compiere.grid.PaymentFormCheck;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
import org.compiere.model.MBankAccountProcessor;
import org.compiere.model.MConversionRate; import org.compiere.model.MConversionRate;
import org.compiere.model.MPaymentValidate; import org.compiere.model.MPaymentValidate;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.KeyNamePair; import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg; import org.compiere.util.Msg;
import org.zkoss.zk.au.out.AuEcho;
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zul.Cell; import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Space; import org.zkoss.zul.Space;
/**
*
* @author Elaine
*
*/
public class WPaymentFormCheck extends PaymentFormCheck implements EventListener<Event> { public class WPaymentFormCheck extends PaymentFormCheck implements EventListener<Event> {
private WPaymentFormWindow window; private WPaymentFormWindow window;
@ -39,6 +61,7 @@ public class WPaymentFormCheck extends PaymentFormCheck implements EventListener
private Listbox sBankAccountCombo = ListboxFactory.newDropdownListbox(); private Listbox sBankAccountCombo = ListboxFactory.newDropdownListbox();
private Label sCurrencyLabel = new Label(); private Label sCurrencyLabel = new Label();
private Listbox sCurrencyCombo = ListboxFactory.newDropdownListbox(); private Listbox sCurrencyCombo = ListboxFactory.newDropdownListbox();
private Space sCurrencySpace = new Space();
private Label sAmountLabel = new Label(); private Label sAmountLabel = new Label();
private WNumberEditor sAmountField = new WNumberEditor(); private WNumberEditor sAmountField = new WNumberEditor();
private Label sRoutingLabel = new Label(); private Label sRoutingLabel = new Label();
@ -49,6 +72,7 @@ public class WPaymentFormCheck extends PaymentFormCheck implements EventListener
private Label sCheckLabel = new Label(); private Label sCheckLabel = new Label();
private Button sOnline = new Button(); private Button sOnline = new Button();
private Label sStatus = new Label(); private Label sStatus = new Label();
private Panel customizePanel = new Panel();
public WPaymentFormCheck(int windowNo, GridTab mTab) { public WPaymentFormCheck(int windowNo, GridTab mTab) {
super(windowNo, mTab); super(windowNo, mTab);
@ -71,7 +95,7 @@ public class WPaymentFormCheck extends PaymentFormCheck implements EventListener
sStatus.setText(" "); sStatus.setText(" ");
sOnline.setLabel(Msg.getMsg(Env.getCtx(), "Online")); sOnline.setLabel(Msg.getMsg(Env.getCtx(), "Online"));
LayoutUtils.addSclass("action-text-button", sOnline); LayoutUtils.addSclass("action-text-button", sOnline);
// sOnline.addActionListener(this); sOnline.addActionListener(this);
window.getPanel().setId("sPanel"); window.getPanel().setId("sPanel");
Columns columns = new Columns(); Columns columns = new Columns();
@ -79,15 +103,11 @@ public class WPaymentFormCheck extends PaymentFormCheck implements EventListener
Column column = new Column(); Column column = new Column();
columns.appendChild(column); columns.appendChild(column);
column.setWidth("30%"); column.setWidth("40%");
column = new Column(); column = new Column();
columns.appendChild(column); columns.appendChild(column);
column.setWidth("50%"); column.setWidth("60%");
column = new Column();
columns.appendChild(column);
column.setWidth("20%");
sAmountField.getComponent().setWidth("150px"); sAmountField.getComponent().setWidth("150px");
@ -95,38 +115,37 @@ public class WPaymentFormCheck extends PaymentFormCheck implements EventListener
Row row = rows.newRow(); Row row = rows.newRow();
row.appendChild(sBankAccountLabel.rightAlign()); row.appendChild(sBankAccountLabel.rightAlign());
row.appendChild(sBankAccountCombo); row.appendChild(sBankAccountCombo);
row.appendChild(new Space());
row = rows.newRow(); row = rows.newRow();
row.appendChild(sCurrencyLabel.rightAlign()); row.appendChild(sCurrencyLabel.rightAlign());
row.appendChild(sCurrencyCombo); row.appendChild(sCurrencyCombo);
row.appendChild(new Space());
row = rows.newRow(); row = rows.newRow();
row.appendChild(sAmountLabel.rightAlign()); row.appendChild(sAmountLabel.rightAlign());
row.appendChild(sAmountField.getComponent()); row.appendChild(sAmountField.getComponent());
row.appendChild(new Space()); sAmountField.getComponent().addEventListener(Events.ON_BLUR, this);
row = rows.newRow(); row = rows.newRow();
row.appendChild(sRoutingLabel.rightAlign()); row.appendChild(sRoutingLabel.rightAlign());
row.appendChild(sRoutingField); row.appendChild(sRoutingField);
row.appendChild(new Space());
row = rows.newRow(); row = rows.newRow();
row.appendChild(sNumberLabel.rightAlign()); row.appendChild(sNumberLabel.rightAlign());
row.appendChild(sNumberField); row.appendChild(sNumberField);
row.appendChild(new Space());
row = rows.newRow(); row = rows.newRow();
row.appendChild(sCheckLabel.rightAlign()); row.appendChild(sCheckLabel.rightAlign());
row.appendChild(sCheckField); row.appendChild(sCheckField);
row = rows.newRow();
row.appendCellChild(customizePanel, 2);
row = rows.newRow();
row.appendChild(new Space());
row.appendChild(sOnline); row.appendChild(sOnline);
row = rows.newRow(); row = rows.newRow();
Cell cell = new Cell(); row.appendCellChild(sStatus, 2);
row.appendChild(cell);
cell.appendChild(sStatus);
cell.setColspan(3);
} }
@Override @Override
@ -159,6 +178,7 @@ public class WPaymentFormCheck extends PaymentFormCheck implements EventListener
{ {
sCurrencyLabel.setVisible(false); // Check sCurrencyLabel.setVisible(false); // Check
sCurrencyCombo.setVisible(false); sCurrencyCombo.setVisible(false);
sCurrencySpace.setVisible(false);
} }
ArrayList<KeyNamePair> list = getBankAccountList(); ArrayList<KeyNamePair> list = getBankAccountList();
@ -168,21 +188,59 @@ public class WPaymentFormCheck extends PaymentFormCheck implements EventListener
// Set Selection // Set Selection
if (selectedBankAccount != null) if (selectedBankAccount != null)
sBankAccountCombo.setSelectedKeyNamePair(selectedBankAccount); sBankAccountCombo.setSelectedKeyNamePair(selectedBankAccount);
boolean exist = isBankAccountProcessorExist(m_C_Currency_ID, (BigDecimal) sAmountField.getValue());
sOnline.setVisible(exist);
if (exist)
updateOnlineButton();
} }
public void onEvent(Event e) public void onEvent(Event e)
{ {
if (e.getTarget() == sCurrencyCombo || e.getTarget() == sAmountField)
{
int C_Currency_ID = 0;
KeyNamePair pp = sCurrencyCombo.getSelectedItem().toKeyNamePair();
if (pp != null)
C_Currency_ID = pp.getKey();
if (e.getTarget() == sCurrencyCombo) if (e.getTarget() == sCurrencyCombo)
{ {
KeyNamePair pp = sCurrencyCombo.getSelectedItem().toKeyNamePair();
BigDecimal amt = MConversionRate.convert(Env.getCtx(), BigDecimal amt = MConversionRate.convert(Env.getCtx(),
m_Amount, m_C_Currency_ID, pp.getKey(), m_AD_Client_ID, m_AD_Org_ID); m_Amount, m_C_Currency_ID, C_Currency_ID, m_AD_Client_ID, m_AD_Org_ID);
sAmountField.setValue(amt); sAmountField.setValue(amt);
} }
// else if (e.getTarget() == sOnline) {
// window.lockUI(); updateOnlineButton();
// Clients.response(new AuEcho(window, "runProcessOnline", null)); }
// } else if (e.getTarget() == sOnline)
{
window.lockUI();
Clients.response(new AuEcho(window, "runProcessOnline", null));
}
}
private void updateOnlineButton()
{
int C_Currency_ID = 0;
KeyNamePair pp = sCurrencyCombo.getSelectedItem().toKeyNamePair();
if (pp != null)
C_Currency_ID = pp.getKey();
BigDecimal PayAmt = (BigDecimal) sAmountField.getValue();
if (C_Currency_ID > 0 && PayAmt != null)
{
MBankAccountProcessor bankAccountProcessor = getBankAccountProcessor(C_Currency_ID, PayAmt);
sOnline.setEnabled(bankAccountProcessor != null);
setBankAccountProcessor(bankAccountProcessor);
}
else
{
sOnline.setEnabled(false);
setBankAccountProcessor(null);
}
} }
@Override @Override
@ -240,7 +298,7 @@ public class WPaymentFormCheck extends PaymentFormCheck implements EventListener
else if (processMsg != null) else if (processMsg != null)
FDialog.info(getWindowNo(), window, "PaymentCreated", m_mPayment.getDocumentNo()); FDialog.info(getWindowNo(), window, "PaymentCreated", m_mPayment.getDocumentNo());
return true; return ok;
} }
@Override @Override
@ -257,4 +315,9 @@ public class WPaymentFormCheck extends PaymentFormCheck implements EventListener
public Object getWindow() { public Object getWindow() {
return window; return window;
} }
@Override
public Object getCustomizePanel() {
return customizePanel;
}
} }

View File

@ -1,3 +1,16 @@
/******************************************************************************
* Copyright (C) 2012 Elaine Tan *
* Copyright (C) 2012 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.adempiere.webui.apps.form; package org.adempiere.webui.apps.form;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -12,6 +25,7 @@ import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.ListItem; import org.adempiere.webui.component.ListItem;
import org.adempiere.webui.component.Listbox; import org.adempiere.webui.component.Listbox;
import org.adempiere.webui.component.ListboxFactory; import org.adempiere.webui.component.ListboxFactory;
import org.adempiere.webui.component.Panel;
import org.adempiere.webui.component.Row; import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows; import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Textbox; import org.adempiere.webui.component.Textbox;
@ -19,15 +33,23 @@ import org.adempiere.webui.editor.WNumberEditor;
import org.adempiere.webui.window.FDialog; import org.adempiere.webui.window.FDialog;
import org.compiere.grid.PaymentFormCreditCard; import org.compiere.grid.PaymentFormCreditCard;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
import org.compiere.model.MBankAccountProcessor;
import org.compiere.model.MPaymentProcessor;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Msg; import org.compiere.util.Msg;
import org.compiere.util.ValueNamePair; import org.compiere.util.ValueNamePair;
import org.zkoss.zk.au.out.AuEcho; import org.zkoss.zk.au.out.AuEcho;
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.util.Clients; import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Space; import org.zkoss.zul.Space;
/**
*
* @author Elaine
*
*/
public class WPaymentFormCreditCard extends PaymentFormCreditCard implements EventListener<Event> { public class WPaymentFormCreditCard extends PaymentFormCreditCard implements EventListener<Event> {
private WPaymentFormWindow window; private WPaymentFormWindow window;
@ -44,6 +66,7 @@ public class WPaymentFormCreditCard extends PaymentFormCreditCard implements Eve
private Textbox kApprovalField = new Textbox(); private Textbox kApprovalField = new Textbox();
private Button kOnline = new Button(); private Button kOnline = new Button();
private Label kStatus = new Label(); private Label kStatus = new Label();
private Panel customizePanel = new Panel();
public WPaymentFormCreditCard(int windowNo, GridTab mTab) { public WPaymentFormCreditCard(int windowNo, GridTab mTab) {
super(windowNo, mTab); super(windowNo, mTab);
@ -73,15 +96,11 @@ public class WPaymentFormCreditCard extends PaymentFormCreditCard implements Eve
Column column = new Column(); Column column = new Column();
columns.appendChild(column); columns.appendChild(column);
column.setWidth("30%"); column.setWidth("40%");
column = new Column(); column = new Column();
columns.appendChild(column); columns.appendChild(column);
column.setWidth("50%"); column.setWidth("60%");
column = new Column();
columns.appendChild(column);
column.setWidth("20%");
kAmountField.getComponent().setWidth("150px"); kAmountField.getComponent().setWidth("150px");
@ -89,30 +108,34 @@ public class WPaymentFormCreditCard extends PaymentFormCreditCard implements Eve
Row row = rows.newRow(); Row row = rows.newRow();
row.appendChild(kTypeLabel.rightAlign()); row.appendChild(kTypeLabel.rightAlign());
row.appendChild(kTypeCombo); row.appendChild(kTypeCombo);
row.appendChild(new Space()); kTypeCombo.addEventListener(Events.ON_SELECT, this);
row = rows.newRow(); row = rows.newRow();
row.appendChild(kNumberLabel.rightAlign()); row.appendChild(kNumberLabel.rightAlign());
row.appendChild(kNumberField); row.appendChild(kNumberField);
row.appendChild(new Space());
row = rows.newRow(); row = rows.newRow();
row.appendChild(kExpLabel.rightAlign()); row.appendChild(kExpLabel.rightAlign());
row.appendChild(kExpField); row.appendChild(kExpField);
row.appendChild(new Space());
row = rows.newRow(); row = rows.newRow();
row.appendChild(kAmountLabel.rightAlign()); row.appendChild(kAmountLabel.rightAlign());
row.appendChild(kAmountField.getComponent()); row.appendChild(kAmountField.getComponent());
row.appendChild(new Space()); kAmountField.getComponent().addEventListener(Events.ON_BLUR, this);
row = rows.newRow(); row = rows.newRow();
row.appendChild(kApprovalLabel.rightAlign()); row.appendChild(kApprovalLabel.rightAlign());
row.appendChild(kApprovalField); row.appendChild(kApprovalField);
row = rows.newRow();
row.appendCellChild(customizePanel, 2);
row = rows.newRow();
row.appendChild(new Space());
row.appendChild(kOnline); row.appendChild(kOnline);
row = rows.newRow(); row = rows.newRow();
row.appendCellChild(kStatus, 3); row.appendCellChild(kStatus, 2);
} }
@Override @Override
@ -146,6 +169,23 @@ public class WPaymentFormCreditCard extends PaymentFormCreditCard implements Eve
// Set Selection // Set Selection
if (selectedCreditCard != null) if (selectedCreditCard != null)
kTypeCombo.setSelectedValueNamePair(selectedCreditCard); kTypeCombo.setSelectedValueNamePair(selectedCreditCard);
if (m_mPayment.isApproved())
{
kOnline.setVisible(true);
kOnline.setEnabled(false);
MBankAccountProcessor bankAccountProcessor = new MBankAccountProcessor(m_mPayment.getCtx(), m_mPayment.getC_BankAccount_ID(), m_mPayment.getC_PaymentProcessor_ID(), null);
setBankAccountProcessor(bankAccountProcessor);
}
else
{
boolean exist = isBankAccountProcessorExist("", (BigDecimal) kAmountField.getValue());
kOnline.setVisible(exist);
if (exist)
updateOnlineButton();
}
} }
public void onEvent(Event e) public void onEvent(Event e)
@ -154,6 +194,34 @@ public class WPaymentFormCreditCard extends PaymentFormCreditCard implements Eve
window.lockUI(); window.lockUI();
Clients.response(new AuEcho(window, "runProcessOnline", null)); Clients.response(new AuEcho(window, "runProcessOnline", null));
} }
else if (e.getTarget() == kTypeCombo || e.getTarget() == kAmountField)
updateOnlineButton();
}
private void updateOnlineButton()
{
String CCType = null;
ListItem selected = kTypeCombo.getSelectedItem();
ValueNamePair vp = selected != null ? selected.toValueNamePair() : null;
if (vp != null)
CCType = vp.getValue();
BigDecimal PayAmt = (BigDecimal) kAmountField.getValue();
if (CCType != null && PayAmt != null)
{
MBankAccountProcessor bankAccountProcessor = getBankAccountProcessor(CCType, PayAmt);
kOnline.setEnabled(bankAccountProcessor != null);
setBankAccountProcessor(bankAccountProcessor);
MPaymentProcessor paymentProcessor = new MPaymentProcessor(Env.getCtx(), bankAccountProcessor.getC_PaymentProcessor_ID(), null);
kApprovalField.setReadonly(!paymentProcessor.isRequireVV());
}
else
{
kOnline.setEnabled(false);
setBankAccountProcessor(null);
}
} }
@Override @Override
@ -175,7 +243,7 @@ public class WPaymentFormCreditCard extends PaymentFormCreditCard implements Eve
else if (processMsg != null) else if (processMsg != null)
FDialog.info(getWindowNo(), window, "PaymentCreated", processMsg); FDialog.info(getWindowNo(), window, "PaymentCreated", processMsg);
return true; return ok;
} }
@Override @Override
@ -190,7 +258,7 @@ public class WPaymentFormCreditCard extends PaymentFormCreditCard implements Eve
boolean ok = processOnline(CCType, kNumberField.getText(), kExpField.getText()); boolean ok = processOnline(CCType, kNumberField.getText(), kExpField.getText());
if (!ok) if (!ok)
FDialog.error(getWindowNo(), window, "PaymentError", processMsg); FDialog.error(getWindowNo(), window, "PaymentNotProcessed", processMsg);
else if (processMsg != null) else if (processMsg != null)
FDialog.info(getWindowNo(), window, "PaymentProcessed", processMsg); FDialog.info(getWindowNo(), window, "PaymentProcessed", processMsg);
} // online } // online
@ -209,4 +277,9 @@ public class WPaymentFormCreditCard extends PaymentFormCreditCard implements Eve
public Object getWindow() { public Object getWindow() {
return window; return window;
} }
@Override
public Object getCustomizePanel() {
return customizePanel;
}
} }

View File

@ -0,0 +1,196 @@
/******************************************************************************
* Copyright (C) 2012 Elaine Tan *
* Copyright (C) 2012 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.adempiere.webui.apps.form;
import java.util.ArrayList;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.Column;
import org.adempiere.webui.component.Columns;
import org.adempiere.webui.component.Grid;
import org.adempiere.webui.component.GridFactory;
import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.ListItem;
import org.adempiere.webui.component.Listbox;
import org.adempiere.webui.component.ListboxFactory;
import org.adempiere.webui.component.Panel;
import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Textbox;
import org.adempiere.webui.window.FDialog;
import org.compiere.grid.PaymentFormDirect;
import org.compiere.model.GridTab;
import org.compiere.model.MBankAccountProcessor;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg;
import org.zkoss.zk.au.out.AuEcho;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Space;
/**
*
* @author Elaine
*
*/
public abstract class WPaymentFormDirect extends PaymentFormDirect implements EventListener<Event> {
private WPaymentFormWindow window;
private Label tAccountLabel = new Label();
private Listbox tAccountCombo = ListboxFactory.newDropdownListbox();
private Button tOnline = new Button();
private Textbox tRoutingField = new Textbox();
private Textbox tNumberField = new Textbox();
private Label tStatus = new Label();
private Label tRoutingText = new Label();
private Label tNumberText = new Label();
private Panel customizePanel = new Panel();
public WPaymentFormDirect(int windowNo, GridTab mTab, boolean isDebit) {
super(windowNo, mTab, isDebit);
window = new WPaymentFormWindow(this, windowNo);
init();
}
public void init() {
Grid tPanelLayout = GridFactory.newGridLayout();
window.getPanel().appendChild(tPanelLayout);
tAccountLabel.setText(Msg.translate(Env.getCtx(), "C_BP_BankAccount_ID"));
tRoutingField.setCols(8);
tNumberField.setCols(10);
tRoutingText.setText(Msg.translate(Env.getCtx(), "RoutingNo"));
tNumberText.setText(Msg.translate(Env.getCtx(), "AccountNo"));
tOnline.setLabel(Msg.getMsg(Env.getCtx(), "Online"));
LayoutUtils.addSclass("action-text-button", tOnline);
tOnline.addActionListener(this);
tStatus.setText(" ");
window.getPanel().setId("tPanel");
Columns columns = new Columns();
tPanelLayout.appendChild(columns);
Column column = new Column();
columns.appendChild(column);
column.setWidth("40%");
column = new Column();
columns.appendChild(column);
column.setWidth("60%");
Rows rows = tPanelLayout.newRows();
Row row = rows.newRow();
row.appendChild(tAccountLabel.rightAlign());
row.appendChild(tAccountCombo);
row = rows.newRow();
row.appendChild(tRoutingText.rightAlign());
row.appendChild(tRoutingField);
row = rows.newRow();
row.appendChild(tNumberText.rightAlign());
row.appendChild(tNumberField);
row = rows.newRow();
row.appendCellChild(customizePanel, 2);
row = rows.newRow();
row.appendChild(new Space());
row.appendChild(tOnline);
row = rows.newRow();
row.appendCellChild(tStatus, 2);
}
@Override
public void loadData() {
if (m_C_Payment_ID != 0)
{
tRoutingField.setText(m_mPayment.getRoutingNo());
tNumberField.setText(m_mPayment.getAccountNo());
tStatus.setText(m_mPayment.getR_PnRef());
}
ArrayList<KeyNamePair> list = getBPBankAccountList();
for (KeyNamePair pp : list)
tAccountCombo.addItem(pp);
boolean exist = isBankAccountProcessorExist();
tOnline.setVisible(exist);
MBankAccountProcessor bankAccountProcessor = getBankAccountProcessor();
setBankAccountProcessor(bankAccountProcessor);
}
public void onEvent(Event e)
{
if (e.getTarget() == tOnline)
{
window.lockUI();
Clients.response(new AuEcho(window, "runProcessOnline", null));
}
}
@Override
public boolean checkMandatory() {
/***********************
* Mandatory Data Check
*/
boolean dataOK = true;
ListItem selected = tAccountCombo.getSelectedItem();
KeyNamePair bpba = selected != null ? selected.toKeyNamePair() : null;
if (bpba == null)
{
FDialog.error(getWindowNo(), window, "PaymentBPBankNotFound");
dataOK = false;
}
//
log.config("OK=" + dataOK);
return dataOK;
}
@Override
public boolean saveChangesInTrx(final String trxName) {
boolean ok = save(0, tRoutingField.getText(), tNumberField.getText());
if (!ok)
FDialog.error(getWindowNo(), window, "PaymentError", processMsg);
else if (processMsg != null)
FDialog.info(getWindowNo(), window, "PaymentCreated", m_mPayment.getDocumentNo());
return ok;
}
@Override
public void showWindow() {
window.setVisible(true);
}
@Override
public void closeWindow() {
window.dispose();
}
@Override
public Object getWindow() {
return window;
}
@Override
public Object getCustomizePanel() {
return customizePanel;
}
}

View File

@ -1,10 +1,28 @@
/******************************************************************************
* Copyright (C) 2012 Elaine Tan *
* Copyright (C) 2012 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.adempiere.webui.apps.form; package org.adempiere.webui.apps.form;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
public class WPaymentFormDirectDebit extends WPaymentFormDirectDeposit { /**
*
* @author Elaine
*
*/
public class WPaymentFormDirectDebit extends WPaymentFormDirect {
public WPaymentFormDirectDebit(int windowNo, GridTab mTab) { public WPaymentFormDirectDebit(int windowNo, GridTab mTab) {
super(windowNo, mTab); super(windowNo, mTab, true);
} }
} }

View File

@ -1,150 +1,28 @@
/******************************************************************************
* Copyright (C) 2012 Elaine Tan *
* Copyright (C) 2012 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.adempiere.webui.apps.form; package org.adempiere.webui.apps.form;
import java.util.ArrayList;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.Column;
import org.adempiere.webui.component.Columns;
import org.adempiere.webui.component.Grid;
import org.adempiere.webui.component.GridFactory;
import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.ListItem;
import org.adempiere.webui.component.Listbox;
import org.adempiere.webui.component.ListboxFactory;
import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Textbox;
import org.adempiere.webui.window.FDialog;
import org.compiere.grid.PaymentFormDirectDeposit;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg;
import org.zkoss.zul.Space;
public class WPaymentFormDirectDeposit extends PaymentFormDirectDeposit { /**
*
private WPaymentFormWindow window; * @author Elaine
*
private Label tAccountLabel = new Label(); */
private Listbox tAccountCombo = ListboxFactory.newDropdownListbox(); public class WPaymentFormDirectDeposit extends WPaymentFormDirect {
private Button tOnline = new Button();
private Textbox tRoutingField = new Textbox();
private Textbox tNumberField = new Textbox();
private Label tStatus = new Label();
private Label tRoutingText = new Label();
private Label tNumberText = new Label();
public WPaymentFormDirectDeposit(int windowNo, GridTab mTab) { public WPaymentFormDirectDeposit(int windowNo, GridTab mTab) {
super(windowNo, mTab); super(windowNo, mTab, false);
window = new WPaymentFormWindow(this, windowNo);
init();
}
public void init() {
Grid tPanelLayout = GridFactory.newGridLayout();
window.getPanel().appendChild(tPanelLayout);
tAccountLabel.setText(Msg.translate(Env.getCtx(), "C_BP_BankAccount_ID"));
tRoutingField.setCols(8);
tNumberField.setCols(10);
tRoutingText.setText(Msg.translate(Env.getCtx(), "RoutingNo"));
tNumberText.setText(Msg.translate(Env.getCtx(), "AccountNo"));
tOnline.setLabel(Msg.getMsg(Env.getCtx(), "Online"));
LayoutUtils.addSclass("action-text-button", tOnline);
tStatus.setText(" ");
window.getPanel().setId("tPanel");
Columns columns = new Columns();
tPanelLayout.appendChild(columns);
Column column = new Column();
columns.appendChild(column);
column.setWidth("30%");
column = new Column();
columns.appendChild(column);
column.setWidth("50%");
column = new Column();
columns.appendChild(column);
column.setWidth("20%");
Rows rows = tPanelLayout.newRows();
Row row = rows.newRow();
row.appendChild(tAccountLabel.rightAlign());
row.appendChild(tAccountCombo);
row.appendChild(new Space());
row = rows.newRow();
row.appendChild(tRoutingText.rightAlign());
row.appendChild(tRoutingField);
row.appendChild(new Space());
row = rows.newRow();
row.appendChild(tNumberText.rightAlign());
row.appendChild(tNumberField);
row.appendChild(tOnline);
row = rows.newRow();
row.appendCellChild(tStatus, 3);
}
@Override
public void loadData() {
if (m_C_Payment_ID != 0)
{
tRoutingField.setText(m_mPayment.getRoutingNo());
tNumberField.setText(m_mPayment.getAccountNo());
tStatus.setText(m_mPayment.getR_PnRef());
}
ArrayList<KeyNamePair> list = getBankAccountList();
for (KeyNamePair pp : list)
tAccountCombo.addItem(pp);
}
@Override
public boolean checkMandatory() {
/***********************
* Mandatory Data Check
*/
boolean dataOK = true;
ListItem selected = tAccountCombo.getSelectedItem();
KeyNamePair bpba = selected != null ? selected.toKeyNamePair() : null;
if (bpba == null)
{
FDialog.error(getWindowNo(), window, "PaymentBPBankNotFound");
dataOK = false;
}
//
log.config("OK=" + dataOK);
return dataOK;
}
@Override
public boolean saveChangesInTrx(final String trxName) {
boolean ok = save();
if (!ok)
FDialog.error(getWindowNo(), window, "PaymentError", processMsg);
else if (processMsg != null)
FDialog.info(getWindowNo(), window, "PaymentCreated", m_mPayment.getDocumentNo());
return true;
}
@Override
public void showWindow() {
window.setVisible(true);
}
@Override
public void closeWindow() {
window.dispose();
}
@Override
public Object getWindow() {
return window;
} }
} }

View File

@ -1,19 +1,31 @@
/******************************************************************************
* Copyright (C) 2012 Elaine Tan *
* Copyright (C) 2012 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.adempiere.webui.apps.form; package org.adempiere.webui.apps.form;
import java.util.HashMap; import java.util.HashMap;
import java.util.logging.Level; import java.util.logging.Level;
import org.compiere.grid.IPaymentForm; import org.compiere.grid.IPaymentForm;
import org.compiere.grid.PaymentFormCash;
import org.compiere.grid.PaymentFormCheck;
import org.compiere.grid.PaymentFormCreditCard;
import org.compiere.grid.PaymentFormDirectDebit;
import org.compiere.grid.PaymentFormDirectDeposit;
import org.compiere.grid.PaymentFormMixedPOS;
import org.compiere.grid.PaymentFormOnCredit;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
import org.compiere.model.MInvoice;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
/**
*
* @author Elaine
*
*/
public class WPaymentFormFactory { public class WPaymentFormFactory {
/** Static Logger */ /** Static Logger */
@ -36,13 +48,13 @@ public class WPaymentFormFactory {
{ {
// Register defaults: // Register defaults:
s_registeredClasses = new HashMap<String, Class<? extends IPaymentForm>>(); s_registeredClasses = new HashMap<String, Class<? extends IPaymentForm>>();
s_registeredClasses.put(PaymentFormCash.PAYMENTRULE, WPaymentFormCash.class); s_registeredClasses.put(MInvoice.PAYMENTRULE_Cash, WPaymentFormCash.class);
s_registeredClasses.put(PaymentFormCheck.PAYMENTRULE, WPaymentFormCheck.class); s_registeredClasses.put(MInvoice.PAYMENTRULE_Check, WPaymentFormCheck.class);
s_registeredClasses.put(PaymentFormCreditCard.PAYMENTRULE, WPaymentFormCreditCard.class); s_registeredClasses.put(MInvoice.PAYMENTRULE_CreditCard, WPaymentFormCreditCard.class);
s_registeredClasses.put(PaymentFormDirectDebit.PAYMENTRULE, WPaymentFormDirectDebit.class); s_registeredClasses.put(MInvoice.PAYMENTRULE_DirectDebit, WPaymentFormDirectDebit.class);
s_registeredClasses.put(PaymentFormDirectDeposit.PAYMENTRULE, WPaymentFormDirectDeposit.class); s_registeredClasses.put(MInvoice.PAYMENTRULE_DirectDeposit, WPaymentFormDirectDeposit.class);
s_registeredClasses.put(PaymentFormMixedPOS.PAYMENTRULE, WPaymentFormMixedPOS.class); s_registeredClasses.put(MInvoice.PAYMENTRULE_MixedPOSPayment, WPaymentFormMixedPOS.class);
s_registeredClasses.put(PaymentFormOnCredit.PAYMENTRULE, WPaymentFormOnCredit.class); s_registeredClasses.put(MInvoice.PAYMENTRULE_OnCredit, WPaymentFormOnCredit.class);
} }
public static IPaymentForm create(int windowNo, GridTab mTab, String paymentRule) public static IPaymentForm create(int windowNo, GridTab mTab, String paymentRule)

View File

@ -1,8 +1,26 @@
/******************************************************************************
* Copyright (C) 2012 Elaine Tan *
* Copyright (C) 2012 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.adempiere.webui.apps.form; package org.adempiere.webui.apps.form;
import org.compiere.grid.PaymentFormMixedPOS; import org.compiere.grid.PaymentFormMixedPOS;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
/**
*
* @author Elaine
*
*/
public class WPaymentFormMixedPOS extends PaymentFormMixedPOS { public class WPaymentFormMixedPOS extends PaymentFormMixedPOS {
private WPaymentFormWindow window; private WPaymentFormWindow window;

View File

@ -1,3 +1,16 @@
/******************************************************************************
* Copyright (C) 2012 Elaine Tan *
* Copyright (C) 2012 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.adempiere.webui.apps.form; package org.adempiere.webui.apps.form;
import java.util.ArrayList; import java.util.ArrayList;
@ -18,6 +31,11 @@ import org.compiere.util.Env;
import org.compiere.util.KeyNamePair; import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg; import org.compiere.util.Msg;
/**
*
* @author Elaine
*
*/
public class WPaymentFormOnCredit extends PaymentFormOnCredit { public class WPaymentFormOnCredit extends PaymentFormOnCredit {
private WPaymentFormWindow window; private WPaymentFormWindow window;

View File

@ -1,3 +1,16 @@
/******************************************************************************
* Copyright (C) 2012 Elaine Tan *
* Copyright (C) 2012 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.adempiere.webui.apps.form; package org.adempiere.webui.apps.form;
import org.adempiere.webui.apps.BusyDialog; import org.adempiere.webui.apps.BusyDialog;
@ -15,10 +28,20 @@ import org.zkoss.zul.Borderlayout;
import org.zkoss.zul.Center; import org.zkoss.zul.Center;
import org.zkoss.zul.South; import org.zkoss.zul.South;
/**
*
* @author Elaine
*
*/
public class WPaymentFormWindow extends Window implements EventListener<Event>, DialogEvents { public class WPaymentFormWindow extends Window implements EventListener<Event>, DialogEvents {
/**
*
*/
private static final long serialVersionUID = 2710316463655831868L;
private PaymentForm paymentForm; private PaymentForm paymentForm;
private int windowNo; // private int windowNo;
private Panel mainPanel = new Panel(); private Panel mainPanel = new Panel();
private Panel centerPanel = new Panel(); private Panel centerPanel = new Panel();
@ -34,7 +57,7 @@ public class WPaymentFormWindow extends Window implements EventListener<Event>,
super(); super();
this.paymentForm = paymentForm; this.paymentForm = paymentForm;
this.windowNo = windowNo; // this.windowNo = windowNo;
try { try {
zkInit(); zkInit();
@ -59,6 +82,9 @@ public class WPaymentFormWindow extends Window implements EventListener<Event>,
Center center = new Center(); Center center = new Center();
mainLayout.appendChild(center); mainLayout.appendChild(center);
center.appendChild(centerPanel = getPanel()); center.appendChild(centerPanel = getPanel());
centerPanel.setHflex("1");
centerPanel.setVflex("1");
center.setAutoscroll(true);
// //
South south = new South(); South south = new South();
south.setStyle("border: none"); south.setStyle("border: none");

View File

@ -587,7 +587,8 @@ public class WWFActivity extends ADForm implements EventListener
{ {
int AD_Form_ID = node.getAD_Form_ID(); int AD_Form_ID = node.getAD_Form_ID();
Window form = ADForm.openForm(AD_Form_ID); ADForm form = ADForm.openForm(AD_Form_ID);
form.setAttribute(Window.MODE_KEY, form.getWindowMode());
AEnv.showWindow(form); AEnv.showWindow(form);
} }
else else

View File

@ -1,3 +1,16 @@
/******************************************************************************
* Copyright (C) 2012 Elaine Tan *
* Copyright (C) 2012 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.adempiere.webui.component; package org.adempiere.webui.component;
import java.beans.PropertyChangeListener; import java.beans.PropertyChangeListener;
@ -10,8 +23,17 @@ import org.zkoss.zul.Comboitem;
import org.zkoss.zul.Div; import org.zkoss.zul.Div;
import org.zkoss.zul.Hlayout; import org.zkoss.zul.Hlayout;
/**
*
* @author Elaine
*
*/
public class Paymentbox extends Div { public class Paymentbox extends Div {
/**
*
*/
private static final long serialVersionUID = 1807586169091171780L;
protected PropertyChangeSupport m_propertyChangeListeners = new PropertyChangeSupport(this); protected PropertyChangeSupport m_propertyChangeListeners = new PropertyChangeSupport(this);
protected Combobox combo; protected Combobox combo;
protected Button btn; protected Button btn;

View File

@ -77,5 +77,29 @@ public class Window extends org.zkoss.zul.Window
Events.sendEvent(this, new Event(DialogEvents.ON_WINDOW_CLOSE, this, null)); Events.sendEvent(this, new Event(DialogEvents.ON_WINDOW_CLOSE, this, null));
} }
/**
* Get the window mode attribute
* @return Window.Mode
*/
public Mode getModeAttribute() {
Object modeValue = getAttribute(Window.MODE_KEY);
if (modeValue instanceof Mode) {
return (Mode) modeValue;
}
final String mode = modeValue != null ? modeValue.toString() : Window.MODE_HIGHLIGHTED;
if (Window.MODE_EMBEDDED.equals(mode)) {
return Mode.EMBEDDED;
} else if (Window.MODE_HIGHLIGHTED.equals(mode)) {
return Mode.HIGHLIGHTED;
} else if (Window.MODE_MODAL.equals(mode)) {
return Mode.MODAL;
} else if (Window.MODE_OVERLAPPED.equals(mode)) {
return Mode.OVERLAPPED;
} else if (Window.MODE_POPUP.equals(mode)) {
return Mode.POPUP;
} else {
return Mode.HIGHLIGHTED;
}
}
} }

View File

@ -28,6 +28,7 @@ import org.compiere.util.Env;
import org.zkoss.zk.ui.Executions; import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zul.Window.Mode;
/** /**
* Base class for desktop implementation * Base class for desktop implementation
@ -148,11 +149,9 @@ public abstract class AbstractDesktop extends AbstractUIPart implements IDesktop
*/ */
public void showWindow(final Window win, final String pos) public void showWindow(final Window win, final String pos)
{ {
Object objMode = win.getAttribute(Window.MODE_KEY); final Window.Mode windowMode = win.getModeAttribute();
final String mode = objMode != null ? objMode.toString() : Window.MODE_HIGHLIGHTED; if (Mode.MODAL == windowMode)
if (Window.MODE_MODAL.equals(mode))
{ {
if (pos != null) if (pos != null)
win.setPosition(pos); win.setPosition(pos);
@ -162,14 +161,14 @@ public abstract class AbstractDesktop extends AbstractUIPart implements IDesktop
{ {
if (Executions.getCurrent() != null) if (Executions.getCurrent() != null)
{ {
showNonModalWindow(win, pos, mode); showNonModalWindow(win, pos, windowMode);
} }
else else
{ {
Executions.schedule(getComponent().getDesktop(), new EventListener<Event>() { Executions.schedule(getComponent().getDesktop(), new EventListener<Event>() {
@Override @Override
public void onEvent(Event event) throws Exception { public void onEvent(Event event) throws Exception {
showNonModalWindow(win, pos, mode); showNonModalWindow(win, pos, windowMode);
} }
}, new Event("onExecute")); }, new Event("onExecute"));
} }
@ -177,20 +176,20 @@ public abstract class AbstractDesktop extends AbstractUIPart implements IDesktop
} }
private void showNonModalWindow(final Window win, final String pos, private void showNonModalWindow(final Window win, final String pos,
final String mode) { final Mode mode) {
if (Window.MODE_POPUP.equals(mode)) if (Mode.POPUP == mode)
{ {
showPopup(win, pos); showPopup(win, pos);
} }
else if (Window.MODE_OVERLAPPED.equals(mode)) else if (Mode.OVERLAPPED == mode)
{ {
showOverlapped(win, pos); showOverlapped(win, pos);
} }
else if (Window.MODE_EMBEDDED.equals(mode)) else if (Mode.EMBEDDED == mode)
{ {
showEmbedded(win); showEmbedded(win);
} }
else if (Window.MODE_HIGHLIGHTED.equals(mode)) else if (Mode.HIGHLIGHTED == mode)
{ {
showHighlighted(win, pos); showHighlighted(win, pos);
} }

View File

@ -1,351 +0,0 @@
/******************************************************************************
* Copyright (C) 2008 Low Heng Sin *
* Copyright (C) 2008 Idalica Corporation *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.adempiere.webui.desktop;
import java.io.Serializable;
import java.util.Properties;
import org.adempiere.util.ServerContext;
import org.adempiere.webui.adwindow.ADWindow;
import org.adempiere.webui.apps.BusyDialog;
import org.adempiere.webui.apps.ProcessDialog;
import org.adempiere.webui.component.Accordion;
import org.adempiere.webui.component.Tabpanel;
import org.adempiere.webui.component.ToolBarButton;
import org.adempiere.webui.dashboard.DPActivities;
import org.adempiere.webui.dashboard.DashboardPanel;
import org.adempiere.webui.event.MenuListener;
import org.adempiere.webui.panel.ADForm;
import org.adempiere.webui.panel.HeaderPanel;
import org.adempiere.webui.session.SessionContextListener;
import org.adempiere.webui.session.SessionManager;
import org.adempiere.webui.util.IServerPushCallback;
import org.adempiere.webui.util.ServerPushTemplate;
import org.adempiere.webui.util.UserPreference;
import org.compiere.util.CLogger;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.util.Util;
import org.zkoss.zk.au.out.AuScript;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.Page;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.event.OpenEvent;
import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Borderlayout;
import org.zkoss.zul.Center;
import org.zkoss.zul.Div;
import org.zkoss.zul.North;
import org.zkoss.zul.West;
/**
* @author hengsin
*/
public class NavBar2Desktop extends TabbedDesktop implements MenuListener, Serializable, EventListener<Event>, IServerPushCallback
{
private static final long serialVersionUID = -7483133591812825441L;
private static final String FAVOURITES_PATH = "/zul/favourites.zul";
private static final String ACTIVITIES_PATH = "/zul/activities.zul";
@SuppressWarnings("unused")
private static final CLogger logger = CLogger.getCLogger(DefaultDesktop.class);
private Center windowArea;
private Borderlayout layout;
private Accordion shortcutPanel;
private int noOfNotice;
private int noOfRequest;
private int noOfWorkflow;
private int noOfUnprocessed;
private Tabpanel homeTab;
private DashboardController dashboardController, sideController;
public NavBar2Desktop()
{
super();
dashboardController = new DashboardController();
sideController = new DashboardController();
}
protected Component doCreatePart(Component parent)
{
HeaderPanel pnlHead = new HeaderPanel();
layout = new Borderlayout();
if (parent != null)
{
layout.setParent(parent);
layout.setWidth("100%");
layout.setHeight("100%");
layout.setStyle("position: absolute");
}
else
layout.setPage(page);
North n = new North();
layout.appendChild(n);
n.setCollapsible(false);
pnlHead.setParent(n);
West w = new West();
w.setTitle(" ");
layout.appendChild(w);
w.setWidth("300px");
w.setCollapsible(true);
w.setSplittable(true);
w.addEventListener(Events.ON_OPEN, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
OpenEvent oe = (OpenEvent) event;
UserPreference pref = SessionManager.getSessionApplication().getUserPreference();
pref.setProperty(UserPreference.P_MENU_COLLAPSED, !oe.isOpen());
pref.savePreference();
}
});
UserPreference pref = SessionManager.getSessionApplication().getUserPreference();
boolean menuCollapsed= pref.isPropertyBool(UserPreference.P_MENU_COLLAPSED);
w.setOpen(!menuCollapsed);
sideController.render(w, this, false);
Center center = new Center();
center.setParent(layout);
Borderlayout innerLayout = new Borderlayout();
innerLayout.setHeight("100%");
innerLayout.setWidth("100%");
innerLayout.setParent(center);
innerLayout.setVflex("1");
innerLayout.setHflex("1");
West innerW = new West();
innerW.setWidth("200px");
innerW.setCollapsible(true);
innerW.setTitle("Navigation");
innerW.setSplittable(true);
innerW.setCollapsible(true);
innerW.setParent(innerLayout);
shortcutPanel = new Accordion();
shortcutPanel.setWidth("100%");
shortcutPanel.setHeight("100%");
innerW.appendChild(shortcutPanel);
Div div = new Div();
Executions.createComponents(FAVOURITES_PATH, div, null);
shortcutPanel.add(div, "Favourites");
div = new Div();
Component component = Executions.createComponents(ACTIVITIES_PATH, div, null);
if (component instanceof DashboardPanel)
{
DashboardPanel dashboardPanel = (DashboardPanel) component;
dashboardController.addDashboardPanel(dashboardPanel);
}
shortcutPanel.add(div, "Activities");
shortcutPanel.setSelectedIndex(0);
windowArea = new Center();
windowArea.setParent(innerLayout);
windowContainer.createPart(windowArea);
homeTab = new Tabpanel();
windowContainer.addWindow(homeTab, Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Home")), false);
BusyDialog busyDialog = new BusyDialog();
busyDialog.setShadow(false);
homeTab.appendChild(busyDialog);
if (!layout.getDesktop().isServerPushEnabled())
{
layout.getDesktop().enableServerPush(true);
}
Runnable runnable = new Runnable() {
public void run() {
try {
Thread.sleep(100);
} catch (InterruptedException e) {}
IServerPushCallback callback = new IServerPushCallback() {
public void updateUI() {
Properties ctx = (Properties)layout.getDesktop().getSession().getAttribute(SessionContextListener.SESSION_CTX);
try {
ServerContext.setCurrentInstance(ctx);
renderHomeTab();
} finally {
ServerContext.dispose();
}
}
};
ServerPushTemplate template = new ServerPushTemplate(layout.getDesktop());
template.executeAsync(callback);
}
};
Thread thread = new Thread(runnable);
thread.start();
return layout;
}
private void renderHomeTab()
{
homeTab.getChildren().clear();
//register as 0
registerWindow(homeTab);
dashboardController.render(homeTab, this, true);
}
public void onEvent(Event event)
{
Component comp = event.getTarget();
String eventName = event.getName();
if(eventName.equals(Events.ON_CLICK))
{
if(comp instanceof ToolBarButton)
{
ToolBarButton btn = (ToolBarButton) comp;
int menuId = 0;
try
{
menuId = Integer.valueOf(btn.getName());
}
catch (Exception e) {
}
if(menuId > 0) onMenuSelected(menuId);
}
}
}
public void onServerPush(ServerPushTemplate template)
{
noOfNotice = DPActivities.getNoticeCount();
noOfRequest = DPActivities.getRequestCount();
noOfWorkflow = DPActivities.getWorkflowCount();
noOfUnprocessed = DPActivities.getUnprocessedCount();
template.executeAsync(this);
}
/**
*
* @param page
*/
public void setPage(Page page) {
if (this.page != page) {
layout.setPage(page);
this.page = page;
}
if (dashboardController != null) {
dashboardController.onSetPage(page, layout.getDesktop(), this);
}
if (sideController != null) {
sideController.onSetPage(page, layout.getDesktop(), this);
}
}
/**
* Get the root component
* @return Component
*/
public Component getComponent() {
return layout;
}
public void logout() {
if (dashboardController != null) {
dashboardController.onLogOut();
}
if (sideController != null) {
sideController.onLogOut();
}
}
public void updateUI() {
int total = noOfNotice + noOfRequest + noOfWorkflow + noOfUnprocessed;
shortcutPanel.setLabel(1, "Activities (" + total + ")");
shortcutPanel.setTooltiptext(1, Msg.translate(Env.getCtx(), "AD_Note_ID") + " : " + noOfNotice
+ ", " + Msg.translate(Env.getCtx(), "R_Request_ID") + " : " + noOfRequest
+ ", " + Msg.getMsg (Env.getCtx(), "WorkflowActivities") + " : " + noOfWorkflow
+ (noOfUnprocessed>0 ? ", " + Msg.getMsg (Env.getCtx(), "UnprocessedDocs") + " : " + noOfUnprocessed : "")
);
}
private void autoHideMenu() {
if (layout.getWest().isCollapsible() && !layout.getWest().isOpen())
{
//using undocumented js api, need to be retested after every version upgrade
String id = layout.getWest().getUuid() + "!real";
String btn = layout.getWest().getUuid() + "!btn";
String script = "zk.show('" + id + "', false);";
script += "$e('"+id+"')._isSlide = false;";
script += "$e('"+id+"')._lastSize = null;";
script += "$e('"+btn+"').style.display = '';";
AuScript aus = new AuScript(layout.getWest(), script);
Clients.response("autoHideWest", aus);
}
}
@Override
public ADWindow openWindow(int windowId) {
autoHideMenu();
return super.openWindow(windowId);
}
@Override
public ADForm openForm(int formId) {
autoHideMenu();
return super.openForm(formId);
}
@Override
public ProcessDialog openProcessDialog(int processId, boolean soTrx) {
autoHideMenu();
return super.openProcessDialog(processId, soTrx);
}
@Override
public void openTask(int taskId) {
autoHideMenu();
super.openTask(taskId);
}
@Override
public void openWorkflow(int workflowID) {
autoHideMenu();
super.openWorkflow(workflowID);
}
}

View File

@ -1,359 +0,0 @@
/******************************************************************************
* Copyright (C) 2008 Low Heng Sin *
* Copyright (C) 2008 Idalica Corporation *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.adempiere.webui.desktop;
import java.io.Serializable;
import java.util.Properties;
import org.adempiere.util.ServerContext;
import org.adempiere.webui.adwindow.ADWindow;
import org.adempiere.webui.apps.BusyDialog;
import org.adempiere.webui.apps.ProcessDialog;
import org.adempiere.webui.component.Accordion;
import org.adempiere.webui.component.Tabpanel;
import org.adempiere.webui.component.ToolBarButton;
import org.adempiere.webui.dashboard.DPActivities;
import org.adempiere.webui.dashboard.DPFavourites;
import org.adempiere.webui.dashboard.DashboardPanel;
import org.adempiere.webui.event.MenuListener;
import org.adempiere.webui.panel.ADForm;
import org.adempiere.webui.panel.HeaderPanel;
import org.adempiere.webui.panel.MenuTreePanel;
import org.adempiere.webui.session.SessionContextListener;
import org.adempiere.webui.session.SessionManager;
import org.adempiere.webui.util.IServerPushCallback;
import org.adempiere.webui.util.ServerPushTemplate;
import org.adempiere.webui.util.UserPreference;
import org.compiere.util.CLogger;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.zkoss.zk.au.out.AuScript;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.Page;
import org.zkoss.zk.ui.event.DropEvent;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.event.OpenEvent;
import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Borderlayout;
import org.zkoss.zul.Center;
import org.zkoss.zul.Div;
import org.zkoss.zul.North;
import org.zkoss.zul.Treeitem;
import org.zkoss.zul.Treerow;
import org.zkoss.zul.West;
/**
* @author hengsin
*/
public class NavBarDesktop extends TabbedDesktop implements MenuListener, Serializable, EventListener<Event>, IServerPushCallback
{
private static final long serialVersionUID = 4721048271543882164L;
private static final String FAVOURITES_PATH = "/zul/favourites.zul";
private static final String ACTIVITIES_PATH = "/zul/activities.zul";
private static final String VIEWS_PATH = "/zul/views.zul";
@SuppressWarnings("unused")
private static final CLogger logger = CLogger.getCLogger(DefaultDesktop.class);
private Center windowArea;
private Borderlayout layout;
private Accordion navigationPanel;
private West leftRegion;
private DPFavourites favPanel;
private int noOfNotice;
private int noOfRequest;
private int noOfWorkflow;
private int noOfUnprocessed;
private Tabpanel homeTab;
private DashboardController dashboardController;
public NavBarDesktop()
{
super();
dashboardController = new DashboardController();
}
protected Component doCreatePart(Component parent)
{
HeaderPanel pnlHead = new HeaderPanel();
layout = new Borderlayout();
if (parent != null)
{
layout.setParent(parent);
layout.setWidth("100%");
layout.setHeight("100%");
layout.setStyle("position: absolute");
}
else
layout.setPage(page);
North n = new North();
layout.appendChild(n);
n.setCollapsible(false);
pnlHead.setParent(n);
leftRegion = new West();
layout.appendChild(leftRegion);
leftRegion.setWidth("300px");
leftRegion.setCollapsible(true);
leftRegion.setSplittable(true);
leftRegion.setTitle("Navigation");
leftRegion.addEventListener(Events.ON_OPEN, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
OpenEvent oe = (OpenEvent) event;
UserPreference pref = SessionManager.getSessionApplication().getUserPreference();
pref.setProperty(UserPreference.P_MENU_COLLAPSED, !oe.isOpen());
pref.savePreference();
}
});
UserPreference pref = SessionManager.getSessionApplication().getUserPreference();
boolean menuCollapsed= pref.isPropertyBool(UserPreference.P_MENU_COLLAPSED);
leftRegion.setOpen(!menuCollapsed);
navigationPanel = new Accordion();
navigationPanel.setParent(leftRegion);
navigationPanel.setWidth("100%");
navigationPanel.setHeight("100%");
navigationPanel.add(new MenuTreePanel(null), "Application Menu");
Div div = new Div();
favPanel = (DPFavourites) Executions.createComponents(FAVOURITES_PATH, div, null);
navigationPanel.add(div, "Favourites");
//setup drag and drop for favourites
div = navigationPanel.getHeader(1);
div.setDroppable(DPFavourites.FAVOURITE_DROPPABLE);
div.addEventListener(Events.ON_DROP, this);
div = new Div();
Component component = Executions.createComponents(ACTIVITIES_PATH, div, null);
if (component instanceof DashboardPanel)
{
DashboardPanel dashboardPanel = (DashboardPanel) component;
dashboardController.addDashboardPanel(dashboardPanel);
}
navigationPanel.add(div, "Activities");
div = new Div();
Executions.createComponents(VIEWS_PATH, div, null);
navigationPanel.add(div, Msg.getMsg(Env.getCtx(), "View").replaceAll("&", ""));
navigationPanel.setSelectedIndex(0);
windowArea = new Center();
windowArea.setParent(layout);
windowContainer.createPart(windowArea);
homeTab = new Tabpanel();
windowContainer.addWindow(homeTab, Msg.getMsg(Env.getCtx(), "Home").replaceAll("&", ""), false);
BusyDialog busyDialog = new BusyDialog();
busyDialog.setShadow(false);
homeTab.appendChild(busyDialog);
if (!layout.getDesktop().isServerPushEnabled())
{
layout.getDesktop().enableServerPush(true);
}
Runnable runnable = new Runnable() {
public void run() {
try {
Thread.sleep(100);
} catch (InterruptedException e) {}
IServerPushCallback callback = new IServerPushCallback() {
public void updateUI() {
Properties ctx = (Properties)layout.getDesktop().getSession().getAttribute(SessionContextListener.SESSION_CTX);
try {
ServerContext.setCurrentInstance(ctx);
renderHomeTab();
} finally {
ServerContext.dispose();
}
}
};
ServerPushTemplate template = new ServerPushTemplate(layout.getDesktop());
template.executeAsync(callback);
}
};
Thread thread = new Thread(runnable);
thread.start();
return layout;
}
private void renderHomeTab()
{
homeTab.getChildren().clear();
//register as 0
registerWindow(homeTab);
dashboardController.render(homeTab, this, true);
}
public void onEvent(Event event)
{
Component comp = event.getTarget();
String eventName = event.getName();
if(eventName.equals(Events.ON_CLICK))
{
if(comp instanceof ToolBarButton)
{
ToolBarButton btn = (ToolBarButton) comp;
int menuId = 0;
try
{
menuId = Integer.valueOf(btn.getName());
}
catch (Exception e) {
}
if(menuId > 0) onMenuSelected(menuId);
}
}
else if(eventName.equals(Events.ON_DROP))
{
DropEvent de = (DropEvent) event;
Component dragged = de.getDragged();
if(dragged instanceof Treerow)
{
Treerow treerow = (Treerow) dragged;
Treeitem treeitem = (Treeitem) treerow.getParent();
favPanel.addItem(treeitem);
}
}
}
public void onServerPush(ServerPushTemplate template)
{
noOfNotice = DPActivities.getNoticeCount();
noOfRequest = DPActivities.getRequestCount();
noOfWorkflow = DPActivities.getWorkflowCount();
noOfUnprocessed = DPActivities.getUnprocessedCount();
template.executeAsync(this);
}
/**
*
* @param page
*/
public void setPage(Page page) {
if (this.page != page) {
layout.setPage(page);
this.page = page;
}
if (dashboardController != null) {
dashboardController.onSetPage(page, layout.getDesktop(), this);
}
}
/**
* Get the root component
* @return Component
*/
public Component getComponent() {
return layout;
}
public void logout() {
if (dashboardController != null) {
dashboardController.onLogOut();
}
}
public void updateUI() {
int total = noOfNotice + noOfRequest + noOfWorkflow + noOfUnprocessed;
navigationPanel.setLabel(2, "Activities (" + total + ")");
navigationPanel.setTooltiptext(2, Msg.translate(Env.getCtx(), "AD_Note_ID") + " : " + noOfNotice
+ ", " + Msg.translate(Env.getCtx(), "R_Request_ID") + " : " + noOfRequest
+ ", " + Msg.getMsg (Env.getCtx(), "WorkflowActivities") + " : " + noOfWorkflow
+ (noOfUnprocessed>0 ? ", " + Msg.getMsg (Env.getCtx(), "UnprocessedDocs") + " : " + noOfUnprocessed : "")
);
}
private void autoHideMenu() {
if (layout.getWest().isCollapsible() && !layout.getWest().isOpen())
{
//using undocumented js api, need to be retested after every version upgrade
String id = layout.getWest().getUuid() + "!real";
String btn = layout.getWest().getUuid() + "!btn";
String script = "zk.show('" + id + "', false);";
script += "$e('"+id+"')._isSlide = false;";
script += "$e('"+id+"')._lastSize = null;";
script += "$e('"+btn+"').style.display = '';";
AuScript aus = new AuScript(layout.getWest(), script);
Clients.response("autoHideWest", aus);
}
}
@Override
public ADWindow openWindow(int windowId) {
autoHideMenu();
return super.openWindow(windowId);
}
@Override
public ADForm openForm(int formId) {
autoHideMenu();
return super.openForm(formId);
}
@Override
public ProcessDialog openProcessDialog(int processId, boolean soTrx) {
autoHideMenu();
return super.openProcessDialog(processId, soTrx);
}
@Override
public void openTask(int taskId) {
autoHideMenu();
super.openTask(taskId);
}
@Override
public void openWorkflow(int workflowID) {
autoHideMenu();
super.openWorkflow(workflowID);
}
}

View File

@ -78,12 +78,17 @@ public abstract class TabbedDesktop extends AbstractDesktop {
public ADForm openForm(int formId) { public ADForm openForm(int formId) {
ADForm form = ADForm.openForm(formId); ADForm form = ADForm.openForm(formId);
if (Window.Mode.EMBEDDED == form.getWindowMode()) {
DesktopTabpanel tabPanel = new DesktopTabpanel(); DesktopTabpanel tabPanel = new DesktopTabpanel();
form.setParent(tabPanel); form.setParent(tabPanel);
//do not show window title when open as tab //do not show window title when open as tab
form.setTitle(null); form.setTitle(null);
preOpenNewTab(); preOpenNewTab();
windowContainer.addWindow(tabPanel, form.getFormName(), true); windowContainer.addWindow(tabPanel, form.getFormName(), true);
} else {
form.setAttribute(Window.MODE_KEY, form.getWindowMode());
showWindow(form);
}
return form; return form;
} }

View File

@ -24,6 +24,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.logging.Level; import java.util.logging.Level;
import org.adempiere.webui.adwindow.IADTabpanel;
import org.adempiere.webui.component.Button; import org.adempiere.webui.component.Button;
import org.adempiere.webui.event.ActionEvent; import org.adempiere.webui.event.ActionEvent;
import org.adempiere.webui.event.ActionListener; import org.adempiere.webui.event.ActionListener;
@ -72,6 +73,8 @@ public class WButtonEditor extends WEditor
private ArrayList<ActionListener> actionListeners = new ArrayList<ActionListener>(); private ArrayList<ActionListener> actionListeners = new ArrayList<ActionListener>();
private IADTabpanel adTabpanel;
public WButtonEditor(GridField gridField) public WButtonEditor(GridField gridField)
{ {
this(gridField, -1); this(gridField, -1);
@ -260,6 +263,11 @@ public class WButtonEditor extends WEditor
actionListeners.add(actionListener); actionListeners.add(actionListener);
} }
public boolean removeActionListener(ActionListener actionListener)
{
return actionListeners.remove(actionListener);
}
@Override @Override
public String[] getEvents() public String[] getEvents()
{ {
@ -279,4 +287,12 @@ public class WButtonEditor extends WEditor
} }
} }
} }
public void setADTabpanel(IADTabpanel adTabpanel) {
this.adTabpanel = adTabpanel;
}
public IADTabpanel getADTabpanel() {
return adTabpanel;
}
} }

View File

@ -1,3 +1,16 @@
/******************************************************************************
* Copyright (C) 2012 Elaine Tan *
* Copyright (C) 2012 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.adempiere.webui.editor; package org.adempiere.webui.editor;
import javax.swing.event.ListDataListener; import javax.swing.event.ListDataListener;
@ -25,6 +38,11 @@ import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Comboitem; import org.zkoss.zul.Comboitem;
/**
*
* @author Elaine
*
*/
public class WPaymentEditor extends WEditor implements ListDataListener { public class WPaymentEditor extends WEditor implements ListDataListener {
public final static String ON_SAVE_PAYMENT = "onSavePayment"; public final static String ON_SAVE_PAYMENT = "onSavePayment";

View File

@ -169,4 +169,6 @@ public interface ToolbarListener
* Customize grid view. * Customize grid view.
*/ */
public void onCustomize(); public void onCustomize();
public void onProcess();
} }

View File

@ -397,4 +397,12 @@ public abstract class ADForm extends Window implements EventListener
{ {
return m_customForm; return m_customForm;
} }
/**
* Default to embedded mode, subclass may override this to open form in different mode
* @return Window mode
*/
public Mode getWindowMode() {
return Mode.EMBEDDED;
}
} }

View File

@ -160,10 +160,10 @@ public class CustomizeGridViewPanel extends Panel
yesList.setSeltype("multiple"); yesList.setSeltype("multiple");
noList.setSeltype("multiple"); noList.setSeltype("multiple");
bAdd.setImage("images/Detail24.png"); bAdd.setImage("images/Next24.png");
bAdd.addEventListener(Events.ON_CLICK, actionListener); bAdd.addEventListener(Events.ON_CLICK, actionListener);
bRemove.setImage("images/Parent24.png"); bRemove.setImage("images/Previous24.png");
bRemove.addEventListener(Events.ON_CLICK, actionListener); bRemove.addEventListener(Events.ON_CLICK, actionListener);
EventListener crossListMouseListener = new DragListener(); EventListener crossListMouseListener = new DragListener();
@ -179,10 +179,10 @@ public class CustomizeGridViewPanel extends Panel
} }
}; };
bUp.setImage("images/Previous24.png"); bUp.setImage("images/Parent24.png");
bUp.addEventListener(Events.ON_CLICK, actionListener); bUp.addEventListener(Events.ON_CLICK, actionListener);
bDown.setImage("images/Next24.png"); bDown.setImage("images/Detail24.png");
bDown.addEventListener(Events.ON_CLICK, actionListener); bDown.addEventListener(Events.ON_CLICK, actionListener);
EventListener yesListMouseMotionListener = new EventListener() EventListener yesListMouseMotionListener = new EventListener()

View File

@ -247,7 +247,7 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
Grid grid = GridFactory.newGridLayout(); Grid grid = GridFactory.newGridLayout();
grid.setId("grd"); grid.setId("grd");
grid.setWidth("400px"); grid.setStyle("width: 390px; margin: auto;");
Rows rows = new Rows(); Rows rows = new Rows();
@ -258,10 +258,10 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
Panel pnlDocAction = new Panel(); Panel pnlDocAction = new Panel();
pnlDocAction.appendChild(lblDocAction); pnlDocAction.appendChild(lblDocAction);
pnlDocAction.appendChild(new Space());
pnlDocAction.appendChild(lstDocAction); pnlDocAction.appendChild(lstDocAction);
rowDocAction.appendChild(pnlDocAction); rowDocAction.appendChild(pnlDocAction);
rowDocAction.setAlign("right");
rowLabel.appendChild(label); rowLabel.appendChild(label);
rowConfirm.appendChild(confirmPanel); rowConfirm.appendChild(confirmPanel);
rowSpacer.appendChild(new Space()); rowSpacer.appendChild(new Space());

View File

@ -22,10 +22,13 @@ import java.util.Properties;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
import org.compiere.util.CLogMgt; import org.adempiere.util.ServerContext;
import org.adempiere.util.ServerContextURLHandler;
import org.compiere.model.MSession;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.zkoss.util.Locales; import org.zkoss.util.Locales;
import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Desktop;
import org.zkoss.zk.ui.Execution; import org.zkoss.zk.ui.Execution;
import org.zkoss.zk.ui.Executions; import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.Session; import org.zkoss.zk.ui.Session;
@ -36,12 +39,11 @@ import org.zkoss.zk.ui.event.EventThreadResume;
import org.zkoss.zk.ui.event.EventThreadSuspend; import org.zkoss.zk.ui.event.EventThreadSuspend;
import org.zkoss.zk.ui.sys.DesktopCtrl; import org.zkoss.zk.ui.sys.DesktopCtrl;
import org.zkoss.zk.ui.sys.ServerPush; import org.zkoss.zk.ui.sys.ServerPush;
import org.zkoss.zk.ui.util.DesktopCleanup;
import org.zkoss.zk.ui.util.DesktopInit;
import org.zkoss.zk.ui.util.ExecutionCleanup; import org.zkoss.zk.ui.util.ExecutionCleanup;
import org.zkoss.zk.ui.util.ExecutionInit; import org.zkoss.zk.ui.util.ExecutionInit;
import org.adempiere.util.ServerContextURLHandler;
import org.adempiere.util.ServerContext;
/** /**
* *
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a> * @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
@ -49,7 +51,7 @@ import org.adempiere.util.ServerContext;
* @version $Revision: 0.10 $ * @version $Revision: 0.10 $
*/ */
public class SessionContextListener implements ExecutionInit, public class SessionContextListener implements ExecutionInit,
ExecutionCleanup, EventThreadInit, EventThreadResume, EventThreadCleanup, EventThreadSuspend ExecutionCleanup, EventThreadInit, EventThreadResume, EventThreadCleanup, EventThreadSuspend, DesktopCleanup, DesktopInit
{ {
public static final String SERVLET_SESSION_ID = "servlet.sessionId"; public static final String SERVLET_SESSION_ID = "servlet.sessionId";
public static final String SESSION_CTX = "WebUISessionContext"; public static final String SESSION_CTX = "WebUISessionContext";
@ -301,4 +303,33 @@ public class SessionContextListener implements ExecutionInit,
return true; return true;
} }
@Override
public void cleanup(Desktop desktop) throws Exception {
if (ServerContext.getCurrentInstance().isEmpty() || !isContextValid())
{
setupExecutionContextFromSession(Executions.getCurrent());
}
MSession mSession = MSession.get(Env.getCtx(), false);
if(mSession!=null && !mSession.isProcessed() && (Env.getContext(Env.getCtx(), "isReloaded")==null || Env.getContext(Env.getCtx(), "isReloaded").equals("") || Env.getContext(Env.getCtx(), "isReloaded").equals("N"))){
mSession.setProcessed(true);
mSession.save();
}
Env.setContext(Env.getCtx(), "isReloaded", "N");
}
@Override
public void init(Desktop desktop, Object request) throws Exception {
if (ServerContext.getCurrentInstance().isEmpty() || !isContextValid())
{
setupExecutionContextFromSession(Executions.getCurrent());
}
MSession mSession = MSession.get(Env.getCtx(), false);
if(mSession!=null && mSession.isProcessed()){
mSession.setProcessed(false);
mSession.save();
}else if(mSession!=null){
Env.setContext(Env.getCtx(), "isReloaded", "Y");
}
}
} }

View File

@ -53,6 +53,15 @@
org.zkoss.zk.ui.http.HttpSessionListener org.zkoss.zk.ui.http.HttpSessionListener
</listener-class> </listener-class>
</listener> </listener>
<listener>
<description>
Used to track the session currently used
</description>
<display-name>Update Session</display-name>
<listener-class>
org.adempiere.webui.LoggedSessionListener
</listener-class>
</listener>
<servlet> <servlet>
<description>ZK loader for ZUML pages</description> <description>ZK loader for ZUML pages</description>

View File

@ -230,6 +230,22 @@ div.wc-modal, div.wc-modal-none, div.wc-highlighted, div.wc-highlighted-none {
margin-right: 2px; margin-right: 2px;
} }
.desktop-tabbox .z-tab .z-tab-hl, .desktop-tabbox .z-tab .z-tab-hr,
.desktop-tabbox .z-tab .z-tab-hm {
height: 22px;
}
.desktop-tabbox .z-tab-seld .z-tab-hl, .desktop-tabbox .z-tab-seld .z-tab-hr,
.desktop-tabbox .z-tab-seld .z-tab-hm {
height: 21px;
}
.desktop-tabbox .z-tab-seld {
border-top: 2px solid #666;
border-top-left-radius: 5px 5px;
border-top-right-radius: 5px 5px;
}
.desktop-north, .desktop-center { .desktop-north, .desktop-center {
border: none; border: none;
} }
@ -485,8 +501,13 @@ div.wc-modal, div.wc-modal-none, div.wc-highlighted, div.wc-highlighted-none {
position: absolute; position: absolute;
} }
.current-row-indicator { .row-indicator-seld {
background-color: #FA962F !important; background-color: #666 !important;
background-image: none !important;
}
.row-indicator {
background-color: transparent !important;
background-image: none !important; background-image: none !important;
} }
@ -782,12 +803,12 @@ div.simileAjax-bubble-container {
background-color: transparent !important; background-color: transparent !important;
} }
.grid-layout .z-row-inner { .grid-layout .z-row-inner, .grid-layout .z-cell {
border: none !important; border: none !important;
background-color: transparent !important; background-color: transparent !important;
} }
.grid-layout tr.z-row-over>td.z-row-inner { .grid-layout tr.z-row-over>td.z-row-inner, .grid-layout tr.z-row-over>.z-cell {
border: none !important; border: none !important;
} }
@ -865,3 +886,16 @@ tbody.z-grid-empty-body td {
border-right: 6px dashed transparent; border-right: 6px dashed transparent;
border-bottom: 6px solid #FFF; border-bottom: 6px solid #FFF;
} }
.adwindow-detailpane-sub-tab::before {
content: '';
position: absolute;
width: 0px;
height: 0px;
top: 6px;
left: 4px;
border-top: 5px dashed transparent;
border-left: 5px dashed #696969;
border-right: 5px dashed transparent;
border-bottom: 5px solid transparent;
}

View File

@ -1,5 +1,20 @@
/******************************************************************************
* Copyright (C) 2012 Elaine Tan *
* Copyright (C) 2012 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.compiere.grid; package org.compiere.grid;
import org.compiere.model.MBankAccountProcessor;
public interface IPaymentForm { public interface IPaymentForm {
public boolean checkMandatory(); public boolean checkMandatory();
@ -13,4 +28,10 @@ public interface IPaymentForm {
public void closeWindow(); public void closeWindow();
public Object getWindow(); public Object getWindow();
public Object getCustomizePanel();
public void setCustomizeValues();
public void setBankAccountProcessor(MBankAccountProcessor bankAccountProcessor);
} }

View File

@ -1,3 +1,16 @@
/******************************************************************************
* Copyright (C) 2012 Elaine Tan *
* Copyright (C) 2012 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.compiere.grid; package org.compiere.grid;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -6,20 +19,29 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.Properties;
import java.util.logging.Level; import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException; import org.adempiere.exceptions.AdempiereException;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
import org.compiere.model.MBankAccountProcessor;
import org.compiere.model.MCashLine; import org.compiere.model.MCashLine;
import org.compiere.model.MPayment; import org.compiere.model.MPayment;
import org.compiere.model.MPaymentProcessor;
import org.compiere.model.MSysConfig; import org.compiere.model.MSysConfig;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.KeyNamePair; import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg;
import org.compiere.util.Trx; import org.compiere.util.Trx;
import org.compiere.util.TrxRunnable; import org.compiere.util.TrxRunnable;
/**
*
* @author Elaine
*
*/
public abstract class PaymentForm implements IPaymentForm { public abstract class PaymentForm implements IPaymentForm {
/** Logger */ /** Logger */
@ -198,6 +220,9 @@ public abstract class PaymentForm implements IPaymentForm {
}; };
try { try {
Trx.run(r); Trx.run(r);
} catch (AdempiereException ae) {
success[0] = false;
throw ae;
} catch (Throwable e) { } catch (Throwable e) {
success[0] = false; success[0] = false;
throw new AdempiereException("PaymentError", e); throw new AdempiereException("PaymentError", e);
@ -277,7 +302,43 @@ public abstract class PaymentForm implements IPaymentForm {
public void processOnline() public void processOnline()
{ {
throw new AdempiereException(Msg.getMsg(Env.getCtx(), "ActionNotSupported"));
}
public boolean isBankAccountProcessorExist(Properties ctx, String tender, String CCType, int AD_Client_ID, int C_Currency_ID, BigDecimal PayAmt, String trxName)
{
MBankAccountProcessor[] m_mBankAccountProcessors = MPaymentProcessor.find(ctx, tender, CCType, AD_Client_ID, C_Currency_ID, PayAmt, trxName);
// Relax Amount
if (m_mBankAccountProcessors == null || m_mBankAccountProcessors.length == 0)
m_mBankAccountProcessors = MPaymentProcessor.find(ctx, tender, CCType, AD_Client_ID, C_Currency_ID, Env.ZERO, trxName);
if (m_mBankAccountProcessors == null || m_mBankAccountProcessors.length == 0)
return false;
return true;
}
public MBankAccountProcessor getBankAccountProcessor(Properties ctx, String tender, String CCType, int AD_Client_ID, int C_Currency_ID, BigDecimal PayAmt, String trxName)
{
MBankAccountProcessor[] m_mBankAccountProcessors = MPaymentProcessor.find(ctx, tender, CCType, AD_Client_ID, C_Currency_ID, PayAmt, trxName);
// Relax Amount
if (m_mBankAccountProcessors == null || m_mBankAccountProcessors.length == 0)
m_mBankAccountProcessors = MPaymentProcessor.find(ctx, tender, CCType, AD_Client_ID, C_Currency_ID, Env.ZERO, trxName);
if (m_mBankAccountProcessors == null || m_mBankAccountProcessors.length == 0)
return null;
MBankAccountProcessor m_mBankAccountProcessor = null;
// Find the first right one
for (int i = 0; i < m_mBankAccountProcessors.length; i++)
{
MBankAccountProcessor bankAccountProcessor = m_mBankAccountProcessors[i];
MPaymentProcessor paymentProcessor = new MPaymentProcessor(bankAccountProcessor.getCtx(), bankAccountProcessor.getC_PaymentProcessor_ID(), bankAccountProcessor.get_TrxName());
if (paymentProcessor.accepts (tender, CCType))
{
m_mBankAccountProcessor = m_mBankAccountProcessors[i];
break;
}
}
//
return m_mBankAccountProcessor;
} }
public GridTab getGridTab() public GridTab getGridTab()
@ -299,4 +360,19 @@ public abstract class PaymentForm implements IPaymentForm {
{ {
return m_WindowNo; return m_WindowNo;
} }
public Object getCustomizePanel()
{
return null;
}
public void setCustomizeValues()
{
}
public void setBankAccountProcessor(MBankAccountProcessor bankAccountProcessor)
{
}
} }

View File

@ -1,3 +1,16 @@
/******************************************************************************
* Copyright (C) 2012 Elaine Tan *
* Copyright (C) 2012 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.compiere.grid; package org.compiere.grid;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -8,6 +21,7 @@ import java.sql.Timestamp;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.logging.Level; import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
import org.compiere.model.MCash; import org.compiere.model.MCash;
import org.compiere.model.MCashLine; import org.compiere.model.MCashLine;
@ -20,10 +34,16 @@ import org.compiere.util.CLogger;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.KeyNamePair; import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg;
import org.compiere.util.TimeUtil; import org.compiere.util.TimeUtil;
/**
*
* @author Elaine
*
*/
public abstract class PaymentFormCash extends PaymentForm { public abstract class PaymentFormCash extends PaymentForm {
public static final String PAYMENTRULE = MInvoice.PAYMENTRULE_Cash; private final String PAYMENTRULE = MInvoice.PAYMENTRULE_Cash;
public PaymentFormCash(int WindowNo, GridTab mTab) { public PaymentFormCash(int WindowNo, GridTab mTab) {
super(WindowNo, mTab); super(WindowNo, mTab);
@ -116,7 +136,6 @@ public abstract class PaymentFormCash extends PaymentForm {
public boolean save(int newC_BankAccount_ID, int newC_CashBook_ID, Timestamp newDateAcct, BigDecimal newAmount, String trxName) public boolean save(int newC_BankAccount_ID, int newC_CashBook_ID, Timestamp newDateAcct, BigDecimal newAmount, String trxName)
{ {
processMsg = null; processMsg = null;
boolean error = false;
int newC_CashLine_ID = m_C_CashLine_ID; int newC_CashLine_ID = m_C_CashLine_ID;
/*********************** /***********************
@ -134,8 +153,8 @@ public abstract class PaymentFormCash extends PaymentForm {
log.config( "CashCancelled"); log.config( "CashCancelled");
else else
{ {
processMsg = "CashNotCancelled"; processMsg = Msg.getMsg(Env.getCtx(), "CashNotCancelled");
error = true; throw new AdempiereException(processMsg);
} }
} }
newC_CashLine_ID = 0; // reset newC_CashLine_ID = 0; // reset
@ -177,8 +196,8 @@ public abstract class PaymentFormCash extends PaymentForm {
if (C_Invoice_ID == 0 && order == null) if (C_Invoice_ID == 0 && order == null)
{ {
log.config("No Invoice!"); log.config("No Invoice!");
processMsg = "CashNotCreated"; processMsg = Msg.getMsg(Env.getCtx(), "CashNotCreated");
error = false; throw new AdempiereException(processMsg);
} }
else else
{ {
@ -219,7 +238,7 @@ public abstract class PaymentFormCash extends PaymentForm {
if (cash == null || cash.get_ID() == 0) if (cash == null || cash.get_ID() == 0)
{ {
processMsg = CLogger.retrieveErrorString("CashNotCreated"); processMsg = CLogger.retrieveErrorString("CashNotCreated");
error = true; throw new AdempiereException(processMsg);
} }
else else
{ {
@ -290,8 +309,8 @@ public abstract class PaymentFormCash extends PaymentForm {
processMsg = m_mPayment.getDocumentNo(); processMsg = m_mPayment.getDocumentNo();
else else
{ {
processMsg = "PaymentNotCreated"; processMsg = Msg.getMsg(Env.getCtx(), "PaymentNotCreated");
error = true; throw new AdempiereException(processMsg);
} }
} }
else else
@ -321,6 +340,6 @@ public abstract class PaymentFormCash extends PaymentForm {
else else
getGridTab().setValue("C_CashLine_ID", new Integer(newC_CashLine_ID)); getGridTab().setValue("C_CashLine_ID", new Integer(newC_CashLine_ID));
} }
return !error; return true;
} }
} }

View File

@ -1,3 +1,16 @@
/******************************************************************************
* Copyright (C) 2012 Elaine Tan *
* Copyright (C) 2012 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.compiere.grid; package org.compiere.grid;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -7,7 +20,9 @@ import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.logging.Level; import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
import org.compiere.model.MBankAccountProcessor;
import org.compiere.model.MInvoice; import org.compiere.model.MInvoice;
import org.compiere.model.MOrder; import org.compiere.model.MOrder;
import org.compiere.model.MPayment; import org.compiere.model.MPayment;
@ -16,9 +31,15 @@ import org.compiere.process.DocAction;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.KeyNamePair; import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg;
/**
*
* @author Elaine
*
*/
public abstract class PaymentFormCheck extends PaymentForm { public abstract class PaymentFormCheck extends PaymentForm {
public static final String PAYMENTRULE = MInvoice.PAYMENTRULE_Check; private final String PAYMENTRULE = MInvoice.PAYMENTRULE_Check;
public PaymentFormCheck(int WindowNo, GridTab mTab) { public PaymentFormCheck(int WindowNo, GridTab mTab) {
super(WindowNo, mTab); super(WindowNo, mTab);
@ -68,7 +89,6 @@ public abstract class PaymentFormCheck extends PaymentForm {
public boolean save(int newC_BankAccount_ID, String routing, String number, String check, BigDecimal amount) public boolean save(int newC_BankAccount_ID, String routing, String number, String check, BigDecimal amount)
{ {
processMsg = null; processMsg = null;
boolean error = false;
String payTypes = m_Cash_As_Payment ? "KTSDB" : "KTSD"; String payTypes = m_Cash_As_Payment ? "KTSDB" : "KTSD";
/*********************** /***********************
@ -85,11 +105,11 @@ public abstract class PaymentFormCheck extends PaymentForm {
boolean ok = m_mPaymentOriginal.processIt(DocAction.ACTION_Reverse_Correct); boolean ok = m_mPaymentOriginal.processIt(DocAction.ACTION_Reverse_Correct);
m_mPaymentOriginal.saveEx(); m_mPaymentOriginal.saveEx();
if (ok) if (ok)
log.info( "Payment Canecelled - " + m_mPaymentOriginal); log.info( "Payment Cancelled - " + m_mPaymentOriginal);
else else
{ {
processMsg = "PaymentNotCancelled " + m_mPaymentOriginal.getDocumentNo(); processMsg = Msg.getMsg(Env.getCtx(), "PaymentNotCancelled") + " " + m_mPaymentOriginal.getDocumentNo();
error = true; throw new AdempiereException(processMsg);
} }
m_mPayment.resetNew(); m_mPayment.resetNew();
} }
@ -111,8 +131,8 @@ public abstract class PaymentFormCheck extends PaymentForm {
} }
else else
{ {
processMsg = "PaymentNotCancelled " + m_mPayment.getDocumentNo(); processMsg = Msg.getMsg(Env.getCtx(), "PaymentNotCancelled") + " " + m_mPayment.getDocumentNo();
error = true; throw new AdempiereException(processMsg);
} }
} }
} }
@ -163,6 +183,7 @@ public abstract class PaymentFormCheck extends PaymentForm {
} }
m_mPayment.setDateTrx(m_DateAcct); m_mPayment.setDateTrx(m_DateAcct);
m_mPayment.setDateAcct(m_DateAcct); m_mPayment.setDateAcct(m_DateAcct);
setCustomizeValues();
m_mPayment.saveEx(); m_mPayment.saveEx();
// Save/Post // Save/Post
@ -174,8 +195,8 @@ public abstract class PaymentFormCheck extends PaymentForm {
processMsg = m_mPayment.getDocumentNo(); processMsg = m_mPayment.getDocumentNo();
else else
{ {
processMsg = "PaymentNotCreated"; processMsg = Msg.getMsg(Env.getCtx(), "PaymentNotCreated");
error = true; throw new AdempiereException(processMsg);
} }
} }
else else
@ -193,6 +214,16 @@ public abstract class PaymentFormCheck extends PaymentForm {
else else
getGridTab().setValue("C_Payment_ID", new Integer(m_mPayment.getC_Payment_ID())); getGridTab().setValue("C_Payment_ID", new Integer(m_mPayment.getC_Payment_ID()));
} }
return !error; return true;
}
public boolean isBankAccountProcessorExist(int C_Currency_ID, BigDecimal PayAmt)
{
return isBankAccountProcessorExist(Env.getCtx(), MPayment.TENDERTYPE_Check, "", Env.getAD_Client_ID(Env.getCtx()), C_Currency_ID, PayAmt, null);
}
public MBankAccountProcessor getBankAccountProcessor(int C_Currency_ID, BigDecimal PayAmt)
{
return getBankAccountProcessor(Env.getCtx(), MPayment.TENDERTYPE_Check, "", Env.getAD_Client_ID(Env.getCtx()), C_Currency_ID, PayAmt, null);
} }
} }

View File

@ -1,17 +1,38 @@
/******************************************************************************
* Copyright (C) 2012 Elaine Tan *
* Copyright (C) 2012 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.compiere.grid; package org.compiere.grid;
import java.math.BigDecimal; import java.math.BigDecimal;
import org.adempiere.exceptions.AdempiereException;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
import org.compiere.model.MBankAccountProcessor;
import org.compiere.model.MInvoice; import org.compiere.model.MInvoice;
import org.compiere.model.MOrder; import org.compiere.model.MOrder;
import org.compiere.model.MPayment; import org.compiere.model.MPayment;
import org.compiere.process.DocAction; import org.compiere.process.DocAction;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.util.ValueNamePair; import org.compiere.util.ValueNamePair;
/**
*
* @author Elaine
*
*/
public abstract class PaymentFormCreditCard extends PaymentForm { public abstract class PaymentFormCreditCard extends PaymentForm {
public static final String PAYMENTRULE = MInvoice.PAYMENTRULE_CreditCard; private final String PAYMENTRULE = MInvoice.PAYMENTRULE_CreditCard;
public PaymentFormCreditCard(int WindowNo, GridTab mTab) { public PaymentFormCreditCard(int WindowNo, GridTab mTab) {
super(WindowNo, mTab); super(WindowNo, mTab);
@ -34,7 +55,6 @@ public abstract class PaymentFormCreditCard extends PaymentForm {
public boolean save(String newCCType, String newCCNumber, String newCCExp, BigDecimal newAmount) public boolean save(String newCCType, String newCCNumber, String newCCExp, BigDecimal newAmount)
{ {
processMsg = null; processMsg = null;
boolean error = false;
String payTypes = m_Cash_As_Payment ? "KTSDB" : "KTSD"; String payTypes = m_Cash_As_Payment ? "KTSDB" : "KTSD";
/*********************** /***********************
@ -51,11 +71,11 @@ public abstract class PaymentFormCreditCard extends PaymentForm {
boolean ok = m_mPaymentOriginal.processIt(DocAction.ACTION_Reverse_Correct); boolean ok = m_mPaymentOriginal.processIt(DocAction.ACTION_Reverse_Correct);
m_mPaymentOriginal.saveEx(); m_mPaymentOriginal.saveEx();
if (ok) if (ok)
log.info( "Payment Canecelled - " + m_mPaymentOriginal); log.info( "Payment Cancelled - " + m_mPaymentOriginal);
else else
{ {
processMsg = "PaymentNotCancelled " + m_mPaymentOriginal.getDocumentNo(); processMsg = Msg.getMsg(Env.getCtx(), "PaymentNotCancelled") + " " + m_mPaymentOriginal.getDocumentNo();
error = true; throw new AdempiereException(processMsg);
} }
m_mPayment.resetNew(); m_mPayment.resetNew();
} }
@ -77,8 +97,8 @@ public abstract class PaymentFormCreditCard extends PaymentForm {
} }
else else
{ {
processMsg = "PaymentNotCancelled " + m_mPayment.getDocumentNo(); processMsg = Msg.getMsg(Env.getCtx(), "PaymentNotCancelled") + " " + m_mPayment.getDocumentNo();
error = true; throw new AdempiereException(processMsg);
} }
} }
} }
@ -130,6 +150,14 @@ public abstract class PaymentFormCreditCard extends PaymentForm {
} }
m_mPayment.setDateTrx(m_DateAcct); m_mPayment.setDateTrx(m_DateAcct);
m_mPayment.setDateAcct(m_DateAcct); m_mPayment.setDateAcct(m_DateAcct);
setCustomizeValues();
if (!m_mPayment.isApproved())
{
processMsg = Msg.getMsg(Env.getCtx(), "CardNotProcessed");
throw new AdempiereException(processMsg);
}
m_mPayment.saveEx(); m_mPayment.saveEx();
// Save/Post // Save/Post
@ -141,8 +169,8 @@ public abstract class PaymentFormCreditCard extends PaymentForm {
processMsg = m_mPayment.getDocumentNo(); processMsg = m_mPayment.getDocumentNo();
else else
{ {
processMsg = "PaymentNotCreated"; processMsg = Msg.getMsg(Env.getCtx(), "PaymentNotCreated");
error = true; throw new AdempiereException(processMsg);
} }
} }
else else
@ -161,7 +189,7 @@ public abstract class PaymentFormCreditCard extends PaymentForm {
getGridTab().setValue("C_Payment_ID", new Integer(m_mPayment.getC_Payment_ID())); getGridTab().setValue("C_Payment_ID", new Integer(m_mPayment.getC_Payment_ID()));
} }
return !error; return true;
} }
public boolean processOnline(String CCType, String CCNumber, String CCExp) public boolean processOnline(String CCType, String CCNumber, String CCExp)
@ -188,8 +216,9 @@ public abstract class PaymentFormCreditCard extends PaymentForm {
m_mPayment.setDateTrx(m_DateAcct); m_mPayment.setDateTrx(m_DateAcct);
// Set Amount // Set Amount
m_mPayment.setAmount(m_C_Currency_ID, m_Amount); m_mPayment.setAmount(m_C_Currency_ID, m_Amount);
setCustomizeValues();
if (!m_mPayment.save()) { if (!m_mPayment.save()) {
processMsg = "PaymentNotCreated"; processMsg = Msg.getMsg(Env.getCtx(), "PaymentNotCreated");
return false; return false;
} else { } else {
approved = m_mPayment.processOnline(); approved = m_mPayment.processOnline();
@ -205,7 +234,7 @@ public abstract class PaymentFormCreditCard extends PaymentForm {
processMsg = info + "\n" + m_mPayment.getDocumentNo(); processMsg = info + "\n" + m_mPayment.getDocumentNo();
else else
{ {
processMsg = "PaymentNotCreated"; processMsg = Msg.getMsg(Env.getCtx(), "PaymentNotCreated");
error = true; error = true;
} }
saveChanges(); saveChanges();
@ -218,4 +247,14 @@ public abstract class PaymentFormCreditCard extends PaymentForm {
} }
return !error; return !error;
} }
public boolean isBankAccountProcessorExist(String CCType, BigDecimal PayAmt)
{
return isBankAccountProcessorExist(Env.getCtx(), MPayment.TENDERTYPE_CreditCard, CCType, Env.getAD_Client_ID(Env.getCtx()), m_C_Currency_ID, PayAmt, null);
}
public MBankAccountProcessor getBankAccountProcessor(String CCType, BigDecimal PayAmt)
{
return getBankAccountProcessor(Env.getCtx(), MPayment.TENDERTYPE_CreditCard, CCType, Env.getAD_Client_ID(Env.getCtx()), m_C_Currency_ID, PayAmt, null);
}
} }

View File

@ -0,0 +1,222 @@
/******************************************************************************
* Copyright (C) 2012 Elaine Tan *
* Copyright (C) 2012 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.compiere.grid;
import java.math.BigDecimal;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException;
import org.compiere.model.GridTab;
import org.compiere.model.MBankAccountProcessor;
import org.compiere.model.MInvoice;
import org.compiere.model.MOrder;
import org.compiere.model.MPayment;
import org.compiere.process.DocAction;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg;
/**
*
* @author Elaine
*
*/
public abstract class PaymentFormDirect extends PaymentForm {
private String PAYMENTRULE;
public PaymentFormDirect(int WindowNo, GridTab mTab, boolean isDebit) {
super(WindowNo, mTab);
PAYMENTRULE = isDebit ? MInvoice.PAYMENTRULE_DirectDebit : MInvoice.PAYMENTRULE_DirectDeposit;
}
public ArrayList<KeyNamePair> getBPBankAccountList() {
ArrayList<KeyNamePair> list = new ArrayList<KeyNamePair>();
/**
* Load Accounts
*/
String SQL = "SELECT a.C_BP_BankAccount_ID, NVL(b.Name, ' ')||'_'||NVL(a.AccountNo, ' ') AS Acct "
+ "FROM C_BP_BankAccount a"
+ " LEFT OUTER JOIN C_Bank b ON (a.C_Bank_ID=b.C_Bank_ID) "
+ "WHERE C_BPartner_ID=?"
+ "AND a.IsActive='Y' AND a.IsACH='Y'";
try
{
PreparedStatement pstmt = DB.prepareStatement(SQL, null);
pstmt.setInt(1, m_C_BPartner_ID);
ResultSet rs = pstmt.executeQuery();
while (rs.next())
{
int key = rs.getInt(1);
String name = rs.getString(2);
KeyNamePair pp = new KeyNamePair(key, name);
list.add(pp);
}
rs.close();
pstmt.close();
}
catch (SQLException eac)
{
log.log(Level.SEVERE, SQL, eac);
}
return list;
}
public String processMsg;
public boolean save(int newC_BankAccount_ID, String routing, String number)
{
processMsg = null;
String payTypes = m_Cash_As_Payment ? "KTSDB" : "KTSD";
/***********************
* Changed PaymentRule
*/
if (!PAYMENTRULE.equals(m_PaymentRule))
{
log.fine("Changed PaymentRule: " + m_PaymentRule + " -> " + PAYMENTRULE);
// We had a change in Payment type (e.g. Check to CC)
if (payTypes.indexOf(m_PaymentRule) != -1 && payTypes.indexOf(PAYMENTRULE) != -1 && m_mPaymentOriginal != null)
{
log.fine("Old Payment(1) - " + m_mPaymentOriginal);
m_mPaymentOriginal.setDocAction(DocAction.ACTION_Reverse_Correct);
boolean ok = m_mPaymentOriginal.processIt(DocAction.ACTION_Reverse_Correct);
m_mPaymentOriginal.saveEx();
if (ok)
log.info( "Payment Cancelled - " + m_mPaymentOriginal);
else
{
processMsg = Msg.getMsg(Env.getCtx(), "PaymentNotCancelled") + " " + m_mPaymentOriginal.getDocumentNo();
throw new AdempiereException(processMsg);
}
m_mPayment.resetNew();
}
// We had a Payment and something else (e.g. Check to Cash)
else if (payTypes.indexOf(m_PaymentRule) != -1 && payTypes.indexOf(PAYMENTRULE) == -1)
{
log.fine("Old Payment(2) - " + m_mPaymentOriginal);
if (m_mPaymentOriginal != null)
{
m_mPaymentOriginal.setDocAction(DocAction.ACTION_Reverse_Correct);
boolean ok = m_mPaymentOriginal.processIt(DocAction.ACTION_Reverse_Correct);
m_mPaymentOriginal.saveEx();
if (ok) // Cancel Payment
{
log.fine("PaymentCancelled " + m_mPayment.getDocumentNo ());
getGridTab().getTableModel().dataSave(true);
m_mPayment.resetNew();
m_mPayment.setAmount(m_C_Currency_ID, m_Amount);
}
else
{
processMsg = Msg.getMsg(Env.getCtx(), "PaymentNotCancelled") + " " + m_mPayment.getDocumentNo();
throw new AdempiereException(processMsg);
}
}
}
}
// Get Order and optionally Invoice
int C_Order_ID = Env.getContextAsInt(Env.getCtx(), getWindowNo(), "C_Order_ID");
int C_Invoice_ID = Env.getContextAsInt(Env.getCtx(), getWindowNo(), "C_Invoice_ID");
if (C_Invoice_ID == 0 && m_DocStatus.equals("CO"))
C_Invoice_ID = getInvoiceID (C_Order_ID);
// Amount sign negative, if ARC (Credit Memo) or API (AP Invoice)
boolean negateAmt = false;
MInvoice invoice = null;
if (C_Invoice_ID != 0)
{
invoice = new MInvoice (Env.getCtx(), C_Invoice_ID, null);
negateAmt = invoice.isCreditMemo();
}
MOrder order = null;
if (invoice == null && C_Order_ID != 0)
order = new MOrder (Env.getCtx(), C_Order_ID, null);
BigDecimal payAmount = m_Amount;
if (negateAmt)
payAmount = m_Amount.negate();
// Info
log.config("C_Order_ID=" + C_Order_ID + ", C_Invoice_ID=" + C_Invoice_ID + ", NegateAmt=" + negateAmt);
/***********************
* Payments
*/
m_mPayment.setBankACH(newC_BankAccount_ID, m_isSOTrx, PAYMENTRULE, routing, number);
m_mPayment.setAmount(m_C_Currency_ID, payAmount);
m_mPayment.setC_BPartner_ID(m_C_BPartner_ID);
m_mPayment.setC_Invoice_ID(C_Invoice_ID);
if (order != null)
{
m_mPayment.setC_Order_ID(C_Order_ID);
m_needSave = true;
}
m_mPayment.setDateTrx(m_DateAcct);
m_mPayment.setDateAcct(m_DateAcct);
setCustomizeValues();
m_mPayment.saveEx();
// Save/Post
if (m_mPayment.get_ID() > 0 && MPayment.DOCSTATUS_Drafted.equals(m_mPayment.getDocStatus()))
{
boolean ok = m_mPayment.processIt(DocAction.ACTION_Complete);
m_mPayment.saveEx();
if (ok)
processMsg = m_mPayment.getDocumentNo();
else
{
processMsg = Msg.getMsg(Env.getCtx(), "PaymentNotCreated");
throw new AdempiereException(processMsg);
}
}
else
log.fine("NotDraft " + m_mPayment);
/**********************
* Save Values to mTab
*/
log.config("Saving changes");
// Set Payment
if (m_mPayment.getC_Payment_ID() != m_C_Payment_ID)
{
if (m_mPayment.getC_Payment_ID() == 0)
getGridTab().setValue("C_Payment_ID", null);
else
getGridTab().setValue("C_Payment_ID", new Integer(m_mPayment.getC_Payment_ID()));
}
return true;
}
public boolean isBankAccountProcessorExist()
{
String tender = PAYMENTRULE.equals(MInvoice.PAYMENTRULE_DirectDebit) ? MPayment.TENDERTYPE_DirectDebit : MPayment.TENDERTYPE_DirectDeposit;
return isBankAccountProcessorExist(Env.getCtx(), tender, "", Env.getAD_Client_ID(Env.getCtx()), m_C_Currency_ID, m_Amount, null);
}
public MBankAccountProcessor getBankAccountProcessor()
{
String tender = PAYMENTRULE.equals(MInvoice.PAYMENTRULE_DirectDebit) ? MPayment.TENDERTYPE_DirectDebit : MPayment.TENDERTYPE_DirectDeposit;
return getBankAccountProcessor(Env.getCtx(), tender, "", Env.getAD_Client_ID(Env.getCtx()), m_C_Currency_ID, m_Amount, null);
}
}

View File

@ -1,12 +0,0 @@
package org.compiere.grid;
import org.compiere.model.GridTab;
import org.compiere.model.MInvoice;
public abstract class PaymentFormDirectDebit extends PaymentFormDirectDeposit {
public static final String PAYMENTRULE = MInvoice.PAYMENTRULE_DirectDebit;
public PaymentFormDirectDebit(int WindowNo, GridTab mTab) {
super(WindowNo, mTab);
}
}

View File

@ -1,125 +0,0 @@
package org.compiere.grid;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.logging.Level;
import org.compiere.model.GridTab;
import org.compiere.model.MInvoice;
import org.compiere.process.DocAction;
import org.compiere.util.DB;
import org.compiere.util.KeyNamePair;
public abstract class PaymentFormDirectDeposit extends PaymentForm {
public static final String PAYMENTRULE = MInvoice.PAYMENTRULE_DirectDeposit;
public PaymentFormDirectDeposit(int WindowNo, GridTab mTab) {
super(WindowNo, mTab);
}
public ArrayList<KeyNamePair> getBankAccountList() {
ArrayList<KeyNamePair> list = new ArrayList<KeyNamePair>();
/**
* Load Accounts
*/
String SQL = "SELECT a.C_BP_BankAccount_ID, NVL(b.Name, ' ')||'_'||NVL(a.AccountNo, ' ') AS Acct "
+ "FROM C_BP_BankAccount a"
+ " LEFT OUTER JOIN C_Bank b ON (a.C_Bank_ID=b.C_Bank_ID) "
+ "WHERE C_BPartner_ID=?"
+ "AND a.IsActive='Y' AND a.IsACH='Y'";
try
{
PreparedStatement pstmt = DB.prepareStatement(SQL, null);
pstmt.setInt(1, m_C_BPartner_ID);
ResultSet rs = pstmt.executeQuery();
while (rs.next())
{
int key = rs.getInt(1);
String name = rs.getString(2);
KeyNamePair pp = new KeyNamePair(key, name);
list.add(pp);
}
rs.close();
pstmt.close();
}
catch (SQLException eac)
{
log.log(Level.SEVERE, SQL, eac);
}
return list;
}
public String processMsg;
public boolean save()
{
processMsg = null;
boolean error = false;
String payTypes = m_Cash_As_Payment ? "KTSDB" : "KTSD";
/***********************
* Changed PaymentRule
*/
if (!PAYMENTRULE.equals(m_PaymentRule))
{
log.fine("Changed PaymentRule: " + m_PaymentRule + " -> " + PAYMENTRULE);
// We had a change in Payment type (e.g. Check to CC)
if (payTypes.indexOf(m_PaymentRule) != -1 && payTypes.indexOf(PAYMENTRULE) != -1 && m_mPaymentOriginal != null)
{
log.fine("Old Payment(1) - " + m_mPaymentOriginal);
m_mPaymentOriginal.setDocAction(DocAction.ACTION_Reverse_Correct);
boolean ok = m_mPaymentOriginal.processIt(DocAction.ACTION_Reverse_Correct);
m_mPaymentOriginal.saveEx();
if (ok)
log.info( "Payment Canecelled - " + m_mPaymentOriginal);
else
{
processMsg = "PaymentNotCancelled " + m_mPaymentOriginal.getDocumentNo();
error = true;
}
m_mPayment.resetNew();
}
// We had a Payment and something else (e.g. Check to Cash)
else if (payTypes.indexOf(m_PaymentRule) != -1 && payTypes.indexOf(PAYMENTRULE) == -1)
{
log.fine("Old Payment(2) - " + m_mPaymentOriginal);
if (m_mPaymentOriginal != null)
{
m_mPaymentOriginal.setDocAction(DocAction.ACTION_Reverse_Correct);
boolean ok = m_mPaymentOriginal.processIt(DocAction.ACTION_Reverse_Correct);
m_mPaymentOriginal.saveEx();
if (ok) // Cancel Payment
{
log.fine("PaymentCancelled " + m_mPayment.getDocumentNo ());
getGridTab().getTableModel().dataSave(true);
m_mPayment.resetNew();
m_mPayment.setAmount(m_C_Currency_ID, m_Amount);
}
else
{
processMsg = "PaymentNotCancelled " + m_mPayment.getDocumentNo();
error = true;
}
}
}
}
/**********************
* Save Values to mTab
*/
log.config("Saving changes");
// Set Payment
if (m_mPayment.getC_Payment_ID() != m_C_Payment_ID)
{
if (m_mPayment.getC_Payment_ID() == 0)
getGridTab().setValue("C_Payment_ID", null);
else
getGridTab().setValue("C_Payment_ID", new Integer(m_mPayment.getC_Payment_ID()));
}
return !error;
}
}

View File

@ -1,10 +1,26 @@
/******************************************************************************
* Copyright (C) 2012 Elaine Tan *
* Copyright (C) 2012 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.compiere.grid; package org.compiere.grid;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
import org.compiere.model.MInvoice;
/**
*
* @author Elaine
*
*/
public abstract class PaymentFormMixedPOS extends PaymentForm { public abstract class PaymentFormMixedPOS extends PaymentForm {
public static final String PAYMENTRULE = MInvoice.PAYMENTRULE_MixedPOSPayment;
public PaymentFormMixedPOS(int WindowNo, GridTab mTab) { public PaymentFormMixedPOS(int WindowNo, GridTab mTab) {
super(WindowNo, mTab); super(WindowNo, mTab);

View File

@ -1,3 +1,16 @@
/******************************************************************************
* Copyright (C) 2012 Elaine Tan *
* Copyright (C) 2012 Trek Global
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.compiere.grid; package org.compiere.grid;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -7,13 +20,16 @@ import java.util.ArrayList;
import java.util.logging.Level; import java.util.logging.Level;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
import org.compiere.model.MInvoice;
import org.compiere.model.MRole; import org.compiere.model.MRole;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.util.KeyNamePair; import org.compiere.util.KeyNamePair;
/**
*
* @author Elaine
*
*/
public abstract class PaymentFormOnCredit extends PaymentForm { public abstract class PaymentFormOnCredit extends PaymentForm {
public static final String PAYMENTRULE = MInvoice.PAYMENTRULE_OnCredit;
/** Start Payment Term */ /** Start Payment Term */
public int m_C_PaymentTerm_ID = 0; public int m_C_PaymentTerm_ID = 0;