hg merge release-2.1 (merge release2.1 into development)

This commit is contained in:
Carlos Ruiz 2014-12-28 12:51:27 -05:00
commit 1267117906
26 changed files with 400 additions and 325 deletions

View File

@ -0,0 +1,15 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Dec 23, 2014 11:08:01 PM COT
-- IDEMPIERE-2370 SaaS Generate on menu option
UPDATE AD_Process_Para SET AD_Reference_Value_ID=NULL,Updated=TO_DATE('2014-12-23 23:08:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=53128
;
-- Dec 23, 2014 11:24:40 PM COT
UPDATE AD_Process_Para SET IsMandatory='Y',Updated=TO_DATE('2014-12-23 23:24:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=53128
;
SELECT register_migration_script('201412232308_SaaSMenu.sql') FROM dual
;

View File

@ -0,0 +1,12 @@
-- Dec 23, 2014 11:08:01 PM COT
-- IDEMPIERE-2370 SaaS Generate on menu option
UPDATE AD_Process_Para SET AD_Reference_Value_ID=NULL,Updated=TO_TIMESTAMP('2014-12-23 23:08:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=53128
;
-- Dec 23, 2014 11:24:40 PM COT
UPDATE AD_Process_Para SET IsMandatory='Y',Updated=TO_TIMESTAMP('2014-12-23 23:24:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=53128
;
SELECT register_migration_script('201412232308_SaaSMenu.sql') FROM dual
;

View File

@ -41,6 +41,7 @@ import org.compiere.model.MProcess;
import org.compiere.model.MProcessPara; import org.compiere.model.MProcessPara;
import org.compiere.model.MTab; import org.compiere.model.MTab;
import org.compiere.model.MTask; import org.compiere.model.MTask;
import org.compiere.model.MToolBarButton;
import org.compiere.model.MTree; import org.compiere.model.MTree;
import org.compiere.model.MTreeNode; import org.compiere.model.MTreeNode;
import org.compiere.model.MWindow; import org.compiere.model.MWindow;
@ -56,6 +57,7 @@ import org.compiere.process.ProcessInfoParameter;
import org.compiere.process.SvrProcess; import org.compiere.process.SvrProcess;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.util.DisplayType; import org.compiere.util.DisplayType;
import org.compiere.wf.MWFNode;
import org.compiere.wf.MWorkflow; import org.compiere.wf.MWorkflow;
/** /**
@ -122,7 +124,7 @@ public class ASPGenerateLevel extends SvrProcess
node = thisTree.getRoot(); node = thisTree.getRoot();
// Navigate the menu and add every non-summary node // Navigate the menu and add every non-summary node
if (node != null && node.isSummary()) if (node != null)
{ {
Enumeration<?> en = node.preorderEnumeration(); Enumeration<?> en = node.preorderEnumeration();
while (en.hasMoreElements()) while (en.hasMoreElements())
@ -158,98 +160,13 @@ public class ASPGenerateLevel extends SvrProcess
MMenu menu = new MMenu(getCtx(), nn.getNode_ID(), get_TrxName()); MMenu menu = new MMenu(getCtx(), nn.getNode_ID(), get_TrxName());
if (menu.getAction().equals(MMenu.ACTION_Window)) { if (menu.getAction().equals(MMenu.ACTION_Window)) {
MWindow window = new MWindow(getCtx(), menu.getAD_Window_ID(), get_TrxName()); generateWindow(menu.getAD_Window_ID());
int asp_window_id = DB.getSQLValueEx(get_TrxName(), } else if (menu.getAction().equals(MMenu.ACTION_Process) || menu.getAction().equals(MMenu.ACTION_Report)) {
"SELECT ASP_Window_ID FROM ASP_Window WHERE ASP_Level_ID = ? AND AD_Window_ID = ?",
p_ASP_Level_ID, window.getAD_Window_ID());
X_ASP_Window aspWindow = null;
if (asp_window_id < 1) {
// Add Window, Tabs and Fields (if IsGenerateFields)
aspWindow = new X_ASP_Window(getCtx(), 0, get_TrxName());
aspWindow.setASP_Level_ID(p_ASP_Level_ID);
aspWindow.setAD_Window_ID(window.getAD_Window_ID());
aspWindow.setASP_Status(p_ASP_Status);
if (aspWindow.save()) {
noWindows++;
asp_window_id = aspWindow.getASP_Window_ID();
}
} else {
aspWindow = new X_ASP_Window(getCtx(), asp_window_id, get_TrxName());
}
// tabs
for (MTab tab : window.getTabs(true, get_TrxName())) {
int asp_tab_id = DB.getSQLValueEx(get_TrxName(),
"SELECT ASP_Tab_ID FROM ASP_Tab WHERE ASP_Window_ID = ? AND AD_Tab_ID = ?",
asp_window_id, tab.getAD_Tab_ID());
X_ASP_Tab aspTab = null;
if (asp_tab_id < 1) {
aspTab = new X_ASP_Tab(getCtx(), 0, get_TrxName());
aspTab.setASP_Window_ID(asp_window_id);
aspTab.setAD_Tab_ID(tab.getAD_Tab_ID());
aspTab.setASP_Status(p_ASP_Status);
aspTab.setAllFields(! p_IsGenerateFields);
if (aspTab.save()) {
noTabs++;
asp_tab_id = aspTab.getASP_Tab_ID();
}
} else {
aspTab = new X_ASP_Tab(getCtx(), asp_tab_id, get_TrxName());
}
// fields
for (MField field : tab.getFields(true, get_TrxName())) {
if (p_IsGenerateFields) {
if (DB.getSQLValueEx(
get_TrxName(),
"SELECT COUNT(*) FROM ASP_Field WHERE ASP_Tab_ID = ? AND AD_Field_ID = ?",
aspTab.getASP_Tab_ID(), field.getAD_Field_ID()) < 1) {
X_ASP_Field aspField = new X_ASP_Field(getCtx(), 0, get_TrxName());
aspField.setASP_Tab_ID(aspTab.getASP_Tab_ID());
aspField.setAD_Field_ID(field.getAD_Field_ID());
aspField.setASP_Status(p_ASP_Status);
if (aspField.save())
noFields++;
}
}
// verify if a field is a button and assign permission to the corresponding process
MColumn column = MColumn.get(getCtx(), field.getAD_Column_ID());
if (column.getAD_Reference_ID() == DisplayType.Button) {
if (column.getAD_Process_ID() > 0) {
generateProcess(column.getAD_Process_ID());
}
}
}
}
} else if (menu.getAction().equals(MMenu.ACTION_Process)
|| menu.getAction().equals(MMenu.ACTION_Report)) {
generateProcess(menu.getAD_Process_ID()); generateProcess(menu.getAD_Process_ID());
} else if (menu.getAction().equals(MMenu.ACTION_Form)) { } else if (menu.getAction().equals(MMenu.ACTION_Form)) {
// Add Form generateForm(menu.getAD_Form_ID());
MForm form = new MForm(getCtx(), menu.getAD_Form_ID(), get_TrxName());
if (DB.getSQLValueEx(
get_TrxName(),
"SELECT COUNT(*) FROM ASP_Form WHERE ASP_Level_ID = ? AND AD_Form_ID = ?",
p_ASP_Level_ID, form.getAD_Form_ID()) < 1) {
X_ASP_Form aspForm = new X_ASP_Form(getCtx(), 0, get_TrxName());
aspForm.setASP_Level_ID(p_ASP_Level_ID);
aspForm.setAD_Form_ID(form.getAD_Form_ID());
aspForm.setASP_Status(p_ASP_Status);
if (aspForm.save())
noForms++;
}
} else if (menu.getAction().equals(MMenu.ACTION_Task)) { } else if (menu.getAction().equals(MMenu.ACTION_Task)) {
// Add Task generateTask(menu.getAD_Task_ID());
MTask task = new MTask(getCtx(), menu.getAD_Task_ID(), get_TrxName());
if (DB.getSQLValueEx(
get_TrxName(),
"SELECT COUNT(*) FROM ASP_Task WHERE ASP_Level_ID = ? AND AD_Task_ID = ?",
p_ASP_Level_ID, task.getAD_Task_ID()) < 1) {
X_ASP_Task aspTask = new X_ASP_Task(getCtx(), 0, get_TrxName());
aspTask.setASP_Level_ID(p_ASP_Level_ID);
aspTask.setAD_Task_ID(task.getAD_Task_ID());
aspTask.setASP_Status(p_ASP_Status);
if (aspTask.save())
noTasks++;
}
} else if (menu.getAction().equals(MMenu.ACTION_WorkFlow)) { } else if (menu.getAction().equals(MMenu.ACTION_WorkFlow)) {
generateWorkflow(menu.getAD_Workflow_ID()); generateWorkflow(menu.getAD_Workflow_ID());
} }
@ -291,6 +208,9 @@ public class ASPGenerateLevel extends SvrProcess
if (process.getAD_Workflow_ID() > 0) { if (process.getAD_Workflow_ID() > 0) {
generateWorkflow(process.getAD_Workflow_ID()); generateWorkflow(process.getAD_Workflow_ID());
} }
if (process.getAD_Form_ID() > 0) {
generateForm(process.getAD_Form_ID());
}
} }
private void generateWorkflow(int p_AD_Workflow_ID) { private void generateWorkflow(int p_AD_Workflow_ID) {
@ -307,6 +227,121 @@ public class ASPGenerateLevel extends SvrProcess
if (aspWorkflow.save()) if (aspWorkflow.save())
noWorkflows++; noWorkflows++;
} }
for (MWFNode node : workflow.getNodes(false, getAD_Client_ID())) {
if ( ( MWFNode.ACTION_AppsProcess.equals(node.getAction()) || MWFNode.ACTION_AppsReport.equals(node.getAction()) ) && node.getAD_Process_ID() > 0) {
generateProcess(node.getAD_Process_ID());
} else if (MWFNode.ACTION_AppsTask.equals(node.getAction()) && node.getAD_Task_ID() > 0) {
generateTask(node.getAD_Task_ID());
} else if (MWFNode.ACTION_UserForm.equals(node.getAction()) && node.getAD_Form_ID() > 0) {
generateForm(node.getAD_Form_ID());
} else if (MWFNode.ACTION_UserWindow.equals(node.getAction()) && node.getAD_Window_ID() > 0) {
generateWindow(node.getAD_Window_ID());
}
}
}
private void generateForm(int p_AD_Form_ID) {
// Add Form
MForm form = new MForm(getCtx(), p_AD_Form_ID, get_TrxName());
if (DB.getSQLValueEx(
get_TrxName(),
"SELECT COUNT(*) FROM ASP_Form WHERE ASP_Level_ID = ? AND AD_Form_ID = ?",
p_ASP_Level_ID, form.getAD_Form_ID()) < 1) {
X_ASP_Form aspForm = new X_ASP_Form(getCtx(), 0, get_TrxName());
aspForm.setASP_Level_ID(p_ASP_Level_ID);
aspForm.setAD_Form_ID(form.getAD_Form_ID());
aspForm.setASP_Status(p_ASP_Status);
if (aspForm.save())
noForms++;
}
}
private void generateTask(int p_AD_Task_ID) {
// Add Task
MTask task = new MTask(getCtx(), p_AD_Task_ID, get_TrxName());
if (DB.getSQLValueEx(
get_TrxName(),
"SELECT COUNT(*) FROM ASP_Task WHERE ASP_Level_ID = ? AND AD_Task_ID = ?",
p_ASP_Level_ID, task.getAD_Task_ID()) < 1) {
X_ASP_Task aspTask = new X_ASP_Task(getCtx(), 0, get_TrxName());
aspTask.setASP_Level_ID(p_ASP_Level_ID);
aspTask.setAD_Task_ID(task.getAD_Task_ID());
aspTask.setASP_Status(p_ASP_Status);
if (aspTask.save())
noTasks++;
}
}
private void generateWindow(int p_AD_Window_ID) {
MWindow window = new MWindow(getCtx(), p_AD_Window_ID, get_TrxName());
int asp_window_id = DB.getSQLValueEx(get_TrxName(),
"SELECT ASP_Window_ID FROM ASP_Window WHERE ASP_Level_ID = ? AND AD_Window_ID = ?",
p_ASP_Level_ID, window.getAD_Window_ID());
X_ASP_Window aspWindow = null;
if (asp_window_id < 1) {
// Add Window, Tabs and Fields (if IsGenerateFields)
aspWindow = new X_ASP_Window(getCtx(), 0, get_TrxName());
aspWindow.setASP_Level_ID(p_ASP_Level_ID);
aspWindow.setAD_Window_ID(window.getAD_Window_ID());
aspWindow.setASP_Status(p_ASP_Status);
if (aspWindow.save()) {
noWindows++;
asp_window_id = aspWindow.getASP_Window_ID();
}
} else {
aspWindow = new X_ASP_Window(getCtx(), asp_window_id, get_TrxName());
}
// tabs
for (MTab tab : window.getTabs(true, get_TrxName())) {
int asp_tab_id = DB.getSQLValueEx(get_TrxName(),
"SELECT ASP_Tab_ID FROM ASP_Tab WHERE ASP_Window_ID = ? AND AD_Tab_ID = ?",
asp_window_id, tab.getAD_Tab_ID());
X_ASP_Tab aspTab = null;
if (asp_tab_id < 1) {
aspTab = new X_ASP_Tab(getCtx(), 0, get_TrxName());
aspTab.setASP_Window_ID(asp_window_id);
aspTab.setAD_Tab_ID(tab.getAD_Tab_ID());
aspTab.setASP_Status(p_ASP_Status);
aspTab.setAllFields(! p_IsGenerateFields);
if (aspTab.save()) {
noTabs++;
asp_tab_id = aspTab.getASP_Tab_ID();
}
} else {
aspTab = new X_ASP_Tab(getCtx(), asp_tab_id, get_TrxName());
}
if (tab.getAD_Process_ID() > 0) {
generateProcess(tab.getAD_Process_ID());
}
for (MToolBarButton tb : MToolBarButton.getProcessButtonOfTab(tab.getAD_Tab_ID(), get_TrxName())) {
if (tb.getAD_Process_ID() > 0) {
generateProcess(tb.getAD_Process_ID());
}
}
// fields
for (MField field : tab.getFields(true, get_TrxName())) {
if (p_IsGenerateFields) {
if (DB.getSQLValueEx(
get_TrxName(),
"SELECT COUNT(*) FROM ASP_Field WHERE ASP_Tab_ID = ? AND AD_Field_ID = ?",
aspTab.getASP_Tab_ID(), field.getAD_Field_ID()) < 1) {
X_ASP_Field aspField = new X_ASP_Field(getCtx(), 0, get_TrxName());
aspField.setASP_Tab_ID(aspTab.getASP_Tab_ID());
aspField.setAD_Field_ID(field.getAD_Field_ID());
aspField.setASP_Status(p_ASP_Status);
if (aspField.save())
noFields++;
}
}
// verify if a field is a button and assign permission to the corresponding process
MColumn column = MColumn.get(getCtx(), field.getAD_Column_ID());
if (column.getAD_Reference_ID() == DisplayType.Button) {
if (column.getAD_Process_ID() > 0) {
generateProcess(column.getAD_Process_ID());
}
}
}
}
} }
} // ASPGenerateLevel } // ASPGenerateLevel

View File

@ -132,6 +132,8 @@ implements DocAction
return status; return status;
} }
// Set the definite document number after completed (if needed)
//setDefiniteDocumentNo();
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE);
if (m_processMsg != null) if (m_processMsg != null)
@ -157,9 +159,6 @@ implements DocAction
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
// Set the definite document number after completed (if needed)
//setDefiniteDocumentNo();
setProcessed(true); setProcessed(true);
setDocAction(DOCACTION_Close); setDocAction(DOCACTION_Close);
return DocAction.STATUS_Completed; return DocAction.STATUS_Completed;

View File

@ -195,6 +195,8 @@ implements DocAction
return status; return status;
} }
// Set the definite document number after completed (if needed)
//setDefiniteDocumentNo();
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE);
if (m_processMsg != null) if (m_processMsg != null)
@ -224,9 +226,6 @@ implements DocAction
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
// Set the definite document number after completed (if needed)
//setDefiniteDocumentNo();
setProcessed(true); setProcessed(true);
setDocAction(DOCACTION_Close); setDocAction(DOCACTION_Close);
return DocAction.STATUS_Completed; return DocAction.STATUS_Completed;

View File

@ -1256,6 +1256,9 @@ public class MInOut extends X_M_InOut implements DocAction
return status; return status;
} }
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE);
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
@ -1652,9 +1655,6 @@ public class MInOut extends X_M_InOut implements DocAction
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
m_processMsg = info.toString(); m_processMsg = info.toString();
setProcessed(true); setProcessed(true);
setDocAction(DOCACTION_Close); setDocAction(DOCACTION_Close);

View File

@ -390,6 +390,9 @@ public class MInventory extends X_M_Inventory implements DocAction
return status; return status;
} }
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE);
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
@ -579,9 +582,6 @@ public class MInventory extends X_M_Inventory implements DocAction
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
// //
setProcessed(true); setProcessed(true);
setDocAction(DOCACTION_Close); setDocAction(DOCACTION_Close);

View File

@ -1692,6 +1692,9 @@ public class MInvoice extends X_C_Invoice implements DocAction
return status; return status;
} }
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE);
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
@ -2086,9 +2089,6 @@ public class MInvoice extends X_C_Invoice implements DocAction
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
// Counter Documents // Counter Documents
MInvoice counter = createCounterDoc(); MInvoice counter = createCounterDoc();
if (counter != null) if (counter != null)
@ -2120,7 +2120,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
setDateInvoiced(new Timestamp (System.currentTimeMillis())); setDateInvoiced(new Timestamp (System.currentTimeMillis()));
if (getDateAcct().before(getDateInvoiced())) { if (getDateAcct().before(getDateInvoiced())) {
setDateAcct(getDateInvoiced()); setDateAcct(getDateInvoiced());
MPeriod.testPeriodOpen(getCtx(), getDateAcct(), getC_DocTypeTarget_ID(), getAD_Org_ID()); MPeriod.testPeriodOpen(getCtx(), getDateAcct(), getC_DocType_ID(), getAD_Org_ID());
} }
} }
if (dt.isOverwriteSeqOnComplete()) { if (dt.isOverwriteSeqOnComplete()) {

View File

@ -594,6 +594,9 @@ public class MJournal extends X_GL_Journal implements DocAction
return status; return status;
} }
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE);
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
@ -610,9 +613,6 @@ public class MJournal extends X_GL_Journal implements DocAction
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
// //
setProcessed(true); setProcessed(true);
setDocAction(DOCACTION_Close); setDocAction(DOCACTION_Close);

View File

@ -439,6 +439,9 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
return status; return status;
} }
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE);
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
@ -494,9 +497,6 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
// //
setProcessed(true); setProcessed(true);
setDocAction(DOCACTION_Close); setDocAction(DOCACTION_Close);

View File

@ -354,6 +354,9 @@ public class MMovement extends X_M_Movement implements DocAction
return status; return status;
} }
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE);
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
@ -532,9 +535,6 @@ public class MMovement extends X_M_Movement implements DocAction
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
// //
setProcessed(true); setProcessed(true);
setDocAction(DOCACTION_Close); setDocAction(DOCACTION_Close);

View File

@ -1869,6 +1869,10 @@ public class MOrder extends X_C_Order implements DocAction
setProcessed(false); setProcessed(false);
return DocAction.STATUS_InProgress; return DocAction.STATUS_InProgress;
} }
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
// Offers // Offers
if (MDocType.DOCSUBTYPESO_Proposal.equals(DocSubTypeSO) if (MDocType.DOCSUBTYPESO_Proposal.equals(DocSubTypeSO)
|| MDocType.DOCSUBTYPESO_Quotation.equals(DocSubTypeSO)) || MDocType.DOCSUBTYPESO_Quotation.equals(DocSubTypeSO))
@ -1882,8 +1886,6 @@ public class MOrder extends X_C_Order implements DocAction
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE);
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
setProcessed(true); setProcessed(true);
return DocAction.STATUS_Completed; return DocAction.STATUS_Completed;
} }
@ -1987,9 +1989,6 @@ public class MOrder extends X_C_Order implements DocAction
} }
} }
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
setProcessed(true); setProcessed(true);
m_processMsg = info.toString(); m_processMsg = info.toString();
// //
@ -2130,7 +2129,7 @@ public class MOrder extends X_C_Order implements DocAction
setDateOrdered(new Timestamp (System.currentTimeMillis())); setDateOrdered(new Timestamp (System.currentTimeMillis()));
if (getDateAcct().before(getDateOrdered())) { if (getDateAcct().before(getDateOrdered())) {
setDateAcct(getDateOrdered()); setDateAcct(getDateOrdered());
MPeriod.testPeriodOpen(getCtx(), getDateAcct(), getC_DocTypeTarget_ID(), getAD_Org_ID()); MPeriod.testPeriodOpen(getCtx(), getDateAcct(), getC_DocType_ID(), getAD_Org_ID());
} }
} }
} }

View File

@ -1944,6 +1944,9 @@ public class MPayment extends X_C_Payment
return status; return status;
} }
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE);
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
@ -2078,9 +2081,6 @@ public class MPayment extends X_C_Payment
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
// //
setProcessed(true); setProcessed(true);
setDocAction(DOCACTION_Close); setDocAction(DOCACTION_Close);

View File

@ -415,6 +415,9 @@ public class MProduction extends X_M_Production implements DocAction {
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
// Std Period open?
MPeriod.testPeriodOpen(getCtx(), getMovementDate(), MDocType.DOCBASETYPE_MaterialProduction, getAD_Org_ID());
if ( getIsCreated().equals("N") ) if ( getIsCreated().equals("N") )
{ {
m_processMsg = "Not created"; m_processMsg = "Not created";

View File

@ -430,6 +430,9 @@ public class MRMA extends X_M_RMA implements DocAction
return status; return status;
} }
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE);
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
@ -461,9 +464,6 @@ public class MRMA extends X_M_RMA implements DocAction
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
// //
setProcessed(true); setProcessed(true);
setDocAction(DOCACTION_Close); setDocAction(DOCACTION_Close);

View File

@ -331,6 +331,9 @@ public class MRequisition extends X_M_Requisition implements DocAction
return status; return status;
} }
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE);
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
@ -348,9 +351,6 @@ public class MRequisition extends X_M_Requisition implements DocAction
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
// Set the definite document number after completed (if needed)
setDefiniteDocumentNo();
// //
setProcessed(true); setProcessed(true);
setDocAction(ACTION_Close); setDocAction(ACTION_Close);

View File

@ -2551,6 +2551,8 @@ public final class MRole extends X_AD_Role
+ " WHERE ro.AD_Role_ID=?" + " WHERE ro.AD_Role_ID=?"
+ " AND ty.DocBaseType=?" + " AND ty.DocBaseType=?"
+ (MDocType.DOCBASETYPE_SalesOrder.equals(doc.getDocBaseType()) ? " AND ty.DocSubTypeSO=?" : "") + (MDocType.DOCBASETYPE_SalesOrder.equals(doc.getDocBaseType()) ? " AND ty.DocSubTypeSO=?" : "")
+ (MDocType.DOCBASETYPE_PurchaseOrder.equals(doc.getDocBaseType()) && doc.getDocSubTypeSO() != null ? " AND ty.DocSubTypeSO=?" : "")
+ (MDocType.DOCBASETYPE_MaterialPhysicalInventory.equals(doc.getDocBaseType()) ? " AND ty.DocSubTypeInv=?" : "")
+ " AND rl.Value IN (" + " AND rl.Value IN ("
+ sql_values + sql_values
+ ")"; + ")";
@ -2560,6 +2562,10 @@ public final class MRole extends X_AD_Role
pstmt.setString(idxpar++, doc.getDocBaseType()); pstmt.setString(idxpar++, doc.getDocBaseType());
if (MDocType.DOCBASETYPE_SalesOrder.equals(doc.getDocBaseType())) if (MDocType.DOCBASETYPE_SalesOrder.equals(doc.getDocBaseType()))
pstmt.setString(idxpar++, doc.getDocSubTypeSO()); pstmt.setString(idxpar++, doc.getDocSubTypeSO());
else if (MDocType.DOCBASETYPE_PurchaseOrder.equals(doc.getDocBaseType()) && doc.getDocSubTypeSO() != null)
pstmt.setString(idxpar++, doc.getDocSubTypeSO());
else if (MDocType.DOCBASETYPE_MaterialPhysicalInventory.equals(doc.getDocBaseType()))
pstmt.setString(idxpar++, doc.getDocSubTypeInv());
} else { } else {
// master role on tenant - check options based on doctypeid // master role on tenant - check options based on doctypeid
sql = "SELECT DISTINCT rl.Value, a.IsActive" sql = "SELECT DISTINCT rl.Value, a.IsActive"

View File

@ -540,15 +540,18 @@ public class MTable extends X_AD_Table
// boolean hasParents = false; // boolean hasParents = false;
StringBuffer constraints = new StringBuffer(); StringBuffer constraints = new StringBuffer();
getColumns(true); getColumns(true);
boolean columnAdded = false;
for (int i = 0; i < m_columns.length; i++) for (int i = 0; i < m_columns.length; i++)
{ {
MColumn column = m_columns[i]; MColumn column = m_columns[i];
String colSQL = column.getSQLDDL(); String colSQL = column.getSQLDDL();
if ( colSQL != null ) if ( colSQL != null )
{ {
if (i > 0) if (columnAdded)
sb.append(", "); sb.append(", ");
sb.append(column.getSQLDDL()); else
columnAdded = true;
sb.append(column.getSQLDDL());
} }
else // virtual column else // virtual column
continue; continue;

View File

@ -216,6 +216,8 @@ public class DocActionTemplate extends PO implements DocAction
return status; return status;
} }
// setDefiniteDocumentNo();
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE);
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
@ -233,8 +235,6 @@ public class DocActionTemplate extends PO implements DocAction
m_processMsg = valid; m_processMsg = valid;
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
// setDefiniteDocumentNo();
// setProcessed(true); // setProcessed(true);
// setDocAction(DOCACTION_Close); // setDocAction(DOCACTION_Close);
return DocAction.STATUS_Completed; return DocAction.STATUS_Completed;
@ -248,6 +248,10 @@ public class DocActionTemplate extends PO implements DocAction
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
if (dt.isOverwriteDateOnComplete()) { if (dt.isOverwriteDateOnComplete()) {
setDateInvoiced(new Timestamp (System.currentTimeMillis())); setDateInvoiced(new Timestamp (System.currentTimeMillis()));
if (getDateAcct().before(getDateInvoiced())) {
setDateAcct(getDateInvoiced());
MPeriod.testPeriodOpen(getCtx(), getDateAcct(), getC_DocType_ID(), getAD_Org_ID());
}
} }
if (dt.isOverwriteSeqOnComplete()) { if (dt.isOverwriteSeqOnComplete()) {
String value = null; String value = null;

View File

@ -25,10 +25,13 @@
* * * *
* Sponsors: * * Sponsors: *
* - e-Evolution (http://www.e-evolution.com) * * - e-Evolution (http://www.e-evolution.com) *
***********************************************************************/ **********************************************************************/
package org.adempiere.model; package org.adempiere.model;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
import org.adempiere.process.rpl.exp.ExportHelper; import org.adempiere.process.rpl.exp.ExportHelper;
@ -39,6 +42,7 @@ import org.compiere.model.MTable;
import org.compiere.model.ModelValidationEngine; import org.compiere.model.ModelValidationEngine;
import org.compiere.model.ModelValidator; import org.compiere.model.ModelValidator;
import org.compiere.model.PO; import org.compiere.model.PO;
import org.compiere.model.Query;
import org.compiere.model.X_AD_ReplicationDocument; import org.compiere.model.X_AD_ReplicationDocument;
import org.compiere.model.X_AD_ReplicationTable; import org.compiere.model.X_AD_ReplicationTable;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
@ -61,9 +65,8 @@ import org.compiere.util.Env;
* *
* @version $Id$ * @version $Id$
*/ */
public class ExportModelValidator implements ModelValidator public class ExportModelValidator implements ModelValidator {
{ /** Context variable which says if replication is enabled */
/** Context variable which says if replication is enabled */
public static final String CTX_IsReplicationEnabled = "#IsReplicationEnabled"; public static final String CTX_IsReplicationEnabled = "#IsReplicationEnabled";
/** Logger */ /** Logger */
@ -72,30 +75,18 @@ public class ExportModelValidator implements ModelValidator
/** Client */ /** Client */
private int m_AD_Client_ID = -1; private int m_AD_Client_ID = -1;
/** Organization */
private int m_AD_Org_ID = -1;
/** Role */
private int m_AD_Role_ID = -1;
/** User */
private int m_AD_User_ID = -1;
/** Replication Strategy **/
private int m_AD_ReplicationStrategy_ID = -1;
/** ModelValidationEngine engine **/ /** ModelValidationEngine engine **/
ModelValidationEngine m_engine = null; List<String> modelTables = new ArrayList<String>();
List<String> docTables = new ArrayList<String>();
/** Export Helper */ /* The Export Helpers per each replication strategy */
ExportHelper expHelper = null; Hashtable<Integer, ExportHelper> helpers = new Hashtable<Integer, ExportHelper>();
/** /**
* Constructor. * Constructor.
* The class is instantiated when logging in and client is selected/known * The class is instantiated when logging in and client is selected/known
*/ */
public ExportModelValidator () public ExportModelValidator () {
{
super (); super ();
} }
@ -104,108 +95,156 @@ public class ExportModelValidator implements ModelValidator
* @param engine validation engine * @param engine validation engine
* @param client client * @param client client
*/ */
public void initialize (ModelValidationEngine engine, MClient client) public void initialize (ModelValidationEngine engine, MClient client) {
{ if (client != null) {
m_engine = engine;
if (client != null)
{
m_AD_Client_ID = client.getAD_Client_ID(); m_AD_Client_ID = client.getAD_Client_ID();
if (log.isLoggable(Level.INFO)) log.info(client.toString()); if (log.isLoggable(Level.INFO)) log.info(client.toString());
} loadReplicationStrategy(engine);
else } else {
{ log.warning("Export Model Validator cannot be used as a global validator, it needs to be defined in a per-client (tenant) basis");
log.warning("Export Model Validator cannot be used as a global validator, it needs to be defined in a per-client (tenant) basis"); return;
return; }
}
} }
/** public void loadReplicationStrategy(ModelValidationEngine engine) {
* Model Change of a monitored Table. MClient client = MClient.get(Env.getCtx(), m_AD_Client_ID);
* Called after PO.beforeSave/PO.beforeDelete String where = "AD_ReplicationStrategy_ID IN (" +
* @param po persistent object "SELECT AD_ReplicationStrategy_ID FROM AD_Client WHERE AD_Client_ID=? " +
* @param type TYPE_ "UNION " +
* @return error message or null "SELECT AD_ReplicationStrategy_ID FROM AD_Org WHERE AD_Client_ID=?)";
* @exception Exception if the recipient wishes the change to be not accept. List<MReplicationStrategy> rss = new Query(Env.getCtx(), MReplicationStrategy.Table_Name, where, null)
*/ .setOnlyActiveRecords(true)
public String modelChange (PO po, int type) throws Exception .setParameters(m_AD_Client_ID, m_AD_Client_ID)
{ .list();
//String Mode = "Table"; for (MReplicationStrategy rplStrategy : rss) {
if (log.isLoggable(Level.INFO)) log.info("po.get_TableName() = " + po.get_TableName()); ExportHelper expClientHelper = new ExportHelper(client, rplStrategy);
if (expHelper != null) { helpers.put(rplStrategy.getAD_ReplicationStrategy_ID(), expClientHelper);
if ( type == TYPE_AFTER_CHANGE // Add Tables
|| type == TYPE_AFTER_NEW // We want to be informed when records in Replication tables are created/updated/deleted!
|| type == TYPE_BEFORE_DELETE) // After Change or After New for (X_AD_ReplicationTable rplTable : rplStrategy.getReplicationTables()) {
{ if ( X_AD_ReplicationTable.REPLICATIONTYPE_Merge.equals(rplTable.getReplicationType())
X_AD_ReplicationTable replicationTable = MReplicationStrategy.getReplicationTable( || X_AD_ReplicationTable.REPLICATIONTYPE_Broadcast.equals(rplTable.getReplicationType())
po.getCtx(), m_AD_ReplicationStrategy_ID, po.get_Table_ID()); || X_AD_ReplicationTable.REPLICATIONTYPE_Reference.equals(rplTable.getReplicationType()))
if (replicationTable != null) {
{ String tableName = MTable.getTableName(client.getCtx(), rplTable.getAD_Table_ID());
expHelper.exportRecord( if (! modelTables.contains(tableName)) {
po, engine.addModelChange(tableName, this);
MReplicationStrategy.REPLICATION_TABLE, modelTables.add(tableName);
replicationTable.getReplicationType(), }
type); }
} }
// Add Documents
// We want to be informed when Replication documents are created/updated/deleted!
for (X_AD_ReplicationDocument rplDocument : rplStrategy.getReplicationDocuments()) {
if ( X_AD_ReplicationDocument.REPLICATIONTYPE_Merge.equals(rplDocument.getReplicationType())
|| X_AD_ReplicationDocument.REPLICATIONTYPE_Reference.equals(rplDocument.getReplicationType()))
{
String tableName = MTable.getTableName(client.getCtx(), rplDocument.getAD_Table_ID());
if (! docTables.contains(tableName)) {
engine.addDocValidate(tableName, this);
docTables.add(tableName);
}
}
} }
} }
}
/**
* Model Change of a monitored Table.
* Called after PO.beforeSave/PO.beforeDelete
* @param po persistent object
* @param type TYPE_
* @return error message or null
* @exception Exception if the recipient wishes the change to be not accept.
*/
public String modelChange (PO po, int type) throws Exception {
if (log.isLoggable(Level.INFO)) log.info("po.get_TableName() = " + po.get_TableName());
int rsID = getReplicationStrategy(po);
if (rsID > 0) {
ExportHelper expHelper = helpers.get(rsID);
if (expHelper != null) {
if ( type == TYPE_AFTER_CHANGE
|| type == TYPE_AFTER_NEW
|| type == TYPE_BEFORE_DELETE) {
X_AD_ReplicationTable replicationTable = MReplicationStrategy.getReplicationTable(
po.getCtx(), rsID, po.get_Table_ID());
if (replicationTable != null) {
expHelper.exportRecord(
po,
MReplicationStrategy.REPLICATION_TABLE,
replicationTable.getReplicationType(),
type);
}
}
}
}
return null; return null;
} }
/** /**
* Validate Document. * Validate Document.
* Called as first step of DocAction.prepareIt * Called as first step of DocAction.prepareIt
* when you called addDocValidate for the table. * when you called addDocValidate for the table.
* @param po persistent object * @param po persistent object
* @param type see TIMING_ constants * @param type see TIMING_ constants
* @return error message or null * @return error message or null
* @throws Exception * @throws Exception
*/ */
public String docValidate (PO po, int type) public String docValidate (PO po, int type) {
{
if (log.isLoggable(Level.INFO)) log.info("Replicate the Document = " + po.get_TableName() + " with Type = " + type); if (log.isLoggable(Level.INFO)) log.info("Replicate the Document = " + po.get_TableName() + " with Type = " + type);
String result = null; String result = null;
if (expHelper != null) { int rsID = getReplicationStrategy(po);
try { if (rsID > 0) {
if ( type == TIMING_AFTER_COMPLETE ExportHelper expHelper = helpers.get(rsID);
|| type == TIMING_AFTER_CLOSE if (expHelper != null) {
|| type == TIMING_AFTER_REVERSECORRECT try {
|| type == TIMING_AFTER_VOID if ( type == TIMING_AFTER_COMPLETE
|| type == TIMING_AFTER_REACTIVATE || type == TIMING_AFTER_CLOSE
//|| type == TIMING_AFTER_PREPARE || type == TIMING_AFTER_REVERSECORRECT
) || type == TIMING_AFTER_VOID
{ || type == TIMING_AFTER_REACTIVATE
X_AD_ReplicationDocument replicationDocument = null; //|| type == TIMING_AFTER_PREPARE
int C_DocType_ID = po.get_ValueAsInt("C_DocType_ID"); ) {
if (C_DocType_ID > 0) X_AD_ReplicationDocument replicationDocument = null;
{ int C_DocType_ID = po.get_ValueAsInt("C_DocType_ID");
replicationDocument = MReplicationStrategy.getReplicationDocument( if (C_DocType_ID > 0) {
po.getCtx(), m_AD_ReplicationStrategy_ID, po.get_Table_ID(), C_DocType_ID); replicationDocument = MReplicationStrategy.getReplicationDocument(
} po.getCtx(), rsID, po.get_Table_ID(), C_DocType_ID);
else } else {
{ replicationDocument = MReplicationStrategy.getReplicationDocument(
replicationDocument = MReplicationStrategy.getReplicationDocument( po.getCtx(), rsID, po.get_Table_ID());
po.getCtx(), m_AD_ReplicationStrategy_ID, po.get_Table_ID()); }
}
if (replicationDocument != null) {
expHelper.exportRecord(
po,
MReplicationStrategy.REPLICATION_DOCUMENT,
replicationDocument.getReplicationType(),
type);
}
if (replicationDocument != null) {
expHelper.exportRecord(
po,
MReplicationStrategy.REPLICATION_DOCUMENT,
replicationDocument.getReplicationType(),
type);
}
}
} catch (Exception e) {
e.printStackTrace();
result = e.toString();
} }
} catch (Exception e) {
e.printStackTrace();
result = e.toString();
} }
} }
return result; return result;
} }
private int getReplicationStrategy(PO po) {
int rsID = -1;
int orgID = po.getAD_Org_ID();
if (orgID > 0) {
rsID = MOrg.get(po.getCtx(), orgID).getAD_ReplicationStrategy_ID();
}
if (rsID <= 0) {
int clientID = po.getAD_Client_ID();
rsID = MClient.get(Env.getCtx(), clientID).getAD_ReplicationStrategy_ID();
}
return rsID;
}
/** /**
* User Login. * User Login.
* Called when preferences are set * Called when preferences are set
@ -214,89 +253,24 @@ public class ExportModelValidator implements ModelValidator
* @param AD_User_ID user * @param AD_User_ID user
* @return error message or null * @return error message or null
*/ */
public String login (int AD_Org_ID, int AD_Role_ID, int AD_User_ID) public String login (int AD_Org_ID, int AD_Role_ID, int AD_User_ID) {
{ Env.setContext(Env.getCtx(), CTX_IsReplicationEnabled, true);
Env.setContext(Env.getCtx(), CTX_IsReplicationEnabled, true);
m_AD_Org_ID = AD_Org_ID;
m_AD_Role_ID = AD_Role_ID;
m_AD_User_ID = AD_User_ID;
if (log.isLoggable(Level.INFO)){
log.info("AD_Org_ID =" + m_AD_Org_ID);
log.info("AD_Role_ID =" + m_AD_Role_ID);
log.info("AD_User_ID =" + m_AD_User_ID);}
loadReplicationStrategy();
return null; return null;
} }
/** /**
* Get Client to be monitored * Get Client to be monitored
* @return AD_Client_ID client * @return AD_Client_ID client
*/ */
public int getAD_Client_ID() public int getAD_Client_ID() {
{
return m_AD_Client_ID; return m_AD_Client_ID;
} }
public void loadReplicationStrategy()
{
MClient client = MClient.get(Env.getCtx(), m_AD_Client_ID);
MReplicationStrategy rplStrategy = null;
m_AD_ReplicationStrategy_ID = MOrg.get(client.getCtx(),m_AD_Org_ID).getAD_ReplicationStrategy_ID();
if(m_AD_ReplicationStrategy_ID <= 0)
{
m_AD_ReplicationStrategy_ID = client.getAD_ReplicationStrategy_ID();
if (log.isLoggable(Level.INFO)) log.info("client.getAD_ReplicationStrategy_ID() = " + m_AD_ReplicationStrategy_ID);
}
if (m_AD_ReplicationStrategy_ID > 0) {
rplStrategy = new MReplicationStrategy(client.getCtx(), m_AD_ReplicationStrategy_ID, null);
if(!rplStrategy.isActive())
{
return;
}
expHelper = new ExportHelper(client, rplStrategy);
}
// Add Tables
// We want to be informed when records in Replication tables are created/updated/deleted!
//engine.addModelChange(MBPartner.Table_Name, this);
//engine.addModelChange(MOrder.Table_Name, this);
//engine.addModelChange(MOrderLine.Table_Name, this);
if (rplStrategy != null) {
for (X_AD_ReplicationTable rplTable : rplStrategy.getReplicationTables()) {
if (X_AD_ReplicationTable.REPLICATIONTYPE_Merge.equals(rplTable.getReplicationType())
|| X_AD_ReplicationTable.REPLICATIONTYPE_Broadcast.equals(rplTable.getReplicationType())
|| X_AD_ReplicationTable.REPLICATIONTYPE_Reference.equals(rplTable.getReplicationType()))
{
String tableName = MTable.getTableName(client.getCtx(), rplTable.getAD_Table_ID());
m_engine.addModelChange(tableName, this);
}
}
}
// Add Documents
// We want to be informed when Replication documents are created/updated/deleted!
if (rplStrategy != null) {
for (X_AD_ReplicationDocument rplDocument : rplStrategy.getReplicationDocuments()) {
if (X_AD_ReplicationDocument.REPLICATIONTYPE_Merge.equals(rplDocument.getReplicationType())
|| X_AD_ReplicationDocument.REPLICATIONTYPE_Reference.equals(rplDocument.getReplicationType()))
{
String tableName = MTable.getTableName(client.getCtx(), rplDocument.getAD_Table_ID());
m_engine.addDocValidate(tableName, this);
}
}
}
}
/** /**
* String Representation * String Representation
* @return info * @return info
*/ */
public String toString () public String toString () {
{
StringBuilder sb = new StringBuilder (ExportModelValidator.class.getName()); StringBuilder sb = new StringBuilder (ExportModelValidator.class.getName());
return sb.toString(); return sb.toString();
} }

View File

@ -34,6 +34,10 @@ import org.compiere.apps.ADialog;
import org.compiere.apps.AEnv; import org.compiere.apps.AEnv;
import org.compiere.apps.ConfirmPanel; import org.compiere.apps.ConfirmPanel;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
import org.compiere.model.MAllocationHdr;
import org.compiere.model.MBankStatement;
import org.compiere.model.MDocType;
import org.compiere.model.MProduction;
import org.compiere.model.MTable; import org.compiere.model.MTable;
import org.compiere.model.PO; import org.compiere.model.PO;
import org.compiere.process.DocOptions; import org.compiere.process.DocOptions;
@ -245,6 +249,15 @@ public class VDocAction extends CDialog
if(doctypeId==null || doctypeId.intValue()==0){ if(doctypeId==null || doctypeId.intValue()==0){
doctypeId = (Integer)m_mTab.getValue("C_DocTypeTarget_ID"); doctypeId = (Integer)m_mTab.getValue("C_DocTypeTarget_ID");
} }
if (doctypeId == null && MAllocationHdr.Table_ID == m_AD_Table_ID) {
doctypeId = MDocType.getDocType(MDocType.DOCBASETYPE_PaymentAllocation);
}
if (doctypeId == null && MBankStatement.Table_ID == m_AD_Table_ID) {
doctypeId = MDocType.getDocType(MDocType.DOCBASETYPE_BankStatement);
}
if (doctypeId == null && MProduction.Table_ID == m_AD_Table_ID) {
doctypeId = MDocType.getDocType(MDocType.DOCBASETYPE_MaterialProduction);
}
if (log.isLoggable(Level.FINE)) log.fine("get doctype: " + doctypeId); if (log.isLoggable(Level.FINE)) log.fine("get doctype: " + doctypeId);
if (doctypeId != null) { if (doctypeId != null) {
index = DocumentEngine.checkActionAccess(Env.getAD_Client_ID(Env.getCtx()), index = DocumentEngine.checkActionAccess(Env.getAD_Client_ID(Env.getCtx()),

View File

@ -111,8 +111,8 @@ public class ADSortTab extends Panel implements IADTabpanel
// UI variables // UI variables
private Label noLabel = new Label(); private Label noLabel = new Label();
private Label yesLabel = new Label(); private Label yesLabel = new Label();
private Button bAdd = ButtonFactory.createButton(null, ThemeManager.getThemeResource("images/MoveLeft16.png"), null); private Button bAdd = ButtonFactory.createButton(null, ThemeManager.getThemeResource("images/MoveRight16.png"), null);
private Button bRemove = ButtonFactory.createButton(null, ThemeManager.getThemeResource("images/MoveRight16.png"), null); private Button bRemove = ButtonFactory.createButton(null, ThemeManager.getThemeResource("images/MoveLeft16.png"), null);
private Button bUp = ButtonFactory.createButton(null, ThemeManager.getThemeResource("images/MoveUp16.png"), null); private Button bUp = ButtonFactory.createButton(null, ThemeManager.getThemeResource("images/MoveUp16.png"), null);
private Button bDown = ButtonFactory.createButton(null, ThemeManager.getThemeResource("images/MoveDown16.png"), null); private Button bDown = ButtonFactory.createButton(null, ThemeManager.getThemeResource("images/MoveDown16.png"), null);
// //

View File

@ -107,9 +107,9 @@ public class CustomizeGridViewPanel extends Panel
private Label noLabel = new Label(); private Label noLabel = new Label();
private Label yesLabel = new Label(); private Label yesLabel = new Label();
private Button bAdd = ButtonFactory.createButton(null, private Button bAdd = ButtonFactory.createButton(null,
ThemeManager.getThemeResource("images/MoveLeft16.png"), null);
private Button bRemove = ButtonFactory.createButton(null,
ThemeManager.getThemeResource("images/MoveRight16.png"), null); ThemeManager.getThemeResource("images/MoveRight16.png"), null);
private Button bRemove = ButtonFactory.createButton(null,
ThemeManager.getThemeResource("images/MoveLeft16.png"), null);
private Button bUp = ButtonFactory.createButton(null, private Button bUp = ButtonFactory.createButton(null,
ThemeManager.getThemeResource("images/MoveUp16.png"), null); ThemeManager.getThemeResource("images/MoveUp16.png"), null);
private Button bDown = ButtonFactory.createButton(null, private Button bDown = ButtonFactory.createButton(null,

View File

@ -35,7 +35,11 @@ import org.adempiere.webui.component.Window;
import org.adempiere.webui.event.DialogEvents; import org.adempiere.webui.event.DialogEvents;
import org.adempiere.webui.window.FDialog; import org.adempiere.webui.window.FDialog;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
import org.compiere.model.MAllocationHdr;
import org.compiere.model.MBankStatement;
import org.compiere.model.MClientInfo; import org.compiere.model.MClientInfo;
import org.compiere.model.MDocType;
import org.compiere.model.MProduction;
import org.compiere.model.MTable; import org.compiere.model.MTable;
import org.compiere.model.PO; import org.compiere.model.PO;
import org.compiere.process.DocOptions; import org.compiere.process.DocOptions;
@ -169,6 +173,15 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
if(doctypeId==null || doctypeId.intValue()==0){ if(doctypeId==null || doctypeId.intValue()==0){
doctypeId = (Integer)gridTab.getValue("C_DocTypeTarget_ID"); doctypeId = (Integer)gridTab.getValue("C_DocTypeTarget_ID");
} }
if (doctypeId == null && MAllocationHdr.Table_ID == m_AD_Table_ID) {
doctypeId = MDocType.getDocType(MDocType.DOCBASETYPE_PaymentAllocation);
}
if (doctypeId == null && MBankStatement.Table_ID == m_AD_Table_ID) {
doctypeId = MDocType.getDocType(MDocType.DOCBASETYPE_BankStatement);
}
if (doctypeId == null && MProduction.Table_ID == m_AD_Table_ID) {
doctypeId = MDocType.getDocType(MDocType.DOCBASETYPE_MaterialProduction);
}
if (logger.isLoggable(Level.FINE)) logger.fine("get doctype: " + doctypeId); if (logger.isLoggable(Level.FINE)) logger.fine("get doctype: " + doctypeId);
if (doctypeId != null) { if (doctypeId != null) {
index = DocumentEngine.checkActionAccess(Env.getAD_Client_ID(Env.getCtx()), index = DocumentEngine.checkActionAccess(Env.getAD_Client_ID(Env.getCtx()),

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB