teo_sarca 2009-05-05 10:24:59 +00:00
parent 270dc8d679
commit 6a1aff8d61
8 changed files with 254 additions and 7 deletions

View File

@ -0,0 +1,50 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 2009 SC ARHIPAC SERVICE SRL. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. 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., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.adempiere.exceptions;
import org.compiere.model.I_C_BPartner;
/**
* Thrown when an exception related to a BPartner happened.
* @author Teo Sarca, www.arhipac.ro
*/
public abstract class BPartnerException extends AdempiereException
{
/**
*
*/
private static final long serialVersionUID = -4311798678799373821L;
private final int C_BPartner_ID;
BPartnerException(String message, I_C_BPartner bp)
{
super(message+" - "+(bp == null ? "?" : bp.getValue()+"_"+bp.getName()));
if (bp != null)
{
this.C_BPartner_ID = bp.getC_BPartner_ID();
}
else
{
this.C_BPartner_ID = -1;
}
}
/**
* @return the c_BPartner_ID
*/
public int getC_BPartner_ID()
{
return C_BPartner_ID;
}
}

View File

@ -0,0 +1,39 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 2009 SC ARHIPAC SERVICE SRL. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. 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., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.adempiere.exceptions;
import org.compiere.model.I_C_BPartner;
/**
* Thrown when an location/address is required for a BPartner but not found.
* @author Teo Sarca, www.arhipac.ro
*/
public class BPartnerNoAddressException extends BPartnerException
{
/**
*
*/
private static final long serialVersionUID = -1892858395845764918L;
public static final String AD_Message = "BPartnerNoAddress";
/**
* @param message
* @param bp
*/
public BPartnerNoAddressException(I_C_BPartner bp)
{
super(AD_Message, bp);
}
}

View File

@ -0,0 +1,34 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 2009 SC ARHIPAC SERVICE SRL. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. 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., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.adempiere.exceptions;
import org.compiere.model.I_C_BPartner;
/**
* Thrown when Bill To Address is required for a BPartner but not found.
* @author Teo Sarca, www.arhipac.ro
*/
public class BPartnerNoBillToAddressException extends BPartnerException
{
/**
*
*/
private static final long serialVersionUID = -8423260338845096466L;
public static final String AD_Message = "BPartnerNoBillToAddress";
public BPartnerNoBillToAddressException(I_C_BPartner bp)
{
super(AD_Message, bp);
}
}

View File

@ -0,0 +1,34 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 2009 SC ARHIPAC SERVICE SRL. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. 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., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.adempiere.exceptions;
import org.compiere.model.I_C_BPartner;
/**
* Thrown when Ship To Address is required for a BPartner but not found.
* @author Teo Sarca, www.arhipac.ro
*/
public class BPartnerNoShipToAddressException extends BPartnerException
{
/**
*
*/
private static final long serialVersionUID = 4388496060894704270L;
public static final String AD_Message = "BPartnerNoShipToAddress";
public BPartnerNoShipToAddressException(I_C_BPartner bp)
{
super(AD_Message, bp);
}
}

View File

@ -27,6 +27,7 @@ import java.util.List;
import java.util.Properties;
import java.util.logging.Level;
import org.adempiere.exceptions.BPartnerNoAddressException;
import org.adempiere.exceptions.DBException;
import org.compiere.print.ReportEngine;
import org.compiere.process.DocAction;
@ -405,7 +406,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
setC_BPartner_Location_ID(locs[0].getC_BPartner_Location_ID());
}
if (getC_BPartner_Location_ID() == 0)
log.log(Level.SEVERE, "Has no To Address: " + bp);
log.log(Level.SEVERE, new BPartnerNoAddressException(bp).getLocalizedMessage()); //TODO: throw exception?
// Set Contact
MUser[] contacts = bp.getContacts(false);

View File

@ -26,7 +26,8 @@ import java.util.Properties;
import java.util.logging.Level;
import java.util.regex.Pattern;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.exceptions.BPartnerNoBillToAddressException;
import org.adempiere.exceptions.BPartnerNoShipToAddressException;
import org.adempiere.exceptions.FillMandatoryException;
import org.compiere.print.ReportEngine;
import org.compiere.process.DocAction;
@ -477,14 +478,12 @@ public class MOrder extends X_C_Order implements DocAction
}
if (getC_BPartner_Location_ID() == 0)
{
log.log(Level.SEVERE, "MOrder.setBPartner - Has no Ship To Address: " + bp);
throw new AdempiereException("MOrder.setBPartner - Has no Ship To Address: "+bp);
throw new BPartnerNoShipToAddressException(bp);
}
if (getBill_Location_ID() == 0)
{
log.log(Level.SEVERE, "MOrder.setBPartner - Has no Bill To Address: " + bp);
throw new AdempiereException("MOrder.setBPartner - Has no Bill To Address: "+bp);
{
throw new BPartnerNoBillToAddressException(bp);
}
// Set Contact

View File

@ -0,0 +1,45 @@
-- 05.05.2009 12:30:29 EEST
-- -
INSERT INTO AD_Message (MsgType,MsgText,CreatedBy,IsActive,Created,Updated,UpdatedBy,AD_Client_ID,AD_Org_ID,EntityType,Value,AD_Message_ID) VALUES ('E','Business Partner has no Ship To Address',0,'Y',TO_DATE('2009-05-05 12:30:26','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-05-05 12:30:26','YYYY-MM-DD HH24:MI:SS'),0,0,0,'D','BPartnerNoShipToAddress',53056)
;
-- 05.05.2009 12:30:29 EEST
-- -
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=53056 AND EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Message_ID!=t.AD_Message_ID)
;
-- 05.05.2009 12:31:21 EEST
-- -
UPDATE AD_Message_Trl SET IsTranslated='Y',MsgText='Partenerul nu are definita adresa de expeditie',Updated=TO_DATE('2009-05-05 12:31:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Message_ID=53056 AND AD_Language='ro_RO'
;
-- 05.05.2009 12:32:08 EEST
-- -
INSERT INTO AD_Message (MsgType,MsgText,CreatedBy,IsActive,Created,Updated,UpdatedBy,AD_Client_ID,AD_Org_ID,EntityType,Value,AD_Message_ID) VALUES ('E','Business Partner has no Bill To Address',0,'Y',TO_DATE('2009-05-05 12:32:00','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-05-05 12:32:00','YYYY-MM-DD HH24:MI:SS'),0,0,0,'D','BPartnerNoBillToAddress',53057)
;
-- 05.05.2009 12:32:08 EEST
-- -
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=53057 AND EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Message_ID!=t.AD_Message_ID)
;
-- 05.05.2009 12:32:27 EEST
-- -
UPDATE AD_Message_Trl SET IsTranslated='Y',MsgText='Partenerul nu are definita adresa de facturare',Updated=TO_DATE('2009-05-05 12:32:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Message_ID=53057 AND AD_Language='ro_RO'
;
-- 05.05.2009 12:48:47 EEST
-- -
INSERT INTO AD_Message (MsgType,MsgText,CreatedBy,IsActive,Created,Updated,UpdatedBy,AD_Client_ID,AD_Org_ID,EntityType,Value,AD_Message_ID) VALUES ('E','Business Partner has no Address',0,'Y',TO_DATE('2009-05-05 12:48:42','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-05-05 12:48:42','YYYY-MM-DD HH24:MI:SS'),0,0,0,'D','BPartnerNoAddress',53058)
;
-- 05.05.2009 12:48:47 EEST
-- -
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=53058 AND EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Message_ID!=t.AD_Message_ID)
;
-- 05.05.2009 12:49:10 EEST
-- -
UPDATE AD_Message_Trl SET IsTranslated='Y',MsgText='Partenerul nu are nici o locatie definita',Updated=TO_DATE('2009-05-05 12:49:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Message_ID=53058 AND AD_Language='ro_RO'
;

View File

@ -0,0 +1,45 @@
-- 05.05.2009 12:30:29 EEST
-- -
INSERT INTO AD_Message (MsgType,MsgText,CreatedBy,IsActive,Created,Updated,UpdatedBy,AD_Client_ID,AD_Org_ID,EntityType,Value,AD_Message_ID) VALUES ('E','Business Partner has no Ship To Address',0,'Y',TO_TIMESTAMP('2009-05-05 12:30:26','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-05-05 12:30:26','YYYY-MM-DD HH24:MI:SS'),0,0,0,'D','BPartnerNoShipToAddress',53056)
;
-- 05.05.2009 12:30:29 EEST
-- -
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=53056 AND EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Message_ID!=t.AD_Message_ID)
;
-- 05.05.2009 12:31:21 EEST
-- -
UPDATE AD_Message_Trl SET IsTranslated='Y',MsgText='Partenerul nu are definita adresa de expeditie',Updated=TO_TIMESTAMP('2009-05-05 12:31:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Message_ID=53056 AND AD_Language='ro_RO'
;
-- 05.05.2009 12:32:08 EEST
-- -
INSERT INTO AD_Message (MsgType,MsgText,CreatedBy,IsActive,Created,Updated,UpdatedBy,AD_Client_ID,AD_Org_ID,EntityType,Value,AD_Message_ID) VALUES ('E','Business Partner has no Bill To Address',0,'Y',TO_TIMESTAMP('2009-05-05 12:32:00','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-05-05 12:32:00','YYYY-MM-DD HH24:MI:SS'),0,0,0,'D','BPartnerNoBillToAddress',53057)
;
-- 05.05.2009 12:32:08 EEST
-- -
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=53057 AND EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Message_ID!=t.AD_Message_ID)
;
-- 05.05.2009 12:32:27 EEST
-- -
UPDATE AD_Message_Trl SET IsTranslated='Y',MsgText='Partenerul nu are definita adresa de facturare',Updated=TO_TIMESTAMP('2009-05-05 12:32:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Message_ID=53057 AND AD_Language='ro_RO'
;
-- 05.05.2009 12:48:47 EEST
-- -
INSERT INTO AD_Message (MsgType,MsgText,CreatedBy,IsActive,Created,Updated,UpdatedBy,AD_Client_ID,AD_Org_ID,EntityType,Value,AD_Message_ID) VALUES ('E','Business Partner has no Address',0,'Y',TO_TIMESTAMP('2009-05-05 12:48:42','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-05-05 12:48:42','YYYY-MM-DD HH24:MI:SS'),0,0,0,'D','BPartnerNoAddress',53058)
;
-- 05.05.2009 12:48:47 EEST
-- -
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=53058 AND EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Message_ID!=t.AD_Message_ID)
;
-- 05.05.2009 12:49:10 EEST
-- -
UPDATE AD_Message_Trl SET IsTranslated='Y',MsgText='Partenerul nu are nici o locatie definita',Updated=TO_TIMESTAMP('2009-05-05 12:49:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Message_ID=53058 AND AD_Language='ro_RO'
;