hg merge release-6.2 (merge release6.2 into default)

This commit is contained in:
Carlos Ruiz 2019-08-31 16:34:46 +02:00
commit 12e9d47c74
20 changed files with 279 additions and 49 deletions

View File

@ -0,0 +1,7 @@
DELETE FROM AD_InfoWindow_Access WHERE ad_infowindow_id IN (SELECT ad_infowindow_id FROM ad_infowindow iw JOIN ad_table t ON (iw.ad_table_id=t.ad_table_id) WHERE t.AccessLevel='4') AND ad_role_id IN (SELECT ad_role_id FROM ad_role WHERE ismanual='N' AND isactive='Y' AND userlevel!='S ');
DELETE FROM AD_InfoWindow_Access WHERE ad_infowindow_id IN (SELECT ad_infowindow_id FROM ad_infowindow iw JOIN ad_table t ON (iw.ad_table_id=t.ad_table_id) WHERE t.AccessLevel IN ('1','2','3')) AND ad_role_id IN (SELECT ad_role_id FROM ad_role WHERE ismanual='N' AND isactive='Y' AND userlevel='S ');
SELECT register_migration_script('201908201457_IDEMPIERE-3936.sql') FROM dual
;

View File

@ -0,0 +1,22 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- IDEMPIERE-4034 - Payment Selection improvements/bugs
-- Aug 23, 2019, 7:04:12 PM CEST
INSERT INTO AD_Message (MsgType,MsgText,MsgTip,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Only positive balance','',0,0,'Y',TO_DATE('2019-08-23 19:04:11','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-08-23 19:04:11','YYYY-MM-DD HH24:MI:SS'),100,200537,'PositiveBalance','D','9184dbfd-02c9-4881-9dad-c3a6b390da1e')
;
-- Aug 23, 2019, 8:27:41 PM CEST
INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,Description,PrintName,EntityType,AD_Element_UU) VALUES (203357,0,0,'Y',TO_DATE('2019-08-23 20:27:40','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-08-23 20:27:40','YYYY-MM-DD HH24:MI:SS'),100,'PositiveBalance','Only positive balance','Include only positive balance','Only positive balance','D','27848071-41b9-4a4f-ada2-aa536af547c7')
;
-- Aug 23, 2019, 8:28:34 PM CEST
INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,FieldLength,IsMandatory,DefaultValue,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200281,0,0,'Y',TO_DATE('2019-08-23 20:28:34','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-08-23 20:28:34','YYYY-MM-DD HH24:MI:SS'),100,'Only positive balance','Include only positive balance',156,80,20,'N',0,'Y','N','PositiveBalance','Y','D',203357,'50f11422-1361-4d50-b6d3-bfe6770e43d3','N')
;
-- Aug 24, 2019, 2:53:06 PM CEST
UPDATE AD_Process_Para SET DefaultValue='Y',Updated=TO_DATE('2019-08-24 14:53:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200281
;
SELECT register_migration_script('201908232051_IDEMPIERE-4034.sql') FROM dual
;

View File

@ -0,0 +1,7 @@
DELETE FROM AD_InfoWindow_Access WHERE ad_infowindow_id IN (SELECT ad_infowindow_id FROM ad_infowindow iw JOIN ad_table t ON (iw.ad_table_id=t.ad_table_id) WHERE t.AccessLevel='4') AND ad_role_id IN (SELECT ad_role_id FROM ad_role WHERE ismanual='N' AND isactive='Y' AND userlevel!='S ');
DELETE FROM AD_InfoWindow_Access WHERE ad_infowindow_id IN (SELECT ad_infowindow_id FROM ad_infowindow iw JOIN ad_table t ON (iw.ad_table_id=t.ad_table_id) WHERE t.AccessLevel IN ('1','2','3')) AND ad_role_id IN (SELECT ad_role_id FROM ad_role WHERE ismanual='N' AND isactive='Y' AND userlevel='S ');
SELECT register_migration_script('201908201457_IDEMPIERE-3936.sql') FROM dual
;

View File

@ -0,0 +1,19 @@
-- IDEMPIERE-4034 - Payment Selection improvements/bugs
-- Aug 23, 2019, 7:04:12 PM CEST
INSERT INTO AD_Message (MsgType,MsgText,MsgTip,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Only positive balance','',0,0,'Y',TO_TIMESTAMP('2019-08-23 19:04:11','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-08-23 19:04:11','YYYY-MM-DD HH24:MI:SS'),100,200537,'PositiveBalance','D','9184dbfd-02c9-4881-9dad-c3a6b390da1e')
;
-- Aug 23, 2019, 8:27:41 PM CEST
INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,Description,PrintName,EntityType,AD_Element_UU) VALUES (203357,0,0,'Y',TO_TIMESTAMP('2019-08-23 20:27:40','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-08-23 20:27:40','YYYY-MM-DD HH24:MI:SS'),100,'PositiveBalance','Only positive balance','Include only positive balance','Only positive balance','D','27848071-41b9-4a4f-ada2-aa536af547c7')
;
-- Aug 23, 2019, 8:28:34 PM CEST
INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,FieldLength,IsMandatory,DefaultValue,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200281,0,0,'Y',TO_TIMESTAMP('2019-08-23 20:28:34','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-08-23 20:28:34','YYYY-MM-DD HH24:MI:SS'),100,'Only positive balance','Include only positive balance',156,80,20,'N',0,'Y','N','PositiveBalance','Y','D',203357,'50f11422-1361-4d50-b6d3-bfe6770e43d3','N')
;
-- Aug 24, 2019, 2:53:06 PM CEST
UPDATE AD_Process_Para SET DefaultValue='Y',Updated=TO_TIMESTAMP('2019-08-24 14:53:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200281
;
SELECT register_migration_script('201908232051_IDEMPIERE-4034.sql') FROM dual
;

View File

@ -111,13 +111,16 @@ BEGIN
|| ' where name=''' || ' where name='''
|| r.tablename || r.tablename
|| ''' and istableid=''Y'''; || ''' and istableid=''Y''';
EXECUTE cmdupd; EXECUTE cmdupd;
END IF; END IF;
IF currentseq < currentnext AND isnativeseqon ='Y' THEN IF currentseq < currentnext AND isnativeseqon ='Y' THEN
WHILE NOT currentseq >= (currentnext-1) LOOP cmdupd :=
EXECUTE 'SELECT nextval('''||trim(r.tablename)||'_sq'''||')' INTO currentseq; 'SELECT setval('''
END LOOP; || trim(r.tablename)
|| '_sq'','
|| currentnext
|| ')';
EXECUTE cmdupd;
END IF; END IF;
END IF; END IF;
END LOOP; END LOOP;

View File

@ -85,7 +85,9 @@ BEGIN
|| r.ad_role_id || r.ad_role_id
|| ','||r.ad_client_id||','||r.ad_org_id||',''Y'', statement_timestamp(),0, statement_timestamp(),0 FROM AD_InfoWindow i LEFT JOIN AD_InfoWindow_Access ia ON (ia.AD_Role_ID=' || ','||r.ad_client_id||','||r.ad_org_id||',''Y'', statement_timestamp(),0, statement_timestamp(),0 FROM AD_InfoWindow i LEFT JOIN AD_InfoWindow_Access ia ON (ia.AD_Role_ID='
|| r.ad_role_id || r.ad_role_id
|| ' AND i.AD_InfoWindow_ID = ia.AD_InfoWindow_ID) WHERE i.AD_Client_ID IN (0,'||r.ad_client_id||') AND ia.AD_InfoWindow_ID IS NULL'; || ' AND i.AD_InfoWindow_ID = ia.AD_InfoWindow_ID) INNER JOIN AD_Table tt ON (i.AD_Table_ID=tt.AD_Table_ID) WHERE i.AD_Client_ID IN (0,'||r.ad_client_id||') AND ia.AD_InfoWindow_ID IS NULL AND tt.AccessLevel IN '
|| roleaccesslevel;
EXECUTE sqlins; EXECUTE sqlins;

View File

@ -56,6 +56,8 @@ public class PaySelectionCreateFrom extends SvrProcess
private int p_C_BP_Group_ID = 0; private int p_C_BP_Group_ID = 0;
/** Payment Selection */ /** Payment Selection */
private int p_C_PaySelection_ID = 0; private int p_C_PaySelection_ID = 0;
/** Only positive balance */
private boolean p_OnlyPositive = false;
private Timestamp p_DueDate = null; private Timestamp p_DueDate = null;
@ -86,6 +88,8 @@ public class PaySelectionCreateFrom extends SvrProcess
p_C_BP_Group_ID = para[i].getParameterAsInt(); p_C_BP_Group_ID = para[i].getParameterAsInt();
else if (name.equals("DueDate")) else if (name.equals("DueDate"))
p_DueDate = (Timestamp) para[i].getParameter(); p_DueDate = (Timestamp) para[i].getParameter();
else if (name.equals("PositiveBalance"))
p_OnlyPositive = "Y".equals(para[i].getParameter());
else else
log.log(Level.SEVERE, "Unknown Parameter: " + name); log.log(Level.SEVERE, "Unknown Parameter: " + name);
} }
@ -104,6 +108,7 @@ public class PaySelectionCreateFrom extends SvrProcess
+ ", IncludeInDispute=" + p_IncludeInDispute + ", IncludeInDispute=" + p_IncludeInDispute
+ ", MatchRequirement=" + p_MatchRequirement + ", MatchRequirement=" + p_MatchRequirement
+ ", PaymentRule=" + p_PaymentRule + ", PaymentRule=" + p_PaymentRule
+ ", POsitiveBalancet=" + p_OnlyPositive
+ ", C_BP_Group_ID=" + p_C_BP_Group_ID + ", C_BPartner_ID=" + p_C_BPartner_ID); + ", C_BP_Group_ID=" + p_C_BP_Group_ID + ", C_BPartner_ID=" + p_C_BPartner_ID);
MPaySelection psel = new MPaySelection (getCtx(), p_C_PaySelection_ID, get_TrxName()); MPaySelection psel = new MPaySelection (getCtx(), p_C_PaySelection_ID, get_TrxName());
@ -127,13 +132,15 @@ public class PaySelectionCreateFrom extends SvrProcess
.append(" PaymentRule, IsSOTrx, ") // 4..5 .append(" PaymentRule, IsSOTrx, ") // 4..5
.append(" currencyConvert(invoiceWriteOff(i.C_Invoice_ID) ") .append(" currencyConvert(invoiceWriteOff(i.C_Invoice_ID) ")
.append(",i.C_Currency_ID, ?,?,i.C_ConversionType_ID,i.AD_Client_ID,i.AD_Org_ID) AS WriteOffAmt ") // 6 ##p6/p7 Currency_To,PayDate .append(",i.C_Currency_ID, ?,?,i.C_ConversionType_ID,i.AD_Client_ID,i.AD_Org_ID) AS WriteOffAmt ") // 6 ##p6/p7 Currency_To,PayDate
.append("FROM C_Invoice_v i WHERE "); .append("FROM C_Invoice_v i ");
StringBuilder sqlWhere = new StringBuilder("WHERE ");
if (X_C_Order.PAYMENTRULE_DirectDebit.equals(p_PaymentRule)) if (X_C_Order.PAYMENTRULE_DirectDebit.equals(p_PaymentRule))
sql.append("IsSOTrx='Y'"); sqlWhere.append("i.IsSOTrx='Y'");
else else
sql.append("IsSOTrx='N'"); sqlWhere.append("i.IsSOTrx='N'");
sql.append(" AND IsPaid='N' AND DocStatus IN ('CO','CL')") sqlWhere.append(" AND i.IsPaid='N' AND i.DocStatus IN ('CO','CL')")
.append(" AND AD_Client_ID=?") // ##p8 .append(" AND i.AD_Client_ID=?") // ##p8
// Existing Payments - Will reselect Invoice if prepared but not paid // Existing Payments - Will reselect Invoice if prepared but not paid
.append(" AND NOT EXISTS (SELECT * FROM C_PaySelectionLine psl") .append(" AND NOT EXISTS (SELECT * FROM C_PaySelectionLine psl")
.append(" INNER JOIN C_PaySelectionCheck psc ON (psl.C_PaySelectionCheck_ID=psc.C_PaySelectionCheck_ID)") .append(" INNER JOIN C_PaySelectionCheck psc ON (psl.C_PaySelectionCheck_ID=psc.C_PaySelectionCheck_ID)")
@ -144,42 +151,42 @@ public class PaySelectionCreateFrom extends SvrProcess
.append(" AND i.C_Invoice_ID NOT IN (SELECT i.C_Invoice_ID FROM C_PaySelectionLine psl WHERE psl.C_PaySelection_ID=?)"); // ##p9 .append(" AND i.C_Invoice_ID NOT IN (SELECT i.C_Invoice_ID FROM C_PaySelectionLine psl WHERE psl.C_PaySelection_ID=?)"); // ##p9
// Disputed // Disputed
if (!p_IncludeInDispute) if (!p_IncludeInDispute)
sql.append(" AND i.IsInDispute='N'"); sqlWhere.append(" AND i.IsInDispute='N'");
// PaymentRule (optional) // PaymentRule (optional)
if (p_PaymentRule != null) if (p_PaymentRule != null)
sql.append(" AND PaymentRule=?"); // ## sqlWhere.append(" AND i.PaymentRule=?"); // ##
// OnlyDiscount // OnlyDiscount
if (p_OnlyDiscount) if (p_OnlyDiscount)
{ {
if (p_OnlyDue) if (p_OnlyDue)
sql.append(" AND ("); sqlWhere.append(" AND (");
else else
sql.append(" AND "); sqlWhere.append(" AND ");
sql.append("invoiceDiscount(i.C_Invoice_ID,?,i.C_InvoicePaySchedule_ID) > 0"); // ## sqlWhere.append("invoiceDiscount(i.C_Invoice_ID,?,i.C_InvoicePaySchedule_ID) > 0"); // ##
} }
// OnlyDue // OnlyDue
if (p_OnlyDue) if (p_OnlyDue)
{ {
if (p_OnlyDiscount) if (p_OnlyDiscount)
sql.append(" OR "); sqlWhere.append(" OR ");
else else
sql.append(" AND "); sqlWhere.append(" AND ");
// sql.append("paymentTermDueDays(C_PaymentTerm_ID, DateInvoiced, ?) >= 0"); // ## // sql.append("paymentTermDueDays(C_PaymentTerm_ID, DateInvoiced, ?) >= 0"); // ##
sql.append("i.DueDate<=?"); // ## sqlWhere.append("i.DueDate<=?"); // ##
if (p_OnlyDiscount) if (p_OnlyDiscount)
sql.append(")"); sqlWhere.append(")");
} }
// Business Partner // Business Partner
if (p_C_BPartner_ID != 0) if (p_C_BPartner_ID != 0)
sql.append(" AND C_BPartner_ID=?"); // ## sqlWhere.append(" AND i.C_BPartner_ID=?"); // ##
// Business Partner Group // Business Partner Group
else if (p_C_BP_Group_ID != 0) else if (p_C_BP_Group_ID != 0)
sql.append(" AND EXISTS (SELECT * FROM C_BPartner bp ") sqlWhere.append(" AND EXISTS (SELECT * FROM C_BPartner bp ")
.append("WHERE bp.C_BPartner_ID=i.C_BPartner_ID AND bp.C_BP_Group_ID=?)"); // ## .append("WHERE bp.C_BPartner_ID=i.C_BPartner_ID AND bp.C_BP_Group_ID=?)"); // ##
// PO Matching Requirement // PO Matching Requirement
if (p_MatchRequirement.equals("P") || p_MatchRequirement.equals("B")) if (p_MatchRequirement.equals("P") || p_MatchRequirement.equals("B"))
{ {
sql.append(" AND EXISTS (SELECT * FROM C_InvoiceLine il ") sqlWhere.append(" AND EXISTS (SELECT * FROM C_InvoiceLine il ")
.append("WHERE i.C_Invoice_ID=il.C_Invoice_ID") .append("WHERE i.C_Invoice_ID=il.C_Invoice_ID")
.append(" AND QtyInvoiced=(SELECT SUM(Qty) FROM M_MatchPO m ") .append(" AND QtyInvoiced=(SELECT SUM(Qty) FROM M_MatchPO m ")
.append("WHERE il.C_InvoiceLine_ID=m.C_InvoiceLine_ID))"); .append("WHERE il.C_InvoiceLine_ID=m.C_InvoiceLine_ID))");
@ -187,12 +194,32 @@ public class PaySelectionCreateFrom extends SvrProcess
// Receipt Matching Requirement // Receipt Matching Requirement
if (p_MatchRequirement.equals("R") || p_MatchRequirement.equals("B")) if (p_MatchRequirement.equals("R") || p_MatchRequirement.equals("B"))
{ {
sql.append(" AND EXISTS (SELECT * FROM C_InvoiceLine il ") sqlWhere.append(" AND EXISTS (SELECT * FROM C_InvoiceLine il ")
.append("WHERE i.C_Invoice_ID=il.C_Invoice_ID") .append("WHERE i.C_Invoice_ID=il.C_Invoice_ID")
.append(" AND QtyInvoiced=(SELECT SUM(Qty) FROM M_MatchInv m ") .append(" AND QtyInvoiced=(SELECT SUM(Qty) FROM M_MatchInv m ")
.append("WHERE il.C_InvoiceLine_ID=m.C_InvoiceLine_ID))"); .append("WHERE il.C_InvoiceLine_ID=m.C_InvoiceLine_ID))");
} }
// Include only business partners with positive balance
if (p_OnlyPositive) {
String subWhereClause = sqlWhere.toString();
subWhereClause = subWhereClause.replaceAll("\\bi\\b", "i1");
subWhereClause = subWhereClause.replaceAll("\\bpsl\\b", "psl1");
subWhereClause = subWhereClause.replaceAll("\\bpsc\\b", "psc1");
subWhereClause = subWhereClause.replaceAll("\\bpmt\\b", "pmt1");
subWhereClause = subWhereClause.replaceAll("\\bbp\\b", "bp1");
subWhereClause = subWhereClause.replaceAll("\\bil\\b", "il1");
String onlyPositiveWhere = " AND i.c_bpartner_id NOT IN ( SELECT i1.C_BPartner_ID"
+ " FROM C_Invoice_v i1 "
+ subWhereClause.toString()
+ " GROUP BY i1.C_BPartner_ID"
+ " HAVING sum(invoiceOpen(i1.C_Invoice_ID, i1.C_InvoicePaySchedule_ID)) <= 0) ";
sqlWhere.append(onlyPositiveWhere);
}
sql.append(sqlWhere.toString());
// //
int lines = 0; int lines = 0;
int C_CurrencyTo_ID = psel.getC_Currency_ID(); int C_CurrencyTo_ID = psel.getC_Currency_ID();
@ -223,6 +250,21 @@ public class PaySelectionCreateFrom extends SvrProcess
pstmt.setInt (index++, p_C_BPartner_ID); pstmt.setInt (index++, p_C_BPartner_ID);
else if (p_C_BP_Group_ID != 0) else if (p_C_BP_Group_ID != 0)
pstmt.setInt (index++, p_C_BP_Group_ID); pstmt.setInt (index++, p_C_BP_Group_ID);
if (p_OnlyPositive) {
pstmt.setInt(index++, psel.getAD_Client_ID());
pstmt.setInt(index++, p_C_PaySelection_ID);
if (p_PaymentRule != null)
pstmt.setString(index++, p_PaymentRule);
if (p_OnlyDiscount)
pstmt.setTimestamp(index++, psel.getPayDate());
if (p_OnlyDue)
pstmt.setTimestamp(index++, p_DueDate);
if (p_C_BPartner_ID != 0)
pstmt.setInt (index++, p_C_BPartner_ID);
else if (p_C_BP_Group_ID != 0)
pstmt.setInt (index++, p_C_BP_Group_ID);
}
// //
rs = pstmt.executeQuery (); rs = pstmt.executeQuery ();
while (rs.next ()) while (rs.next ())

View File

@ -16,6 +16,7 @@ package org.adempiere.impexp;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.sql.Date;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.NumberFormat; import java.text.NumberFormat;
@ -505,7 +506,11 @@ public abstract class AbstractExcelExporter
} else if (!isVisible(rownum, col)) { } else if (!isVisible(rownum, col)) {
; ;
} else if (DisplayType.isDate(displayType)) { } else if (DisplayType.isDate(displayType)) {
Timestamp value = (Timestamp)obj; Timestamp value = null;
if (obj instanceof Date)
value = new Timestamp(((Date)obj).getTime());
else
value = (Timestamp)obj;
cell.setCellValue(value); cell.setCellValue(value);
} }
else if (DisplayType.isNumeric(displayType)) { else if (DisplayType.isNumeric(displayType)) {

View File

@ -533,7 +533,6 @@ public class MOrder extends X_C_Order implements DocAction
line.setQtyInvoiced(Env.ZERO); line.setQtyInvoiced(Env.ZERO);
line.setQtyReserved(Env.ZERO); line.setQtyReserved(Env.ZERO);
line.setQtyLostSales(Env.ZERO); line.setQtyLostSales(Env.ZERO);
line.setQtyOrdered(Env.ZERO);
line.setDateDelivered(null); line.setDateDelivered(null);
line.setDateInvoiced(null); line.setDateInvoiced(null);
// //

View File

@ -496,7 +496,9 @@ public final class MRole extends X_AD_Role
+ " FROM AD_InfoWindow i LEFT JOIN AD_InfoWindow_Access ia ON " + " FROM AD_InfoWindow i LEFT JOIN AD_InfoWindow_Access ia ON "
+ "(ia.AD_Role_ID=" + getAD_Role_ID() + "(ia.AD_Role_ID=" + getAD_Role_ID()
+ " AND i.AD_InfoWindow_ID = ia.AD_InfoWindow_ID) " + " AND i.AD_InfoWindow_ID = ia.AD_InfoWindow_ID) "
+ "WHERE i.AD_Client_ID IN (0," + getAD_Client_ID() + ") AND ia.AD_InfoWindow_ID IS NULL"; + " INNER JOIN AD_Table tt ON (i.AD_Table_ID=tt.AD_Table_ID) "
+ "WHERE i.AD_Client_ID IN (0," + getAD_Client_ID() + ") AND ia.AD_InfoWindow_ID IS NULL"
+ " AND tt.AccessLevel IN ";
/** /**
* Fill AD_xx_Access * Fill AD_xx_Access
@ -537,7 +539,7 @@ public final class MRole extends X_AD_Role
int form = DB.executeUpdateEx(sqlForm + roleAccessLevel, get_TrxName()); int form = DB.executeUpdateEx(sqlForm + roleAccessLevel, get_TrxName());
int wf = DB.executeUpdateEx(sqlWorkflow + roleAccessLevel, get_TrxName()); int wf = DB.executeUpdateEx(sqlWorkflow + roleAccessLevel, get_TrxName());
int docact = DB.executeUpdateEx(sqlDocAction, get_TrxName()); int docact = DB.executeUpdateEx(sqlDocAction, get_TrxName());
int info = DB.executeUpdateEx(sqlInfo, get_TrxName()); int info = DB.executeUpdateEx(sqlInfo + roleAccessLevel, get_TrxName());
loadAccess(true); loadAccess(true);
return "@AD_Window_ID@ #" + win return "@AD_Window_ID@ #" + win

View File

@ -280,7 +280,7 @@ public class VPaySelect extends PaySelect implements FormPanel, ActionListener,
KeyNamePair bpartner = (KeyNamePair)fieldBPartner.getSelectedItem(); KeyNamePair bpartner = (KeyNamePair)fieldBPartner.getSelectedItem();
KeyNamePair docType = (KeyNamePair)fieldDtype.getSelectedItem(); KeyNamePair docType = (KeyNamePair)fieldDtype.getSelectedItem();
loadTableInfo(bi, payDate, paymentRule, onlyDue.isSelected(), bpartner, docType, miniTable); loadTableInfo(bi, payDate, paymentRule, onlyDue.isSelected(), false, bpartner, docType, miniTable);
calculateSelection(); calculateSelection();
} // loadTableInfo } // loadTableInfo

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.webui.process.BankTransferParameterListener">
<implementation class="org.adempiere.webui.process.BankTransferParameterListener"/>
<property name="ProcessClass" type="String" value="org.eevolution.process.BankTransfer"/>
<property name="ColumnName" type="String" value="StatementDate,From_C_BankAccount_ID,To_C_BankAccount_ID"/>
<service>
<provide interface="org.adempiere.webui.apps.IProcessParameterListener"/>
</service>
</scr:component>

View File

@ -63,7 +63,7 @@ public class Extensions {
ServiceQuery query = new ServiceQuery(); ServiceQuery query = new ServiceQuery();
query.put("ProcessClass", processClass); query.put("ProcessClass", processClass);
if (columnName != null) if (columnName != null)
query.put("|ColumnName", columnName+"|"+columnName+",*|"+"*,"+columnName+",*|"+"*,"+columnName); query.put("|(ColumnName", columnName+")(ColumnName="+columnName+",*)(ColumnName="+"*,"+columnName+",*)(ColumnName=*,"+columnName+")");
return Service.locator().list(IProcessParameterListener.class, null, query).getServices(); return Service.locator().list(IProcessParameterListener.class, null, query).getServices();
} }
} }

View File

@ -108,6 +108,7 @@ public class WPaySelect extends PaySelect
private Label labelCurrency = new Label(); private Label labelCurrency = new Label();
private Label labelBalance = new Label(); private Label labelBalance = new Label();
private Checkbox onlyDue = new Checkbox(); private Checkbox onlyDue = new Checkbox();
private Checkbox onlyPositiveBalance = new Checkbox();
private Label labelBPartner = new Label(); private Label labelBPartner = new Label();
private Listbox fieldBPartner = ListboxFactory.newDropdownListbox(); private Listbox fieldBPartner = ListboxFactory.newDropdownListbox();
private Label dataStatus = new Label(); private Label dataStatus = new Label();
@ -189,6 +190,10 @@ public class WPaySelect extends PaySelect
chkOnePaymentPerInv.setText(Msg.translate(Env.getCtx(), MPaySelection.COLUMNNAME_IsOnePaymentPerInvoice)); chkOnePaymentPerInv.setText(Msg.translate(Env.getCtx(), MPaySelection.COLUMNNAME_IsOnePaymentPerInvoice));
chkOnePaymentPerInv.addActionListener(this); chkOnePaymentPerInv.addActionListener(this);
onlyPositiveBalance.setText(Msg.getMsg(Env.getCtx(), "PositiveBalance"));
onlyPositiveBalance.addActionListener(this);
onlyPositiveBalance.setChecked(true);
//IDEMPIERE-2657, pritesh shah //IDEMPIERE-2657, pritesh shah
bGenerate.setEnabled(false); bGenerate.setEnabled(false);
bGenerate.addActionListener(this); bGenerate.addActionListener(this);
@ -255,13 +260,15 @@ public class WPaySelect extends PaySelect
row = rows.newRow(); row = rows.newRow();
row.appendChild(labelDtype.rightAlign()); row.appendChild(labelDtype.rightAlign());
row.appendChild(fieldDtype); row.appendChild(fieldDtype);
row.appendChild(new Space()); if (ClientInfo.maxWidth(ClientInfo.MEDIUM_WIDTH-1))
row.appendCellChild(chkOnePaymentPerInv);
if (ClientInfo.minWidth(ClientInfo.MEDIUM_WIDTH))
{ {
row.appendChild(new Space()); row.appendChild(new Space());
row.appendChild(new Space()); row = rows.newRow();
} }
row.appendChild(new Space());
row.appendChild(onlyPositiveBalance);
row.appendCellChild(chkOnePaymentPerInv);
row.appendChild(new Space());
row = rows.newRow(); row = rows.newRow();
row.appendChild(labelPayDate.rightAlign()); row.appendChild(labelPayDate.rightAlign());
@ -373,7 +380,7 @@ public class WPaySelect extends PaySelect
KeyNamePair bpartner = (KeyNamePair) fieldBPartner.getSelectedItem().getValue(); KeyNamePair bpartner = (KeyNamePair) fieldBPartner.getSelectedItem().getValue();
KeyNamePair docType = (KeyNamePair) fieldDtype.getSelectedItem().getValue(); KeyNamePair docType = (KeyNamePair) fieldDtype.getSelectedItem().getValue();
loadTableInfo(bi, payDate, paymentRule, onlyDue.isSelected(), bpartner, docType, miniTable); loadTableInfo(bi, payDate, paymentRule, onlyDue.isSelected(), onlyPositiveBalance.isSelected(), bpartner, docType, miniTable);
calculateSelection(); calculateSelection();
if (ClientInfo.maxHeight(ClientInfo.MEDIUM_HEIGHT-1)) if (ClientInfo.maxHeight(ClientInfo.MEDIUM_HEIGHT-1))
@ -413,7 +420,7 @@ public class WPaySelect extends PaySelect
// Update Open Invoices // Update Open Invoices
else if (e.getTarget() == fieldBPartner || e.getTarget() == bRefresh || e.getTarget() == fieldDtype else if (e.getTarget() == fieldBPartner || e.getTarget() == bRefresh || e.getTarget() == fieldDtype
|| e.getTarget() == fieldPaymentRule || e.getTarget() == onlyDue) || e.getTarget() == fieldPaymentRule || e.getTarget() == onlyDue || e.getTarget() == onlyPositiveBalance)
loadTableInfo(); loadTableInfo();
else if (DialogEvents.ON_WINDOW_CLOSE.equals(e.getName())) { else if (DialogEvents.ON_WINDOW_CLOSE.equals(e.getName())) {

View File

@ -30,6 +30,7 @@
package org.adempiere.webui.dashboard; package org.adempiere.webui.dashboard;
import org.adempiere.webui.apps.graph.WDocumentStatusPanel; import org.adempiere.webui.apps.graph.WDocumentStatusPanel;
import org.adempiere.webui.component.ToolBarButton;
import org.adempiere.webui.theme.ThemeManager; import org.adempiere.webui.theme.ThemeManager;
import org.adempiere.webui.util.ServerPushTemplate; import org.adempiere.webui.util.ServerPushTemplate;
import org.compiere.util.Env; import org.compiere.util.Env;
@ -68,14 +69,26 @@ public class DPDocumentStatus extends DashboardPanel implements EventListener<Ev
return; return;
this.appendChild(statusPanel); this.appendChild(statusPanel);
Toolbar recentItemsToolbar = new Toolbar(); Toolbar documentStatusToolbar = new Toolbar();
this.appendChild(recentItemsToolbar); this.appendChild(documentStatusToolbar);
Image imgr = new Image(ThemeManager.getThemeResource("images/Refresh24.png")); if (ThemeManager.isUseFontIconForImage())
recentItemsToolbar.appendChild(imgr); {
imgr.setStyle("text-align: right; cursor: pointer; width:24px; height:24px;"); ToolBarButton btn = new ToolBarButton();
imgr.setTooltiptext(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Refresh"))); btn.setIconSclass("z-icon-Refresh");
imgr.addEventListener(Events.ON_CLICK, this); btn.setSclass("trash-toolbarbutton");
documentStatusToolbar.appendChild(btn);
btn.setTooltiptext(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Refresh")));
btn.addEventListener(Events.ON_CLICK, this);
}
else
{
Image imgr = new Image(ThemeManager.getThemeResource("images/Refresh24.png"));
documentStatusToolbar.appendChild(imgr);
imgr.setStyle("text-align: right; cursor: pointer; width:24px; height:24px;");
imgr.setTooltiptext(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Refresh")));
imgr.addEventListener(Events.ON_CLICK, this);
}
} }
public void onEvent(Event event) throws Exception { public void onEvent(Event event) throws Exception {

View File

@ -0,0 +1,57 @@
/**********************************************************************
* This file is part of iDempiere ERP Open Source *
* http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* 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., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - Carlos Ruiz *
**********************************************************************/
package org.adempiere.webui.process;
import org.adempiere.webui.apps.IProcessParameterListener;
import org.adempiere.webui.apps.ProcessParameterPanel;
import org.adempiere.webui.editor.WEditor;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.zkoss.zk.ui.WrongValueException;
public class BankTransferParameterListener implements IProcessParameterListener {
@Override
public void onChange(ProcessParameterPanel parameterPanel, String columnName, WEditor editor) {
if (editor.getValue() != null) {
if ("StatementDate".equals(editor.getColumnName())) {
// set Accounting Date when StatementDate changes
WEditor dateAcctEditor = parameterPanel.getEditor("DateAcct");
dateAcctEditor.setValue(editor.getValue());
} else if ( "From_C_BankAccount_ID".equals(editor.getColumnName())
|| "To_C_BankAccount_ID".equals(editor.getColumnName())) {
WEditor toBankEditor = parameterPanel.getEditor("To_C_BankAccount_ID");
WEditor fromBankEditor = parameterPanel.getEditor("From_C_BankAccount_ID");
if ( toBankEditor.getValue() != null && fromBankEditor.getValue() != null
&& fromBankEditor.getValue().equals(toBankEditor.getValue())) {
editor.setValue(null);
throw new WrongValueException(editor.getComponent(), Msg.getMsg(Env.getCtx(), "BankFromToMustDiffer"));
}
}
}
}
}

View File

@ -134,7 +134,7 @@ public class ZkJRViewer extends Window implements EventListener<Event>, ITabOnCl
private void init() { private void init() {
final boolean isCanExport=MRole.getDefault().isCanExport(); final boolean isCanExport=MRole.getDefault().isCanExport();
defaultType = jasperPrint.getProperty("IDEMPIERE_REPORT_TYPE"); defaultType = jasperPrint == null ? null : jasperPrint.getProperty("IDEMPIERE_REPORT_TYPE");
if (Util.isEmpty(defaultType)) { if (Util.isEmpty(defaultType)) {
defaultType = MSysConfig.getValue(MSysConfig.ZK_REPORT_JASPER_OUTPUT_TYPE, "PDF", defaultType = MSysConfig.getValue(MSysConfig.ZK_REPORT_JASPER_OUTPUT_TYPE, "PDF",
Env.getAD_Client_ID(Env.getCtx()), Env.getAD_Org_ID(Env.getCtx()));//It gets default Jasper output type Env.getAD_Client_ID(Env.getCtx()), Env.getAD_Org_ID(Env.getCtx()));//It gets default Jasper output type

View File

@ -27,6 +27,7 @@ bin.includes = META-INF/,\
OSGI-INF/defaultcreatefromfactory.xml,\ OSGI-INF/defaultcreatefromfactory.xml,\
OSGI-INF/defaultformfactory.xml,\ OSGI-INF/defaultformfactory.xml,\
OSGI-INF/feedbackservice.xml,\ OSGI-INF/feedbackservice.xml,\
OSGI-INF/banktransferparameterslistener.xml,\
sessiontimeout.zul,\ sessiontimeout.zul,\
*.jsp,\ *.jsp,\
labelapplet.jar,\ labelapplet.jar,\

View File

@ -197,7 +197,7 @@
content: "\f0d6"; content: "\f0d6";
} }
.z-icon-PostIt:before { .z-icon-PostIt:before {
content: "\f15c"; content: "\f24a";
} }
.z-icon-Preference:before { .z-icon-Preference:before {
content: "\f085"; content: "\f085";
@ -274,7 +274,10 @@
.z-icon-Zoom:before { .z-icon-Zoom:before {
content: "\f14c"; content: "\f14c";
} }
.z-icon-ZoomAcross:before { .z-icon-ZoomAcross:before {
content: "\f00e"; content: "\f00e";
} }
.z-icon-CSVImport:before {
content: "\f0f6";
}

View File

@ -243,6 +243,7 @@ public class PaySelect
+ " INNER JOIN C_PaymentTerm p ON (i.C_PaymentTerm_ID=p.C_PaymentTerm_ID)", + " INNER JOIN C_PaymentTerm p ON (i.C_PaymentTerm_ID=p.C_PaymentTerm_ID)",
// WHERE // WHERE
"i.IsSOTrx=? AND IsPaid='N'" "i.IsSOTrx=? AND IsPaid='N'"
+ " AND invoiceOpen(i.C_Invoice_ID, i.C_InvoicePaySchedule_ID) != 0" //Check that AmountDue <> 0
// Different Payment Selection // Different Payment Selection
+ " AND NOT EXISTS (SELECT * FROM C_PaySelectionLine psl" + " AND NOT EXISTS (SELECT * FROM C_PaySelectionLine psl"
+ " INNER JOIN C_PaySelectionCheck psc ON (psl.C_PaySelectionCheck_ID=psc.C_PaySelectionCheck_ID)" + " INNER JOIN C_PaySelectionCheck psc ON (psl.C_PaySelectionCheck_ID=psc.C_PaySelectionCheck_ID)"
@ -303,7 +304,7 @@ public class PaySelect
* Query and create TableInfo * Query and create TableInfo
*/ */
public void loadTableInfo(BankInfo bi, Timestamp payDate, ValueNamePair paymentRule, boolean onlyDue, public void loadTableInfo(BankInfo bi, Timestamp payDate, ValueNamePair paymentRule, boolean onlyDue,
KeyNamePair bpartner, KeyNamePair docType, IMiniTable miniTable) boolean onlyPositiveBalance, KeyNamePair bpartner, KeyNamePair docType, IMiniTable miniTable)
{ {
log.config(""); log.config("");
// not yet initialized // not yet initialized
@ -331,6 +332,27 @@ public class PaySelect
int c_doctype_id = dt.getKey(); int c_doctype_id = dt.getKey();
if (c_doctype_id != 0) if (c_doctype_id != 0)
sql += " AND i.c_doctype_id =?"; sql += " AND i.c_doctype_id =?";
if (onlyPositiveBalance) {
int innerindex = sql.indexOf("INNER");
String subWhereClause = sql.substring(innerindex, sql.length());
//Replace original aliases with new aliases
subWhereClause = subWhereClause.replaceAll("\\bi\\b", "i1");
subWhereClause = subWhereClause.replaceAll("\\bbp\\b", "bp1");
subWhereClause = subWhereClause.replaceAll("\\bc\\b", "c1");
subWhereClause = subWhereClause.replaceAll("\\bp\\b", "p1");
subWhereClause = subWhereClause.replaceAll("\\bpsl\\b", "psl1");
subWhereClause = subWhereClause.replaceAll("\\bpsc\\b", "psc1");
subWhereClause = subWhereClause.replaceAll("\\bpmt\\b", "pmt1");
sql += " AND i.c_bpartner_id NOT IN ( SELECT i1.C_BPartner_ID"
+ " FROM C_Invoice_v i1 "
+ subWhereClause
+ " GROUP BY i1.C_BPartner_ID"
+ " HAVING sum(invoiceOpen(i1.C_Invoice_ID, i1.C_InvoicePaySchedule_ID)) <= 0) ";
}
sql += " ORDER BY 2,3"; sql += " ORDER BY 2,3";
if (log.isLoggable(Level.FINEST)) log.finest(sql + " - C_Currency_ID=" + bi.C_Currency_ID + ", C_BPartner_ID=" + C_BPartner_ID + ", C_doctype_id=" + c_doctype_id ); if (log.isLoggable(Level.FINEST)) log.finest(sql + " - C_Currency_ID=" + bi.C_Currency_ID + ", C_BPartner_ID=" + C_BPartner_ID + ", C_doctype_id=" + c_doctype_id );
@ -359,6 +381,16 @@ public class PaySelect
pstmt.setInt(index++, C_BPartner_ID); pstmt.setInt(index++, C_BPartner_ID);
if (c_doctype_id != 0) //Document type if (c_doctype_id != 0) //Document type
pstmt.setInt(index++, c_doctype_id ); pstmt.setInt(index++, c_doctype_id );
if (onlyPositiveBalance) {
pstmt.setString(index++, isSOTrx); // IsSOTrx
pstmt.setInt(index++, m_AD_Client_ID); // Client
if (onlyDue)
pstmt.setTimestamp(index++, payDate);
if (C_BPartner_ID != 0)
pstmt.setInt(index++, C_BPartner_ID);
if (c_doctype_id != 0) //Document type
pstmt.setInt(index++, c_doctype_id );
}
// //
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
miniTable.loadTable(rs); miniTable.loadTable(rs);