IDEMPIERE-63 Document number is updated again when document completed after reactivation
This commit is contained in:
parent
9f30dab0b6
commit
e3ae21da2b
|
@ -0,0 +1,26 @@
|
|||
-- Aug 29, 2012 6:44:34 PM COT
|
||||
-- IDEMPIERE-63 Document number is updated again when document completed after reactivation
|
||||
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','Document type cannot be changed when overwrite document number on complete is set and the document was already processed',200025,'D','1bc9f344-4855-473d-a058-424dfd6d9a1e','CannotChangeProcessedDocType','Y',TO_DATE('2012-08-29 18:44:33','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-08-29 18:44:33','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
-- Aug 29, 2012 6:44:34 PM COT
|
||||
-- IDEMPIERE-63 Document number is updated again when document completed after reactivation
|
||||
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=200025 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)
|
||||
;
|
||||
|
||||
-- Aug 29, 2012 6:44:57 PM COT
|
||||
-- IDEMPIERE-63 Document number is updated again when document completed after reactivation
|
||||
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','Date cannot be changed when overwrite date on complete is set and the document was already processed',200026,'D','81bf5a40-ae47-4dcf-9be3-9d04d0c9116f','CannotChangeProcessedDate','Y',TO_DATE('2012-08-29 18:44:56','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-08-29 18:44:56','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
-- Aug 29, 2012 6:44:57 PM COT
|
||||
-- IDEMPIERE-63 Document number is updated again when document completed after reactivation
|
||||
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=200026 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)
|
||||
;
|
||||
|
||||
UPDATE AD_System
|
||||
SET LastMigrationScriptApplied='897_IDEMPIERE-63.sql'
|
||||
WHERE LastMigrationScriptApplied<'897_IDEMPIERE-63.sql'
|
||||
OR LastMigrationScriptApplied IS NULL
|
||||
;
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
-- Aug 29, 2012 6:44:34 PM COT
|
||||
-- IDEMPIERE-63 Document number is updated again when document completed after reactivation
|
||||
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','Document type cannot be changed when overwrite document number on complete is set and the document was already processed',200025,'D','1bc9f344-4855-473d-a058-424dfd6d9a1e','CannotChangeProcessedDocType','Y',TO_TIMESTAMP('2012-08-29 18:44:33','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-08-29 18:44:33','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
-- Aug 29, 2012 6:44:34 PM COT
|
||||
-- IDEMPIERE-63 Document number is updated again when document completed after reactivation
|
||||
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=200025 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)
|
||||
;
|
||||
|
||||
-- Aug 29, 2012 6:44:57 PM COT
|
||||
-- IDEMPIERE-63 Document number is updated again when document completed after reactivation
|
||||
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','Date cannot be changed when overwrite date on complete is set and the document was already processed',200026,'D','81bf5a40-ae47-4dcf-9be3-9d04d0c9116f','CannotChangeProcessedDate','Y',TO_TIMESTAMP('2012-08-29 18:44:56','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-08-29 18:44:56','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
-- Aug 29, 2012 6:44:57 PM COT
|
||||
-- IDEMPIERE-63 Document number is updated again when document completed after reactivation
|
||||
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=200026 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)
|
||||
;
|
||||
|
||||
UPDATE AD_System
|
||||
SET LastMigrationScriptApplied='897_IDEMPIERE-63.sql'
|
||||
WHERE LastMigrationScriptApplied<'897_IDEMPIERE-63.sql'
|
||||
OR LastMigrationScriptApplied IS NULL
|
||||
;
|
||||
|
|
@ -305,6 +305,28 @@ public class MJournal extends X_GL_Journal implements DocAction
|
|||
if (getDateAcct() == null)
|
||||
setDateAcct(getDateDoc());
|
||||
|
||||
// IDEMPIERE-63
|
||||
// for documents that can be reactivated we cannot allow changing
|
||||
// C_DocTypeTarget_ID or C_DocType_ID if they were already processed and isOverwriteSeqOnComplete
|
||||
// neither change the Date if isOverwriteDateOnComplete
|
||||
BigDecimal previousProcessedOn = (BigDecimal) get_ValueOld(COLUMNNAME_ProcessedOn);
|
||||
if (! newRecord && previousProcessedOn != null && previousProcessedOn.signum() > 0) {
|
||||
int previousDocTypeID = (Integer) get_ValueOld(COLUMNNAME_C_DocType_ID);
|
||||
MDocType previousdt = MDocType.get(getCtx(), previousDocTypeID);
|
||||
if (is_ValueChanged(COLUMNNAME_C_DocType_ID)) {
|
||||
if (previousdt.isOverwriteSeqOnComplete()) {
|
||||
log.saveError("Error", Msg.getMsg(getCtx(), "CannotChangeProcessedDocType"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (is_ValueChanged(COLUMNNAME_DateDoc)) {
|
||||
if (previousdt.isOverwriteDateOnComplete()) {
|
||||
log.saveError("Error", Msg.getMsg(getCtx(), "CannotChangeProcessedDate"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update DateAcct on lines - teo_sarca BF [ 1775358 ]
|
||||
if (is_ValueChanged(COLUMNNAME_DateAcct)) {
|
||||
int no = DB.executeUpdate(
|
||||
|
@ -601,14 +623,18 @@ public class MJournal extends X_GL_Journal implements DocAction
|
|||
private void setDefiniteDocumentNo() {
|
||||
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
|
||||
if (dt.isOverwriteDateOnComplete()) {
|
||||
if (this.getProcessedOn().signum() == 0) {
|
||||
setDateDoc(new Timestamp (System.currentTimeMillis()));
|
||||
}
|
||||
}
|
||||
if (dt.isOverwriteSeqOnComplete()) {
|
||||
if (this.getProcessedOn().signum() == 0) {
|
||||
String value = DB.getDocumentNo(getC_DocType_ID(), get_TrxName(), true, this);
|
||||
if (value != null)
|
||||
setDocumentNo(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Void Document.
|
||||
|
|
|
@ -1044,6 +1044,28 @@ public class MOrder extends X_C_Order implements DocAction
|
|||
}
|
||||
}
|
||||
|
||||
// IDEMPIERE-63
|
||||
// for documents that can be reactivated we cannot allow changing
|
||||
// C_DocTypeTarget_ID or C_DocType_ID if they were already processed and isOverwriteSeqOnComplete
|
||||
// neither change the Date if isOverwriteDateOnComplete
|
||||
BigDecimal previousProcessedOn = (BigDecimal) get_ValueOld(COLUMNNAME_ProcessedOn);
|
||||
if (! newRecord && previousProcessedOn != null && previousProcessedOn.signum() > 0) {
|
||||
int previousDocTypeID = (Integer) get_ValueOld(COLUMNNAME_C_DocTypeTarget_ID);
|
||||
MDocType previousdt = MDocType.get(getCtx(), previousDocTypeID);
|
||||
if (is_ValueChanged(COLUMNNAME_C_DocType_ID) || is_ValueChanged(COLUMNNAME_C_DocTypeTarget_ID)) {
|
||||
if (previousdt.isOverwriteSeqOnComplete()) {
|
||||
log.saveError("Error", Msg.getMsg(getCtx(), "CannotChangeProcessedDocType"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (is_ValueChanged(COLUMNNAME_DateOrdered)) {
|
||||
if (previousdt.isOverwriteDateOnComplete()) {
|
||||
log.saveError("Error", Msg.getMsg(getCtx(), "CannotChangeProcessedDate"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
} // beforeSave
|
||||
|
||||
|
@ -1857,13 +1879,13 @@ public class MOrder extends X_C_Order implements DocAction
|
|||
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
|
||||
if (dt.isOverwriteDateOnComplete()) {
|
||||
/* a42niem - BF IDEMPIERE-63 - check if document has been completed before */
|
||||
if (this.getProcessedOn().compareTo(Env.ZERO) == 0) {
|
||||
if (this.getProcessedOn().signum() == 0) {
|
||||
setDateOrdered(new Timestamp (System.currentTimeMillis()));
|
||||
}
|
||||
}
|
||||
if (dt.isOverwriteSeqOnComplete()) {
|
||||
/* a42niem - BF IDEMPIERE-63 - check if document has been completed before */
|
||||
if (this.getProcessedOn().compareTo(Env.ZERO) == 0) {
|
||||
if (this.getProcessedOn().signum() == 0) {
|
||||
String value = DB.getDocumentNo(getC_DocType_ID(), get_TrxName(), true, this);
|
||||
if (value != null)
|
||||
setDocumentNo(value);
|
||||
|
|
Loading…
Reference in New Issue