IDEMPIERE-3858 Options to create one to one check on payment selection window.
This commit is contained in:
parent
8509f6f0f3
commit
d6e2058703
|
@ -0,0 +1,34 @@
|
|||
SET SQLBLANKLINES ON
|
||||
SET DEFINE OFF
|
||||
|
||||
-- Jan 3, 2019 4:20:27 PM IST
|
||||
INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (203288,0,0,'Y',TO_DATE('2019-01-03 16:20:25','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-01-03 16:20:25','YYYY-MM-DD HH24:MI:SS'),100,'IsOnePaymentPerInvoice','One Payment Per Invoice','One Payment Per Invoice','D','695d48e7-7a98-4c18-bd31-dc3fa0748ff4')
|
||||
;
|
||||
|
||||
-- Jan 3, 2019 4:22:43 PM IST
|
||||
INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,FieldLength,IsMandatory,DefaultValue,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,DisplayLogic,AD_Process_Para_UU,IsEncrypted) VALUES (200253,0,0,'Y',TO_DATE('2019-01-03 16:22:42','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-01-03 16:22:42','YYYY-MM-DD HH24:MI:SS'),100,'One Payment Per Invoice',155,20,20,'N',0,'N','@IsOnePaymentPerInvoice@','IsOnePaymentPerInvoice','Y','D',203288,'1=2','acbf3fcd-f9bd-41d6-a1f8-d6e4bdff8820','N')
|
||||
;
|
||||
|
||||
-- Jan 3, 2019 4:25:16 PM IST
|
||||
INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,IsHtml) VALUES (213824,0,'One Payment Per Invoice',426,'IsOnePaymentPerInvoice',1,'N','N','N','N','N',0,'N',20,0,0,'Y',TO_DATE('2019-01-03 16:25:15','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-01-03 16:25:15','YYYY-MM-DD HH24:MI:SS'),100,203288,'Y','N','D','N','N','N','Y','80292698-a92a-42a0-9b91-62fb55ee8ad3','Y',0,'N','N','N')
|
||||
;
|
||||
|
||||
-- Jan 3, 2019 4:25:19 PM IST
|
||||
ALTER TABLE C_PaySelection ADD IsOnePaymentPerInvoice CHAR(1) DEFAULT NULL CHECK (IsOnePaymentPerInvoice IN ('Y','N'))
|
||||
;
|
||||
|
||||
-- Jan 3, 2019 4:25:28 PM IST
|
||||
UPDATE AD_Column SET DefaultValue='N',Updated=TO_DATE('2019-01-03 16:25:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=213824
|
||||
;
|
||||
|
||||
-- Jan 3, 2019 4:25:31 PM IST
|
||||
ALTER TABLE C_PaySelection MODIFY IsOnePaymentPerInvoice CHAR(1) DEFAULT 'N'
|
||||
;
|
||||
|
||||
-- Jan 3, 2019 4:27:59 PM IST
|
||||
INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (205900,'One Payment Per Invoice',352,213824,'Y',0,95,0,'N','N','N','N',0,0,'Y',TO_DATE('2019-01-03 16:27:58','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-01-03 16:27:58','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','6989ca75-b5bc-4b84-ad0c-8209fcc0697a','Y',140,5,2,1,'N','N','N')
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201901031640_IDEMPIERE-3858.sql') FROM dual
|
||||
;
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
|
||||
-- Jan 3, 2019 4:20:27 PM IST
|
||||
INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (203288,0,0,'Y',TO_TIMESTAMP('2019-01-03 16:20:25','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-01-03 16:20:25','YYYY-MM-DD HH24:MI:SS'),100,'IsOnePaymentPerInvoice','One Payment Per Invoice','One Payment Per Invoice','D','695d48e7-7a98-4c18-bd31-dc3fa0748ff4')
|
||||
;
|
||||
|
||||
-- Jan 3, 2019 4:22:43 PM IST
|
||||
INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,FieldLength,IsMandatory,DefaultValue,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,DisplayLogic,AD_Process_Para_UU,IsEncrypted) VALUES (200253,0,0,'Y',TO_TIMESTAMP('2019-01-03 16:22:42','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-01-03 16:22:42','YYYY-MM-DD HH24:MI:SS'),100,'One Payment Per Invoice',155,20,20,'N',0,'N','@IsOnePaymentPerInvoice@','IsOnePaymentPerInvoice','Y','D',203288,'1=2','acbf3fcd-f9bd-41d6-a1f8-d6e4bdff8820','N')
|
||||
;
|
||||
|
||||
-- Jan 3, 2019 4:25:16 PM IST
|
||||
INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,IsHtml) VALUES (213824,0,'One Payment Per Invoice',426,'IsOnePaymentPerInvoice',1,'N','N','N','N','N',0,'N',20,0,0,'Y',TO_TIMESTAMP('2019-01-03 16:25:15','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-01-03 16:25:15','YYYY-MM-DD HH24:MI:SS'),100,203288,'Y','N','D','N','N','N','Y','80292698-a92a-42a0-9b91-62fb55ee8ad3','Y',0,'N','N','N')
|
||||
;
|
||||
|
||||
-- Jan 3, 2019 4:25:19 PM IST
|
||||
ALTER TABLE C_PaySelection ADD COLUMN IsOnePaymentPerInvoice CHAR(1) DEFAULT NULL CHECK (IsOnePaymentPerInvoice IN ('Y','N'))
|
||||
;
|
||||
|
||||
-- Jan 3, 2019 4:25:28 PM IST
|
||||
UPDATE AD_Column SET DefaultValue='N',Updated=TO_TIMESTAMP('2019-01-03 16:25:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=213824
|
||||
;
|
||||
|
||||
-- Jan 3, 2019 4:25:31 PM IST
|
||||
INSERT INTO t_alter_column values('c_payselection','IsOnePaymentPerInvoice','CHAR(1)',null,'N')
|
||||
;
|
||||
|
||||
-- Jan 3, 2019 4:27:59 PM IST
|
||||
INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (205900,'One Payment Per Invoice',352,213824,'Y',0,95,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2019-01-03 16:27:58','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-01-03 16:27:58','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','6989ca75-b5bc-4b84-ad0c-8209fcc0697a','Y',140,5,2,1,'N','N','N')
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201901031640_IDEMPIERE-3858.sql') FROM dual
|
||||
;
|
||||
|
|
@ -39,6 +39,8 @@ public class PaySelectionCreateCheck extends SvrProcess
|
|||
private String p_PaymentRule = null;
|
||||
/** Payment Selection */
|
||||
private int p_C_PaySelection_ID = 0;
|
||||
/** one payment per invoice */
|
||||
private boolean p_onepaymentPerInvoice = false;
|
||||
/** The checks */
|
||||
private ArrayList<MPaySelectionCheck> m_list = new ArrayList<MPaySelectionCheck>();
|
||||
|
||||
|
@ -55,6 +57,8 @@ public class PaySelectionCreateCheck extends SvrProcess
|
|||
;
|
||||
else if (name.equals("PaymentRule"))
|
||||
p_PaymentRule = (String)para[i].getParameter();
|
||||
else if (name.equalsIgnoreCase(MPaySelection.COLUMNNAME_IsOnePaymentPerInvoice))
|
||||
p_onepaymentPerInvoice = para[i].getParameterAsBoolean();
|
||||
else
|
||||
log.log(Level.SEVERE, "Unknown Parameter: " + name);
|
||||
}
|
||||
|
@ -102,21 +106,24 @@ public class PaySelectionCreateCheck extends SvrProcess
|
|||
*/
|
||||
private void createCheck (MPaySelectionLine line) throws Exception
|
||||
{
|
||||
// Try to find one
|
||||
for (int i = 0; i < m_list.size(); i++)
|
||||
if (!p_onepaymentPerInvoice)
|
||||
{
|
||||
MPaySelectionCheck check = (MPaySelectionCheck)m_list.get(i);
|
||||
// Add to existing
|
||||
if (check.getC_BPartner_ID() == line.getInvoice().getC_BPartner_ID())
|
||||
// Try to find one
|
||||
for (int i = 0; i < m_list.size(); i++)
|
||||
{
|
||||
check.addLine(line);
|
||||
if (!check.save())
|
||||
throw new IllegalStateException("Cannot save MPaySelectionCheck");
|
||||
line.setC_PaySelectionCheck_ID(check.getC_PaySelectionCheck_ID());
|
||||
line.setProcessed(true);
|
||||
if (!line.save())
|
||||
throw new IllegalStateException("Cannot save MPaySelectionLine");
|
||||
return;
|
||||
MPaySelectionCheck check = (MPaySelectionCheck) m_list.get(i);
|
||||
// Add to existing
|
||||
if (check.getC_BPartner_ID() == line.getInvoice().getC_BPartner_ID())
|
||||
{
|
||||
check.addLine(line);
|
||||
if (!check.save())
|
||||
throw new IllegalStateException("Cannot save MPaySelectionCheck");
|
||||
line.setC_PaySelectionCheck_ID(check.getC_PaySelectionCheck_ID());
|
||||
line.setProcessed(true);
|
||||
if (!line.save())
|
||||
throw new IllegalStateException("Cannot save MPaySelectionLine");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Create new
|
||||
|
|
|
@ -167,6 +167,15 @@ public interface I_C_PaySelection
|
|||
*/
|
||||
public boolean isApproved();
|
||||
|
||||
/** Column name IsOnePaymentPerInvoice */
|
||||
public static final String COLUMNNAME_IsOnePaymentPerInvoice = "IsOnePaymentPerInvoice";
|
||||
|
||||
/** Set One Payment Per Invoice */
|
||||
public void setIsOnePaymentPerInvoice (boolean IsOnePaymentPerInvoice);
|
||||
|
||||
/** Get One Payment Per Invoice */
|
||||
public boolean isOnePaymentPerInvoice();
|
||||
|
||||
/** Column name Name */
|
||||
public static final String COLUMNNAME_Name = "Name";
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ public class X_C_PaySelection extends PO implements I_C_PaySelection, I_Persiste
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 20190106L;
|
||||
private static final long serialVersionUID = 20190104L;
|
||||
|
||||
/** Standard Constructor */
|
||||
public X_C_PaySelection (Properties ctx, int C_PaySelection_ID, String trxName)
|
||||
|
@ -205,6 +205,27 @@ public class X_C_PaySelection extends PO implements I_C_PaySelection, I_Persiste
|
|||
return false;
|
||||
}
|
||||
|
||||
/** Set One Payment Per Invoice.
|
||||
@param IsOnePaymentPerInvoice One Payment Per Invoice */
|
||||
public void setIsOnePaymentPerInvoice (boolean IsOnePaymentPerInvoice)
|
||||
{
|
||||
set_Value (COLUMNNAME_IsOnePaymentPerInvoice, Boolean.valueOf(IsOnePaymentPerInvoice));
|
||||
}
|
||||
|
||||
/** Get One Payment Per Invoice.
|
||||
@return One Payment Per Invoice */
|
||||
public boolean isOnePaymentPerInvoice ()
|
||||
{
|
||||
Object oo = get_Value(COLUMNNAME_IsOnePaymentPerInvoice);
|
||||
if (oo != null)
|
||||
{
|
||||
if (oo instanceof Boolean)
|
||||
return ((Boolean)oo).booleanValue();
|
||||
return "Y".equals(oo);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Set Name.
|
||||
@param Name
|
||||
Alphanumeric identifier of the entity
|
||||
|
|
|
@ -63,6 +63,7 @@ import org.compiere.model.MPaySelection;
|
|||
import org.compiere.model.MSysConfig;
|
||||
import org.compiere.model.X_C_PaySelection;
|
||||
import org.compiere.process.ProcessInfo;
|
||||
import org.compiere.process.ProcessInfoParameter;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.KeyNamePair;
|
||||
import org.compiere.util.Msg;
|
||||
|
@ -122,6 +123,7 @@ public class WPaySelect extends PaySelect
|
|||
private Label labelDtype = new Label();
|
||||
private Listbox fieldDtype = ListboxFactory.newDropdownListbox();
|
||||
private Panel southPanel;
|
||||
private Checkbox chkOnePaymentPerInv = new Checkbox();
|
||||
@SuppressWarnings("unused")
|
||||
private ProcessInfo m_pi;
|
||||
private boolean m_isLock;
|
||||
|
@ -184,6 +186,9 @@ public class WPaySelect extends PaySelect
|
|||
fieldPayDate.addValueChangeListener(this);
|
||||
ZKUpdateUtil.setHflex(fieldPayDate.getComponent(), "1");
|
||||
|
||||
chkOnePaymentPerInv.setText(Msg.translate(Env.getCtx(), MPaySelection.COLUMNNAME_IsOnePaymentPerInvoice));
|
||||
chkOnePaymentPerInv.addActionListener(this);
|
||||
|
||||
//IDEMPIERE-2657, pritesh shah
|
||||
bGenerate.setEnabled(false);
|
||||
bGenerate.addActionListener(this);
|
||||
|
@ -251,6 +256,7 @@ public class WPaySelect extends PaySelect
|
|||
row.appendChild(labelDtype.rightAlign());
|
||||
row.appendChild(fieldDtype);
|
||||
row.appendChild(new Space());
|
||||
row.appendCellChild(chkOnePaymentPerInv);
|
||||
if (ClientInfo.minWidth(ClientInfo.MEDIUM_WIDTH))
|
||||
{
|
||||
row.appendChild(new Space());
|
||||
|
@ -433,6 +439,10 @@ public class WPaySelect extends PaySelect
|
|||
}
|
||||
});
|
||||
}
|
||||
else if (e.getTarget().equals(chkOnePaymentPerInv))
|
||||
{
|
||||
m_isOnePaymentPerInvoice = chkOnePaymentPerInv.isChecked();
|
||||
}
|
||||
} // actionPerformed
|
||||
|
||||
@Override
|
||||
|
@ -506,6 +516,9 @@ public class WPaySelect extends PaySelect
|
|||
dialog.setVisible(true);
|
||||
dialog.setPage(form.getPage());
|
||||
dialog.doHighlighted();
|
||||
// Create instance parameters. Parameters you want to send to the process.
|
||||
ProcessInfoParameter piParam = new ProcessInfoParameter(MPaySelection.COLUMNNAME_IsOnePaymentPerInvoice, m_isOnePaymentPerInvoice, "", "", "");
|
||||
dialog.getProcessInfo().setParameter(new ProcessInfoParameter[] {piParam});
|
||||
} catch (SuspendNotAllowedException e) {
|
||||
log.log(Level.SEVERE, e.getLocalizedMessage(), e);
|
||||
}
|
||||
|
|
|
@ -68,6 +68,8 @@ public class PaySelect
|
|||
public boolean m_isLocked = false;
|
||||
/** Payment Selection */
|
||||
public MPaySelection m_ps = null;
|
||||
/** one-To-one payment per invoice */
|
||||
public boolean m_isOnePaymentPerInvoice = false;
|
||||
/** Logger */
|
||||
public static CLogger log = CLogger.getCLogger(PaySelect.class);
|
||||
|
||||
|
@ -434,6 +436,7 @@ public class PaySelect
|
|||
m_ps.setPayDate (payDate);
|
||||
m_ps.setC_BankAccount_ID(bi.C_BankAccount_ID);
|
||||
m_ps.setIsApproved(true);
|
||||
m_ps.setIsOnePaymentPerInvoice(m_isOnePaymentPerInvoice);
|
||||
m_ps.saveEx();
|
||||
if (log.isLoggable(Level.CONFIG)) log.config(m_ps.toString());
|
||||
|
||||
|
|
Loading…
Reference in New Issue