diff --git a/.hgignore b/.hgignore index 55041d90cc..559269d4fa 100644 --- a/.hgignore +++ b/.hgignore @@ -93,6 +93,7 @@ syntax: regexp ^org\.apache\.ecs/bin/.*$ ^keystore/.*$ ^log/.*$ +^PostgreSQL/.*$ ^.*\.log$ ^Adempiere.properties$ ^idempiere.properties$ diff --git a/migration/i1.0b-release/oracle/201306211448_IDEMPIERE-594.sql b/migration/i1.0b-release/oracle/201306211448_IDEMPIERE-594.sql new file mode 100644 index 0000000000..02f0d3a4f8 --- /dev/null +++ b/migration/i1.0b-release/oracle/201306211448_IDEMPIERE-594.sql @@ -0,0 +1,24 @@ +-- Jun 21, 2013 2:31:08 PM COT +-- IDEMPIERE-594 Improve positioning on windows +UPDATE AD_Field SET IsCentrallyMaintained='N', Help='You can check the valid variables and values at http://wiki.idempiere.org/en/System_Configurator_(Window_ID-50006)', Description='Value for the configuration key', Name='Configured Value',Updated=TO_DATE('2013-06-21 14:31:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50166 +; + +-- Jun 21, 2013 2:44:12 PM COT +UPDATE AD_Field SET SeqNo=730, IsDisplayed='Y', XPosition=5,Updated=TO_DATE('2013-06-21 14:44:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=4040 +; + +-- Jun 21, 2013 2:44:13 PM COT +UPDATE AD_Field SET SeqNo=0, IsDisplayed='N', XPosition=1,Updated=TO_DATE('2013-06-21 14:44:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=52052 +; + +-- Jun 21, 2013 2:46:13 PM COT +UPDATE AD_Column SET IsSelectionColumn='N',Updated=TO_DATE('2013-06-21 14:46:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=5050 +; + +-- Jun 21, 2013 2:51:52 PM COT +UPDATE AD_Field SET IsReadOnly='Y', DisplayLogic='@Processed@=Y', IsDisplayedGrid='Y', SeqNoGrid=730,Updated=TO_DATE('2013-06-21 14:51:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=4040 +; + +SELECT register_migration_script('201306211448_IDEMPIERE-594.sql') FROM dual +; + diff --git a/migration/i1.0b-release/postgresql/201306211448_IDEMPIERE-594.sql b/migration/i1.0b-release/postgresql/201306211448_IDEMPIERE-594.sql new file mode 100644 index 0000000000..ec71f300df --- /dev/null +++ b/migration/i1.0b-release/postgresql/201306211448_IDEMPIERE-594.sql @@ -0,0 +1,24 @@ +-- Jun 21, 2013 2:31:08 PM COT +-- IDEMPIERE-594 Improve positioning on windows +UPDATE AD_Field SET IsCentrallyMaintained='N', Help='You can check the valid variables and values at http://wiki.idempiere.org/en/System_Configurator_(Window_ID-50006)', Description='Value for the configuration key', Name='Configured Value',Updated=TO_TIMESTAMP('2013-06-21 14:31:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50166 +; + +-- Jun 21, 2013 2:44:12 PM COT +UPDATE AD_Field SET SeqNo=730, IsDisplayed='Y', XPosition=5,Updated=TO_TIMESTAMP('2013-06-21 14:44:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=4040 +; + +-- Jun 21, 2013 2:44:13 PM COT +UPDATE AD_Field SET SeqNo=0, IsDisplayed='N', XPosition=1,Updated=TO_TIMESTAMP('2013-06-21 14:44:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=52052 +; + +-- Jun 21, 2013 2:46:13 PM COT +UPDATE AD_Column SET IsSelectionColumn='N',Updated=TO_TIMESTAMP('2013-06-21 14:46:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=5050 +; + +-- Jun 21, 2013 2:51:52 PM COT +UPDATE AD_Field SET IsReadOnly='Y', DisplayLogic='@Processed@=Y', IsDisplayedGrid='Y', SeqNoGrid=730,Updated=TO_TIMESTAMP('2013-06-21 14:51:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=4040 +; + +SELECT register_migration_script('201306211448_IDEMPIERE-594.sql') FROM dual +; + diff --git a/org.adempiere.base.process/src/org/compiere/process/AllocationReset.java b/org.adempiere.base.process/src/org/compiere/process/AllocationReset.java index a93b20a2b6..e6c1ff9ec1 100644 --- a/org.adempiere.base.process/src/org/compiere/process/AllocationReset.java +++ b/org.adempiere.base.process/src/org/compiere/process/AllocationReset.java @@ -21,6 +21,7 @@ import java.sql.ResultSet; import java.sql.Timestamp; import java.util.logging.Level; +import org.adempiere.exceptions.AdempiereException; import org.compiere.model.MAllocationHdr; import org.compiere.util.AdempiereUserError; import org.compiere.util.DB; @@ -110,6 +111,8 @@ public class AllocationReset extends SvrProcess MAllocationHdr hdr = new MAllocationHdr(getCtx(), p_C_AllocationHdr_ID, m_trx.getTrxName()); if (delete(hdr)) count++; + else + throw new AdempiereException("Cannot delete"); m_trx.close(); StringBuilder msgreturn = new StringBuilder("@Deleted@ #").append(count); return msgreturn.toString(); diff --git a/org.adempiere.base/src/org/compiere/model/GridField.java b/org.adempiere.base/src/org/compiere/model/GridField.java index 8240fe8103..7d3276ac0f 100644 --- a/org.adempiere.base/src/org/compiere/model/GridField.java +++ b/org.adempiere.base/src/org/compiere/model/GridField.java @@ -450,13 +450,15 @@ public class GridField keyColumn = "AD_EntityType_ID"; if (!keyColumn.endsWith("_ID")) keyColumn += "_ID"; // AD_Language_ID - int Record_ID = Env.getContextAsInt(ctx, m_vo.WindowNo, m_vo.TabNo, keyColumn); - int AD_Table_ID = m_vo.AD_Table_ID; - if (!MRole.getDefault(ctx, false).canUpdate( - AD_Client_ID, AD_Org_ID, AD_Table_ID, Record_ID, false)) - return false; - if (!MRole.getDefault(ctx, false).isColumnAccess(AD_Table_ID, m_vo.AD_Column_ID, false)) - return false; + if (getGridTab() != null) { + int Record_ID = Env.getContextAsInt(ctx, m_vo.WindowNo, m_vo.TabNo, keyColumn); + int AD_Table_ID = m_vo.AD_Table_ID; + if (!MRole.getDefault(ctx, false).canUpdate( + AD_Client_ID, AD_Org_ID, AD_Table_ID, Record_ID, false)) + return false; + if (!MRole.getDefault(ctx, false).isColumnAccess(AD_Table_ID, m_vo.AD_Column_ID, false)) + return false; + } } // Do we have a readonly rule @@ -487,7 +489,7 @@ public class GridField return true; // BF [ 2910368 ] // Record is not Active - if (checkContext && !Env.getContext(ctx, m_vo.WindowNo,m_vo.TabNo, "IsActive").equals("Y")) + if (checkContext && getGridTab() != null && !Env.getContext(ctx, m_vo.WindowNo,m_vo.TabNo, "IsActive").equals("Y")) return false; // ultimately visibility decides diff --git a/org.adempiere.base/src/org/compiere/model/MAllocationHdr.java b/org.adempiere.base/src/org/compiere/model/MAllocationHdr.java index bbfc21cd22..6e1faafe8e 100644 --- a/org.adempiere.base/src/org/compiere/model/MAllocationHdr.java +++ b/org.adempiere.base/src/org/compiere/model/MAllocationHdr.java @@ -321,7 +321,8 @@ public final class MAllocationHdr extends X_C_AllocationHdr implements DocAction } // Mark as Inactive setIsActive(false); // updated DB for line delete/process - + this.saveEx(); + // Unlink getLines(true); if (!updateBP(true)) @@ -406,21 +407,23 @@ public final class MAllocationHdr extends X_C_AllocationHdr implements DocAction } // Stop the Document Workflow if invoice to allocate is as paid - for (MAllocationLine line :m_lines) - { - if (line.getC_Invoice_ID() != 0) - { - StringBuilder whereClause = new StringBuilder(I_C_Invoice.COLUMNNAME_C_Invoice_ID).append("=? AND ") - .append(I_C_Invoice.COLUMNNAME_IsPaid).append("=? AND ") - .append(I_C_Invoice.COLUMNNAME_DocStatus).append(" NOT IN (?,?)"); - boolean InvoiceIsPaid = new Query(getCtx(), I_C_Invoice.Table_Name, whereClause.toString(), get_TrxName()) - .setClient_ID() - .setParameters(line.getC_Invoice_ID(), "Y", X_C_Invoice.DOCSTATUS_Voided, X_C_Invoice.DOCSTATUS_Reversed) - .match(); - if(InvoiceIsPaid && line.getAmount().signum() > 0) - throw new AdempiereException("@ValidationError@ @C_Invoice_ID@ @IsPaid@"); - } - } + if (!isReversal()) { + for (MAllocationLine line :m_lines) + { + if (line.getC_Invoice_ID() != 0) + { + StringBuilder whereClause = new StringBuilder(I_C_Invoice.COLUMNNAME_C_Invoice_ID).append("=? AND ") + .append(I_C_Invoice.COLUMNNAME_IsPaid).append("=? AND ") + .append(I_C_Invoice.COLUMNNAME_DocStatus).append(" NOT IN (?,?)"); + boolean InvoiceIsPaid = new Query(getCtx(), I_C_Invoice.Table_Name, whereClause.toString(), get_TrxName()) + .setClient_ID() + .setParameters(line.getC_Invoice_ID(), "Y", X_C_Invoice.DOCSTATUS_Voided, X_C_Invoice.DOCSTATUS_Reversed) + .match(); + if (InvoiceIsPaid && line.getAmount().signum() > 0) + throw new AdempiereException("@ValidationError@ @C_Invoice_ID@ @IsPaid@"); + } + } + } // Add up Amounts & validate BigDecimal approval = Env.ZERO; diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/ProcessElementHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/ProcessElementHandler.java index d1f2feb539..25aa74dc57 100644 --- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/ProcessElementHandler.java +++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/ProcessElementHandler.java @@ -23,11 +23,11 @@ import javax.xml.transform.sax.TransformerHandler; import org.adempiere.exceptions.AdempiereException; import org.adempiere.pipo2.AbstractElementHandler; +import org.adempiere.pipo2.Element; import org.adempiere.pipo2.ElementHandler; import org.adempiere.pipo2.PIPOContext; -import org.adempiere.pipo2.PoExporter; -import org.adempiere.pipo2.Element; import org.adempiere.pipo2.PackOut; +import org.adempiere.pipo2.PoExporter; import org.adempiere.pipo2.PoFiller; import org.adempiere.pipo2.exception.POSaveFailedException; import org.compiere.model.I_AD_PrintFormat; @@ -36,7 +36,9 @@ import org.compiere.model.I_AD_Reference; import org.compiere.model.I_AD_ReportView; import org.compiere.model.I_AD_Val_Rule; import org.compiere.model.I_AD_Workflow; +import org.compiere.model.MAttachment; import org.compiere.model.Query; +import org.compiere.model.X_AD_Attachment; import org.compiere.model.X_AD_Package_Exp_Detail; import org.compiere.model.X_AD_Package_Imp_Detail; import org.compiere.model.X_AD_Process; @@ -119,6 +121,17 @@ public class ProcessElementHandler extends AbstractElementHandler { AttributesImpl atts = new AttributesImpl(); try { + // Export attachment if necessary + MAttachment attachment = m_Process.getAttachment(); + if (attachment != null && attachment.get_ID() > 0) { + ElementHandler handler = ctx.packOut.getHandler(X_AD_Attachment.Table_Name); + try { + handler.packOut(ctx.packOut, document, null, attachment.getAD_Attachment_ID()); + } catch (Exception e) { + throw new SAXException(e); + } + } + if (m_Process.isReport() && m_Process.getAD_ReportView_ID() > 0) { ElementHandler handler = packOut.getHandler(I_AD_ReportView.Table_Name); diff --git a/org.adempiere.report.jasper/src/org/compiere/report/ReportStarter.java b/org.adempiere.report.jasper/src/org/compiere/report/ReportStarter.java index 5aa4c8bf26..2c42722568 100644 --- a/org.adempiere.report.jasper/src/org/compiere/report/ReportStarter.java +++ b/org.adempiere.report.jasper/src/org/compiere/report/ReportStarter.java @@ -414,18 +414,15 @@ public class ReportStarter implements ProcessCall, ClientProcess String jasperName = data.getJasperName(); String name = jasperReport.getName(); File reportDir = data.getReportDir(); - + String resourcePath = reportDir.getAbsolutePath(); - String reportdir = reportPath.substring(0, reportPath.lastIndexOf("/")); if (!resourcePath.endsWith("/") && !resourcePath.endsWith("\\")); { resourcePath = resourcePath + "/"; - reportdir = reportdir + "/"; } params.put("SUBREPORT_DIR", resourcePath); params.put("RESOURCE_DIR", resourcePath); - params.put("REPORT_DIR", reportdir); - + if (jasperReport != null && pi.getTable_ID() > 0 && Record_ID <= 0 && pi.getRecord_IDs() != null && pi.getRecord_IDs().length > 0) { try diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessParameterPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessParameterPanel.java index d482832b29..a294ba81f6 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessParameterPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessParameterPanel.java @@ -29,6 +29,7 @@ import org.adempiere.webui.component.GridFactory; import org.adempiere.webui.component.Panel; import org.adempiere.webui.component.Row; import org.adempiere.webui.component.Rows; +import org.adempiere.webui.editor.IZoomableEditor; import org.adempiere.webui.editor.WEditor; import org.adempiere.webui.editor.WEditorPopupMenu; import org.adempiere.webui.editor.WebEditorFactory; @@ -54,6 +55,7 @@ import org.zkoss.zk.ui.event.Events; import org.zkoss.zul.Div; import org.zkoss.zul.Hbox; import org.zkoss.zul.Label; +import org.zkoss.zul.impl.XulElement; /** * Process Parameter Panel, based on existing ProcessParameter dialog. - @@ -68,7 +70,8 @@ public class ProcessParameterPanel extends Panel implements /** * */ - private static final long serialVersionUID = 7163263872945366389L; + private static final long serialVersionUID = -5996487688479454715L; + private String width; /** @@ -291,9 +294,25 @@ public class ProcessParameterPanel extends Panel implements editor.fillHorizontal(); // setup editor context menu WEditorPopupMenu popupMenu = editor.getPopupMenu(); - if (popupMenu != null) { - popupMenu.addMenuListener((ContextMenuListener) editor); + if (popupMenu != null) + { + popupMenu.addMenuListener((ContextMenuListener)editor); + popupMenu.setId(mField.getColumnName()+"-popup"); this.appendChild(popupMenu); + if (!mField.isFieldOnly()) + { + Label label = editor.getLabel(); + if (popupMenu.isZoomEnabled() && editor instanceof IZoomableEditor) + { + label.addEventListener(Events.ON_CLICK, new ZoomListener((IZoomableEditor) editor)); + } + + popupMenu.addContextElement(label); + if (editor.getComponent() instanceof XulElement) + { + popupMenu.addContextElement((XulElement) editor.getComponent()); + } + } } // m_wEditors.add(editor); // add to Editors @@ -634,6 +653,7 @@ public class ProcessParameterPanel extends Panel implements m_wEditors2.get(i).setVisible(false); } } + editor.updateLabelStyle(); } } @@ -661,5 +681,21 @@ public class ProcessParameterPanel extends Panel implements m_processInfo = processInfo; } -} // ProcessParameterPanel + static class ZoomListener implements EventListener { + private IZoomableEditor searchEditor; + + ZoomListener(IZoomableEditor editor) { + searchEditor = editor; + } + + public void onEvent(Event event) throws Exception { + if (Events.ON_CLICK.equals(event.getName())) { + searchEditor.actionZoom(); + } + + } + + } + +} // ProcessParameterPanel diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WEditor.java index a396a48a07..e47d057e3d 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WEditor.java @@ -566,7 +566,8 @@ public abstract class WEditor implements EventListener, PropertyChangeLis * @return boolean */ protected boolean isShowPreference() { - return MRole.getDefault().isShowPreference() && gridField != null && !gridField.isEncrypted() && !gridField.isEncryptedColumn(); + return MRole.getDefault().isShowPreference() && gridField != null && !gridField.isEncrypted() && !gridField.isEncryptedColumn() + && gridTab != null; // don't show preference for process parameters } /** diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java index 12301d0c3c..0a628599b7 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java @@ -27,9 +27,11 @@ import java.sql.SQLException; import java.util.logging.Level; import org.adempiere.util.Callback; +import org.adempiere.webui.LayoutUtils; import org.adempiere.webui.ValuePreference; import org.adempiere.webui.adwindow.ADTabpanel; import org.adempiere.webui.adwindow.ADWindow; +import org.adempiere.webui.adwindow.ADWindowContent; import org.adempiere.webui.adwindow.IFieldEditorContainer; import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.component.Searchbox; @@ -90,6 +92,8 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value private static final String IN_PROGRESS_IMAGE = "~./zk/img/progress3.gif"; + private ADWindow adwindow; + public WSearchEditor (GridField gridField) { super(new CustomSearchBox(), gridField); @@ -504,6 +508,11 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value vqe.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener() { @Override public void onEvent(Event event) throws Exception { + if (adwindow != null) + { + adwindow.getADWindowContent().hideBusyMask(); + adwindow = null; + } // get result int result = vqe.getRecord_ID(); @@ -520,8 +529,16 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value } }); - vqe.setVisible(true); - AEnv.showWindow(vqe); + vqe.setSizable(true); + adwindow = ADWindow.findADWindow(getComponent()); + if (adwindow != null) { + ADWindowContent content = adwindow.getADWindowContent(); + content.getComponent().getParent().appendChild(vqe); + content.showBusyMask(vqe); + LayoutUtils.openOverlappedWindow(content.getComponent().getParent(), vqe, "middle_center"); + } else { + AEnv.showWindow(vqe); + } } // actionQuickEntry private void actionButton(String queryValue) diff --git a/org.adempiere.ui/src/org/compiere/grid/CreateFromBatch.java b/org.adempiere.ui/src/org/compiere/grid/CreateFromBatch.java index 882bdc884e..75ba8e3ac4 100644 --- a/org.adempiere.ui/src/org/compiere/grid/CreateFromBatch.java +++ b/org.adempiere.ui/src/org/compiere/grid/CreateFromBatch.java @@ -94,13 +94,13 @@ public abstract class CreateFromBatch extends CreateFrom throws SQLException { // Get StatementDate - Timestamp ts = (Timestamp) getGridTab().getValue("StatementDate"); - if (ts == null) - ts = new Timestamp(System.currentTimeMillis()); + //Timestamp ts = (Timestamp) getGridTab().getValue("StatementDate"); + //if (ts == null) + //ts = new Timestamp(System.currentTimeMillis()); int index = 1; - pstmt.setTimestamp(index++, ts); + //pstmt.setTimestamp(index++, ts); pstmt.setInt(index++, BankAccount != null ? (Integer) BankAccount : (Integer) getGridTab().getValue("C_BankAccount_ID")); if(DocType != null) diff --git a/org.adempiere.ui/src/org/compiere/grid/CreateFromStatement.java b/org.adempiere.ui/src/org/compiere/grid/CreateFromStatement.java index 2f1d2bdad1..a40f8775e6 100644 --- a/org.adempiere.ui/src/org/compiere/grid/CreateFromStatement.java +++ b/org.adempiere.ui/src/org/compiere/grid/CreateFromStatement.java @@ -59,7 +59,7 @@ public abstract class CreateFromStatement extends CreateFromBatch StringBuilder sql = new StringBuilder(); sql.append("SELECT p.DateTrx,p.C_Payment_ID,p.DocumentNo, p.C_Currency_ID,c.ISO_Code, p.PayAmt,"); - sql.append("currencyConvert(p.PayAmt,p.C_Currency_ID,ba.C_Currency_ID,?,null,p.AD_Client_ID,p.AD_Org_ID), bp.Name "); + sql.append("currencyConvert(p.PayAmt,p.C_Currency_ID,ba.C_Currency_ID,p.DateAcct,p.C_ConversionType_ID,p.AD_Client_ID,p.AD_Org_ID), bp.Name "); sql.append("FROM C_BankAccount ba"); sql.append(" INNER JOIN C_Payment_v p ON (p.C_BankAccount_ID=ba.C_BankAccount_ID)"); sql.append(" INNER JOIN C_Currency c ON (p.C_Currency_ID=c.C_Currency_ID)");