IDEMPIERE-332 Document sequence organization level and restart monthly / Thanks to Nicolas Micoud

This commit is contained in:
Carlos Ruiz 2012-09-07 16:56:44 -05:00
parent 0329963b14
commit 368ce19b6e
15 changed files with 1022 additions and 864 deletions

View File

@ -1,25 +0,0 @@
CREATE or REPLACE PROCEDURE NextIDByYear
(
p_AD_Sequence_ID IN NUMBER,
p_IncrementNo IN NUMBER,
p_CalendarYear IN CHAR,
o_NextID OUT NUMBER
)
AS
BEGIN
SELECT CurrentNext
INTO o_NextID
FROM AD_Sequence_No
WHERE AD_Sequence_ID=p_AD_Sequence_ID
AND CalendarYear = p_CalendarYear
FOR UPDATE OF CurrentNext;
--
UPDATE AD_Sequence_No
SET CurrentNext = CurrentNext + p_IncrementNo
WHERE AD_Sequence_ID=p_AD_Sequence_ID
AND CalendarYear = p_CalendarYear;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE(SQLERRM);
END NextIDByYear;
/

View File

@ -1,24 +0,0 @@
CREATE or REPLACE FUNCTION NextIDByYear
(
p_AD_Sequence_ID IN numeric,
p_IncrementNo IN numeric,
p_CalendarYear IN varchar
)
RETURNS numeric AS $$
DECLARE
o_NextID numeric;
BEGIN
SELECT CurrentNext
INTO o_NextID
FROM ad_sequence_no
WHERE AD_Sequence_ID=p_AD_Sequence_ID
AND CalendarYear = p_CalendarYear
FOR UPDATE OF ad_sequence_no;
--
UPDATE ad_sequence_no
SET CurrentNext = CurrentNext + p_IncrementNo
WHERE AD_Sequence_ID=p_AD_Sequence_ID
AND CalendarYear = p_CalendarYear;
RETURN o_NextID;
END
$$ LANGUAGE plpgsql;

View File

@ -0,0 +1,240 @@
-- Jul 12, 2012 9:29:41 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,200060,0,'StartNewMonth',TO_DATE('2012-07-12 09:29:39','YYYY-MM-DD HH24:MI:SS'),0,'D','Y','Restart sequence every month','Restart sequence every month',TO_DATE('2012-07-12 09:29:39','YYYY-MM-DD HH24:MI:SS'),0)
;
-- Jul 12, 2012 9:29:41 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=200060 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)
;
-- Jul 12, 2012 9:30:32 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,200061,0,'IsOrgLevelSequence',TO_DATE('2012-07-12 09:30:32','YYYY-MM-DD HH24:MI:SS'),0,'This sequence can be defined for each organization','D','Y','Organization level','Organization level',TO_DATE('2012-07-12 09:30:32','YYYY-MM-DD HH24:MI:SS'),0)
;
-- Jul 12, 2012 9:30:32 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=200061 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)
;
-- Jul 12, 2012 9:32:18 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DefaultValue,EntityType,FieldLength,IsActive,IsAllowCopy,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,200212,200060,0,20,115,'StartNewMonth',TO_DATE('2012-07-12 09:32:18','YYYY-MM-DD HH24:MI:SS'),0,'N','D',1,'Y','Y','Y','N','N','N','N','N','Y','N','N','N','N','Y','Restart sequence every month',0,TO_DATE('2012-07-12 09:32:18','YYYY-MM-DD HH24:MI:SS'),0,0)
;
-- Jul 12, 2012 9:32:19 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) 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 FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200212 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)
;
-- Jul 12, 2012 9:32:48 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
ALTER TABLE AD_Sequence ADD StartNewMonth CHAR(1) DEFAULT 'N' CHECK (StartNewMonth IN ('Y','N')) NOT NULL
;
-- Jul 12, 2012 9:33:30 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,IsActive,IsAllowCopy,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,200213,200061,0,20,115,'IsOrgLevelSequence',TO_DATE('2012-07-12 09:33:29','YYYY-MM-DD HH24:MI:SS'),0,'N','This sequence can be defined for each organization','D',1,'Y','Y','Y','N','N','N','N','N','Y','N','N','N','N','Y','Organization level',0,TO_DATE('2012-07-12 09:33:29','YYYY-MM-DD HH24:MI:SS'),0,0)
;
-- Jul 12, 2012 9:33:30 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) 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 FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200213 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)
;
-- Jul 12, 2012 9:33:31 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
ALTER TABLE AD_Sequence ADD IsOrgLevelSequence CHAR(1) DEFAULT 'N' CHECK (IsOrgLevelSequence IN ('Y','N')) NOT NULL
;
-- Jul 12, 2012 9:34:03 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAllowCopy,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,MandatoryLogic,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,200214,1591,0,10,115,'OrgColumn',TO_DATE('2012-07-12 09:34:03','YYYY-MM-DD HH24:MI:SS'),0,'Fully qualified Organization column (AD_Org_ID)','D',60,'The Organization Column indicates the organization to be used in calculating this measurement.','Y','Y','Y','N','N','N','N','N','N','N','N','N','N','Y','@IsUseOrgLevelSequence@=Y','Org Column',0,TO_DATE('2012-07-12 09:34:03','YYYY-MM-DD HH24:MI:SS'),0,0)
;
-- Jul 12, 2012 9:34:03 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) 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 FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200214 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)
;
-- Jul 12, 2012 9:34:04 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
ALTER TABLE AD_Sequence ADD OrgColumn NVARCHAR2(60) DEFAULT NULL
;
-- Jul 12, 2012 9:35:04 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SortNo,Updated,UpdatedBy) VALUES (0,200213,200162,0,146,TO_DATE('2012-07-12 09:35:03','YYYY-MM-DD HH24:MI:SS'),0,'This sequence can be defined for each organization',0,'D','Y','Y','Y','N','N','N','N','N','Organization level',170,0,TO_DATE('2012-07-12 09:35:03','YYYY-MM-DD HH24:MI:SS'),0)
;
-- Jul 12, 2012 9:35:04 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=200162 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)
;
-- Jul 12, 2012 9:35:24 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,DisplayLogic,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SortNo,Updated,UpdatedBy) VALUES (0,200214,200163,0,146,TO_DATE('2012-07-12 09:35:23','YYYY-MM-DD HH24:MI:SS'),0,'Fully qualified Organization column (AD_Org_ID)',0,'@IsOrgLevelSequence@=Y','D','The Organization Column indicates the organization to be used in calculating this measurement.','Y','Y','Y','N','N','N','N','Y','Org Column',180,0,TO_DATE('2012-07-12 09:35:23','YYYY-MM-DD HH24:MI:SS'),0)
;
-- Jul 12, 2012 9:35:24 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=200163 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)
;
-- Jul 12, 2012 9:35:39 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,DisplayLength,DisplayLogic,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SortNo,Updated,UpdatedBy) VALUES (0,200212,200164,0,146,TO_DATE('2012-07-12 09:35:39','YYYY-MM-DD HH24:MI:SS'),0,0,'@StartNewYear@=Y','D','Y','Y','Y','N','N','N','N','N','Restart sequence every month',190,0,TO_DATE('2012-07-12 09:35:39','YYYY-MM-DD HH24:MI:SS'),0)
;
-- Jul 12, 2012 9:35:39 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=200164 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)
;
-- Jul 12, 2012 9:36:20 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y' WHERE AD_Field_ID=54391
;
-- Jul 12, 2012 9:36:20 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Field SET SeqNo=120,IsDisplayed='Y' WHERE AD_Field_ID=332
;
-- Jul 12, 2012 9:36:20 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Field SET SeqNo=130,IsDisplayed='Y' WHERE AD_Field_ID=333
;
-- Jul 12, 2012 9:36:20 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Field SET SeqNo=140,IsDisplayed='Y' WHERE AD_Field_ID=200162
;
-- Jul 12, 2012 9:36:20 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Field SET SeqNo=150,IsDisplayed='Y' WHERE AD_Field_ID=200163
;
-- Jul 12, 2012 9:36:20 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Field SET SeqNo=160,IsDisplayed='Y' WHERE AD_Field_ID=335
;
-- Jul 12, 2012 9:36:20 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Field SET SeqNo=170,IsDisplayed='Y' WHERE AD_Field_ID=54357
;
-- Jul 12, 2012 9:36:20 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Field SET SeqNo=180,IsDisplayed='Y' WHERE AD_Field_ID=200164
;
-- Jul 12, 2012 9:36:20 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Field SET SeqNo=190,IsDisplayed='Y' WHERE AD_Field_ID=1555
;
-- Jul 12, 2012 9:36:20 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Field SET SeqNo=200,IsDisplayed='Y' WHERE AD_Field_ID=334
;
-- Jul 12, 2012 9:38:29 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Field SET DisplayLogic='@IsAutoSequence@=Y & @IsTableID@=N', IsSameLine='N',Updated=TO_DATE('2012-07-12 09:38:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=1555
;
-- Jul 12, 2012 9:38:51 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Field SET IsSameLine='Y',Updated=TO_DATE('2012-07-12 09:38:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=54357
;
-- Jul 12, 2012 9:41:56 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,200062,0,'CalendarYearMonth',TO_DATE('2012-07-12 09:41:55','YYYY-MM-DD HH24:MI:SS'),0,'YYYYMM','D','Y','YearMonth','YearMonth',TO_DATE('2012-07-12 09:41:55','YYYY-MM-DD HH24:MI:SS'),0)
;
-- Jul 12, 2012 9:41:56 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=200062 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)
;
-- Aug 1, 2012 8:32:42 AM COT
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Column SET Help=NULL, FieldLength=6, AD_Element_ID=200062, IsUpdateable='N', ColumnName='CalendarYearMonth', Description='YYYYMM', Name='YearMonth',Updated=TO_DATE('2012-08-01 08:32:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=262
;
-- Aug 1, 2012 8:32:42 AM COT
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Column_Trl SET IsTranslated='N' WHERE AD_Column_ID=262
;
-- Aug 1, 2012 8:32:42 AM COT
UPDATE AD_Field SET Name='YearMonth', Description='YYYYMM', Help=NULL WHERE AD_Column_ID=262 AND IsCentrallyMaintained='Y'
;
ALTER TABLE AD_SEQUENCE_NO MODIFY ( CALENDARYEAR VARCHAR2(6) )
;
ALTER TABLE AD_SEQUENCE_NO RENAME COLUMN CALENDARYEAR TO CALENDARYEARMONTH
;
ALTER TABLE AD_SEQUENCE_NO DROP CONSTRAINT AD_SEQUENCE_NO_KEY
;
DROP INDEX AD_SEQUENCE_NO_KEY
;
ALTER TABLE AD_SEQUENCE_NO ADD ( CONSTRAINT AD_SEQUENCE_NO_KEY PRIMARY KEY (AD_SEQUENCE_ID, CALENDARYEARMONTH, AD_ORG_ID) )
;
-- Jul 12, 2012 9:44:43 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Tab SET DisplayLogic='@StartNewYear@=''Y'' | @IsOrgLevelSequence@=Y',Updated=TO_DATE('2012-07-12 09:44:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Tab_ID=200001
;
-- Jul 12, 2012 9:46:03 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Column SET ReadOnlyLogic='@StartNewYear@=N & @IsOrgLevelSequence@=N',Updated=TO_DATE('2012-07-12 09:46:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=2746
;
DROP PROCEDURE nextidbyyear;
-- Sep 7, 2012 11:04:53 AM COT
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Process_Para SET IsActive='N',Updated=TO_DATE('2012-09-07 11:04:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=53129
;
-- Sep 7, 2012 11:04:57 AM COT
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Process SET IsActive='N',Updated=TO_DATE('2012-09-07 11:04:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=53068
;
-- Sep 7, 2012 11:04:57 AM COT
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Menu SET Name='Update Sequence No', Description=NULL, IsActive='N',Updated=TO_DATE('2012-09-07 11:04:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=53087
;
-- Sep 7, 2012 11:04:57 AM COT
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Menu_Trl SET IsTranslated='N' WHERE AD_Menu_ID=53087
;
-- Sep 7, 2012 2:30:26 PM COT
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Field SET DisplayLogic='@IsTableID@=N',Updated=TO_DATE('2012-09-07 14:30:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200162
;
-- Sep 7, 2012 2:32:51 PM COT
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Sequence SET StartNewMonth='Y', IsOrgLevelSequence='Y', OrgColumn='AD_Org_ID', StartNewYear='Y', Prefix='@AD_Org_ID<AD_Org.Value>@-', DateColumn='DateOrdered', Suffix='-@DateAcct<yyyyMM>@', DecimalPattern='0000000',Updated=TO_DATE('2012-09-07 14:32:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Sequence_ID=383
;
UPDATE AD_System
SET LastMigrationScriptApplied='856_IDEMPIERE_332.sql'
WHERE LastMigrationScriptApplied<'856_IDEMPIERE_332.sql'
OR LastMigrationScriptApplied IS NULL;

View File

@ -0,0 +1,237 @@
-- Jul 12, 2012 9:29:41 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,200060,0,'StartNewMonth',TO_TIMESTAMP('2012-07-12 09:29:39','YYYY-MM-DD HH24:MI:SS'),0,'D','Y','Restart sequence every month','Restart sequence every month',TO_TIMESTAMP('2012-07-12 09:29:39','YYYY-MM-DD HH24:MI:SS'),0)
;
-- Jul 12, 2012 9:29:41 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=200060 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)
;
-- Jul 12, 2012 9:30:32 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,200061,0,'IsOrgLevelSequence',TO_TIMESTAMP('2012-07-12 09:30:32','YYYY-MM-DD HH24:MI:SS'),0,'This sequence can be defined for each organization','D','Y','Organization level','Organization level',TO_TIMESTAMP('2012-07-12 09:30:32','YYYY-MM-DD HH24:MI:SS'),0)
;
-- Jul 12, 2012 9:30:32 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=200061 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)
;
-- Jul 12, 2012 9:32:18 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DefaultValue,EntityType,FieldLength,IsActive,IsAllowCopy,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,200212,200060,0,20,115,'StartNewMonth',TO_TIMESTAMP('2012-07-12 09:32:18','YYYY-MM-DD HH24:MI:SS'),0,'N','D',1,'Y','Y','Y','N','N','N','N','N','Y','N','N','N','N','Y','Restart sequence every month',0,TO_TIMESTAMP('2012-07-12 09:32:18','YYYY-MM-DD HH24:MI:SS'),0,0)
;
-- Jul 12, 2012 9:32:19 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) 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 FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200212 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)
;
-- Jul 12, 2012 9:32:48 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
ALTER TABLE AD_Sequence ADD COLUMN StartNewMonth CHAR(1) DEFAULT 'N' CHECK (StartNewMonth IN ('Y','N')) NOT NULL
;
-- Jul 12, 2012 9:33:30 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,IsActive,IsAllowCopy,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,200213,200061,0,20,115,'IsOrgLevelSequence',TO_TIMESTAMP('2012-07-12 09:33:29','YYYY-MM-DD HH24:MI:SS'),0,'N','This sequence can be defined for each organization','D',1,'Y','Y','Y','N','N','N','N','N','Y','N','N','N','N','Y','Organization level',0,TO_TIMESTAMP('2012-07-12 09:33:29','YYYY-MM-DD HH24:MI:SS'),0,0)
;
-- Jul 12, 2012 9:33:30 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) 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 FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200213 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)
;
-- Jul 12, 2012 9:33:31 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
ALTER TABLE AD_Sequence ADD COLUMN IsOrgLevelSequence CHAR(1) DEFAULT 'N' CHECK (IsOrgLevelSequence IN ('Y','N')) NOT NULL
;
-- Jul 12, 2012 9:34:03 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAllowCopy,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,MandatoryLogic,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,200214,1591,0,10,115,'OrgColumn',TO_TIMESTAMP('2012-07-12 09:34:03','YYYY-MM-DD HH24:MI:SS'),0,'Fully qualified Organization column (AD_Org_ID)','D',60,'The Organization Column indicates the organization to be used in calculating this measurement.','Y','Y','Y','N','N','N','N','N','N','N','N','N','N','Y','@IsUseOrgLevelSequence@=Y','Org Column',0,TO_TIMESTAMP('2012-07-12 09:34:03','YYYY-MM-DD HH24:MI:SS'),0,0)
;
-- Jul 12, 2012 9:34:03 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) 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 FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200214 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)
;
-- Jul 12, 2012 9:34:04 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
ALTER TABLE AD_Sequence ADD COLUMN OrgColumn VARCHAR(60) DEFAULT NULL
;
-- Jul 12, 2012 9:35:04 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SortNo,Updated,UpdatedBy) VALUES (0,200213,200162,0,146,TO_TIMESTAMP('2012-07-12 09:35:03','YYYY-MM-DD HH24:MI:SS'),0,'This sequence can be defined for each organization',0,'D','Y','Y','Y','N','N','N','N','N','Organization level',170,0,TO_TIMESTAMP('2012-07-12 09:35:03','YYYY-MM-DD HH24:MI:SS'),0)
;
-- Jul 12, 2012 9:35:04 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=200162 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)
;
-- Jul 12, 2012 9:35:24 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,DisplayLogic,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SortNo,Updated,UpdatedBy) VALUES (0,200214,200163,0,146,TO_TIMESTAMP('2012-07-12 09:35:23','YYYY-MM-DD HH24:MI:SS'),0,'Fully qualified Organization column (AD_Org_ID)',0,'@IsOrgLevelSequence@=Y','D','The Organization Column indicates the organization to be used in calculating this measurement.','Y','Y','Y','N','N','N','N','Y','Org Column',180,0,TO_TIMESTAMP('2012-07-12 09:35:23','YYYY-MM-DD HH24:MI:SS'),0)
;
-- Jul 12, 2012 9:35:24 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=200163 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)
;
-- Jul 12, 2012 9:35:39 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,DisplayLength,DisplayLogic,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SortNo,Updated,UpdatedBy) VALUES (0,200212,200164,0,146,TO_TIMESTAMP('2012-07-12 09:35:39','YYYY-MM-DD HH24:MI:SS'),0,0,'@StartNewYear@=Y','D','Y','Y','Y','N','N','N','N','N','Restart sequence every month',190,0,TO_TIMESTAMP('2012-07-12 09:35:39','YYYY-MM-DD HH24:MI:SS'),0)
;
-- Jul 12, 2012 9:35:39 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=200164 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)
;
-- Jul 12, 2012 9:36:20 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y' WHERE AD_Field_ID=54391
;
-- Jul 12, 2012 9:36:20 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Field SET SeqNo=120,IsDisplayed='Y' WHERE AD_Field_ID=332
;
-- Jul 12, 2012 9:36:20 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Field SET SeqNo=130,IsDisplayed='Y' WHERE AD_Field_ID=333
;
-- Jul 12, 2012 9:36:20 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Field SET SeqNo=140,IsDisplayed='Y' WHERE AD_Field_ID=200162
;
-- Jul 12, 2012 9:36:20 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Field SET SeqNo=150,IsDisplayed='Y' WHERE AD_Field_ID=200163
;
-- Jul 12, 2012 9:36:20 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Field SET SeqNo=160,IsDisplayed='Y' WHERE AD_Field_ID=335
;
-- Jul 12, 2012 9:36:20 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Field SET SeqNo=170,IsDisplayed='Y' WHERE AD_Field_ID=54357
;
-- Jul 12, 2012 9:36:20 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Field SET SeqNo=180,IsDisplayed='Y' WHERE AD_Field_ID=200164
;
-- Jul 12, 2012 9:36:20 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Field SET SeqNo=190,IsDisplayed='Y' WHERE AD_Field_ID=1555
;
-- Jul 12, 2012 9:36:20 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Field SET SeqNo=200,IsDisplayed='Y' WHERE AD_Field_ID=334
;
-- Jul 12, 2012 9:38:29 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Field SET DisplayLogic='@IsAutoSequence@=Y & @IsTableID@=N', IsSameLine='N',Updated=TO_TIMESTAMP('2012-07-12 09:38:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=1555
;
-- Jul 12, 2012 9:38:51 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Field SET IsSameLine='Y',Updated=TO_TIMESTAMP('2012-07-12 09:38:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=54357
;
-- Jul 12, 2012 9:41:56 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,200062,0,'CalendarYearMonth',TO_TIMESTAMP('2012-07-12 09:41:55','YYYY-MM-DD HH24:MI:SS'),0,'YYYYMM','D','Y','YearMonth','YearMonth',TO_TIMESTAMP('2012-07-12 09:41:55','YYYY-MM-DD HH24:MI:SS'),0)
;
-- Jul 12, 2012 9:41:56 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=200062 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)
;
-- Aug 1, 2012 8:32:42 AM COT
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Column SET Help=NULL, FieldLength=6, AD_Element_ID=200062, IsUpdateable='N', ColumnName='CalendarYearMonth', Description='YYYYMM', Name='YearMonth',Updated=TO_TIMESTAMP('2012-08-01 08:32:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=262
;
-- Aug 1, 2012 8:32:42 AM COT
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Column_Trl SET IsTranslated='N' WHERE AD_Column_ID=262
;
-- Aug 1, 2012 8:32:42 AM COT
UPDATE AD_Field SET Name='YearMonth', Description='YYYYMM', Help=NULL WHERE AD_Column_ID=262 AND IsCentrallyMaintained='Y'
;
ALTER TABLE ad_sequence_no ALTER COLUMN calendaryear TYPE varchar(6)
;
ALTER TABLE ad_sequence_no RENAME calendaryear TO calendaryearmonth
;
ALTER TABLE ad_sequence_no DROP CONSTRAINT ad_sequence_no_pkey CASCADE
;
ALTER TABLE ad_sequence_no ADD CONSTRAINT ad_sequence_no_pkey PRIMARY KEY (ad_sequence_id, calendaryearmonth, ad_org_id)
;
-- Jul 12, 2012 9:44:43 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Tab SET DisplayLogic='@StartNewYear@=''Y'' | @IsOrgLevelSequence@=Y',Updated=TO_TIMESTAMP('2012-07-12 09:44:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Tab_ID=200001
;
-- Jul 12, 2012 9:46:03 AM CEST
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Column SET ReadOnlyLogic='@StartNewYear@=N & @IsOrgLevelSequence@=N',Updated=TO_TIMESTAMP('2012-07-12 09:46:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=2746
;
DROP FUNCTION nextidbyyear(numeric, numeric, character varying);
-- Sep 7, 2012 11:04:53 AM COT
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Process_Para SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-07 11:04:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=53129
;
-- Sep 7, 2012 11:04:57 AM COT
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Process SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-07 11:04:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=53068
;
-- Sep 7, 2012 11:04:57 AM COT
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Menu SET Name='Update Sequence No', Description=NULL, IsActive='N',Updated=TO_TIMESTAMP('2012-09-07 11:04:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=53087
;
-- Sep 7, 2012 11:04:57 AM COT
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Menu_Trl SET IsTranslated='N' WHERE AD_Menu_ID=53087
;
-- Sep 7, 2012 2:30:26 PM COT
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Field SET DisplayLogic='@IsTableID@=N',Updated=TO_TIMESTAMP('2012-09-07 14:30:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200162
;
-- Sep 7, 2012 2:32:51 PM COT
-- IDEMPIERE-332 Document sequence organization level and restart monthly
UPDATE AD_Sequence SET StartNewMonth='Y', IsOrgLevelSequence='Y', OrgColumn='AD_Org_ID', StartNewYear='Y', Prefix='@AD_Org_ID<AD_Org.Value>@-', DateColumn='DateOrdered', Suffix='-@DateAcct<yyyyMM>@', DecimalPattern='0000000',Updated=TO_TIMESTAMP('2012-09-07 14:32:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Sequence_ID=383
;
UPDATE AD_System
SET LastMigrationScriptApplied='856_IDEMPIERE_332.sql'
WHERE LastMigrationScriptApplied<'856_IDEMPIERE_332.sql'
OR LastMigrationScriptApplied IS NULL;

View File

@ -174,8 +174,8 @@ public class CalloutInOut extends CalloutEngine
if (C_DocType_ID == null || C_DocType_ID.intValue() == 0) if (C_DocType_ID == null || C_DocType_ID.intValue() == 0)
return ""; return "";
String sql = "SELECT d.DocBaseType, d.IsDocNoControlled, s.CurrentNext, " //1..3 String sql = "SELECT d.DocBaseType, d.IsDocNoControlled, " //1..2
+ "s.AD_Sequence_ID, s.StartNewYear, s.DateColumn, d.IsSOTrx " //4..7 + "s.AD_Sequence_ID, d.IsSOTrx " //3..4
+ "FROM C_DocType d " + "FROM C_DocType d "
+ "LEFT OUTER JOIN AD_Sequence s ON (d.DocNoSequence_ID=s.AD_Sequence_ID) " + "LEFT OUTER JOIN AD_Sequence s ON (d.DocNoSequence_ID=s.AD_Sequence_ID) "
+ "WHERE C_DocType_ID=?"; // 1 + "WHERE C_DocType_ID=?"; // 1
@ -192,7 +192,7 @@ public class CalloutInOut extends CalloutEngine
// Set Movement Type // Set Movement Type
String DocBaseType = rs.getString("DocBaseType"); String DocBaseType = rs.getString("DocBaseType");
// BF [2708789] Read IsSOTrx from C_DocType // BF [2708789] Read IsSOTrx from C_DocType
String trxFlag = rs.getString(7); String trxFlag = rs.getString("IsSOTrx");
if (!(trxFlag.equals(mTab.getValue("IsSOTrx")))) if (!(trxFlag.equals(mTab.getValue("IsSOTrx"))))
mTab.setValue("IsSOTrx", trxFlag); mTab.setValue("IsSOTrx", trxFlag);
if (DocBaseType.equals("MMS")) // Material Shipments if (DocBaseType.equals("MMS")) // Material Shipments
@ -220,17 +220,8 @@ public class CalloutInOut extends CalloutEngine
// DocumentNo // DocumentNo
if (rs.getString("IsDocNoControlled").equals("Y")) if (rs.getString("IsDocNoControlled").equals("Y"))
{ {
if ("Y".equals(rs.getString(5))) int AD_Sequence_ID = rs.getInt("AD_Sequence_ID");
{ mTab.setValue("DocumentNo", MSequence.getPreliminaryNo(mTab, AD_Sequence_ID));
String dateColumn = rs.getString(6);
int AD_Sequence_ID = rs.getInt(4);
mTab.setValue("DocumentNo",
"<"
+ MSequence.getPreliminaryNoByYear(mTab, AD_Sequence_ID, dateColumn, null)
+ ">");
}
else
mTab.setValue("DocumentNo", "<" + rs.getString("CurrentNext") + ">");
} }
} }
} }

View File

@ -59,12 +59,12 @@ public class CalloutInvoice extends CalloutEngine
if (C_DocType_ID == null || C_DocType_ID.intValue() == 0) if (C_DocType_ID == null || C_DocType_ID.intValue() == 0)
return ""; return "";
String sql = "SELECT d.HasCharges,'N',d.IsDocNoControlled," // 1..3 String sql = "SELECT d.HasCharges,d.IsDocNoControlled," // 1..2
+ "s.CurrentNext, d.DocBaseType, " // 4..5 + "d.DocBaseType, " // 3
+ "s.StartNewYear, s.DateColumn, s.AD_Sequence_ID " //6..8 + "s.AD_Sequence_ID " //4
+ "FROM C_DocType d, AD_Sequence s " + "FROM C_DocType d "
+ "WHERE C_DocType_ID=?" // 1 + "LEFT OUTER JOIN AD_Sequence s ON (d.DocNoSequence_ID=s.AD_Sequence_ID) "
+ " AND d.DocNoSequence_ID=s.AD_Sequence_ID(+)"; + "WHERE C_DocType_ID=?"; // 1
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
try try
@ -75,23 +75,15 @@ public class CalloutInvoice extends CalloutEngine
if (rs.next()) if (rs.next())
{ {
// Charges - Set Context // Charges - Set Context
Env.setContext(ctx, WindowNo, "HasCharges", rs.getString(1)); Env.setContext(ctx, WindowNo, "HasCharges", rs.getString("HasCharges"));
// DocumentNo // DocumentNo
if (rs.getString(3).equals("Y")) if (rs.getString("IsDocNoControlled").equals("Y"))
{ {
if ("Y".equals(rs.getString(6))) int AD_Sequence_ID = rs.getInt("AD_Sequence_ID");
{ mTab.setValue("DocumentNo", MSequence.getPreliminaryNo(mTab, AD_Sequence_ID));
String dateColumn = rs.getString(7);
mTab.setValue("DocumentNo",
"<"
+ MSequence.getPreliminaryNoByYear(mTab, rs.getInt(8), dateColumn, null)
+ ">");
}
else
mTab.setValue("DocumentNo", "<" + rs.getString(4) + ">");
} }
// DocBaseType - Set Context // DocBaseType - Set Context
String s = rs.getString(5); String s = rs.getString("DocBaseType");
Env.setContext(ctx, WindowNo, "DocBaseType", s); Env.setContext(ctx, WindowNo, "DocBaseType", s);
// AP Check & AR Credit Memo // AP Check & AR Credit Memo
if (s.startsWith("AP")) if (s.startsWith("AP"))
@ -108,6 +100,7 @@ public class CalloutInvoice extends CalloutEngine
finally finally
{ {
DB.close(rs, pstmt); DB.close(rs, pstmt);
rs = null; pstmt = null;
} }
return ""; return "";
} // docType } // docType

View File

@ -72,18 +72,17 @@ public class CalloutOrder extends CalloutEngine
newDocNo = true; newDocNo = true;
Integer oldC_DocType_ID = (Integer)mTab.getValue("C_DocType_ID"); Integer oldC_DocType_ID = (Integer)mTab.getValue("C_DocType_ID");
String sql = "SELECT d.DocSubTypeSO,d.HasCharges,'N'," // 1..3 String sql = "SELECT d.DocSubTypeSO,d.HasCharges," // 1..2
+ "d.IsDocNoControlled,s.CurrentNext,s.CurrentNextSys," // 4..6 + "d.IsDocNoControlled," // 3
+ "s.AD_Sequence_ID,d.IsSOTrx, " // 7..8 + "s.AD_Sequence_ID,d.IsSOTrx " // 4..5
+ "s.StartNewYear, s.DateColumn " // 9..10 + "FROM C_DocType d "
+ "FROM C_DocType d, AD_Sequence s " + "LEFT OUTER JOIN AD_Sequence s ON (d.DocNoSequence_ID=s.AD_Sequence_ID) "
+ "WHERE C_DocType_ID=?" // #1 + "WHERE C_DocType_ID=?"; // #1
+ " AND d.DocNoSequence_ID=s.AD_Sequence_ID(+)";
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
try try
{ {
int AD_Sequence_ID = 0; int oldAD_Sequence_ID = 0;
// Get old AD_SeqNo for comparison // Get old AD_SeqNo for comparison
if (!newDocNo && oldC_DocType_ID.intValue() != 0) if (!newDocNo && oldC_DocType_ID.intValue() != 0)
@ -92,12 +91,12 @@ public class CalloutOrder extends CalloutEngine
pstmt.setInt(1, oldC_DocType_ID.intValue()); pstmt.setInt(1, oldC_DocType_ID.intValue());
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
AD_Sequence_ID = rs.getInt(7); oldAD_Sequence_ID = rs.getInt("AD_Sequence_ID");
DB.close(rs, pstmt); DB.close(rs, pstmt);
rs = null; rs = null;
pstmt = null; pstmt = null;
} }
pstmt = DB.prepareStatement(sql, null); pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, C_DocType_ID.intValue()); pstmt.setInt(1, C_DocType_ID.intValue());
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
@ -106,14 +105,14 @@ public class CalloutOrder extends CalloutEngine
if (rs.next()) // we found document type if (rs.next()) // we found document type
{ {
// Set Context: Document Sub Type for Sales Orders // Set Context: Document Sub Type for Sales Orders
DocSubTypeSO = rs.getString(1); DocSubTypeSO = rs.getString("DocSubTypeSO");
if (DocSubTypeSO == null) if (DocSubTypeSO == null)
DocSubTypeSO = "--"; DocSubTypeSO = "--";
Env.setContext(ctx, WindowNo, "OrderType", DocSubTypeSO); Env.setContext(ctx, WindowNo, "OrderType", DocSubTypeSO);
// No Drop Ship other than Standard // No Drop Ship other than Standard
if (!DocSubTypeSO.equals(MOrder.DocSubTypeSO_Standard)) if (!DocSubTypeSO.equals(MOrder.DocSubTypeSO_Standard))
mTab.setValue ("IsDropShip", "N"); mTab.setValue ("IsDropShip", "N");
// Delivery Rule // Delivery Rule
if (DocSubTypeSO.equals(MOrder.DocSubTypeSO_POS)) if (DocSubTypeSO.equals(MOrder.DocSubTypeSO_POS))
mTab.setValue ("DeliveryRule", X_C_Order.DELIVERYRULE_Force); mTab.setValue ("DeliveryRule", X_C_Order.DELIVERYRULE_Force);
@ -121,7 +120,7 @@ public class CalloutOrder extends CalloutEngine
mTab.setValue ("DeliveryRule", X_C_Order.DELIVERYRULE_AfterReceipt); mTab.setValue ("DeliveryRule", X_C_Order.DELIVERYRULE_AfterReceipt);
else else
mTab.setValue ("DeliveryRule", X_C_Order.DELIVERYRULE_Availability); mTab.setValue ("DeliveryRule", X_C_Order.DELIVERYRULE_Availability);
// Invoice Rule // Invoice Rule
if (DocSubTypeSO.equals(MOrder.DocSubTypeSO_POS) if (DocSubTypeSO.equals(MOrder.DocSubTypeSO_POS)
|| DocSubTypeSO.equals(MOrder.DocSubTypeSO_Prepay) || DocSubTypeSO.equals(MOrder.DocSubTypeSO_Prepay)
@ -129,7 +128,7 @@ public class CalloutOrder extends CalloutEngine
mTab.setValue ("InvoiceRule", X_C_Order.INVOICERULE_Immediate); mTab.setValue ("InvoiceRule", X_C_Order.INVOICERULE_Immediate);
else else
mTab.setValue ("InvoiceRule", X_C_Order.INVOICERULE_AfterDelivery); mTab.setValue ("InvoiceRule", X_C_Order.INVOICERULE_AfterDelivery);
// Payment Rule - POS Order // Payment Rule - POS Order
if (DocSubTypeSO.equals(MOrder.DocSubTypeSO_POS)) if (DocSubTypeSO.equals(MOrder.DocSubTypeSO_POS))
mTab.setValue("PaymentRule", X_C_Order.PAYMENTRULE_Cash); mTab.setValue("PaymentRule", X_C_Order.PAYMENTRULE_Cash);
@ -137,46 +136,32 @@ public class CalloutOrder extends CalloutEngine
mTab.setValue("PaymentRule", X_C_Order.PAYMENTRULE_OnCredit); mTab.setValue("PaymentRule", X_C_Order.PAYMENTRULE_OnCredit);
// IsSOTrx // IsSOTrx
if ("N".equals(rs.getString(8))) if ("N".equals(rs.getString("IsSOTrx")))
IsSOTrx = false; IsSOTrx = false;
// Set Context: // Set Context:
Env.setContext(ctx, WindowNo, "HasCharges", rs.getString(2)); Env.setContext(ctx, WindowNo, "HasCharges", rs.getString("HasCharges"));
// DocumentNo // DocumentNo
if (rs.getString(4).equals("Y")) // IsDocNoControlled if (rs.getString("IsDocNoControlled").equals("Y")) // IsDocNoControlled
{ {
if (!newDocNo && AD_Sequence_ID != rs.getInt(7)) if (!newDocNo && oldAD_Sequence_ID != rs.getInt("AD_Sequence_ID"))
newDocNo = true; newDocNo = true;
if (newDocNo) if (newDocNo) {
if (Ini.isPropertyBool(Ini.P_ADEMPIERESYS) && Env.getAD_Client_ID(Env.getCtx()) < 1000000) int AD_Sequence_ID = rs.getInt("AD_Sequence_ID");
mTab.setValue("DocumentNo", "<" + rs.getString(6) + ">"); mTab.setValue("DocumentNo", MSequence.getPreliminaryNo(mTab, AD_Sequence_ID));
else }
{
if ("Y".equals(rs.getString(9)))
{
String dateColumn = rs.getString(10);
mTab.setValue("DocumentNo",
"<"
+ MSequence.getPreliminaryNoByYear(mTab, rs.getInt(7), dateColumn, null)
+ ">");
}
else
{
mTab.setValue("DocumentNo", "<" + rs.getString(5) + ">");
}
}
} }
} }
DB.close(rs, pstmt); DB.close(rs, pstmt);
rs = null; rs = null;
pstmt = null; pstmt = null;
// When BPartner is changed, the Rules are not set if // When BPartner is changed, the Rules are not set if
// it is a POS or Credit Order (i.e. defaults from Standard BPartner) // it is a POS or Credit Order (i.e. defaults from Standard BPartner)
// This re-reads the Rules and applies them. // This re-reads the Rules and applies them.
if (DocSubTypeSO.equals(MOrder.DocSubTypeSO_POS) if (DocSubTypeSO.equals(MOrder.DocSubTypeSO_POS)
|| DocSubTypeSO.equals(MOrder.DocSubTypeSO_Prepay)) // not for POS/PrePay || DocSubTypeSO.equals(MOrder.DocSubTypeSO_Prepay)) // not for POS/PrePay
; ;
else else
@ -225,7 +210,7 @@ public class CalloutOrder extends CalloutEngine
if (s != null && s.length() != 0) if (s != null && s.length() != 0)
mTab.setValue("DeliveryViaRule", s); mTab.setValue("DeliveryViaRule", s);
} }
} }
// re-read customer rules // re-read customer rules
} }
catch (SQLException e) catch (SQLException e)

View File

@ -1,76 +0,0 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 2008 Adempiere, Inc. All Rights Reserved. *
* 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.process;
import java.sql.PreparedStatement;
import org.compiere.process.ProcessInfoParameter;
import org.compiere.process.SvrProcess;
import org.compiere.util.DB;
/**
* Insert AD_Sequence records that restart sequence at every year into
* AD_Sequence_No table if the record does not exists
*
* @author Elaine
*
*/
public class UpdateSequenceNo extends SvrProcess {
private String year;
@Override
protected void prepare() {
ProcessInfoParameter[] parameters = this.getParameter();
for (ProcessInfoParameter p : parameters) {
if (p.getParameterName().equals("CalendarYear")) {
year = p.getParameter().toString();
}
}
}
@Override
protected String doIt() throws Exception {
PreparedStatement insertStmt = null;
try {
insertStmt = DB
.prepareStatement(
"INSERT INTO AD_Sequence_No(AD_SEQUENCE_ID, CALENDARYEAR, "
+ "AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, "
+ "UPDATED, UPDATEDBY, CURRENTNEXT) "
+ "(SELECT AD_Sequence_ID, '" + year + "', "
+ "AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, "
+ "Updated, UpdatedBy, StartNo "
+ "FROM AD_Sequence a "
+ "WHERE StartNewYear = 'Y' AND NOT EXISTS ( "
+ "SELECT AD_Sequence_ID "
+ "FROM AD_Sequence_No b "
+ "WHERE a.AD_Sequence_ID = b.AD_Sequence_ID "
+ "AND CalendarYear = ?)) ",
get_TrxName());
insertStmt.setString(1, year);
insertStmt.executeUpdate();
commitEx();
} catch (Exception ex) {
rollback();
throw ex;
} finally {
DB.close(insertStmt);
}
return "Sequence No updated successfully";
}
}

View File

@ -31,7 +31,7 @@ public interface I_AD_Sequence
public static final String Table_Name = "AD_Sequence"; public static final String Table_Name = "AD_Sequence";
/** AD_Table_ID=115 */ /** AD_Table_ID=115 */
public static final int Table_ID = MTable.getTable_ID(Table_Name); public static final int Table_ID = 115;
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name); KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
@ -75,6 +75,15 @@ public interface I_AD_Sequence
*/ */
public int getAD_Sequence_ID(); public int getAD_Sequence_ID();
/** Column name AD_Sequence_UU */
public static final String COLUMNNAME_AD_Sequence_UU = "AD_Sequence_UU";
/** Set AD_Sequence_UU */
public void setAD_Sequence_UU (String AD_Sequence_UU);
/** Get AD_Sequence_UU */
public String getAD_Sequence_UU();
/** Column name Created */ /** Column name Created */
public static final String COLUMNNAME_Created = "Created"; public static final String COLUMNNAME_Created = "Created";
@ -208,6 +217,19 @@ public interface I_AD_Sequence
*/ */
public boolean isAutoSequence(); public boolean isAutoSequence();
/** Column name IsOrgLevelSequence */
public static final String COLUMNNAME_IsOrgLevelSequence = "IsOrgLevelSequence";
/** Set Organization level.
* This sequence can be defined for each organization
*/
public void setIsOrgLevelSequence (boolean IsOrgLevelSequence);
/** Get Organization level.
* This sequence can be defined for each organization
*/
public boolean isOrgLevelSequence();
/** Column name IsTableID */ /** Column name IsTableID */
public static final String COLUMNNAME_IsTableID = "IsTableID"; public static final String COLUMNNAME_IsTableID = "IsTableID";
@ -234,6 +256,19 @@ public interface I_AD_Sequence
*/ */
public String getName(); public String getName();
/** Column name OrgColumn */
public static final String COLUMNNAME_OrgColumn = "OrgColumn";
/** Set Org Column.
* Fully qualified Organization column (AD_Org_ID)
*/
public void setOrgColumn (String OrgColumn);
/** Get Org Column.
* Fully qualified Organization column (AD_Org_ID)
*/
public String getOrgColumn();
/** Column name Prefix */ /** Column name Prefix */
public static final String COLUMNNAME_Prefix = "Prefix"; public static final String COLUMNNAME_Prefix = "Prefix";
@ -247,6 +282,15 @@ public interface I_AD_Sequence
*/ */
public String getPrefix(); public String getPrefix();
/** Column name StartNewMonth */
public static final String COLUMNNAME_StartNewMonth = "StartNewMonth";
/** Set Restart sequence every month */
public void setStartNewMonth (boolean StartNewMonth);
/** Get Restart sequence every month */
public boolean isStartNewMonth();
/** Column name StartNewYear */ /** Column name StartNewYear */
public static final String COLUMNNAME_StartNewYear = "StartNewYear"; public static final String COLUMNNAME_StartNewYear = "StartNewYear";

View File

@ -31,7 +31,7 @@ public interface I_AD_Sequence_No
public static final String Table_Name = "AD_Sequence_No"; public static final String Table_Name = "AD_Sequence_No";
/** AD_Table_ID=122 */ /** AD_Table_ID=122 */
public static final int Table_ID = MTable.getTable_ID(Table_Name); public static final int Table_ID = 122;
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name); KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
@ -75,20 +75,29 @@ public interface I_AD_Sequence_No
*/ */
public int getAD_Sequence_ID(); public int getAD_Sequence_ID();
public I_AD_Sequence getAD_Sequence() throws RuntimeException; public org.compiere.model.I_AD_Sequence getAD_Sequence() throws RuntimeException;
/** Column name CalendarYear */ /** Column name AD_Sequence_No_UU */
public static final String COLUMNNAME_CalendarYear = "CalendarYear"; public static final String COLUMNNAME_AD_Sequence_No_UU = "AD_Sequence_No_UU";
/** Set Year. /** Set AD_Sequence_No_UU */
* Calendar Year public void setAD_Sequence_No_UU (String AD_Sequence_No_UU);
/** Get AD_Sequence_No_UU */
public String getAD_Sequence_No_UU();
/** Column name CalendarYearMonth */
public static final String COLUMNNAME_CalendarYearMonth = "CalendarYearMonth";
/** Set YearMonth.
* YYYYMM
*/ */
public void setCalendarYear (String CalendarYear); public void setCalendarYearMonth (String CalendarYearMonth);
/** Get Year. /** Get YearMonth.
* Calendar Year * YYYYMM
*/ */
public String getCalendarYear(); public String getCalendarYearMonth();
/** Column name Created */ /** Column name Created */
public static final String COLUMNNAME_Created = "Created"; public static final String COLUMNNAME_Created = "Created";

File diff suppressed because it is too large Load Diff

View File

@ -459,24 +459,15 @@ public class MTable extends X_AD_Table
protected boolean afterSave (boolean newRecord, boolean success) protected boolean afterSave (boolean newRecord, boolean success)
{ {
// Sync Table ID // Sync Table ID
if (newRecord) MSequence seq = MSequence.get(getCtx(), getTableName(), get_TrxName());
if (seq == null || seq.get_ID() == 0)
MSequence.createTableSequence(getCtx(), getTableName(), get_TrxName());
else if (seq != null && !seq.getName().equals(getTableName()))
{ {
MSequence seq = MSequence.get(getCtx(), getTableName(), get_TrxName()); seq.setName(getTableName());
if (seq == null || seq.get_ID() == 0) seq.saveEx();
MSequence.createTableSequence(getCtx(), getTableName(), get_TrxName());
} }
else
{
MSequence seq = MSequence.get(getCtx(), getTableName(), get_TrxName());
if (seq == null || seq.get_ID() == 0)
MSequence.createTableSequence(getCtx(), getTableName(), get_TrxName());
else if (!seq.getName().equals(getTableName()))
{
seq.setName(getTableName());
seq.saveEx();
}
}
return success; return success;
} // afterSave } // afterSave

View File

@ -30,7 +30,7 @@ public class X_AD_Sequence extends PO implements I_AD_Sequence, I_Persistent
/** /**
* *
*/ */
private static final long serialVersionUID = 20100614L; private static final long serialVersionUID = 20120907L;
/** Standard Constructor */ /** Standard Constructor */
public X_AD_Sequence (Properties ctx, int AD_Sequence_ID, String trxName) public X_AD_Sequence (Properties ctx, int AD_Sequence_ID, String trxName)
@ -46,7 +46,11 @@ public class X_AD_Sequence extends PO implements I_AD_Sequence, I_Persistent
setIncrementNo (0); setIncrementNo (0);
// 1 // 1
setIsAutoSequence (false); setIsAutoSequence (false);
setIsOrgLevelSequence (false);
// N
setName (null); setName (null);
setStartNewMonth (false);
// N
setStartNo (0); setStartNo (0);
// 1000000 // 1000000
} */ } */
@ -103,6 +107,20 @@ public class X_AD_Sequence extends PO implements I_AD_Sequence, I_Persistent
return ii.intValue(); return ii.intValue();
} }
/** Set AD_Sequence_UU.
@param AD_Sequence_UU AD_Sequence_UU */
public void setAD_Sequence_UU (String AD_Sequence_UU)
{
set_Value (COLUMNNAME_AD_Sequence_UU, AD_Sequence_UU);
}
/** Get AD_Sequence_UU.
@return AD_Sequence_UU */
public String getAD_Sequence_UU ()
{
return (String)get_Value(COLUMNNAME_AD_Sequence_UU);
}
/** Set Current Next. /** Set Current Next.
@param CurrentNext @param CurrentNext
The next number to be used The next number to be used
@ -262,6 +280,30 @@ public class X_AD_Sequence extends PO implements I_AD_Sequence, I_Persistent
return false; return false;
} }
/** Set Organization level.
@param IsOrgLevelSequence
This sequence can be defined for each organization
*/
public void setIsOrgLevelSequence (boolean IsOrgLevelSequence)
{
set_Value (COLUMNNAME_IsOrgLevelSequence, Boolean.valueOf(IsOrgLevelSequence));
}
/** Get Organization level.
@return This sequence can be defined for each organization
*/
public boolean isOrgLevelSequence ()
{
Object oo = get_Value(COLUMNNAME_IsOrgLevelSequence);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Used for Record ID. /** Set Used for Record ID.
@param IsTableID @param IsTableID
The document number will be used as the record key The document number will be used as the record key
@ -311,6 +353,23 @@ public class X_AD_Sequence extends PO implements I_AD_Sequence, I_Persistent
return new KeyNamePair(get_ID(), getName()); return new KeyNamePair(get_ID(), getName());
} }
/** Set Org Column.
@param OrgColumn
Fully qualified Organization column (AD_Org_ID)
*/
public void setOrgColumn (String OrgColumn)
{
set_Value (COLUMNNAME_OrgColumn, OrgColumn);
}
/** Get Org Column.
@return Fully qualified Organization column (AD_Org_ID)
*/
public String getOrgColumn ()
{
return (String)get_Value(COLUMNNAME_OrgColumn);
}
/** Set Prefix. /** Set Prefix.
@param Prefix @param Prefix
Prefix before the sequence number Prefix before the sequence number
@ -328,6 +387,27 @@ public class X_AD_Sequence extends PO implements I_AD_Sequence, I_Persistent
return (String)get_Value(COLUMNNAME_Prefix); return (String)get_Value(COLUMNNAME_Prefix);
} }
/** Set Restart sequence every month.
@param StartNewMonth Restart sequence every month */
public void setStartNewMonth (boolean StartNewMonth)
{
set_Value (COLUMNNAME_StartNewMonth, Boolean.valueOf(StartNewMonth));
}
/** Get Restart sequence every month.
@return Restart sequence every month */
public boolean isStartNewMonth ()
{
Object oo = get_Value(COLUMNNAME_StartNewMonth);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Restart sequence every Year. /** Set Restart sequence every Year.
@param StartNewYear @param StartNewYear
Restart the sequence with Start on every 1/1 Restart the sequence with Start on every 1/1

View File

@ -29,7 +29,7 @@ public class X_AD_Sequence_No extends PO implements I_AD_Sequence_No, I_Persiste
/** /**
* *
*/ */
private static final long serialVersionUID = 20100614L; private static final long serialVersionUID = 20120907L;
/** Standard Constructor */ /** Standard Constructor */
public X_AD_Sequence_No (Properties ctx, int AD_Sequence_No_ID, String trxName) public X_AD_Sequence_No (Properties ctx, int AD_Sequence_No_ID, String trxName)
@ -38,7 +38,7 @@ public class X_AD_Sequence_No extends PO implements I_AD_Sequence_No, I_Persiste
/** if (AD_Sequence_No_ID == 0) /** if (AD_Sequence_No_ID == 0)
{ {
setAD_Sequence_ID (0); setAD_Sequence_ID (0);
setCalendarYear (null); setCalendarYearMonth (null);
setCurrentNext (0); setCurrentNext (0);
} */ } */
} }
@ -71,9 +71,9 @@ public class X_AD_Sequence_No extends PO implements I_AD_Sequence_No, I_Persiste
return sb.toString(); return sb.toString();
} }
public I_AD_Sequence getAD_Sequence() throws RuntimeException public org.compiere.model.I_AD_Sequence getAD_Sequence() throws RuntimeException
{ {
return (I_AD_Sequence)MTable.get(getCtx(), I_AD_Sequence.Table_Name) return (org.compiere.model.I_AD_Sequence)MTable.get(getCtx(), org.compiere.model.I_AD_Sequence.Table_Name)
.getPO(getAD_Sequence_ID(), get_TrxName()); } .getPO(getAD_Sequence_ID(), get_TrxName()); }
/** Set Sequence. /** Set Sequence.
@ -99,21 +99,35 @@ public class X_AD_Sequence_No extends PO implements I_AD_Sequence_No, I_Persiste
return ii.intValue(); return ii.intValue();
} }
/** Set Year. /** Set AD_Sequence_No_UU.
@param CalendarYear @param AD_Sequence_No_UU AD_Sequence_No_UU */
Calendar Year public void setAD_Sequence_No_UU (String AD_Sequence_No_UU)
*/
public void setCalendarYear (String CalendarYear)
{ {
set_ValueNoCheck (COLUMNNAME_CalendarYear, CalendarYear); set_Value (COLUMNNAME_AD_Sequence_No_UU, AD_Sequence_No_UU);
} }
/** Get Year. /** Get AD_Sequence_No_UU.
@return Calendar Year @return AD_Sequence_No_UU */
*/ public String getAD_Sequence_No_UU ()
public String getCalendarYear ()
{ {
return (String)get_Value(COLUMNNAME_CalendarYear); return (String)get_Value(COLUMNNAME_AD_Sequence_No_UU);
}
/** Set YearMonth.
@param CalendarYearMonth
YYYYMM
*/
public void setCalendarYearMonth (String CalendarYearMonth)
{
set_ValueNoCheck (COLUMNNAME_CalendarYearMonth, CalendarYearMonth);
}
/** Get YearMonth.
@return YYYYMM
*/
public String getCalendarYearMonth ()
{
return (String)get_Value(COLUMNNAME_CalendarYearMonth);
} }
/** Set Current Next. /** Set Current Next.

View File

@ -1432,7 +1432,7 @@ public final class Env
String table = tblIndex > 0 ? format.substring(0, tblIndex) : token.substring(0, token.length() - 3); String table = tblIndex > 0 ? format.substring(0, tblIndex) : token.substring(0, token.length() - 3);
String column = tblIndex > 0 ? format.substring(tblIndex + 1) : format; String column = tblIndex > 0 ? format.substring(tblIndex + 1) : format;
outStr.append(DB.getSQLValueString(trxName, outStr.append(DB.getSQLValueString(trxName,
"select " + column + " from " + table + " where " + table + "_id = ?", (Integer)v)); "SELECT " + column + " FROM " + table + " WHERE " + table + "_ID = ?", (Integer)v));
} else if (v instanceof Date) { } else if (v instanceof Date) {
SimpleDateFormat df = new SimpleDateFormat(format); SimpleDateFormat df = new SimpleDateFormat(format);
outStr.append(df.format((Date)v)); outStr.append(df.format((Date)v));